Serac  0.1
Serac is an implicit thermal strucural mechanics simulation code.
Public Member Functions | List of all members
serac::BoundaryCondition Class Reference

Boundary condition information bundle. More...

#include <boundary_condition.hpp>

Public Member Functions

 BoundaryCondition (GeneralCoefficient coef, const std::optional< int > component, const mfem::ParFiniteElementSpace &space, const std::set< int > &attrs)
 Constructor for setting up a boundary condition using a set of attributes. More...
 
 BoundaryCondition (GeneralCoefficient coef, const std::optional< int > component, const mfem::ParFiniteElementSpace &space, const mfem::Array< int > &true_dofs)
 Minimal constructor for setting the true DOFs directly. More...
 
template<typename Tag >
bool tagEquals (const Tag tag) const
 Determines whether a boundary condition is associated with a tag. More...
 
template<typename Tag >
void setTag (const Tag tag)
 Sets the tag for the BC. More...
 
const mfem::Array< int > & markers () const
 Returns a non-owning reference to the array of boundary attribute markers.
 
mfem::Array< int > & markers ()
 Returns a non-owning reference to the array of boundary attribute markers.
 
const mfem::VectorCoefficient & vectorCoefficient () const
 Accessor for the underlying vector coefficient. More...
 
mfem::VectorCoefficient & vectorCoefficient ()
 Accessor for the underlying vector coefficient. More...
 
const mfem::Coefficient & scalarCoefficient () const
 Accessor for the underlying scalar coefficient. More...
 
mfem::Coefficient & scalarCoefficient ()
 Accessor for the underlying scalar coefficient. More...
 
const mfem::Array< int > & getTrueDofList () const
 Returns the DOF indices for an essential boundary condition. More...
 
const mfem::Array< int > & getLocalDofList () const
 Returns the DOF indices for an essential boundary condition. More...
 
void setDofs (mfem::Vector &state, const double time=0.0) const
 Projects the associated coefficient over a solution vector on the DOFs constrained by the boundary condition. More...
 
void apply (mfem::HypreParMatrix &k_mat, mfem::Vector &rhs, mfem::Vector &state) const
 Modify the system of equations \(Ax=b\) by replacing equations that correspond to essential boundary conditions with ones that prescribe the desired values. The rows of the matrix containing essential dofs are set to zero with a one on the diagonal. To preserve symmetry, the off-diagonal entries of associated columns of A are also zeroed out, and b is modified accordingly. This function is equivalent to: More...
 

Detailed Description

Boundary condition information bundle.

Definition at line 30 of file boundary_condition.hpp.

Constructor & Destructor Documentation

◆ BoundaryCondition() [1/2]

serac::BoundaryCondition::BoundaryCondition ( GeneralCoefficient  coef,
const std::optional< int >  component,
const mfem::ParFiniteElementSpace &  space,
const std::set< int > &  attrs 
)

Constructor for setting up a boundary condition using a set of attributes.

Parameters
[in]coefEither a mfem::Coefficient or mfem::VectorCoefficient representing the BC
[in]componentThe zero-indexed vector component if the BC applies to just one component, should be null for all components
[in]attrsThe set of boundary condition attributes in the mesh that the BC applies to
[in]spaceThe finite element space on which this BC is applied. This is used to calculate the DOFs from the attribute list.

Definition at line 13 of file boundary_condition.cpp.

◆ BoundaryCondition() [2/2]

serac::BoundaryCondition::BoundaryCondition ( GeneralCoefficient  coef,
const std::optional< int >  component,
const mfem::ParFiniteElementSpace &  space,
const mfem::Array< int > &  true_dofs 
)

Minimal constructor for setting the true DOFs directly.

Parameters
[in]coefEither a mfem::Coefficient or mfem::VectorCoefficient representing the BC
[in]componentThe zero-indexed vector component if the BC applies to just one component, should be null for all components
[in]true_dofsThe vector indices of the relevant DOFs
[in]spaceThe finite element space on which this BC is applied.

Definition at line 31 of file boundary_condition.cpp.

Member Function Documentation

◆ apply()

void serac::BoundaryCondition::apply ( mfem::HypreParMatrix &  k_mat,
mfem::Vector &  rhs,
mfem::Vector &  state 
) const

Modify the system of equations \(Ax=b\) by replacing equations that correspond to essential boundary conditions with ones that prescribe the desired values. The rows of the matrix containing essential dofs are set to zero with a one on the diagonal. To preserve symmetry, the off-diagonal entries of associated columns of A are also zeroed out, and b is modified accordingly. This function is equivalent to:

