https://mooseframework.inl.gov
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
Moose::MFEM::EquationSystem Class Reference

Class to store weak form components (bilinear and linear forms, and optionally mixed and nonlinear forms) and build methods. More...

#include <EquationSystem.h>

Inheritance diagram for Moose::MFEM::EquationSystem:
[legend]

Public Member Functions

 EquationSystem ()=default
 
 ~EquationSystem () override
 
virtual void AddTestVariableNameIfMissing (const std::string &test_var_name)
 Add test variable to EquationSystem. More...
 
virtual void AddCoupledVariableNameIfMissing (const std::string &coupled_var_name)
 Add coupled variable to EquationSystem. More...
 
virtual void AddKernel (std::shared_ptr< MFEMKernel > kernel)
 Add kernels. More...
 
virtual void AddIntegratedBC (std::shared_ptr< MFEMIntegratedBC > kernel)
 
virtual void AddEssentialBC (std::shared_ptr< MFEMEssentialBC > bc)
 
virtual void Init (Moose::MFEM::GridFunctions &gridfunctions, const Moose::MFEM::FESpaces &fespaces, mfem::AssemblyLevel assembly_level)
 Initialise. More...
 
virtual void BuildLinearForms ()
 Build linear forms and eliminate constrained DoFs. More...
 
virtual void ApplyEssentialBCs ()
 
virtual void EliminateCoupledVariables ()
 
virtual void BuildBilinearForms ()
 Build bilinear forms. More...
 
virtual void BuildMixedBilinearForms ()
 
virtual void BuildEquationSystem ()
 
virtual void FormLinearSystem (mfem::OperatorHandle &op, mfem::BlockVector &trueX, mfem::BlockVector &trueRHS)
 Form linear system, with essential boundary conditions accounted for. More...
 
virtual void FormSystem (mfem::OperatorHandle &op, mfem::BlockVector &trueX, mfem::BlockVector &trueRHS)
 
virtual void FormLegacySystem (mfem::OperatorHandle &op, mfem::BlockVector &trueX, mfem::BlockVector &trueRHS)
 
virtual void BuildJacobian (mfem::BlockVector &trueX, mfem::BlockVector &trueRHS)
 Build linear system, with essential boundary conditions accounted for. More...
 
void Mult (const mfem::Vector &u, mfem::Vector &residual) const override
 Compute residual y = Mu. More...
 
mfem::Operator & GetGradient (const mfem::Vector &u) const override
 Compute J = M + grad_H(u) More...
 
virtual void RecoverFEMSolution (mfem::BlockVector &trueX, Moose::MFEM::GridFunctions &gridfunctions)
 Update variable from solution vector after solve. More...
 
const std::vector< std::string > & TrialVarNames () const
 
const std::vector< std::string > & TestVarNames () const
 

Public Attributes

std::vector< mfem::Array< int > > _ess_tdof_lists
 

Protected Member Functions

void DeleteAllBlocks ()
 Deletes the HypreParMatrix associated with any pointer stored in _h_blocks, and then proceeds to delete all dynamically allocated memory for _h_blocks itself, resetting all dimensions to zero. More...
 
bool VectorContainsName (const std::vector< std::string > &the_vector, const std::string &name) const
 
template<class FormType >
void ApplyDomainBLFIntegrators (const std::string &trial_var_name, const std::string &test_var_name, std::shared_ptr< FormType > form, Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMKernel >>>> &kernels_map)
 Template method for applying BilinearFormIntegrators on domains from kernels to a BilinearForm, or MixedBilinearForm. More...
 
void ApplyDomainLFIntegrators (const std::string &test_var_name, std::shared_ptr< mfem::ParLinearForm > form, Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMKernel >>>> &kernels_map)
 
template<class FormType >
void ApplyBoundaryBLFIntegrators (const std::string &trial_var_name, const std::string &test_var_name, std::shared_ptr< FormType > form, Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMIntegratedBC >>>> &integrated_bc_map)
 
void ApplyBoundaryLFIntegrators (const std::string &test_var_name, std::shared_ptr< mfem::ParLinearForm > form, Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMIntegratedBC >>>> &integrated_bc_map)
 

Protected Attributes

std::vector< std::string > _coupled_var_names
 Names of all trial variables of kernels and boundary conditions added to this EquationSystem. More...
 
std::vector< std::string > _trial_var_names
 Subset of _coupled_var_names of all variables corresponding to gridfunctions with degrees of freedom that comprise the state vector of this EquationSystem. More...
 
std::vector< std::string > _eliminated_var_names
 Names of all coupled variables without a corresponding test variable. More...
 
Moose::MFEM::GridFunctions _eliminated_variables
 Pointers to coupled variables not part of the reduced EquationSystem. More...
 
std::vector< std::string > _test_var_names
 Names of all test variables corresponding to linear forms in this equation system. More...
 
std::vector< mfem::ParFiniteElementSpace * > _test_pfespaces
 Pointers to finite element spaces associated with test variables. More...
 
std::vector< mfem::ParFiniteElementSpace * > _coupled_pfespaces
 Pointers to finite element spaces associated with coupled variables. More...
 
Moose::MFEM::NamedFieldsMap< mfem::ParBilinearForm > _blfs
 
Moose::MFEM::NamedFieldsMap< mfem::ParLinearForm > _lfs
 
Moose::MFEM::NamedFieldsMap< mfem::ParNonlinearForm > _nlfs
 
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< mfem::ParMixedBilinearForm > > _mblfs
 
std::vector< std::unique_ptr< mfem::ParGridFunction > > _var_ess_constraints
 Gridfunctions holding essential constraints from Dirichlet BCs. More...
 
mfem::Array2D< const mfem::HypreParMatrix * > _h_blocks
 
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMKernel > > > > _kernels_map
 Arrays to store kernels to act on each component of weak form. More...
 
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMIntegratedBC > > > > _integrated_bc_map
 Arrays to store integrated BCs to act on each component of weak form. More...
 
Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMEssentialBC > > > _essential_bc_map
 Arrays to store essential BCs to act on each component of weak form. More...
 
mfem::OperatorHandle _jacobian
 
mfem::AssemblyLevel _assembly_level
 

Private Member Functions

virtual void SetTrialVariableNames ()
 Set trial variable names from subset of coupled variables that have an associated test variable. More...
 

Friends

class EquationSystemProblemOperator
 
class TimeDomainEquationSystemProblemOperator
 

Detailed Description

Class to store weak form components (bilinear and linear forms, and optionally mixed and nonlinear forms) and build methods.

Definition at line 30 of file EquationSystem.h.

Constructor & Destructor Documentation

