10 #ifdef MOOSE_MFEM_ENABLED 27 "threshold>=0 & threshold<=1",
28 "Elements above this percentage of the max error will " 29 "be refined. Must be between 0 and 1!");
30 params.
addParam<
bool>(
"rebalance",
false,
"Whether to rebalance the mesh after h-refinement");
32 "max_h_level", 0,
"max_h_level>=0 & max_h_level<=10",
"Max number of h-refinement steps");
34 "max_p_level", 0,
"max_p_level>=0 & max_p_level<=10",
"Max number of p-refinement steps");
40 _estimator_name(getParam<
std::string>(
"indicator")),
41 _error_threshold(getParam<
Real>(
"threshold")),
42 _rebalance(getParam<bool>(
"rebalance")),
43 _max_h_level(getParam<unsigned>(
"max_h_level")),
44 _max_p_level(getParam<unsigned>(
"max_p_level"))
57 mooseWarning(
"Specified p-refinement on an unsupported FESpace or geometry. Only H1 and L2 " 58 "spaces on quad/hex meshes are supported by mfem. Disabling p-refinement.");
65 mooseWarning(
"At present, only either a) h-refinement or b) one level of p-refinement is " 66 "supported. Disabling p-refinement.");
74 mooseWarning(
"Asked for rebalancing as well as p-refinement, which is not supported.");
89 mfem::Array<mfem::Refinement> refinements;
96 mfem::Array<mfem::pRefinement> prefinements(refinements.Size());
97 for (
const auto i :
make_range(refinements.Size()))
98 prefinements[i] = mfem::pRefinement(refinements[i].index, 1);
Thin base for MFEM objects backed directly by MooseObject instead of UserObject.
std::shared_ptr< mfem::ErrorEstimator > getEstimator() const
Method to fetch the error estimator after creation.
const std::string & _estimator_name
The estimator/indicator's name.
MFEMProblem & getMFEMProblem()
Return the owning MFEM problem.
const unsigned _max_h_level
The max no. of times h-refinement can be performed.
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.
mfem::ParMesh & getParMesh() const
Get reference to the FE space's underlying mesh.
bool _rebalance
Whether to rebalance the mesh after h-refinement.
Class to construct threshold refiner.
mfem::ParFiniteElementSpace & getFESpace() const
Get reference to FE space using the name we store when setting up this class.
void mooseWarning(Args &&... args) const
void rebalanceMesh(mfem::ParMesh &pmesh)
Rebalance the (necessarily nonconforming) mesh.
bool pRefine()
Applies p-refinement wherever the refiner sees fit.
const unsigned _max_p_level
The max no. of times h-refinement can be performed.
registerMooseObject("MooseApp", MFEMRefinementMarker)
std::unique_ptr< mfem::ThresholdRefiner > _threshold_refiner
Unique pointer to underlying mfem::ThresholdRefiner object.
MFEMRefinementMarker(const InputParameters ¶ms)
unsigned _p_ref_counter
The no. of times p-refinement has been performed.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void updateGridFunctions()
Calls Update() on all gridfunctions.
static InputParameters validParams()
Declare the common parameters required by MFEM MooseObject-backed classes.
IntRange< T > make_range(T beg, T end)
bool hRefine()
Applies h-refinement wherever the refiner sees fit.
void updateFESpaces()
Calls Update() on all FE spaces.
static InputParameters validParams()
const MFEMIndicator * _estimator
Pointer to the estimator/indicator.
unsigned _h_ref_counter
The no. of times h-refinement has been performed.
const mfem::real_t _error_threshold
The error threshold determining which elements to refine.
void initialSetup()
Constructs associated mfem::ThresholdRefiner once mfem::ErrorEstimator is guaranteed to exist...