10#ifdef MOOSE_MFEM_ENABLED
18 : _dt(1.0), _time_derivative_map(time_derivative_map)
31 const auto & trial_var_name =
33 const auto & test_var_name = kernel->getTestVariableName();
39 auto kernel_field_map =
40 std::make_shared<Moose::MFEM::NamedFieldsMap<std::vector<std::shared_ptr<MFEMKernel>>>>();
46 auto kernels = std::make_shared<std::vector<std::shared_ptr<MFEMKernel>>>();
64 ApplyBoundaryBLFIntegrators<mfem::ParBilinearForm>(
66 ApplyDomainBLFIntegrators<mfem::ParBilinearForm>(
69 ApplyDomainBLFIntegrators<mfem::ParBilinearForm>(
79 ApplyDomainBLFIntegrators<mfem::ParBilinearForm>(
98 auto test_mblfs = std::make_shared<Moose::MFEM::NamedFieldsMap<mfem::ParMixedBilinearForm>>();
105 if (test_var_name != coupled_var_name)
108 ApplyBoundaryBLFIntegrators<mfem::ParMixedBilinearForm>(
110 ApplyDomainBLFIntegrators<mfem::ParMixedBilinearForm>(
113 ApplyDomainBLFIntegrators<mfem::ParMixedBilinearForm>(
115 if (mblf->GetDBFI()->Size() || mblf->GetBBFI()->Size())
122 test_mblfs->Register(coupled_var_name, mblf);
127 _mblfs.Register(test_var_name, test_mblfs);
138 std::make_shared<Moose::MFEM::NamedFieldsMap<mfem::ParMixedBilinearForm>>();
142 auto td_mblf = std::make_shared<mfem::ParMixedBilinearForm>(
_test_pfespaces.at(j),
145 if (test_var_name != trial_var_name)
148 ApplyDomainBLFIntegrators<mfem::ParMixedBilinearForm>(
151 if (td_mblf->GetDBFI()->Size() || td_mblf->GetBBFI()->Size())
157 test_td_mblfs->Register(trial_var_name, td_mblf);
189 if (eliminated_var_name == test_var_name)
193 mfem::Vector lf_prev(lf.Size());
201 auto & td_mblf = *
_td_mblfs.
Get(test_var_name)->Get(eliminated_var_name);
virtual void AddTestVariableNameIfMissing(const std::string &test_var_name)
Add test variable to EquationSystem.
std::vector< std::string > _coupled_var_names
Names of all trial variables of kernels and boundary conditions added to this EquationSystem.
std::vector< mfem::ParFiniteElementSpace * > _test_pfespaces
Pointers to finite element spaces associated with test variables.
NamedFieldsMap< NamedFieldsMap< std::vector< std::shared_ptr< MFEMKernel > > > > _kernels_map
Arrays to store kernels to act on each component of weak form.
std::vector< mfem::ParFiniteElementSpace * > _coupled_pfespaces
Pointers to finite element spaces associated with coupled variables.
void ApplyDomainNLFIntegrators(const std::string &test_var_name, std::shared_ptr< mfem::ParNonlinearForm > form, NamedFieldsMap< NamedFieldsMap< std::vector< std::shared_ptr< MFEMKernel > > > > &kernels_map, std::optional< mfem::real_t > scale_factor=std::nullopt)
Apply domain NonlinearFormIntegrators from kernels to the nonlinear form associated with the supplied...
virtual void EliminateCoupledVariables()
Perform trivial eliminations of coupled variables lacking corresponding test variables.
std::vector< std::string > _test_var_names
Names of all test variables corresponding to linear forms in this equation system.
void ApplyBoundaryNLFIntegrators(const std::string &test_var_name, std::shared_ptr< mfem::ParNonlinearForm > form, NamedFieldsMap< NamedFieldsMap< std::vector< std::shared_ptr< MFEMIntegratedBC > > > > &integrated_bc_map, std::optional< mfem::real_t > scale_factor=std::nullopt)
Apply boundary NonlinearFormIntegrators from integrated boundary conditions to the nonlinear form ass...
NamedFieldsMap< mfem::ParLinearForm > _lfs
mfem::AssemblyLevel _assembly_level
virtual void AddKernel(std::shared_ptr< MFEMKernel > kernel)
Add kernels.
std::vector< mfem::Array< int > > _ess_tdof_lists
NamedFieldsMap< mfem::ParBilinearForm > _blfs
std::vector< std::string > _trial_var_names
Subset of _coupled_var_names of all variables corresponding to gridfunctions with degrees of freedom ...
NamedFieldsMap< NamedFieldsMap< mfem::ParMixedBilinearForm > > _mblfs
virtual void AddEliminatedVariableNameIfMissing(const std::string &eliminated_var_name)
Add eliminated variable to EquationSystem.
NamedFieldsMap< mfem::ParNonlinearForm > _nlfs
Moose::MFEM::GridFunctions _eliminated_variables
Pointers to coupled variables not part of the reduced EquationSystem.
std::vector< std::string > _eliminated_var_names
Names of all coupled variables without a corresponding test variable.
NamedFieldsMap< NamedFieldsMap< std::vector< std::shared_ptr< MFEMIntegratedBC > > > > _integrated_bc_map
Arrays to store integrated 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.
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.
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.
T & GetRef(const std::string &field_name) const
Returns a reference to a field.
const Moose::MFEM::TimeDerivativeMap & _time_derivative_map
Map between variable names and their time derivatives.
virtual void BuildBilinearForms() override
Build bilinear forms (diagonal Jacobian contributions)
Moose::MFEM::NamedFieldsMap< mfem::ParBilinearForm > _td_blfs
Containers to store contributions to weak form of the form (F du/dt, v)
virtual void BuildMixedBilinearForms() override
Build mixed bilinear forms (off-diagonal Jacobian contributions)
virtual void EliminateCoupledVariables() override
Perform trivial eliminations of coupled variables lacking corresponding test variables.
mfem::real_t _dt
Timestep size.
virtual void BuildNonlinearForms() override
Build non-linear action forms.
virtual void AddKernel(std::shared_ptr< MFEMKernel > kernel) override
Add kernels.
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< mfem::ParMixedBilinearForm > > _td_mblfs
TimeDependentEquationSystem(const Moose::MFEM::TimeDerivativeMap &time_derivative_map)
Moose::MFEM::NamedFieldsMap< Moose::MFEM::NamedFieldsMap< std::vector< std::shared_ptr< MFEMKernel > > > > _td_kernels_map
Lightweight adaptor over a std::map relating names of GridFunctions with the name of their time deriv...
const std::string & getTimeIntegralName(const std::string &time_derivative_var_name) const
bool isTimeDerivative(const std::string &time_derivative_var_name) const
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).