◆ EquationSystem()

Moose::MFEM::EquationSystem::EquationSystem ( )
default

◆ ~EquationSystem()

Moose::MFEM::EquationSystem::~EquationSystem ( )
override

Definition at line 18 of file EquationSystem.C.

18 { DeleteAllBlocks(); }
void DeleteAllBlocks()
Deletes the HypreParMatrix associated with any pointer stored in _h_blocks, and then proceeds to dele...

Member Function Documentation

◆ AddCoupledVariableNameIfMissing()

void Moose::MFEM::EquationSystem::AddCoupledVariableNameIfMissing ( const std::string &  coupled_var_name)
virtual

Add coupled variable to EquationSystem.

Reimplemented in Moose::MFEM::TimeDependentEquationSystem.

Definition at line 40 of file EquationSystem.C.

Referenced by Moose::MFEM::TimeDependentEquationSystem::AddCoupledVariableNameIfMissing(), AddIntegratedBC(), and AddKernel().

41 {
42  if (!VectorContainsName(_coupled_var_names, coupled_var_name))
43  _coupled_var_names.push_back(coupled_var_name);
44 }
bool VectorContainsName(const std::vector< std::string > &the_vector, const std::string &name) const
std::vector< std::string > _coupled_var_names
Names of all trial variables of kernels and boundary conditions added to this EquationSystem.

◆ AddEssentialBC()

void Moose::MFEM::EquationSystem::AddEssentialBC ( std::shared_ptr< MFEMEssentialBC bc)
virtual

Definition at line 114 of file EquationSystem.C.

115 {
116  AddTestVariableNameIfMissing(bc->getTestVariableName());
117  auto test_var_name = bc->getTestVariableName();
118  if (!_essential_bc_map.Has(test_var_name))
119  {
120  auto bcs = std::make_shared<std::vector<std::shared_ptr<MFEMEssentialBC>>>();
121  _essential_bc_map.Register(test_var_name, std::move(bcs));
122  }
123  _essential_bc_map.GetRef(test_var_name).push_back(std::move(bc));
124 }
virtual void AddTestVariableNameIfMissing(const std::string &test_var_name)
Add test variable to EquationSystem.
bool Has(const std::string &field_name) const
Predicate to check if a field is registered with name field_name.
Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMEssentialBC > > > _essential_bc_map
Arrays to store essential BCs to act on each component of weak form.
void Register(const std::string &field_name, FieldArgs &&... args)
Construct new field with name field_name and register.
T & GetRef(const std::string &field_name) const
Returns a reference to a field.

◆ AddIntegratedBC()

void Moose::MFEM::EquationSystem::AddIntegratedBC ( std::shared_ptr< MFEMIntegratedBC kernel)
virtual

Definition at line 91 of file EquationSystem.C.

92 {
93  AddTestVariableNameIfMissing(bc->getTestVariableName());
94  AddCoupledVariableNameIfMissing(bc->getTrialVariableName());
95  auto trial_var_name = bc->getTrialVariableName();
96  auto test_var_name = bc->getTestVariableName();
97  if (!_integrated_bc_map.Has(test_var_name))
98  {
99  auto integrated_bc_field_map = std::make_shared<
101  _integrated_bc_map.Register(test_var_name, std::move(integrated_bc_field_map));
102  }
103  // Register new integrated bc map if not present for the test/trial variable
104  // pair
105  if (!_integrated_bc_map.Get(test_var_name)->Has(trial_var_name))
106  {
107  auto bcs = std::make_shared<std::vector<std::shared_ptr<MFEMIntegratedBC>>>();
108  _integrated_bc_map.Get(test_var_name)->Register(trial_var_name, std::move(bcs));
109  }
110  _integrated_bc_map.GetRef(test_var_name).Get(trial_var_name)->push_back(std::move(bc));
111 }
virtual void AddTestVariableNameIfMissing(const std::string &test_var_name)
Add test variable to EquationSystem.
bool Has(const std::string &field_name) const
Predicate to check if a field is registered with name field_name.
Lightweight adaptor over an std::map from strings to pointer to T.
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
virtual void AddCoupledVariableNameIfMissing(const std::string &coupled_var_name)
Add coupled variable to EquationSystem.
void Register(const std::string &field_name, FieldArgs &&... args)
Construct new field with name field_name and register.
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMIntegratedBC > > > > _integrated_bc_map
Arrays to store integrated BCs to act on each component of weak form.
T & GetRef(const std::string &field_name) const
Returns a reference to a field.

◆ AddKernel()

void Moose::MFEM::EquationSystem::AddKernel ( std::shared_ptr< MFEMKernel kernel)
virtual

Add kernels.

Reimplemented in Moose::MFEM::TimeDependentEquationSystem.

Definition at line 68 of file EquationSystem.C.

Referenced by Moose::MFEM::TimeDependentEquationSystem::AddKernel().

69 {
70  AddTestVariableNameIfMissing(kernel->getTestVariableName());
71  AddCoupledVariableNameIfMissing(kernel->getTrialVariableName());
72  auto trial_var_name = kernel->getTrialVariableName();
73  auto test_var_name = kernel->getTestVariableName();
74  if (!_kernels_map.Has(test_var_name))
75  {
76  auto kernel_field_map =
77  std::make_shared<Moose::MFEM::NamedFieldsMap<std::vector<std::shared_ptr<MFEMKernel>>>>();
78  _kernels_map.Register(test_var_name, std::move(kernel_field_map));
79  }
80  // Register new kernels map if not present for the test/trial variable
81  // pair
82  if (!_kernels_map.Get(test_var_name)->Has(trial_var_name))
83  {
84  auto kernels = std::make_shared<std::vector<std::shared_ptr<MFEMKernel>>>();
85  _kernels_map.Get(test_var_name)->Register(trial_var_name, std::move(kernels));
86  }
87  _kernels_map.GetRef(test_var_name).Get(trial_var_name)->push_back(std::move(kernel));
88 }
virtual void AddTestVariableNameIfMissing(const std::string &test_var_name)
Add test variable to EquationSystem.
bool Has(const std::string &field_name) const
Predicate to check if a field is registered with name field_name.
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
virtual void AddCoupledVariableNameIfMissing(const std::string &coupled_var_name)
Add coupled variable to EquationSystem.
void Register(const std::string &field_name, FieldArgs &&... args)
Construct new field with name field_name and register.
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMKernel > > > > _kernels_map
Arrays to store kernels to act on each component of weak form.
T & GetRef(const std::string &field_name) const
Returns a reference to a field.

◆ AddTestVariableNameIfMissing()

