# Libmesh Boundary Conditions

Section 2.4 Boundary Conditions of Ondrej Certik's "notes on FEM":http://ondrej.certik.cz/libmesh/fem.ps describes the penalty method used to apply Dirichlet boundary conditions.

- The boundary fluxes for the conservation equations corresponding to test functions that are non-zero on the Dirichlet boundary are not known. Zero appears to be substituted for the fluxes, making the equations incorrect.
- The L2 projection of the Dirichlet boundary value errors are added to the matrix, "multiplied by some large factor so that, in floating point arithmetic, the existing (smaller) entries in the matrix and right-hand-side are effectively ignored" ("Example 3":http://libmesh.sourceforge.net/ex3.php) and so the incorrect conservation equations are effectively ignored.
- These issues are discussed in "this thread":http://sourceforge.net/mailarchive/message.php?msg_id=37035937.
The Nitsche method for Dirichlet boundary conditions is similar to the penalty method but corrects the conservation equations so that they are consistent.

- There is still a parameter to be selected for the Dirichlet terms that depends on the mesh, but it does not need to be so large as to swamp the conservation equations and so the system is better conditioned.
- More details are in M. Juntunen and R. Stenberg's "A finite element method for general boundary conditions":http://math.tkk.fi/~rstenber/Publications/nscm_general_boundary.pdf for the Proceedings of the 18 Nordic Seminar on Computational Mechanics, which also points out the inconsistency of the penalty method.
- The Nitsche method can also be used on interfaces between portions of the domain with non-matching meshs, as analysed in R. Becker, P. Hansbo, and R. Stenberg's "A finite element method for domain decomposition with non-matching grids":http://www.math.hut.fi/~rstenber/Publications/Becker-Hansbo-Stenberg.pdf in Mathematical Modelling and Numerical Analysis
37(2003) 209-225."This message from Ben Kirk":http://sourceforge.net/mailarchive/message.php?msg_id=8617660 says "there is a more "conventional" way to assign Dirichlet BCs in

the case of lagrange elements..."

- DenseMatrix::condense can be used to do this. Some of the issues involved are mentioned in "this thread":http://sourceforge.net/mailarchive/message.php?msg_id=15191940.
- It may be possible to use 'DofMap::add_constraint_row' to add a zero contraint to remove equations corresponding to Dirichlet boundaries. Corrections would need to be made to the solution and right hand side for non-homogeneous Dirichlet conditions. "This message":http://sourceforge.net/mailarchive/message.php?msg_id=11202052 uses add_constraint_row for periodic boundary conditions (but check followups for suggested improvements).
"This message":http://sourceforge.net/mailarchive/message.php?msg_id=9144809 and "this message":http://sourceforge.net/mailarchive/message.php?msg_id=7524357 discuss 'BoundaryMesh' and 'Mesh::boundary_info'.

- I (Travis) have created an example that implements Dirichlet boundary conditions in the more natural (to me) way. Rows of the matrix corresponding to Dirichlet points are replaced by identity equations. The other rows of the matrix are then changed to make the matrix symmetric. Furthermore, the right-hand side incorporates the effect of boundary conditions.