Takes care of everything related to mesh adaptivity. More...
#include <Adaptivity.h>
Public Member Functions | |
Adaptivity (FEProblemBase &fe_problem) | |
virtual | ~Adaptivity () |
void | init (unsigned int steps, unsigned int initial_steps) |
Initialize and turn on adaptivity for the simulation. More... | |
template<typename T > | |
void | setParam (const std::string ¶m_name, const T ¶m_value) |
Set adaptivity parameter. More... | |
void | setErrorEstimator (const MooseEnum &error_estimator_name) |
Set the error estimator. More... | |
void | setErrorNorm (SystemNorm &sys_norm) |
Set the error norm (FIXME: improve description) More... | |
void | setPrintMeshChanged (bool state=true) |
unsigned int | getInitialSteps () const |
Pull out the number of initial steps previously set by calling init() More... | |
unsigned int | getSteps () const |
Pull out the number of steps previously set by calling init() More... | |
unsigned int | getCyclesPerStep () const |
Pull out the number of cycles_per_step previously set through the AdaptivityAction. More... | |
void | setCyclesPerStep (const unsigned int &num) |
Set the number of cycles_per_step. More... | |
bool | getRecomputeMarkersFlag () const |
Pull out the _recompute_markers_during_cycles flag previously set through the AdaptivityAction. More... | |
void | setRecomputeMarkersFlag (const bool flag) |
Set the flag to recompute markers during adaptivity cycles. More... | |
void | doingPRefinement (bool doing_p_refinement, const MultiMooseEnum &disable_p_refinement_for_families) |
Indicate whether the kind of adaptivity we're doing is p-refinement. More... | |
bool | adaptMesh (std::string marker_name=std::string()) |
Adapts the mesh based on the error estimator used. More... | |
bool | initialAdaptMesh () |
Used during initial adaptivity. More... | |
void | uniformRefineWithProjection () |
Performs uniform refinement on the meshes in the current object. More... | |
void | setAdaptivityOn (bool state) |
Allow adaptivity to be toggled programatically. More... | |
bool | isOn () |
Is adaptivity on? More... | |
bool | isInitialized () |
Returns whether or not Adaptivity::init() has ran. More... | |
void | setTimeActive (Real start_time, Real stop_time) |
Sets the time when the adaptivity is active. More... | |
void | setUseNewSystem () |
Tells this object we're using the "new" adaptivity system. More... | |
void | setMarkerVariableName (std::string marker_field) |
Sets the name of the field variable to actually use to flag elements for refinement / coarsening. More... | |
void | setInitialMarkerVariableName (std::string marker_field) |
Sets the name of the field variable to actually use to flag elements for initial refinement / coarsening. More... | |
void | setMaxHLevel (unsigned int level) |
Set the maximum refinement level (for the new Adaptivity system). More... | |
unsigned int | getMaxHLevel () |
Return the maximum h-level. More... | |
void | setInterval (unsigned int interval) |
Set the interval (number of timesteps) between refinement steps. More... | |
ErrorVector & | getErrorVector (const std::string &indicator_field) |
Get an ErrorVector that will be filled up with values corresponding to the indicator field name passed in. More... | |
void | updateErrorVectors () |
Update the ErrorVectors that have been requested through calls to getErrorVector(). More... | |
bool | isAdaptivityDue () |
Query if an adaptivity step should be performed at the current time / time step. More... | |
PerfGraph & | perfGraph () |
Get the PerfGraph. More... | |
const Parallel::Communicator & | comm () const |
processor_id_type | n_processors () const |
processor_id_type | processor_id () const |
Static Public Member Functions | |
static void | uniformRefine (MooseMesh *mesh, unsigned int level=libMesh::invalid_uint) |
Performs uniform refinement of the passed Mesh object. More... | |
static InputParameters | validParams () |
Public Attributes | |
const ConsoleStream | _console |
An instance of helper class to write streams to the Console objects. More... | |
Protected Member Functions | |
PerfID | registerTimedSection (const std::string §ion_name, const unsigned int level) const |
Call to register a named section for timing. More... | |
PerfID | registerTimedSection (const std::string §ion_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const |
Call to register a named section for timing. More... | |
std::string | timedSectionName (const std::string §ion_name) const |
Protected Attributes | |
FEProblemBase & | _fe_problem |
MooseMesh & | _mesh |
bool | _mesh_refinement_on |
on/off flag reporting if the adaptivity is being used More... | |
bool | _initialized |
on/off flag reporting if the adaptivity system has been initialized More... | |
std::unique_ptr< MeshRefinement > | _mesh_refinement |
A mesh refinement object to be used either with initial refinement or with Adaptivity. More... | |
std::unique_ptr< ErrorEstimator > | _error_estimator |
Error estimator to be used by the apps. More... | |
std::unique_ptr< ErrorVector > | _error |
Error vector for use with the error estimator. More... | |
std::shared_ptr< DisplacedProblem > | _displaced_problem |
std::unique_ptr< MeshRefinement > | _displaced_mesh_refinement |
A mesh refinement object for displaced mesh. More... | |
unsigned int | _initial_steps |
the number of adaptivity steps to do at the beginning of simulation More... | |
unsigned int | _steps |
steps of adaptivity to perform More... | |
bool | _print_mesh_changed |
True if we want to print out info when mesh has changed. More... | |
Real & | _t |
Time. More... | |
int & | _step |
Time Step. More... | |
unsigned int | _interval |
intreval between adaptivity runs More... | |
Real | _start_time |
When adaptivity start. More... | |
Real | _stop_time |
When adaptivity stops. More... | |
unsigned int | _cycles_per_step |
The number of adaptivity cycles per step. More... | |
bool | _use_new_system |
Whether or not to use the "new" adaptivity system. More... | |
std::string | _marker_variable_name |
Name of the marker variable if using the new adaptivity system. More... | |
std::string | _initial_marker_variable_name |
Name of the initial marker variable if using the new adaptivity system. More... | |
unsigned int | _max_h_level |
The maximum number of refinement levels. More... | |
bool | _recompute_markers_during_cycles |
Whether or not to recompute markers during adaptivity cycles. More... | |
std::map< std::string, std::unique_ptr< ErrorVector > > | _indicator_field_to_error_vector |
Stores pointers to ErrorVectors associated with indicator field names. More... | |
bool | _p_refinement_flag = false |
MooseApp & | _pg_moose_app |
The MooseApp that owns the PerfGraph. More... | |
const std::string | _prefix |
A prefix to use for all sections. More... | |
const Parallel::Communicator & | _communicator |
Takes care of everything related to mesh adaptivity.
Definition at line 49 of file Adaptivity.h.
Adaptivity::Adaptivity | ( | FEProblemBase & | fe_problem | ) |
Definition at line 31 of file Adaptivity.C.
|
virtual |
Definition at line 54 of file Adaptivity.C.
bool Adaptivity::adaptMesh | ( | std::string | marker_name = std::string() | ) |
Adapts the mesh based on the error estimator used.
Definition at line 123 of file Adaptivity.C.
Referenced by FEProblemBase::adaptMesh(), and initialAdaptMesh().
void Adaptivity::doingPRefinement | ( | bool | doing_p_refinement, |
const MultiMooseEnum & | disable_p_refinement_for_families | ||
) |
Indicate whether the kind of adaptivity we're doing is p-refinement.
doing_p_refinement | Whether we're doing p-refinement |
disable_p_refinement_for_families | Families to disable p-refinement for |
Definition at line 390 of file Adaptivity.C.
Referenced by AdaptivityAction::act(), and SetAdaptivityOptionsAction::act().
|
inline |
Pull out the number of cycles_per_step previously set through the AdaptivityAction.
Definition at line 111 of file Adaptivity.h.
Referenced by FEProblemBase::adaptMesh().
ErrorVector & Adaptivity::getErrorVector | ( | const std::string & | indicator_field | ) |
Get an ErrorVector that will be filled up with values corresponding to the indicator field name passed in.
Note that this returns a reference... and the return value should be stored as a reference!
indicator_field | The name of the field to get an ErrorVector for. |
Definition at line 354 of file Adaptivity.C.
Referenced by Marker::getErrorVector().
|
inline |
Pull out the number of initial steps previously set by calling init()
Definition at line 97 of file Adaptivity.h.
Referenced by FEProblemBase::hasInitialAdaptivity(), FEProblemBase::initialAdaptMesh(), and FEProblemBase::initialSetup().
|
inline |
Return the maximum h-level.
Definition at line 229 of file Adaptivity.h.
|
inline |
Pull out the _recompute_markers_during_cycles flag previously set through the AdaptivityAction.
Definition at line 124 of file Adaptivity.h.
Referenced by FEProblemBase::adaptMesh().
|
inline |
Pull out the number of steps previously set by calling init()
Definition at line 104 of file Adaptivity.h.
Referenced by Steady::execute(), and Eigenvalue::execute().
Initialize and turn on adaptivity for the simulation.
initial_steps specifies the number of adaptivity cycles to perform before the simulation starts and steps indicates the number of adaptivity cycles to run during a steady (not transient) solve. steps is not used for transient or eigen solves.
Definition at line 57 of file Adaptivity.C.
Referenced by AdaptivityAction::act(), and SetAdaptivityOptionsAction::act().
bool Adaptivity::initialAdaptMesh | ( | ) |
Used during initial adaptivity.
Definition at line 260 of file Adaptivity.C.
Referenced by FEProblemBase::initialAdaptMesh().
bool Adaptivity::isAdaptivityDue | ( | ) |
Query if an adaptivity step should be performed at the current time / time step.
Definition at line 384 of file Adaptivity.C.
Referenced by FEProblemBase::adaptMesh().
|
inline |
Returns whether or not Adaptivity::init() has ran.
Can be used to indicate if mesh adaptivity is available.
Definition at line 187 of file Adaptivity.h.
|
inline |
Is adaptivity on?
Definition at line 179 of file Adaptivity.h.
Referenced by FEProblemBase::addAnyRedistributers(), FEProblemBase::checkProblemIntegrity(), and FEProblemBase::initialSetup().
|
inherited |
Get the PerfGraph.
Definition at line 78 of file PerfGraphInterface.C.
Referenced by CommonOutputAction::act(), PerfGraphData::finalize(), and PerfGraphOutput::output().
|
protectedinherited |
Call to register a named section for timing.
section_name | The name of the code section to be timed |
level | The importance of the timer - lower is more important (0 will always come out) |
Definition at line 53 of file PerfGraphInterface.C.
|
protectedinherited |
Call to register a named section for timing.
section_name | The name of the code section to be timed |
level | The importance of the timer - lower is more important (0 will always come out) |
live_message | The message to be printed to the screen during execution |
print_dots | Whether or not progress dots should be printed for this section |
Definition at line 64 of file PerfGraphInterface.C.
void Adaptivity::setAdaptivityOn | ( | bool | state | ) |
Allow adaptivity to be toggled programatically.
state | The adaptivity state (on/off). |
Definition at line 319 of file Adaptivity.C.
Set the number of cycles_per_step.
num | The number of cycles per step to execute |
Definition at line 117 of file Adaptivity.h.
Referenced by SetAdaptivityOptionsAction::act().
Set the error estimator.
error_estimator_name | the name of the error estimator (currently: Laplacian, Kelly, and PatchRecovery) |
Definition at line 102 of file Adaptivity.C.
Referenced by AdaptivityAction::act().
void Adaptivity::setErrorNorm | ( | SystemNorm & | sys_norm | ) |
Set the error norm (FIXME: improve description)
Definition at line 116 of file Adaptivity.C.
Referenced by AdaptivityAction::act().
void Adaptivity::setInitialMarkerVariableName | ( | std::string | marker_field | ) |
Sets the name of the field variable to actually use to flag elements for initial refinement / coarsening.
This must be a CONSTANT, MONOMIAL Auxiliary Variable Name that contains values corresponding to libMesh::Elem::RefinementState.
marker_field | The name of the field to use for refinement / coarsening. |
Definition at line 348 of file Adaptivity.C.
Referenced by SetAdaptivityOptionsAction::act().
Set the interval (number of timesteps) between refinement steps.
Definition at line 234 of file Adaptivity.h.
Referenced by AdaptivityAction::act(), and SetAdaptivityOptionsAction::act().
void Adaptivity::setMarkerVariableName | ( | std::string | marker_field | ) |
Sets the name of the field variable to actually use to flag elements for refinement / coarsening.
This must be a CONSTANT, MONOMIAL Auxiliary Variable Name that contains values corresponding to libMesh::Elem::RefinementState.
marker_field | The name of the field to use for refinement / coarsening. |
Definition at line 342 of file Adaptivity.C.
Referenced by SetAdaptivityOptionsAction::act().
Set the maximum refinement level (for the new Adaptivity system).
Definition at line 224 of file Adaptivity.h.
Referenced by SetAdaptivityOptionsAction::act().
void Adaptivity::setParam | ( | const std::string & | param_name, |
const T & | param_value | ||
) |
Set adaptivity parameter.
param_name | the name of the parameter |
param_value | the value of parameter |
Definition at line 320 of file Adaptivity.h.
Referenced by AdaptivityAction::act().
|
inline |
Definition at line 90 of file Adaptivity.h.
Referenced by AdaptivityAction::act().
|
inline |
Set the flag to recompute markers during adaptivity cycles.
flag | The flag to recompute markers |
Definition at line 130 of file Adaptivity.h.
Referenced by SetAdaptivityOptionsAction::act().
Sets the time when the adaptivity is active.
start_time | The time when adaptivity starts |
stop_time | The time when adaptivity stops |
Definition at line 329 of file Adaptivity.C.
Referenced by AdaptivityAction::act(), and SetAdaptivityOptionsAction::act().
void Adaptivity::setUseNewSystem | ( | ) |
Tells this object we're using the "new" adaptivity system.
Definition at line 336 of file Adaptivity.C.
Referenced by SetAdaptivityOptionsAction::act().
|
protectedinherited |
section_name
.Optionally adds a prefix if one is defined.
Definition at line 47 of file PerfGraphInterface.C.
Referenced by PerfGraphInterface::registerTimedSection().
|
static |
Performs uniform refinement of the passed Mesh object.
The number of levels of refinement performed is stored in the MooseMesh object. No solution projection is performed in this version.
Definition at line 266 of file Adaptivity.C.
Referenced by SetupMeshCompleteAction::act(), and FEProblemBase::uniformRefine().
void Adaptivity::uniformRefineWithProjection | ( | ) |
Performs uniform refinement on the meshes in the current object.
Projections are performed of the solution vectors.
Definition at line 293 of file Adaptivity.C.
Referenced by FEProblemBase::initialSetup().
void Adaptivity::updateErrorVectors | ( | ) |
Update the ErrorVectors that have been requested through calls to getErrorVector().
Definition at line 363 of file Adaptivity.C.
Referenced by FEProblemBase::computeMarkers().
|
staticinherited |
Definition at line 16 of file PerfGraphInterface.C.
|
inherited |
An instance of helper class to write streams to the Console objects.
Definition at line 31 of file ConsoleStreamInterface.h.
Referenced by IterationAdaptiveDT::acceptStep(), MeshOnlyAction::act(), SetupDebugAction::act(), MaterialOutputAction::act(), adaptMesh(), FEProblemBase::adaptMesh(), PerfGraph::addToExecutionList(), SimplePredictor::apply(), SystemBase::applyScalingFactors(), MultiApp::backup(), FEProblemBase::backupMultiApps(), CoarsenedPiecewiseLinear::buildCoarsenedGrid(), MeshDiagnosticsGenerator::checkElementOverlap(), MeshDiagnosticsGenerator::checkElementTypes(), MeshDiagnosticsGenerator::checkElementVolumes(), FEProblemBase::checkExceptionAndStopSolve(), MeshDiagnosticsGenerator::checkLocalJacobians(), MeshDiagnosticsGenerator::checkNonConformalMesh(), MeshDiagnosticsGenerator::checkNonConformalMeshFromAdaptivity(), MeshDiagnosticsGenerator::checkNonPlanarSides(), FEProblemBase::checkProblemIntegrity(), ReferenceResidualProblem::checkRelativeConvergence(), MeshDiagnosticsGenerator::checkSidesetsOrientation(), IterationAdaptiveDT::computeAdaptiveDT(), Transient::computeConstrainedDT(), FixedPointSolve::computeCustomConvergencePostprocessor(), NonlinearSystemBase::computeDamping(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInitialDT(), IterationAdaptiveDT::computeInterpolationDT(), NonlinearSystemBase::computeScaling(), Problem::console(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), MultiApp::createApp(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MessageFromInput::execute(), Steady::execute(), Eigenvalue::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), ElementQualityChecker::finalize(), FEProblemBase::finishMultiAppStep(), MeshRepairGenerator::fixOverlappingNodes(), CoarsenBlockGenerator::generate(), MeshGenerator::generateInternal(), VariableCondensationPreconditioner::getDofToCondense(), InversePowerMethod::init(), NonlinearEigen::init(), FEProblemBase::initialAdaptMesh(), EigenExecutionerBase::inversePowerIteration(), FEProblemBase::joinAndFinalize(), Transient::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), FEProblemBase::logAdd(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), MooseBaseErrorInterface::mooseDeprecated(), MooseBaseErrorInterface::mooseInfo(), MooseBaseErrorInterface::mooseWarning(), MooseBaseErrorInterface::mooseWarningNonPrefixed(), ReferenceResidualProblem::nonlinearConvergenceSetup(), ReporterDebugOutput::output(), PerfGraphOutput::output(), MaterialPropertyDebugOutput::output(), DOFMapOutput::output(), VariableResidualNormsDebugOutput::output(), Console::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Console::outputInput(), Console::outputPostprocessors(), PseudoTimestep::outputPseudoTimestep(), Console::outputReporters(), Console::outputScalarVariables(), Console::outputSystemInformation(), FEProblemBase::possiblyRebuildGeomSearchPatches(), EigenExecutionerBase::postExecute(), AB2PredictorCorrector::postSolve(), ActionWarehouse::printActionDependencySets(), SolutionInvalidity::printDebug(), EigenExecutionerBase::printEigenvalue(), SecantSolve::printFixedPointConvergenceHistory(), SteffensenSolve::printFixedPointConvergenceHistory(), PicardSolve::printFixedPointConvergenceHistory(), FixedPointSolve::printFixedPointConvergenceReason(), PerfGraphLivePrint::printLiveMessage(), MaterialPropertyDebugOutput::printMaterialMap(), PerfGraphLivePrint::printStats(), AutomaticMortarGeneration::projectPrimaryNodesSinglePair(), AutomaticMortarGeneration::projectSecondaryNodesSinglePair(), CoarsenBlockGenerator::recursiveCoarsen(), SolutionTimeAdaptiveDT::rejectStep(), MultiApp::restore(), FEProblemBase::restoreMultiApps(), SimplePredictor::shouldApply(), Checkpoint::shouldOutput(), SubProblem::showFunctorRequestors(), SubProblem::showFunctors(), FullSolveMultiApp::showStatusMessage(), FEProblemSolve::solve(), FixedPointSolve::solve(), NonlinearSystem::solve(), EigenProblem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), LStableDirk4::solve(), AStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), FixedPointSolve::solveStep(), PerfGraphLivePrint::start(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), Transient::takeStep(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().
|
protected |
The number of adaptivity cycles per step.
Definition at line 295 of file Adaptivity.h.
Referenced by getCyclesPerStep(), setCyclesPerStep(), and setParam().
|
protected |
A mesh refinement object for displaced mesh.
Definition at line 274 of file Adaptivity.h.
Referenced by adaptMesh(), init(), and setParam().
|
protected |
Definition at line 271 of file Adaptivity.h.
Referenced by adaptMesh(), init(), and uniformRefineWithProjection().
|
protected |
Error vector for use with the error estimator.
Definition at line 269 of file Adaptivity.h.
Referenced by adaptMesh(), and init().
|
protected |
Error estimator to be used by the apps.
Definition at line 267 of file Adaptivity.h.
Referenced by adaptMesh(), setErrorEstimator(), and setErrorNorm().
|
protected |
Definition at line 257 of file Adaptivity.h.
Referenced by adaptMesh(), doingPRefinement(), init(), uniformRefineWithProjection(), and updateErrorVectors().
|
protected |
Stores pointers to ErrorVectors associated with indicator field names.
Definition at line 313 of file Adaptivity.h.
Referenced by getErrorVector(), and updateErrorVectors().
|
protected |
Name of the initial marker variable if using the new adaptivity system.
Definition at line 304 of file Adaptivity.h.
Referenced by initialAdaptMesh(), and setInitialMarkerVariableName().
|
protected |
the number of adaptivity steps to do at the beginning of simulation
Definition at line 277 of file Adaptivity.h.
Referenced by getInitialSteps(), and init().
|
protected |
on/off flag reporting if the adaptivity system has been initialized
Definition at line 263 of file Adaptivity.h.
Referenced by init(), isInitialized(), and setAdaptivityOn().
|
protected |
intreval between adaptivity runs
Definition at line 289 of file Adaptivity.h.
Referenced by isAdaptivityDue(), and setInterval().
|
protected |
Name of the marker variable if using the new adaptivity system.
Definition at line 301 of file Adaptivity.h.
Referenced by adaptMesh(), and setMarkerVariableName().
|
protected |
The maximum number of refinement levels.
Definition at line 307 of file Adaptivity.h.
Referenced by adaptMesh(), getMaxHLevel(), and setMaxHLevel().
|
protected |
Definition at line 258 of file Adaptivity.h.
Referenced by adaptMesh(), init(), uniformRefineWithProjection(), and updateErrorVectors().
|
protected |
A mesh refinement object to be used either with initial refinement or with Adaptivity.
Definition at line 265 of file Adaptivity.h.
Referenced by adaptMesh(), init(), and setParam().
|
protected |
on/off flag reporting if the adaptivity is being used
Definition at line 261 of file Adaptivity.h.
Referenced by init(), isAdaptivityDue(), isOn(), and setAdaptivityOn().
|
protected |
Definition at line 315 of file Adaptivity.h.
Referenced by adaptMesh(), and doingPRefinement().
|
protectedinherited |
The MooseApp that owns the PerfGraph.
Definition at line 124 of file PerfGraphInterface.h.
Referenced by PerfGraphInterface::perfGraph().
|
protectedinherited |
A prefix to use for all sections.
Definition at line 127 of file PerfGraphInterface.h.
Referenced by PerfGraphInterface::timedSectionName().
|
protected |
True if we want to print out info when mesh has changed.
Definition at line 282 of file Adaptivity.h.
Referenced by adaptMesh(), and setPrintMeshChanged().
|
protected |
Whether or not to recompute markers during adaptivity cycles.
Definition at line 310 of file Adaptivity.h.
Referenced by getRecomputeMarkersFlag(), setParam(), and setRecomputeMarkersFlag().
|
protected |
When adaptivity start.
Definition at line 291 of file Adaptivity.h.
Referenced by isAdaptivityDue(), and setTimeActive().
|
protected |
|
protected |
steps of adaptivity to perform
Definition at line 279 of file Adaptivity.h.
Referenced by getSteps(), and init().
|
protected |
When adaptivity stops.
Definition at line 293 of file Adaptivity.h.
Referenced by isAdaptivityDue(), and setTimeActive().
|
protected |
|
protected |
Whether or not to use the "new" adaptivity system.
Definition at line 298 of file Adaptivity.h.
Referenced by adaptMesh(), and setUseNewSystem().