12#include "libmesh/libmesh_config.h"
14#ifdef LIBMESH_ENABLE_AMR
22#include "libmesh/parallel_object.h"
25#include "libmesh/mesh_refinement.h"
26#include "libmesh/hp_coarsentest.h"
27#include "libmesh/sibling_coupling.h"
76 void init(
const unsigned int steps,
77 const unsigned int initial_steps,
87 void setParam(
const std::string & param_name,
const T & param_value);
159 bool adaptMesh(std::string marker_name = std::string());
283 std::unique_ptr<libMesh::ErrorVector>
_error;
344 if (param_name ==
"refine fraction")
350 else if (param_name ==
"coarsen fraction")
356 else if (param_name ==
"max h-level")
362 else if (param_name ==
"cycles_per_step")
364 else if (param_name ==
"recompute_markers_during_cycles")
367 mooseError(
"Invalid Param in adaptivity object");
AdaptivityType
Defines types of mesh adaptivity options available.
MooseVariableFE< Real > MooseVariable
MooseVariableFE< libMesh::VectorValue< Real > > VectorMooseVariable
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Takes care of everything related to mesh adaptivity.
void init(const unsigned int steps, const unsigned int initial_steps, const AdaptivityType adaptivity_type)
Initialize and turn on adaptivity for the simulation.
std::unique_ptr< libMesh::SiblingCoupling > _sibling_coupling
Sibling coupling object for HP adaptivity for evaluating data on elements' siblings in HPCoarsenTest.
unsigned int _initial_steps
the number of adaptivity steps to do at the beginning of simulation
std::string _marker_variable_name
Name of the marker variable if using the new adaptivity system.
FEProblemBase & _fe_problem
libMesh::ErrorVector & getErrorVector(const std::string &indicator_field)
Get an ErrorVector that will be filled up with values corresponding to the indicator field name passe...
std::map< std::string, std::unique_ptr< libMesh::ErrorVector > > _indicator_field_to_error_vector
Stores pointers to ErrorVectors associated with indicator field names.
void setUseNewSystem()
Tells this object we're using the "new" adaptivity system.
bool _recompute_markers_during_cycles
Whether or not to recompute markers during adaptivity cycles.
Real _start_time
When adaptivity start.
unsigned int getMaxHLevel()
Return the maximum h-level.
unsigned int getCyclesPerStep() const
Pull out the number of cycles_per_step previously set through the AdaptivityAction.
void setTimeActive(Real start_time, Real stop_time)
Sets the time when the adaptivity is active.
void setParam(const std::string ¶m_name, const T ¶m_value)
Set adaptivity parameter.
void setInterval(unsigned int interval)
Set the interval (number of timesteps) between refinement steps.
std::unique_ptr< libMesh::ErrorVector > _error
Error vector for use with the error estimator.
bool _mesh_refinement_on
on/off flag reporting if the adaptivity is being used
Real _stop_time
When adaptivity stops.
unsigned int _max_h_level
The maximum number of refinement levels.
void setMarkerVariableName(std::string marker_field)
Sets the name of the field variable to actually use to flag elements for refinement / coarsening.
bool initialAdaptMesh()
Used during initial adaptivity.
void uniformRefineWithProjection()
Performs uniform refinement on the meshes in the current object.
void setCyclesPerStep(const unsigned int &num)
Set the number of cycles_per_step.
void setErrorNorm(libMesh::SystemNorm &sys_norm)
Set the error norm (FIXME: improve description)
void setAdaptivityOn(bool state)
Allow adaptivity to be toggled programatically.
bool _use_new_system
Whether or not to use the "new" adaptivity system.
std::unique_ptr< libMesh::MeshRefinement > _displaced_mesh_refinement
A mesh refinement object for displaced mesh.
static void uniformRefine(MooseMesh *mesh, unsigned int level=libMesh::invalid_uint)
Performs uniform refinement of the passed Mesh object.
void setPrintMeshChanged(bool state=true)
void setInitialMarkerVariableName(std::string marker_field)
Sets the name of the field variable to actually use to flag elements for initial refinement / coarsen...
std::unique_ptr< libMesh::ErrorEstimator > _error_estimator
Error estimator to be used by the apps.
void setRecomputeMarkersFlag(const bool flag)
Set the flag to recompute markers during adaptivity cycles.
std::unique_ptr< libMesh::MeshRefinement > _mesh_refinement
A mesh refinement object to be used either with initial refinement or with Adaptivity.
bool getRecomputeMarkersFlag() const
Pull out the _recompute_markers_during_cycles flag previously set through the AdaptivityAction.
unsigned int getSteps() const
Pull out the number of steps previously set by calling init()
AdaptivityType _adaptivity_type
Type of mesh adaptivity.
bool adaptMesh(std::string marker_name=std::string())
Adapts the mesh based on the error estimator used.
bool isAdaptivityDue()
Query if an adaptivity step should be performed at the current time / time step.
bool isOn()
Is adaptivity on?
std::shared_ptr< DisplacedProblem > _displaced_problem
unsigned int _cycles_per_step
The number of adaptivity cycles per step.
std::unique_ptr< libMesh::HPCoarsenTest > _hp_coarsen_test
Object for HP adaptivity.
void setErrorEstimator(const MooseEnum &error_estimator_name)
Set the error estimator.
void updateErrorVectors()
Update the ErrorVectors that have been requested through calls to getErrorVector().
bool _initialized
on/off flag reporting if the adaptivity system has been initialized
bool isInitialized()
Returns whether or not Adaptivity::init() has ran.
unsigned int getInitialSteps() const
Pull out the number of initial steps previously set by calling init()
unsigned int _steps
steps of adaptivity to perform
bool _print_mesh_changed
True if we want to print out info when mesh has changed.
unsigned int _interval
intreval between adaptivity runs
std::string _initial_marker_variable_name
Name of the initial marker variable if using the new adaptivity system.
void setMaxHLevel(unsigned int level)
Set the maximum refinement level (for the new Adaptivity system).
An inteface for the _console for outputting to the Console object.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Class for stuff related to variables.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
Interface for objects interacting with the PerfGraph.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const unsigned int invalid_uint