10 #ifdef MOOSE_MFEM_ENABLED 26 params.
addParam<MFEMFESpaceName>(
"fespace",
27 "The finite element space this variable is defined on.");
30 "Name of a MFEMFESpaceHierarchy the variable lives on its finest level. " 31 "Mutually exclusive with 'fespace'.");
34 params.addClassDescription(
35 "Class for adding MFEM variables to the problem (`mfem::ParGridFunction`s).");
36 params.registerBase(
"MooseVariableBase");
37 params.registerSystemAttributeName(
"MooseVariableBase");
38 params.addParam<VariableName>(
40 "Optional name to assign to the time derivative of the variable in transient problems.");
46 _time_derivative_name(
47 isParamValid(
"time_derivative")
48 ? getParam<VariableName>(
"time_derivative")
50 getMFEMProblem().getProblemData().time_derivative_map.createTimeDerivativeName(
56 if (has_fespace && has_hierarchy)
57 paramError(
"fespace_hierarchy",
"Cannot specify both 'fespace' and 'fespace_hierarchy'.");
58 if (!has_fespace && !has_hierarchy)
59 paramError(
"fespace",
"Either 'fespace' or 'fespace_hierarchy' must be provided.");
64 "MFEMFESpace", getParam<MFEMFESpaceName>(
"fespace"));
70 const auto & hierarchy_name = getParam<std::string>(
"fespace_hierarchy");
72 "MFEMFESpaceHierarchy", hierarchy_name);
81 const std::shared_ptr<mfem::ParGridFunction>
84 return std::make_shared<mfem::ParGridFunction>(
_par_fespace.get());
90 const int cont_type =
_par_fespace->FEColl()->GetContType();
96 if (cont_type == mfem::FiniteElementCollection::CONTINUOUS)
101 name() +
"_grad_mag",
112 if (cont_type == mfem::FiniteElementCollection::TANGENTIAL ||
113 cont_type == mfem::FiniteElementCollection::CONTINUOUS)
118 name() +
"_curl_mag",
122 if (cont_type == mfem::FiniteElementCollection::NORMAL ||
123 cont_type == mfem::FiniteElementCollection::CONTINUOUS)
static InputParameters validParams()
std::string name(const ElemQuality q)
Thin base for MFEM objects backed directly by MooseObject instead of UserObject.
MFEMProblem & getMFEMProblem()
Return the owning MFEM problem.
MFEMProblemData & getProblemData()
Method to get the current MFEMProblemData object storing the current data specifying the FE problem...
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
mfem::VectorCoefficient & getVectorCoefficient(const std::string &name)
Return a vector coefficient with the given name or, if that doesn't exists, try interpreting the name...
T & getMFEMObject(const std::string &system, const std::string &name, const THREAD_ID tid=0) const
Retrieve an MFEM object from the warehouse by system and name.
registerMooseObject("MooseApp", MFEMVariable)
Moose::MFEM::FESpaces fespaces
Constructs and stores an mfem::ParGridFunction object.
MFEMVariable(const InputParameters ¶meters)
const std::string & name() const
Get the name of the class.
mfem::Coefficient & declareScalar(const std::string &name, const std::string &existing_or_literal)
Declare an alias to an existing scalar coefficient or, if it does not exist, try interpreting the nam...
mfem::VectorCoefficient & declareVector(const std::string &name, const std::string &existing_or_literal)
Declare an alias to an existing vector coefficientor or, if it does not exist, try interpreting the n...
Builds and owns a mfem::ParFiniteElementSpaceHierarchy from a base FESpace by applying a sequence of ...
Moose::MFEM::CoefficientManager & getCoefficients()
Method to get the PropertyManager object for storing material properties and converting them to MFEM ...
const std::shared_ptr< mfem::ParGridFunction > buildGridFunction()
Constructs the gridfunction.
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::shared_ptr< mfem::ParFiniteElementSpace > _par_fespace
The underlying MFEM FESpace - always populated regardless of which parameter was used.
std::shared_ptr< mfem::ParGridFunction > getGridFunction() const
Returns a shared pointer to the constructed gridfunction.
Constructs and stores an mfem::ParFiniteElementSpace object.
static InputParameters validParams()
Declare the common parameters required by MFEM MooseObject-backed classes.
static InputParameters validParams()
void declareCoefficients()
Declare default coefficients associated with this gridfunction.
bool isParamSetByUser(const std::string &name) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
std::shared_ptr< mfem::ParGridFunction > _gridfunction
Stores the constructed gridfunction.
Scalar coefficient that evaluates the magnitude of a vector coefficient.