https://mooseframework.inl.gov
MFEMVariable.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #ifdef MOOSE_MFEM_ENABLED
11 
12 #pragma once
13 
14 #include "MFEMObject.h"
15 
19 class MFEMVariable : public MFEMObject
20 {
21 public:
23 
25 
27  std::shared_ptr<mfem::ParGridFunction> getGridFunction() const { return _gridfunction; }
28 
30  const VariableName & getTimeDerivativeName() const { return _time_derivative_name; }
31 
33  void declareCoefficients();
34 
35 protected:
37  std::shared_ptr<mfem::ParFiniteElementSpace> _par_fespace;
38  bool _is_scalar = false;
39 
40 private:
42  const std::shared_ptr<mfem::ParGridFunction> buildGridFunction();
43 
45  std::shared_ptr<mfem::ParGridFunction> _gridfunction = nullptr;
46 
48  const VariableName _time_derivative_name;
49 };
50 
51 #endif
Thin base for MFEM objects backed directly by MooseObject instead of UserObject.
Definition: MFEMObject.h:25
const VariableName & getTimeDerivativeName() const
Returns the variable name corresponding to the time derivative of the MFEMVariable.
Definition: MFEMVariable.h:30
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Constructs and stores an mfem::ParGridFunction object.
Definition: MFEMVariable.h:19
const VariableName _time_derivative_name
Optional name of the time derivative to associate with this variable in transient problems...
Definition: MFEMVariable.h:48
MFEMVariable(const InputParameters &parameters)
Definition: MFEMVariable.C:44
const std::shared_ptr< mfem::ParGridFunction > buildGridFunction()
Constructs the gridfunction.
Definition: MFEMVariable.C:82
std::shared_ptr< mfem::ParFiniteElementSpace > _par_fespace
The underlying MFEM FESpace - always populated regardless of which parameter was used.
Definition: MFEMVariable.h:37
std::shared_ptr< mfem::ParGridFunction > getGridFunction() const
Returns a shared pointer to the constructed gridfunction.
Definition: MFEMVariable.h:27
static InputParameters validParams()
Definition: MFEMVariable.C:22
void declareCoefficients()
Declare default coefficients associated with this gridfunction.
Definition: MFEMVariable.C:88
std::shared_ptr< mfem::ParGridFunction > _gridfunction
Stores the constructed gridfunction.
Definition: MFEMVariable.h:45