1 #ifdef MOOSE_MFEM_ENABLED 5 #include "libmesh/ignore_warnings.h" 6 #include "mfem/miniapps/common/pfem_extras.hpp" 7 #include "libmesh/restore_warnings.h" 28 mfem::AssemblyLevel assembly_level)
override;
31 virtual void Mult(
const mfem::Vector & x, mfem::Vector & y)
const override;
45 mfem::ParComplexGridFunction & trial_gf,
46 mfem::Array<int> & global_ess_markers);
62 mfem::BlockVector & trueX,
63 mfem::BlockVector & trueRHS)
override;
68 mfem::BlockVector & trueX,
69 mfem::BlockVector & trueRHS)
override;
75 template <
class FormType>
77 const std::string & trial_var_name,
78 const std::string & test_var_name,
79 std::shared_ptr<FormType> form,
85 const std::string & test_var_name,
86 std::shared_ptr<mfem::ParComplexLinearForm> form,
91 template <
class FormType>
93 const std::string & trial_var_name,
94 const std::string & test_var_name,
95 std::shared_ptr<FormType> form,
101 const std::string & test_var_name,
102 std::shared_ptr<mfem::ParComplexLinearForm> form,
132 template <
class FormType>
135 const std::string & trial_var_name,
136 const std::string & test_var_name,
137 std::shared_ptr<FormType> form,
140 if (kernels_map.Has(test_var_name) && kernels_map.Get(test_var_name)->Has(trial_var_name))
142 auto kernels = kernels_map.GetRef(test_var_name).GetRef(trial_var_name);
143 for (
auto & kernel : kernels)
145 mfem::BilinearFormIntegrator * integ_real = kernel->getRealBFIntegrator();
146 mfem::BilinearFormIntegrator * integ_imag = kernel->getImagBFIntegrator();
148 if (integ_real || integ_imag)
150 kernel->isSubdomainRestricted()
151 ? form->AddDomainIntegrator(
152 std::move(integ_real), std::move(integ_imag), kernel->getSubdomainMarkers())
153 : form->AddDomainIntegrator(std::move(integ_real), std::move(integ_imag));
161 const std::string & test_var_name,
162 std::shared_ptr<mfem::ParComplexLinearForm> form,
165 if (kernels_map.Has(test_var_name))
167 auto kernels = kernels_map.GetRef(test_var_name).GetRef(test_var_name);
168 for (
auto & kernel : kernels)
170 mfem::LinearFormIntegrator * integ_real = kernel->getRealLFIntegrator();
171 mfem::LinearFormIntegrator * integ_imag = kernel->getImagLFIntegrator();
173 if (integ_real || integ_imag)
175 kernel->isSubdomainRestricted()
176 ? form->AddDomainIntegrator(
177 std::move(integ_real), std::move(integ_imag), kernel->getSubdomainMarkers())
178 : form->AddDomainIntegrator(std::move(integ_real), std::move(integ_imag));
184 template <
class FormType>
187 const std::string & trial_var_name,
188 const std::string & test_var_name,
189 std::shared_ptr<FormType> form,
193 if (integrated_bc_map.Has(test_var_name) &&
194 integrated_bc_map.Get(test_var_name)->Has(trial_var_name))
196 auto bcs = integrated_bc_map.GetRef(test_var_name).GetRef(trial_var_name);
197 for (
auto & bc : bcs)
199 mfem::BilinearFormIntegrator * integ_real = bc->getRealBFIntegrator();
200 mfem::BilinearFormIntegrator * integ_imag = bc->getImagBFIntegrator();
202 if (integ_real || integ_imag)
204 bc->isBoundaryRestricted()
205 ? form->AddBoundaryIntegrator(
206 std::move(integ_real), std::move(integ_imag), bc->getBoundaryMarkers())
207 : form->AddBoundaryIntegrator(std::move(integ_real), std::move(integ_imag));
215 const std::string & test_var_name,
216 std::shared_ptr<mfem::ParComplexLinearForm> form,
220 if (integrated_bc_map.Has(test_var_name))
222 auto bcs = integrated_bc_map.GetRef(test_var_name).GetRef(test_var_name);
223 for (
auto & bc : bcs)
225 mfem::LinearFormIntegrator * integ_real = bc->getRealLFIntegrator();
226 mfem::LinearFormIntegrator * integ_imag = bc->getImagLFIntegrator();
228 if (integ_real || integ_imag)
230 bc->isBoundaryRestricted()
231 ? form->AddBoundaryIntegrator(
232 std::move(integ_real), std::move(integ_imag), bc->getBoundaryMarkers())
233 : form->AddBoundaryIntegrator(std::move(integ_real), std::move(integ_imag));
void ApplyDomainBLFIntegrators(const std::string &trial_var_name, const std::string &test_var_name, std::shared_ptr< FormType > form, NamedFieldsMap< NamedFieldsMap< std::vector< std::shared_ptr< MFEMComplexKernel >>>> &kernels_map)
Template method for applying BilinearFormIntegrators on domains from kernels to a SesquilinearForm...
virtual void Mult(const mfem::Vector &x, mfem::Vector &y) const override
Nonlinear Mult (Used by Newton-solver not necessarily nonlinear)
virtual void SetTrialVariablesFromTrueVectors(const mfem::BlockVector &trueX) const override
Update variable from solution vector after solve.
std::vector< std::unique_ptr< mfem::ParComplexGridFunction > > _cmplx_var_ess_constraints
Complex Gridfunctions holding essential constraints from Dirichlet BCs.
virtual void BuildLinearForms() override
Build linear forms and eliminate constrained DoFs.
~ComplexEquationSystem()=default
NamedFieldsMap< mfem::ParComplexLinearForm > _clfs
virtual void FormSystemOperator(mfem::OperatorHandle &op, mfem::BlockVector &trueX, mfem::BlockVector &trueRHS) override
Form matrix-free representation of system operator.
ComplexGridFunctions _cmplx_eliminated_variables
Pointers to coupled variables not part of the reduced EquationSystem.
Owns the weak-form mathematics of a MOOSE MFEM problem.
virtual void ApplyComplexEssentialBC(const std::string &var_name, mfem::ParComplexGridFunction &trial_gf, mfem::Array< int > &global_ess_markers)
Apply essential BC(s) associated with var_name to set true DoFs of trial_gf and update markers of all...
void AddComplexEssentialBCs(std::shared_ptr< MFEMComplexEssentialBC > bc)
Add complex essential BCs.
virtual void ApplyEssentialBCs() override
Update all essentially constrained true DoF markers and values on boundaries.
NamedFieldsMap< std::vector< std::shared_ptr< MFEMComplexEssentialBC > > > _cmplx_essential_bc_map
virtual void BuildEquationSystem() override
Build all forms comprising this EquationSystem.
virtual void FormSystemMatrix(mfem::OperatorHandle &op, mfem::BlockVector &trueX, mfem::BlockVector &trueRHS) override
Form matrix representation of system operator as a HypreParMatrix.
NamedFieldsMap< NamedFieldsMap< std::vector< std::shared_ptr< MFEMComplexKernel > > > > _cmplx_kernels_map
void ApplyDomainLFIntegrators(const std::string &test_var_name, std::shared_ptr< mfem::ParComplexLinearForm > form, NamedFieldsMap< NamedFieldsMap< std::vector< std::shared_ptr< MFEMComplexKernel >>>> &kernels_map)
Method for applying LinearFormIntegrators on domains from kernels to a ParComplexLinearForm.
virtual void BuildBilinearForms() override
Build bilinear forms (diagonal Jacobian contributions)
void ApplyBoundaryBLFIntegrators(const std::string &trial_var_name, const std::string &test_var_name, std::shared_ptr< FormType > form, NamedFieldsMap< NamedFieldsMap< std::vector< std::shared_ptr< MFEMComplexIntegratedBC >>>> &integrated_bc_map)
Template method for applying BilinearFormIntegrators on boudaries from kernels to a SesquilinearForm...
void AddComplexIntegratedBC(std::shared_ptr< MFEMComplexIntegratedBC > bc)
Add complex integrated BCs.
virtual void Init(GridFunctions &gridfunctions, ComplexGridFunctions &cmplx_gridfunctions, mfem::AssemblyLevel assembly_level) override
Initialise.
NamedFieldsMap< mfem::ParSesquilinearForm > _slfs
Moose::MFEM::ComplexGridFunctions * _complex_gfuncs
void ApplyBoundaryLFIntegrators(const std::string &test_var_name, std::shared_ptr< mfem::ParComplexLinearForm > form, NamedFieldsMap< NamedFieldsMap< std::vector< std::shared_ptr< MFEMComplexIntegratedBC >>>> &integrated_bc_map)
Method for applying LinearFormIntegrators on boundaries from kernels to a ParComplexLinearForm.
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).
NamedFieldsMap< NamedFieldsMap< std::vector< std::shared_ptr< MFEMComplexIntegratedBC > > > > _cmplx_integrated_bc_map
ComplexEquationSystem()=default
bool IsComplex() const override
void AddComplexKernel(std::shared_ptr< MFEMComplexKernel > kernel)
Add complex kernels.