## 5 Examples
### Allen-Cahn Equation
It should be noted that the discrepancy in results should not be expected to be as drastic as shown for linear problems, as then the FEM does not require the reassembly of the right-hand side. The computational advantage then reduces to the matrix-free evaluation of the linear system. In the second scenario, we investigate a more practically relevant benchmark in two dimensions and turn to the well-known vanishing grain problem, leaving all other aspects of the problem as is. Here, the dissolution of a circular-shaped nucleus under the interface energy density pressure under two-phase equilibrium condition \(\mu_{0}=0\) is simulated. These dynamics are also governed by the Allen-Cahn equation and denote the complementary physical effects as compared to the above scenario. In a sharp interface picture, with a constant and isotropic interface energy density \(\gamma\), we expect the temporal evolution of the grain radius to be given by

\[r(t)=\sqrt{R_{0}^{2}-2 Mt}, \tag{25}\]

where \(R_{0}\) indicates the initial radius and \(M\) is the phase field mobility. Snapshots of the phase field \(\phi\) at initial and terminal times are given in Figure 7. \begin{table}
\begin{tabular}{c c c c} \hline  & **FDM** & **FEM** & **Relative** \\ \hline Median run time & 0.450 ms & 9.503 ms & 21.1\(\times\) \\ Mean run time \(\pm 1\sigma\) & 0.578 ms \(\pm\) 0.759 ms & 9.643 ms \(\pm\) 0.741 ms & 16.7\(\times\) \\ Allocated memory & 1.446 kB & 15.598 kB & 10.8\(\times\) \\ \hline \end{tabular}
\end{table} 
Table 2: Run times of the finite element and finite difference model of the 1D Allen–Cahn equation. Both models were run on identical hardware and Julia 1.8.5 with LLVM 13.0.1 [72]. Time stepping was performed using the DifferentialEquations.jl library [73]. Linear algebra operations were performed using OpenBLAS [80; 81] on a single-threaded Apple M1 Pro ARM processor. Fast evaluation of fused array expressions was provided by the Tullio.jl library [82]. Allocated memory refers to the physical size of the problem-specific data structures given in Listing 1. The sample size for each scheme is \(n=100\). We also report the temporal evolution of the radius function for solving this scenario using both numerical methods in Figure 8. As in the one-dimensional simulation, the collocated FE and FD solutions behave identically to each other. Both exhibit a notable discrepancy towards the sharp interface behavior, which again relates to known issues of finite numerical resolution in the phase field simulation [62]. We note at this point that the solution generated by a common FE model, i.e., with fully accurate quadrature, as explained in Section 3.3, also produces very similar results given that all other parameters are chosen the same, albeit with a large computational disadvantage due to the full inversion of the resulting mass matrix. The linked code repository at the end of this article contains the necessary data structures to reproduce these results. To assess the performance gap of both schemes for higher dimensions, we again benchmark both codes against each other. The results are given in Table 3. Comparing the results from the 2D simulation benchmark in Table 3 with its 1D counterpart (Table 2), we find that the discrepancy in performance becomes noticeably more drastic with increasing dimensionality of the problem. This can be attributed to the increased scattering of DoFs in memory. Thus, memory access is less stridden, increasing the lookup time. For a hardware architecture that demands more parallelism and has a shared memory architecture, this could quickly evolve into a serious bottleneck. Figure 8: Evolution of radius over time of the vanishing grain problem. Both finite difference and finite element solutions show a considerable, accumulating error toward the analytical solution. Figure 7: Solution of the two-dimensional Allen–Cahn equation using the finite difference and finite element method. (**a**) Initial configuration of the phase field. The domain shows a quarter-slice of the nucleus.