void Moose::MFEM::EquationSystem::AddTestVariableNameIfMissing ( const std::string &  test_var_name)
virtual

Add test variable to EquationSystem.

Definition at line 47 of file EquationSystem.C.

Referenced by AddEssentialBC(), AddIntegratedBC(), AddKernel(), and Moose::MFEM::TimeDependentEquationSystem::AddKernel().

48 {
49  if (!VectorContainsName(_test_var_names, test_var_name))
50  _test_var_names.push_back(test_var_name);
51 }
bool VectorContainsName(const std::vector< std::string > &the_vector, const std::string &name) const
std::vector< std::string > _test_var_names
Names of all test variables corresponding to linear forms in this equation system.

◆ ApplyBoundaryBLFIntegrators()

template<class FormType >
void Moose::MFEM::EquationSystem::ApplyBoundaryBLFIntegrators ( const std::string &  trial_var_name,
const std::string &  test_var_name,
std::shared_ptr< FormType >  form,
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMIntegratedBC >>>> &  integrated_bc_map 
)
protected

Definition at line 245 of file EquationSystem.h.

252 {
253  if (integrated_bc_map.Has(test_var_name) &&
254  integrated_bc_map.Get(test_var_name)->Has(trial_var_name))
255  {
256  auto bcs = integrated_bc_map.GetRef(test_var_name).GetRef(trial_var_name);
257  for (auto & bc : bcs)
258  {
259  mfem::BilinearFormIntegrator * integ = bc->createBFIntegrator();
260  if (integ != nullptr)
261  {
262  bc->isBoundaryRestricted()
263  ? form->AddBoundaryIntegrator(std::move(integ), bc->getBoundaryMarkers())
264  : form->AddBoundaryIntegrator(std::move(integ));
265  }
266  }
267  }
268 }
bool Has(const std::string &field_name) const
Predicate to check if a field is registered with name field_name.
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
T & GetRef(const std::string &field_name) const
Returns a reference to a field.

◆ ApplyBoundaryLFIntegrators()

void Moose::MFEM::EquationSystem::ApplyBoundaryLFIntegrators ( const std::string &  test_var_name,
std::shared_ptr< mfem::ParLinearForm >  form,
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMIntegratedBC >>>> &  integrated_bc_map 
)
inlineprotected

Definition at line 271 of file EquationSystem.h.

Referenced by BuildLinearForms().

277 {
278  if (integrated_bc_map.Has(test_var_name) &&
279  integrated_bc_map.Get(test_var_name)->Has(test_var_name))
280  {
281  auto bcs = integrated_bc_map.GetRef(test_var_name).GetRef(test_var_name);
282  for (auto & bc : bcs)
283  {
284  mfem::LinearFormIntegrator * integ = bc->createLFIntegrator();
285  if (integ != nullptr)
286  {
287  bc->isBoundaryRestricted()
288  ? form->AddBoundaryIntegrator(std::move(integ), bc->getBoundaryMarkers())
289  : form->AddBoundaryIntegrator(std::move(integ));
290  }
291  }
292  }
293 }
bool Has(const std::string &field_name) const
Predicate to check if a field is registered with name field_name.
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
T & GetRef(const std::string &field_name) const
Returns a reference to a field.

◆ ApplyDomainBLFIntegrators()

template<class FormType >
void Moose::MFEM::EquationSystem::ApplyDomainBLFIntegrators ( const std::string &  trial_var_name,
const std::string &  test_var_name,
std::shared_ptr< FormType >  form,
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMKernel >>>> &  kernels_map 
)
protected

Template method for applying BilinearFormIntegrators on domains from kernels to a BilinearForm, or MixedBilinearForm.

Definition at line 197 of file EquationSystem.h.

203 {
204  if (kernels_map.Has(test_var_name) && kernels_map.Get(test_var_name)->Has(trial_var_name))
205  {
206  auto kernels = kernels_map.GetRef(test_var_name).GetRef(trial_var_name);
207  for (auto & kernel : kernels)
208  {
209  mfem::BilinearFormIntegrator * integ = kernel->createBFIntegrator();
210  if (integ != nullptr)
211  {
212  kernel->isSubdomainRestricted()
213  ? form->AddDomainIntegrator(std::move(integ), kernel->getSubdomainMarkers())
214  : form->AddDomainIntegrator(std::move(integ));
215  }
216  }
217  }
218 }
bool Has(const std::string &field_name) const
Predicate to check if a field is registered with name field_name.
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
T & GetRef(const std::string &field_name) const
Returns a reference to a field.

◆ ApplyDomainLFIntegrators()

void Moose::MFEM::EquationSystem::ApplyDomainLFIntegrators ( const std::string &  test_var_name,
std::shared_ptr< mfem::ParLinearForm >  form,
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMKernel >>>> &  kernels_map 
)
inlineprotected

Definition at line 221 of file EquationSystem.h.

Referenced by BuildLinearForms().

226 {
227  if (kernels_map.Has(test_var_name) && kernels_map.Get(test_var_name)->Has(test_var_name))
228  {
229  auto kernels = kernels_map.GetRef(test_var_name).GetRef(test_var_name);
230  for (auto & kernel : kernels)
231  {
232  mfem::LinearFormIntegrator * integ = kernel->createLFIntegrator();
233  if (integ != nullptr)
234  {
235  kernel->isSubdomainRestricted()
236  ? form->AddDomainIntegrator(std::move(integ), kernel->getSubdomainMarkers())
237  : form->AddDomainIntegrator(std::move(integ));
238  }
239  }
240  }
241 }
bool Has(const std::string &field_name) const
Predicate to check if a field is registered with name field_name.
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
T & GetRef(const std::string &field_name) const
Returns a reference to a field.

◆ ApplyEssentialBCs()

void Moose::MFEM::EquationSystem::ApplyEssentialBCs ( )
virtual

Definition at line 164 of file EquationSystem.C.

Referenced by BuildLinearForms().

