![]() |
LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
|
Assembly in the context of LehrFEM++ refers to computing entries of the stiffness matrix and the right-hand side vector (load vector) for finite elements. Lecture Document Subsection 2.7.4 provides more detailed information.
A key part of efficient assembly is cell-local computations, where the indexing is handled by DOFHandlers. To solve a PDE using the Galerkin method, we assemble the matrix \(\textbf{A}\) and the right-hand side vector \(\vec{b}\) to obtain a linear system \(\textbf{A}\vec{x} = \vec{b}\).
LehrFEM++ provides a number of helper functions for assembly, which are detailed in Lecture Document Subsection 2.7.4.3.
LehrFEM++ provides the lf::assemble::AssembleMatrixLocally
function for assembling the stiffness matrix \(\textbf{A}\). The following example shows how to assemble the stiffness matrix for a Poisson bilinear form
\[a(u, v) = \int_{\Omega} \textbf{grad} u \cdot \textbf{grad} v \, dx \]
using the entity matrix provider lf::uscalfe::LinearFELaplaceElementMatrix
.
LehrFEM++ also provides the lf::assemble::AssembleVectorLocally
function for assembling the right-hand side vector \(\vec{b}\). The following example shows how to assemble a right-hand side vector with a custom entity vector provider, where \(b\) is assembled from volume contributions from local cells.