17#include "libmesh/periodic_boundaries.h"
23 "delete_remote_elements_after_late_geometric_ghosting");
35 params.
addClassDescription(
"Perform operations on the mesh in preparation for a simulation.");
37 params.
addParam<std::vector<std::string>>(
39 "The variables corresponding to the x y z displacements of the mesh. If "
40 "this is provided then the displacements will be taken into account during "
41 "the computation. Creation of the displaced mesh can be suppressed even if "
42 "this is set by setting 'use_displaced_mesh = false'.");
46 "Create the displaced mesh if the 'displacements' "
47 "parameter is set. If this is 'false', a displaced mesh will not be created, "
48 "regardless of whether 'displacements' is set.");
59 mooseError(
"No mesh file was supplied and no generation block was provided");
71 if (
_mesh->isSplit() &&
_mesh->skipRefineWhenUseSplit())
88 TIME_SECTION(
"uniformRefine", 2,
"Uniformly Refining");
90 if (
_mesh->uniformRefineLevel())
92 if (!
_mesh->interiorLowerDBlocks().empty() || !
_mesh->boundaryLowerDBlocks().empty())
93 mooseError(
"HFEM does not support mesh uniform refinement currently.");
103 else if (
_current_task ==
"delete_remote_elements_after_late_geometric_ghosting")
105 TIME_SECTION(
"deleteRemoteElems", 2,
"Deleting Remote Elements");
109 mooseError(
"Our reference and displaced meshes are not in sync with respect to whether we "
110 "should delete remote elements.");
114 if (
_mesh->needsRemoteElemDeletion())
119 _mesh->deleteRemoteElements();
140 else if (
isParamValid(
"displacements") && getParam<bool>(
"use_displaced_mesh"))
142 TIME_SECTION(
"constructDisplacedMesh", 2,
"Constructing Displaced Mesh");
146 if (
const auto * pairs =
_mesh->getMesh().get_disjoint_neighbor_boundary_pairs();
147 pairs && !pairs->empty())
149 "A displaced mesh cannot be used with a mesh that has disjoint neighbor "
150 "boundary pairs, such as those created by BreakMeshByBlockGenerator. Set "
151 "'use_displaced_mesh = false' in the [Mesh] block and use the Lagrangian "
152 "solid mechanics kernels ('new_system = true'), or use the mortar-based "
153 "cohesive zone model, which does not rely on pairing elements through the "
154 "disjoint neighbor machinery.");
156 mooseAssert(
_mesh->prepared(),
"The reference mesh should already be fully prepared here");
160 const auto & displacements = getParam<std::vector<std::string>>(
"displacements");
161 if (displacements.size() <
_mesh->dimension())
162 mooseError(
"Number of displacements must be greater than or equal to the dimension of "
168 TIME_SECTION(
"completeSetupUndisplaced", 2,
"Setting Up Undisplaced Mesh");
registerMooseAction("MooseApp", SetupMeshCompleteAction, "prepare_mesh")
std::shared_ptr< MooseMesh > & _mesh
static InputParameters validParams()
MooseApp & _app
The MOOSE application this is associated with.
std::shared_ptr< MooseMesh > & _displaced_mesh
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
const std::string & _current_task
The current action (even though we have separate instances for each action)
static void uniformRefine(MooseMesh *mesh, unsigned int level=libMesh::invalid_uint)
Performs uniform refinement of the passed Mesh object.
bool isUltimateMaster() const
Whether or not this app is the ultimate master app.
bool getExodusFileRestart() const
Whether or not we need to use a separate Exodus reader to read the mesh BEFORE we create the mesh.
bool isRecovering() const
Whether or not this is a "recover" calculation.
const MooseMesh * masterDisplacedMesh() const
Returns a pointer to the master displaced mesh.
bool useMasterMesh() const
Returns whether to use the parent app mesh as the mesh for this app.
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 ...
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
virtual std::unique_ptr< MooseMesh > safeClone() const =0
A safer version of the clone() method that hands back an allocated object wrapped in a smart pointer.
static InputParameters validParams()
SetupMeshCompleteAction(const InputParameters ¶ms)
virtual void act() override
Method to add objects to the simulation or perform other setup tasks.