165 {
166  _ess_tdof_lists.resize(_test_var_names.size());
167  for (const auto i : index_range(_test_var_names))
168  {
169  auto test_var_name = _test_var_names.at(i);
170  if (!_essential_bc_map.Has(test_var_name))
171  continue;
172 
173  // Set default value of gridfunction used in essential BC. Values
174  // overwritten in applyEssentialBCs
175  mfem::ParGridFunction & trial_gf(*(_var_ess_constraints.at(i)));
176  auto * const pmesh = _test_pfespaces.at(i)->GetParMesh();
177  mooseAssert(pmesh, "parallel mesh is null");
178 
179  auto bcs = _essential_bc_map.GetRef(test_var_name);
180  mfem::Array<int> global_ess_markers(pmesh->bdr_attributes.Max());
181  global_ess_markers = 0;
182  for (auto & bc : bcs)
183  {
184  bc->ApplyBC(trial_gf);
185 
186  mfem::Array<int> ess_bdrs(bc->getBoundaryMarkers());
187  for (auto it = 0; it != pmesh->bdr_attributes.Max(); ++it)
188  {
189  global_ess_markers[it] = std::max(global_ess_markers[it], ess_bdrs[it]);
190  }
191  }
192  trial_gf.FESpace()->GetEssentialTrueDofs(global_ess_markers, _ess_tdof_lists.at(i));
193  }
194 }
bool Has(const std::string &field_name) const
Predicate to check if a field is registered with name field_name.
std::vector< mfem::Array< int > > _ess_tdof_lists
auto max(const L &left, const R &right)
Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMEssentialBC > > > _essential_bc_map
Arrays to store essential BCs to act on each component of weak form.
std::vector< mfem::ParFiniteElementSpace * > _test_pfespaces
Pointers to finite element spaces associated with test variables.
std::vector< std::string > _test_var_names
Names of all test variables corresponding to linear forms in this equation system.
std::vector< std::unique_ptr< mfem::ParGridFunction > > _var_ess_constraints
Gridfunctions holding essential constraints from Dirichlet BCs.
T & GetRef(const std::string &field_name) const
Returns a reference to a field.
auto index_range(const T &sizable)

◆ BuildBilinearForms()

void Moose::MFEM::EquationSystem::BuildBilinearForms ( )
virtual

Build bilinear forms.

Reimplemented in Moose::MFEM::TimeDependentEquationSystem.

Definition at line 381 of file EquationSystem.C.

Referenced by Moose::MFEM::TimeDependentEquationSystem::BuildBilinearForms(), and BuildEquationSystem().

382 {
383  // Register bilinear forms
384  for (const auto i : index_range(_test_var_names))
385  {
386  auto test_var_name = _test_var_names.at(i);
387  _blfs.Register(test_var_name, std::make_shared<mfem::ParBilinearForm>(_test_pfespaces.at(i)));
388 
389  // Apply kernels
390  auto blf = _blfs.GetShared(test_var_name);
391  blf->SetAssemblyLevel(_assembly_level);
392  ApplyBoundaryBLFIntegrators<mfem::ParBilinearForm>(
393  test_var_name, test_var_name, blf, _integrated_bc_map);
394  ApplyDomainBLFIntegrators<mfem::ParBilinearForm>(
395  test_var_name, test_var_name, blf, _kernels_map);
396  // Assemble
397  blf->Assemble();
398  }
399 }
mfem::AssemblyLevel _assembly_level
std::vector< mfem::ParFiniteElementSpace * > _test_pfespaces
Pointers to finite element spaces associated with test variables.
std::shared_ptr< T > GetShared(const std::string &field_name) const
Returns a shared pointer to the field. This is guaranteed to return a non-null shared pointer...
std::vector< std::string > _test_var_names
Names of all test variables corresponding to linear forms in this equation system.
void Register(const std::string &field_name, FieldArgs &&... args)
Construct new field with name field_name and register.
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMIntegratedBC > > > > _integrated_bc_map
Arrays to store integrated BCs to act on each component of weak form.
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMKernel > > > > _kernels_map
Arrays to store kernels to act on each component of weak form.
Moose::MFEM::NamedFieldsMap< mfem::ParBilinearForm > _blfs
auto index_range(const T &sizable)

◆ BuildEquationSystem()

void Moose::MFEM::EquationSystem::BuildEquationSystem ( )
virtual

Definition at line 441 of file EquationSystem.C.

Referenced by Moose::MFEM::EquationSystemProblemOperator::Init(), Moose::MFEM::TimeDomainEquationSystemProblemOperator::Init(), and Moose::MFEM::TimeDependentEquationSystem::UpdateEquationSystem().

442 {
446 }
virtual void BuildBilinearForms()
Build bilinear forms.
virtual void BuildMixedBilinearForms()
virtual void BuildLinearForms()
Build linear forms and eliminate constrained DoFs.

◆ BuildJacobian()

void Moose::MFEM::EquationSystem::BuildJacobian ( mfem::BlockVector &  trueX,
mfem::BlockVector &  trueRHS 
)
virtual

Build linear system, with essential boundary conditions accounted for.

Definition at line 320 of file EquationSystem.C.

Referenced by Moose::MFEM::TimeDomainEquationSystemProblemOperator::BuildEquationSystemOperator(), and Moose::MFEM::EquationSystemProblemOperator::Solve().

321 {
322  height = trueX.Size();
323  width = trueRHS.Size();
324  FormLinearSystem(_jacobian, trueX, trueRHS);
325 }
mfem::OperatorHandle _jacobian
virtual void FormLinearSystem(mfem::OperatorHandle &op, mfem::BlockVector &trueX, mfem::BlockVector &trueRHS)
Form linear system, with essential boundary conditions accounted for.

◆ BuildLinearForms()

void Moose::MFEM::EquationSystem::BuildLinearForms ( )
virtual

Build linear forms and eliminate constrained DoFs.

Definition at line 354 of file EquationSystem.C.

Referenced by BuildEquationSystem().

355 {
356  // Register linear forms
357  for (const auto i : index_range(_test_var_names))
358  {
359  auto test_var_name = _test_var_names.at(i);
360  _lfs.Register(test_var_name, std::make_shared<mfem::ParLinearForm>(_test_pfespaces.at(i)));
361  _lfs.GetRef(test_var_name) = 0.0;
362  }
363 
364  // Apply boundary conditions
366 
367  for (auto & test_var_name : _test_var_names)
368  {
369  // Apply kernels
370  auto lf = _lfs.GetShared(test_var_name);
371  ApplyDomainLFIntegrators(test_var_name, lf, _kernels_map);
373  lf->Assemble();
374  }
375 
376  // Eliminate trivially eliminated variables by subtracting contributions from linear forms
378 }
virtual void EliminateCoupledVariables()
void ApplyBoundaryLFIntegrators(const std::string &test_var_name, std::shared_ptr< mfem::ParLinearForm > form, Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMIntegratedBC >>>> &integrated_bc_map)
std::vector< mfem::ParFiniteElementSpace * > _test_pfespaces
Pointers to finite element spaces associated with test variables.
std::shared_ptr< T > GetShared(const std::string &field_name) const
Returns a shared pointer to the field. This is guaranteed to return a non-null shared pointer...
std::vector< std::string > _test_var_names
Names of all test variables corresponding to linear forms in this equation system.
void Register(const std::string &field_name, FieldArgs &&... args)
Construct new field with name field_name and register.
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMIntegratedBC > > > > _integrated_bc_map
Arrays to store integrated BCs to act on each component of weak form.
void ApplyDomainLFIntegrators(const std::string &test_var_name, std::shared_ptr< mfem::ParLinearForm > form, Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMKernel >>>> &kernels_map)
virtual void ApplyEssentialBCs()
Moose::MFEM::NamedFieldsMap< mfem::ParLinearForm > _lfs
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMKernel > > > > _kernels_map
Arrays to store kernels to act on each component of weak form.
T & GetRef(const std::string &field_name) const
Returns a reference to a field.
auto index_range(const T &sizable)

