MetaFEM: A Generic FEM Solver By Meta-expressions

Jiaxi Xie,Kornel Ehmann,Jian Cao
DOI: https://doi.org/10.1016/j.cma.2022.114907
2021-11-12
Abstract:Current multi-physics Finite Element Method (FEM) solvers are complex systems in terms of both their mathematical complexity and lines of code. This paper proposes a skeleton generic FEM solver, named MetaFEM, in total about 5,000 lines of Julia code, which translates generic input Partial Differential Equation (PDE) weak forms into corresponding GPU-accelerated simulations with a grammar similar to FEniCS or FreeFEM. Two novel approaches differentiate MetaFEM from the common solvers: (1) the FEM kernel is based on an original theory/algorithm which explicitly processes meta-expressions, as the name suggests, and (2) the symbolic engine is a rule-based Computer Algebra System (CAS), i.e., the equations are rewritten/derived according to a set of rewriting rules instead of going through completely fixed routines, supporting easy customization by developers. Example cases in thermal conduction, linear elasticity and incompressible flow are presented to demonstrate utility.
Numerical Analysis,Mathematical Software
What problem does this paper attempt to address?
The problem that this paper attempts to solve is: currently, multi - physical - field finite element method (FEM) solvers are very complex in terms of mathematical complexity and the number of lines of code. The author proposes a general - purpose FEM solver named MetaFEM, aiming to simplify these complex solvers into a more compact and more extensible form by dealing with the weak form of general - input partial differential equations (PDEs). Specifically, MetaFEM has the following two main innovative points: 1. **FEM Kernel Based on Meta - Expressions**: Different from traditional solvers, the FEM kernel of MetaFEM directly processes meta - expressions. This means that it can handle completely general PDE weak forms without relying on specific physical models or boundary conditions. 2. **Rule - Based Computer Algebra System (CAS)**: MetaFEM uses a rule - based symbolic engine instead of fixed routines to parse and rewrite equations. This symbolic engine allows developers to easily customize the behavior of the solver and supports the rewriting and derivation of equations. Through these innovations, MetaFEM can achieve efficient simulations of multiple physical phenomena (such as heat conduction, linear elasticity, incompressible flow, etc.) in about 5,000 lines of Julia code and can accelerate calculations on GPUs. ### Formula Summary - **Weak Form of PDE**: \[ L(\varphi)=L_a\left(\partial_t^{\nu_1} D_1 \varphi, \ldots, \partial_t^{\nu_\lambda} D_\lambda \varphi, \ldots, \partial_t^{\nu_{\hat{\lambda}}} D_{\hat{\lambda}} \varphi\right)=0 \] - **Weak Solution**: \[ \int_\Omega L(\varphi_w) \delta \varphi_w = 0 \] - **Weak Form after Discretization**: \[ \int_\Omega L(\varphi_h) \delta \varphi_h = 0 \] - **Shape Function and Test Function**: \[ \frac{\partial}{\partial t} D \varphi_h(\vec{x}, t)=\sum_{\alpha = 1}^{\hat{\alpha}} (D N_\alpha(\vec{x}))\left(\frac{\partial}{\partial t} \varphi_\alpha(t)\right) \] \[ \delta(D \varphi_h(\vec{x}, t))=\sum_{\alpha = 1}^{\hat{\alpha}} (D N_\alpha(\vec{x})) \delta \varphi_\alpha \] - **Numerical Integration of Bilinear Form**: \[ (D_0 \varphi, L_a(\ldots, \partial_t^{\nu_\lambda} D_\lambda \varphi, \ldots))_\Omega\approx\sum_\gamma w_{itg}^\gamma L_a\left(\ldots, \sum_{\alpha = 1}^{\hat{\alpha}} (D_\lambda N_\alpha)|_{\vec{x}_{itg}^\gamma}(\partial_t^{\nu_\lambda} \varphi_\alpha), \ldots\right)\sum_{\alpha = 1}^{\hat{\alpha}} (D_0 N_\alpha)|_{\vec{x}_{itg}^\gamma} \delt