A stiffness matrix from FEM must be made regular by introducing boundary conditions. One could apply those BCs after assembling the stiffness matrix, however then the sparse matrix has to be touched again. So instead one can apply the BCs already during assembly. How is this done in deal ii?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
In deal.II, applying boundary conditions during assembly (i.e., incorporating them directly into the system matrix and right-hand side as you build them) is typically done by modifying the local element matrices and vectors before they are added to the global system, rather than assembling the full system first and then modifying it afterward.
How is this done in deal.II?
Identify constrained DoFs early:
Use AffineConstraints<double> (previously ConstraintMatrix) to store the boundary conditions.
This object keeps track of which degrees of freedom (DoFs) are constrained (e.g., Dirichlet BCs).
During assembly:
After computing the local element stiffness matrix and right-hand side vector, call