◆ BuildMixedBilinearForms()

void Moose::MFEM::EquationSystem::BuildMixedBilinearForms ( )
virtual

Definition at line 402 of file EquationSystem.C.

Referenced by BuildEquationSystem().

403 {
404  // Register mixed bilinear forms. Note that not all combinations may
405  // have a kernel
406 
407  // Create mblf for each test/coupled variable pair with an added kernel
408  for (const auto i : index_range(_test_var_names))
409  {
410  auto test_var_name = _test_var_names.at(i);
411  auto test_mblfs = std::make_shared<Moose::MFEM::NamedFieldsMap<mfem::ParMixedBilinearForm>>();
412  for (const auto j : index_range(_coupled_var_names))
413  {
414  const auto & coupled_var_name = _coupled_var_names.at(j);
415  auto mblf = std::make_shared<mfem::ParMixedBilinearForm>(_coupled_pfespaces.at(j),
416  _test_pfespaces.at(i));
417  // Register MixedBilinearForm if kernels exist for it, and assemble
418  // kernels
419  if (_kernels_map.Has(test_var_name) &&
420  _kernels_map.Get(test_var_name)->Has(coupled_var_name) &&
421  test_var_name != coupled_var_name)
422  {
423  mblf->SetAssemblyLevel(_assembly_level);
424  // Apply all mixed kernels with this test/trial pair
425  ApplyDomainBLFIntegrators<mfem::ParMixedBilinearForm>(
426  coupled_var_name, test_var_name, mblf, _kernels_map);
427  // Assemble mixed bilinear forms
428  mblf->Assemble();
429  // Register mixed bilinear forms associated with a single trial variable
430  // for the current test variable
431  test_mblfs->Register(coupled_var_name, mblf);
432  }
433  }
434  // Register all mixed bilinear form sets associated with a single test
435  // variable
436  _mblfs.Register(test_var_name, test_mblfs);
437  }
438 }
bool Has(const std::string &field_name) const
Predicate to check if a field is registered with name field_name.
std::vector< mfem::ParFiniteElementSpace * > _coupled_pfespaces
Pointers to finite element spaces associated with coupled variables.
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< mfem::ParMixedBilinearForm > > _mblfs
mfem::AssemblyLevel _assembly_level
std::vector< mfem::ParFiniteElementSpace * > _test_pfespaces
Pointers to finite element spaces associated with test variables.
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
std::vector< std::string > _test_var_names
Names of all test variables corresponding to linear forms in this equation system.
std::vector< std::string > _coupled_var_names
Names of all trial variables of kernels and boundary conditions added to this EquationSystem.
void Register(const std::string &field_name, FieldArgs &&... args)
Construct new field with name field_name and register.
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMKernel > > > > _kernels_map
Arrays to store kernels to act on each component of weak form.
auto index_range(const T &sizable)

◆ DeleteAllBlocks()

void Moose::MFEM::EquationSystem::DeleteAllBlocks ( )
protected

Deletes the HypreParMatrix associated with any pointer stored in _h_blocks, and then proceeds to delete all dynamically allocated memory for _h_blocks itself, resetting all dimensions to zero.

Definition at line 21 of file EquationSystem.C.

Referenced by FormLegacySystem(), Moose::MFEM::TimeDependentEquationSystem::FormLegacySystem(), and ~EquationSystem().

22 {
23  for (const auto i : make_range(_h_blocks.NumRows()))
24  for (const auto j : make_range(_h_blocks.NumCols()))
25  delete _h_blocks(i, j);
26  _h_blocks.DeleteAll();
27 }
mfem::Array2D< const mfem::HypreParMatrix * > _h_blocks
IntRange< T > make_range(T beg, T end)

◆ EliminateCoupledVariables()

void Moose::MFEM::EquationSystem::EliminateCoupledVariables ( )
virtual

Definition at line 197 of file EquationSystem.C.

Referenced by BuildLinearForms().

198 {
199  for (const auto & test_var_name : _test_var_names)
200  {
201  auto lf = _lfs.Get(test_var_name);
202  for (const auto & eliminated_var_name : _eliminated_var_names)
203  {
204  if (_mblfs.Has(test_var_name) && _mblfs.Get(test_var_name)->Has(eliminated_var_name))
205  {
206  auto mblf = _mblfs.Get(test_var_name)->Get(eliminated_var_name);
207  mblf->AddMult(*_eliminated_variables.Get(eliminated_var_name), *lf, -1.0);
208  }
209  }
210  }
211 }
bool Has(const std::string &field_name) const
Predicate to check if a field is registered with name field_name.
std::vector< std::string > _eliminated_var_names
Names of all coupled variables without a corresponding test variable.
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< mfem::ParMixedBilinearForm > > _mblfs
Moose::MFEM::GridFunctions _eliminated_variables
Pointers to coupled variables not part of the reduced EquationSystem.
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
std::vector< std::string > _test_var_names
Names of all test variables corresponding to linear forms in this equation system.
Moose::MFEM::NamedFieldsMap< mfem::ParLinearForm > _lfs

◆ FormLegacySystem()

void Moose::MFEM::EquationSystem::FormLegacySystem ( mfem::OperatorHandle &  op,
mfem::BlockVector &  trueX,
mfem::BlockVector &  trueRHS 
)
virtual

Reimplemented in Moose::MFEM::TimeDependentEquationSystem.

Definition at line 258 of file EquationSystem.C.

Referenced by FormLinearSystem().