\[ A = \tilde{A} + A_e (\tilde{A} + A_e) x = b \tilde{A} x = b - A_e x \]

where \( A_e \) contains the eliminated columns of \( A \) for the essential degrees of freedom. Note that these equations only apply to the non-essential dofs. For the essential rows, \( A \) is modified to contain one on the diagonal and the right hand side is modified to contain the essential value originally contained in \( x \). If \( A \) is given as the input k_mat , \( A_e \) is returned in k_mat .

Parameters
[in,out]k_matA stiffness (system) matrix. The rows and cols of the essential dofs will be set to zero with a one on the diagonal after the return of this method.
[in,out]rhsThe RHS vector for the system. At return, this vector contains \( b - A_e x \).
[in]stateThe state from which the solution DOF values are extracted and used to modify k_mat
Precondition
The input state solution must contain the correct essential DOFs. This can be done by calling the BoundaryCondition::setDofs method.

Definition at line 130 of file boundary_condition.cpp.

◆ getLocalDofList()

const mfem::Array<int>& serac::BoundaryCondition::getLocalDofList ( ) const
inline

Returns the DOF indices for an essential boundary condition.

Returns
A non-owning reference to the array of indices
Note
True and local dofs are described in the MFEM documentation

Definition at line 150 of file boundary_condition.hpp.

◆ getTrueDofList()

const mfem::Array<int>& serac::BoundaryCondition::getTrueDofList ( ) const
inline

Returns the DOF indices for an essential boundary condition.

Returns
A non-owning reference to the array of indices
Note
True and local dofs are described in the MFEM documentation

Definition at line 142 of file boundary_condition.hpp.

◆ scalarCoefficient() [1/2]

mfem::Coefficient & serac::BoundaryCondition::scalarCoefficient ( )

Accessor for the underlying scalar coefficient.

This method performs an internal check to verify the underlying GeneralCoefficient is in fact a scalar.

Returns
A non-owning reference to the underlying scalar coefficient

Definition at line 147 of file boundary_condition.cpp.

◆ scalarCoefficient() [2/2]

const mfem::Coefficient & serac::BoundaryCondition::scalarCoefficient ( ) const

Accessor for the underlying scalar coefficient.

This method performs an internal check to verify the underlying GeneralCoefficient is in fact a scalar.

Returns
A non-owning reference to the underlying scalar coefficient

Definition at line 136 of file boundary_condition.cpp.

◆ setDofs()

void serac::BoundaryCondition::setDofs ( mfem::Vector &  state,
const double  time = 0.0 
) const

Projects the associated coefficient over a solution vector on the DOFs constrained by the boundary condition.

Parameters
[in]timeThe time at which to project the boundary condition
[in,out]stateThe field to project over

Definition at line 95 of file boundary_condition.cpp.

◆ setTag()

template<typename Tag >
void serac::BoundaryCondition::setTag ( const Tag  tag)
inline

Sets the tag for the BC.

Template Parameters
TagThe template type for the tag (label)
Parameters
[in]tagThe new tag
Precondition
Template type "Tag" must be an enumeration

Definition at line 78 of file boundary_condition.hpp.

◆ tagEquals()

template<typename Tag >
bool serac::BoundaryCondition::tagEquals ( const Tag  tag) const
inline

Determines whether a boundary condition is associated with a tag.

Template Parameters
TagThe type of the tag to compare against
Parameters
[in]tagThe tag to compare against
Precondition
Template type "Tag" must be an enumeration

Definition at line 62 of file boundary_condition.hpp.

◆ vectorCoefficient() [1/2]

mfem::VectorCoefficient & serac::BoundaryCondition::vectorCoefficient ( )

Accessor for the underlying vector coefficient.

This method performs an internal check to verify the underlying GeneralCoefficient is in fact a vector.

Returns
A non-owning reference to the underlying vector coefficient

Definition at line 169 of file boundary_condition.cpp.

◆ vectorCoefficient() [2/2]

const mfem::VectorCoefficient & serac::BoundaryCondition::vectorCoefficient ( ) const

Accessor for the underlying vector coefficient.

This method performs an internal check to verify the underlying GeneralCoefficient is in fact a vector.

Returns
A non-owning reference to the underlying vector coefficient

Definition at line 158 of file boundary_condition.cpp.


The documentation for this class was generated from the following files: