DirichletBC.h file
Essential (Dirichlet) boundary conditions, in two flavours.
Rodin's DirichletBC encodes a strongly-imposed essential constraint on a slave trial function over selected codimension-one mesh facets. With no .on(...) selector, this means the exterior boundary. With attributes, this also includes tagged interior facets such as FSI interfaces. Two flavours share the same template name and the same abstract base Rodin::
Value-prescribing BC —
DirichletBC(u, g)withga FunctionBase (scalar, vector, or matrix-valued):This is the classical inhomogeneous Dirichlet condition, including the homogeneous case .
Identification BC —
DirichletBC(u, A(v))withA(v)a ShapeFunctionBase expression linear in another (trial) shape function :where is any operator producing a
ShapeFunctionBase(the identity, a component selection , a left product , a matrix product , sums of these, etc.). This is algebraic identification of the two unknowns' boundary DOFs: both sides of the constraint involve degrees of freedom that are still unknown at solve time, not pre-evaluated values.The optional three-argument spelling
DirichletBC(u, A(v), d)keeps the same linear unknown-dependent part and adds a known defect:This is the form used for exact Newton correction rows such as .
Mathematical model
Let have basis and dual DOF functionals satisfying . Likewise for .
The DOF functionals are FE-local: for Lagrange they are nodal point evaluations , for moment-based or non-nodal elements they are integrals or pairings against dual moments. Both flavours apply the same DOF functional on the slave side; they differ only in what they apply it to.
Value-prescribing. For each slave DOF on
where . The assembled object is a map (the Rodin::
Identification. For each slave DOF on and with linear,
with the constraint coefficients
The assembled object is a map over the non-zero coefficients (the Rodin::
For Lagrange + same FES + : the dual property gives , so each slave maps to the same DOF index of with coefficient one. For on a vector FES at a Lagrange node : — a multi-master row whose coefficients are exact entries of at the slave node.
Exactness, by construction
Slave/master DOF pairings are determined entirely by the selected face and the FES's own connectivity (fes_u.getDOFs(faceDim, fi) and fes_v.getDOFs(faceDim, fi)). There is no geometric search and no tolerance anywhere in the assembly — the FE's DOF-functional contract (fe_u.getLinearForm(s) applied to a callable (Geometry::Point) -> value through the slave-FES pullback) is the only machinery used. Coefficient pruning uses strict c != 0 so that Lagrange-dual-induced sparsity is preserved bit-for-bit.
The identification assembler constructs a pointwise IntegrationPoint from each Geometry::Point and passes it to ShapeFunctionBase::setIntegrationPoint before querying ShapeFunctionBase::getBasis. The pointwise integration point has getQuadratureFormula() == nullptr, which selects direct reference-point evaluation without inventing a single-point quadrature rule. During integration, ShapeFunctionBase::setIntegrationPoint remains the preferred path with a non-null quadrature formula pointer and quadrature index so cached basis tabulations remain available.
Linear-system effect
Problem assembly handles the two flavours differently by visiting the variant returned from DirichletBCBase::getDOFs:
For DirichletBCBase::ValueDOFs at slave global index :
with the column at moved to the RHS as before being zeroed according to the current backend's classical essential-BC convention.
For DirichletBCBase::IdentifiedDOFs at slave global index with masters and coefficients : define an expansion map
Every matrix entry is assembled as
and every vector entry as
For homogeneous identifications this is the variational transformation
For affine identifications , the known defect also shifts the RHS:
If slave DOFs remain in the unknown vector, reconstruction rows are then written as
Identification mode is not zero-pinning, not row-only replacement, and not merely slave-column redirection. It is appropriate for tied fields, same-face linear identifications, periodic-like identifications, and monolithic FSI kinematic coupling where slave residuals/reactions must be transferred into the master equations.
Boundary specification
.on(attr) (or .on(attr1, attr2, ...)) selects the subset from the mesh's codimension-one attribute set. If no attributes are given, only exterior boundary faces are selected; if attributes are given, tagged interior interface faces are selected too. Both slave and master DOFs are read from the same face polytopes — the assembler never matches DOFs across distinct faces (no geometric pairing). For a cross-face periodic relation use Rodin::
Usage examples
// Homogeneous Dirichlet BC: u = 0 on boundary auto bc = DirichletBC(u, Zero()); // Inhomogeneous Dirichlet BC on attribute 1 RealFunction g = [](const Point& p) { return sin(p.x()); }; auto bc = DirichletBC(u, g).on(1); // Identification: pin u on the boundary to v's DOFs auto bc = DirichletBC(u, v).on(1); // Identification: u = R(x) v on the boundary auto bc = DirichletBC(u, R * v).on(1); // Identification: scalar u equal to vector v's x-component auto bc = DirichletBC(u, v.x()).on(1); // Affine identification: u = A(v) + d auto bc = DirichletBC(u, R * v, d).on(1);
Namespaces
- namespace Rodin
- The Rodin library for finite element methods and shape optimization.
- namespace Rodin::Variational
- Module which provides the necessary tools for constructing and solving variational problems.
Classes
-
template<class Scalar>class Rodin::Variational::DirichletBCBase
- Abstract base class for a Dirichlet boundary condition.
-
template<class Solution, class FES, class ValueDerived>class Rodin::Variational::DirichletBC<TrialFunction<Solution, FES>, FunctionBase<ValueDerived>>
- Value-prescribing Dirichlet boundary condition, .
-
template<class Solution, class FES1, class Derived2, class FES2, ShapeFunctionSpaceType Sp>class Rodin::Variational::DirichletBC<TrialFunction<Solution, FES1>, ShapeFunctionBase<Derived2, FES2, Sp>>
- Identification Dirichlet boundary condition, or .