261 {
262 
263  // Allocate block operator
264  DeleteAllBlocks();
265  _h_blocks.SetSize(_test_var_names.size(), _test_var_names.size());
266  // Form diagonal blocks.
267  for (const auto i : index_range(_test_var_names))
268  {
269  auto & test_var_name = _test_var_names.at(i);
270  auto blf = _blfs.Get(test_var_name);
271  auto lf = _lfs.Get(test_var_name);
272  mfem::Vector aux_x, aux_rhs;
273  mfem::HypreParMatrix * aux_a = new mfem::HypreParMatrix;
274  blf->FormLinearSystem(
275  _ess_tdof_lists.at(i), *(_var_ess_constraints.at(i)), *lf, *aux_a, aux_x, aux_rhs);
276  _h_blocks(i, i) = aux_a;
277  trueX.GetBlock(i) = aux_x;
278  trueRHS.GetBlock(i) = aux_rhs;
279  }
280 
281  // Form off-diagonal blocks
282  for (const auto i : index_range(_test_var_names))
283  {
284  auto test_var_name = _test_var_names.at(i);
285  for (const auto j : index_range(_trial_var_names))
286  {
287  auto trial_var_name = _trial_var_names.at(j);
288 
289  mfem::Vector aux_x, aux_rhs;
290  mfem::ParLinearForm aux_lf(_test_pfespaces.at(i));
291  aux_lf = 0.0;
292  if (_mblfs.Has(test_var_name) && _mblfs.Get(test_var_name)->Has(trial_var_name))
293  {
294  auto mblf = _mblfs.Get(test_var_name)->Get(trial_var_name);
295  mfem::HypreParMatrix * aux_a = new mfem::HypreParMatrix;
296  mblf->FormRectangularLinearSystem(_ess_tdof_lists.at(j),
297  _ess_tdof_lists.at(i),
298  *(_var_ess_constraints.at(j)),
299  aux_lf,
300  *aux_a,
301  aux_x,
302  aux_rhs);
303  _h_blocks(i, j) = aux_a;
304  trueRHS.GetBlock(i) += aux_rhs;
305  }
306  }
307  }
308  // Sync memory
309  for (const auto i : index_range(_test_var_names))
310  {
311  trueX.GetBlock(i).SyncAliasMemory(trueX);
312  trueRHS.GetBlock(i).SyncAliasMemory(trueRHS);
313  }
314 
315  // Create monolithic matrix
316  op.Reset(mfem::HypreParMatrixFromBlocks(_h_blocks));
317 }
bool Has(const std::string &field_name) const
Predicate to check if a field is registered with name field_name.
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< mfem::ParMixedBilinearForm > > _mblfs
std::vector< mfem::Array< int > > _ess_tdof_lists
std::vector< mfem::ParFiniteElementSpace * > _test_pfespaces
Pointers to finite element spaces associated with test variables.
std::vector< std::string > _trial_var_names
Subset of _coupled_var_names of all variables corresponding to gridfunctions with degrees of freedom ...
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
std::vector< std::string > _test_var_names
Names of all test variables corresponding to linear forms in this equation system.
std::vector< std::unique_ptr< mfem::ParGridFunction > > _var_ess_constraints
Gridfunctions holding essential constraints from Dirichlet BCs.
mfem::Array2D< const mfem::HypreParMatrix * > _h_blocks
void DeleteAllBlocks()
Deletes the HypreParMatrix associated with any pointer stored in _h_blocks, and then proceeds to dele...
Moose::MFEM::NamedFieldsMap< mfem::ParLinearForm > _lfs
Moose::MFEM::NamedFieldsMap< mfem::ParBilinearForm > _blfs
auto index_range(const T &sizable)

◆ FormLinearSystem()

void Moose::MFEM::EquationSystem::FormLinearSystem ( mfem::OperatorHandle &  op,
mfem::BlockVector &  trueX,
mfem::BlockVector &  trueRHS 
)
virtual

Form linear system, with essential boundary conditions accounted for.

Definition at line 214 of file EquationSystem.C.

Referenced by BuildJacobian().

217 {
218 
219  switch (_assembly_level)
220  {
221  case mfem::AssemblyLevel::LEGACY:
222  FormLegacySystem(op, trueX, trueRHS);
223  break;
224  default:
225  mooseAssert(_test_var_names.size() == 1,
226  "Non-legacy assembly is only supported for single-variable systems");
227  mooseAssert(
228  _test_var_names.size() == _trial_var_names.size(),
229  "Non-legacy assembly is only supported for single test and trial variable systems");
230  FormSystem(op, trueX, trueRHS);
231  }
232 }
mfem::AssemblyLevel _assembly_level
std::vector< std::string > _trial_var_names
Subset of _coupled_var_names of all variables corresponding to gridfunctions with degrees of freedom ...
virtual void FormLegacySystem(mfem::OperatorHandle &op, mfem::BlockVector &trueX, mfem::BlockVector &trueRHS)
std::vector< std::string > _test_var_names
Names of all test variables corresponding to linear forms in this equation system.
virtual void FormSystem(mfem::OperatorHandle &op, mfem::BlockVector &trueX, mfem::BlockVector &trueRHS)

◆ FormSystem()

void Moose::MFEM::EquationSystem::FormSystem ( mfem::OperatorHandle &  op,
mfem::BlockVector &  trueX,
mfem::BlockVector &  trueRHS 
)
virtual

Reimplemented in Moose::MFEM::TimeDependentEquationSystem.

Definition at line 235 of file EquationSystem.C.

Referenced by FormLinearSystem().

238 {
239  auto & test_var_name = _test_var_names.at(0);
240  auto blf = _blfs.Get(test_var_name);
241  auto lf = _lfs.Get(test_var_name);
242  mfem::BlockVector aux_x, aux_rhs;
243  mfem::OperatorPtr aux_a;
244 
245  blf->FormLinearSystem(
246  _ess_tdof_lists.at(0), *(_var_ess_constraints.at(0)), *lf, aux_a, aux_x, aux_rhs);
247 
248  trueX.GetBlock(0) = aux_x;
249  trueRHS.GetBlock(0) = aux_rhs;
250  trueX.SyncFromBlocks();
251  trueRHS.SyncFromBlocks();
252 
253  op.Reset(aux_a.Ptr());
254  aux_a.SetOperatorOwner(false);
255 }
std::vector< mfem::Array< int > > _ess_tdof_lists
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
std::vector< std::string > _test_var_names
Names of all test variables corresponding to linear forms in this equation system.
std::vector< std::unique_ptr< mfem::ParGridFunction > > _var_ess_constraints
Gridfunctions holding essential constraints from Dirichlet BCs.
Moose::MFEM::NamedFieldsMap< mfem::ParLinearForm > _lfs
Moose::MFEM::NamedFieldsMap< mfem::ParBilinearForm > _blfs

◆ GetGradient()

mfem::Operator & Moose::MFEM::EquationSystem::GetGradient ( const mfem::Vector &  u) const
override

Compute J = M + grad_H(u)

Definition at line 336 of file EquationSystem.C.

337 {
338  return *_jacobian;
339 }
mfem::OperatorHandle _jacobian

◆ Init()

void Moose::MFEM::EquationSystem::Init ( Moose::MFEM::GridFunctions gridfunctions,
const Moose::MFEM::FESpaces fespaces,
mfem::AssemblyLevel  assembly_level 
)
virtual

Initialise.

Definition at line 127 of file EquationSystem.C.

130 {
131  _assembly_level = assembly_level;
132 
133  for (auto & test_var_name : _test_var_names)
134  {
135  if (!gridfunctions.Has(test_var_name))
136  {
137  mooseError("MFEM variable ",
138  test_var_name,
139  " requested by equation system during initialisation was "
140  "not found in gridfunctions");
141  }
142  // Store pointers to test FESpaces
143  _test_pfespaces.push_back(gridfunctions.Get(test_var_name)->ParFESpace());
144  // Create auxiliary gridfunctions for storing essential constraints from Dirichlet conditions
145  _var_ess_constraints.emplace_back(
146  std::make_unique<mfem::ParGridFunction>(gridfunctions.Get(test_var_name)->ParFESpace()));
147  }
148 
149  // Store pointers to FESpaces of all coupled variables
150  for (auto & coupled_var_name : _coupled_var_names)
151  _coupled_pfespaces.push_back(gridfunctions.Get(coupled_var_name)->ParFESpace());
152 
153  // Extract which coupled variables are to be trivially eliminated and which are trial variables
155 
156  // Store pointers to coupled variable GridFunctions that are to be eliminated prior to forming the
157  // jacobian
158  for (auto & eliminated_var_name : _eliminated_var_names)
159  _eliminated_variables.Register(eliminated_var_name,
160  gridfunctions.GetShared(eliminated_var_name));
161 }
bool Has(const std::string &field_name) const
Predicate to check if a field is registered with name field_name.
std::vector< mfem::ParFiniteElementSpace * > _coupled_pfespaces
Pointers to finite element spaces associated with coupled variables.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
std::vector< std::string > _eliminated_var_names
Names of all coupled variables without a corresponding test variable.
Moose::MFEM::GridFunctions _eliminated_variables
Pointers to coupled variables not part of the reduced EquationSystem.
mfem::AssemblyLevel _assembly_level
std::vector< mfem::ParFiniteElementSpace * > _test_pfespaces
Pointers to finite element spaces associated with test variables.
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
std::shared_ptr< T > GetShared(const std::string &field_name) const
Returns a shared pointer to the field. This is guaranteed to return a non-null shared pointer...
std::vector< std::string > _test_var_names
Names of all test variables corresponding to linear forms in this equation system.
std::vector< std::unique_ptr< mfem::ParGridFunction > > _var_ess_constraints
Gridfunctions holding essential constraints from Dirichlet BCs.
virtual void SetTrialVariableNames()
Set trial variable names from subset of coupled variables that have an associated test variable...
std::vector< std::string > _coupled_var_names
Names of all trial variables of kernels and boundary conditions added to this EquationSystem.
void Register(const std::string &field_name, FieldArgs &&... args)
Construct new field with name field_name and register.

◆ Mult()

void Moose::MFEM::EquationSystem::Mult ( const mfem::Vector &  u,
mfem::Vector &  residual 
) const
override

Compute residual y = Mu.

Definition at line 328 of file EquationSystem.C.

329 {
330  _jacobian->Mult(x, residual);
331  x.HostRead();
332  residual.HostRead();
333 }
mfem::OperatorHandle _jacobian

◆ RecoverFEMSolution()

void Moose::MFEM::EquationSystem::RecoverFEMSolution ( mfem::BlockVector &  trueX,
Moose::MFEM::GridFunctions gridfunctions 
)
virtual

Update variable from solution vector after solve.

Definition at line 342 of file EquationSystem.C.

Referenced by Moose::MFEM::EquationSystemProblemOperator::Solve().

344 {
345  for (const auto i : index_range(_trial_var_names))
346  {
347  auto & trial_var_name = _trial_var_names.at(i);
348  trueX.GetBlock(i).SyncAliasMemory(trueX);
349  gridfunctions.Get(trial_var_name)->Distribute(&(trueX.GetBlock(i)));
350  }
351 }
std::vector< std::string > _trial_var_names
Subset of _coupled_var_names of all variables corresponding to gridfunctions with degrees of freedom ...
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
auto index_range(const T &sizable)

◆ SetTrialVariableNames()

void Moose::MFEM::EquationSystem::SetTrialVariableNames ( )
privatevirtual

Set trial variable names from subset of coupled variables that have an associated test variable.

Reimplemented in Moose::MFEM::TimeDependentEquationSystem.

Definition at line 54 of file EquationSystem.C.

Referenced by Init().

55 {
56  // If a coupled variable has an equation associated with it,
57  // add it to the set of trial variables.
58  for (const auto & coupled_var_name : _coupled_var_names)
59  {
60  if (VectorContainsName(_test_var_names, coupled_var_name))
61  _trial_var_names.push_back(coupled_var_name);
62  else
63  _eliminated_var_names.push_back(coupled_var_name);
64  }
65 }
bool VectorContainsName(const std::vector< std::string > &the_vector, const std::string &name) const
std::vector< std::string > _eliminated_var_names
Names of all coupled variables without a corresponding test variable.
std::vector< std::string > _trial_var_names
Subset of _coupled_var_names of all variables corresponding to gridfunctions with degrees of freedom ...
std::vector< std::string > _test_var_names
Names of all test variables corresponding to linear forms in this equation system.
std::vector< std::string > _coupled_var_names
Names of all trial variables of kernels and boundary conditions added to this EquationSystem.

◆ TestVarNames()

const std::vector<std::string>& Moose::MFEM::EquationSystem::TestVarNames ( ) const
inline

Definition at line 92 of file EquationSystem.h.

Referenced by Moose::MFEM::EquationSystemProblemOperator::SetGridFunctions(), and Moose::MFEM::TimeDomainEquationSystemProblemOperator::SetGridFunctions().

92 { return _test_var_names; }
std::vector< std::string > _test_var_names
Names of all test variables corresponding to linear forms in this equation system.

◆ TrialVarNames()

const std::vector<std::string>& Moose::MFEM::EquationSystem::TrialVarNames ( ) const
inline

Definition at line 91 of file EquationSystem.h.

Referenced by Moose::MFEM::EquationSystemProblemOperator::SetGridFunctions(), and Moose::MFEM::TimeDomainEquationSystemProblemOperator::SetGridFunctions().

91 { return _trial_var_names; }
std::vector< std::string > _trial_var_names
Subset of _coupled_var_names of all variables corresponding to gridfunctions with degrees of freedom ...

◆ VectorContainsName()

bool Moose::MFEM::EquationSystem::VectorContainsName ( const std::vector< std::string > &  the_vector,
const std::string &  name 
) const
protected

Definition at line 30 of file EquationSystem.C.

Referenced by AddCoupledVariableNameIfMissing(), AddTestVariableNameIfMissing(), SetTrialVariableNames(), and Moose::MFEM::TimeDependentEquationSystem::SetTrialVariableNames().

32 {
33 
34  auto iter = std::find(the_vector.begin(), the_vector.end(), name);
35 
36  return (iter != the_vector.end());
37 }
std::string name(const ElemQuality q)

Friends And Related Function Documentation

◆ EquationSystemProblemOperator

friend class EquationSystemProblemOperator
friend

Definition at line 34 of file EquationSystem.h.

◆ TimeDomainEquationSystemProblemOperator

Definition at line 35 of file EquationSystem.h.

Member Data Documentation

◆ _assembly_level

mfem::AssemblyLevel Moose::MFEM::EquationSystem::_assembly_level
protected

◆ _blfs

Moose::MFEM::NamedFieldsMap<mfem::ParBilinearForm> Moose::MFEM::EquationSystem::_blfs
protected

◆ _coupled_pfespaces

std::vector<mfem::ParFiniteElementSpace *> Moose::MFEM::EquationSystem::_coupled_pfespaces
protected

Pointers to finite element spaces associated with coupled variables.

Definition at line 129 of file EquationSystem.h.

Referenced by BuildMixedBilinearForms(), and Init().

◆ _coupled_var_names

std::vector<std::string> Moose::MFEM::EquationSystem::_coupled_var_names
protected

Names of all trial variables of kernels and boundary conditions added to this EquationSystem.

Definition at line 115 of file EquationSystem.h.

Referenced by AddCoupledVariableNameIfMissing(), BuildMixedBilinearForms(), Init(), SetTrialVariableNames(), and Moose::MFEM::TimeDependentEquationSystem::SetTrialVariableNames().

◆ _eliminated_var_names

std::vector<std::string> Moose::MFEM::EquationSystem::_eliminated_var_names
protected

Names of all coupled variables without a corresponding test variable.

Definition at line 121 of file EquationSystem.h.

Referenced by EliminateCoupledVariables(), Init(), SetTrialVariableNames(), and Moose::MFEM::TimeDependentEquationSystem::SetTrialVariableNames().

◆ _eliminated_variables

Moose::MFEM::GridFunctions Moose::MFEM::EquationSystem::_eliminated_variables
protected

◆ _ess_tdof_lists

std::vector<mfem::Array<int> > Moose::MFEM::EquationSystem::_ess_tdof_lists

◆ _essential_bc_map

Moose::MFEM::NamedFieldsMap<std::vector<std::shared_ptr<MFEMEssentialBC> > > Moose::MFEM::EquationSystem::_essential_bc_map
protected

Arrays to store essential BCs to act on each component of weak form.

Named according to test variable.

Definition at line 188 of file EquationSystem.h.

Referenced by AddEssentialBC(), and ApplyEssentialBCs().

◆ _h_blocks

mfem::Array2D<const mfem::HypreParMatrix *> Moose::MFEM::EquationSystem::_h_blocks
protected

◆ _integrated_bc_map

Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap<std::vector<std::shared_ptr<MFEMIntegratedBC> > > > Moose::MFEM::EquationSystem::_integrated_bc_map
protected

Arrays to store integrated BCs to act on each component of weak form.

Named according to test and trial variables.

Definition at line 185 of file EquationSystem.h.

Referenced by AddIntegratedBC(), BuildBilinearForms(), Moose::MFEM::TimeDependentEquationSystem::BuildBilinearForms(), and BuildLinearForms().

◆ _jacobian

mfem::OperatorHandle Moose::MFEM::EquationSystem::_jacobian
mutableprotected

Definition at line 190 of file EquationSystem.h.

Referenced by BuildJacobian(), GetGradient(), and Mult().

◆ _kernels_map

Moose::MFEM::NamedFieldsMap<Moose::MFEM::NamedFieldsMap<std::vector<std::shared_ptr<MFEMKernel> > > > Moose::MFEM::EquationSystem::_kernels_map
protected

Arrays to store kernels to act on each component of weak form.

Named according to test and trial variables.

Definition at line 180 of file EquationSystem.h.

Referenced by AddKernel(), BuildBilinearForms(), BuildLinearForms(), and BuildMixedBilinearForms().

◆ _lfs

Moose::MFEM::NamedFieldsMap<mfem::ParLinearForm> Moose::MFEM::EquationSystem::_lfs
protected

◆ _mblfs

Moose::MFEM::NamedFieldsMap<Moose::MFEM::NamedFieldsMap<mfem::ParMixedBilinearForm> > Moose::MFEM::EquationSystem::_mblfs
protected

◆ _nlfs

Moose::MFEM::NamedFieldsMap<mfem::ParNonlinearForm> Moose::MFEM::EquationSystem::_nlfs
protected

Definition at line 134 of file EquationSystem.h.

◆ _test_pfespaces

std::vector<mfem::ParFiniteElementSpace *> Moose::MFEM::EquationSystem::_test_pfespaces
protected

Pointers to finite element spaces associated with test variables.

Definition at line 127 of file EquationSystem.h.

Referenced by ApplyEssentialBCs(), BuildBilinearForms(), Moose::MFEM::TimeDependentEquationSystem::BuildBilinearForms(), BuildLinearForms(), BuildMixedBilinearForms(), FormLegacySystem(), and Init().

◆ _test_var_names

std::vector<std::string> Moose::MFEM::EquationSystem::_test_var_names
protected

◆ _trial_var_names

std::vector<std::string> Moose::MFEM::EquationSystem::_trial_var_names
protected

Subset of _coupled_var_names of all variables corresponding to gridfunctions with degrees of freedom that comprise the state vector of this EquationSystem.

This will differ from _coupled_var_names when time derivatives or other eliminated variables are present.

Definition at line 119 of file EquationSystem.h.

Referenced by FormLegacySystem(), FormLinearSystem(), RecoverFEMSolution(), SetTrialVariableNames(), Moose::MFEM::TimeDependentEquationSystem::SetTrialVariableNames(), and TrialVarNames().

◆ _var_ess_constraints

std::vector<std::unique_ptr<mfem::ParGridFunction> > Moose::MFEM::EquationSystem::_var_ess_constraints
protected

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