Skip to content

Commit

Permalink
Added a parameter to allow uniform refinements when using a pre-split…
Browse files Browse the repository at this point in the history
… mesh

Closes idaholab#18575
  • Loading branch information
fdkong committed Aug 18, 2021
1 parent 5fa5c83 commit bbcf186
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
8 changes: 8 additions & 0 deletions framework/include/mesh/MooseMesh.h
Expand Up @@ -488,6 +488,11 @@ class MooseMesh : public MooseObject, public Restartable, public PerfGraphInterf
*/
void setUniformRefineLevel(unsigned int);

/**
* Whether or not allow uniform refinements when using a pre-split mesh
*/
bool allowUniformRefineWhenUseSplit() const { return _allow_uniform_refine_when_use_split; }

/**
* This will add the boundary ids to be ghosted to this processor
*/
Expand Down Expand Up @@ -1122,6 +1127,9 @@ class MooseMesh : public MooseObject, public Restartable, public PerfGraphInterf
/// The level of uniform refinement requested (set to zero if AMR is disabled)
unsigned int _uniform_refine_level;

/// Whether or not to allow uniform refinements when using a pre-split mesh
bool _allow_uniform_refine_when_use_split;

/// true if mesh is changed (i.e. after adaptivity step)
bool _is_changed;

Expand Down
10 changes: 8 additions & 2 deletions framework/src/actions/SetupMeshCompleteAction.C
Expand Up @@ -49,8 +49,14 @@ SetupMeshCompleteAction::act()
{
// we don't need to run mesh modifiers *again* after they ran already during the mesh
// splitting process
//if (_app.isUseSplit())
// return;
// A uniform refinement is helpful for some instances when using a pre-split mesh.
// For example, a 'coarse' mesh might completely resolve geometry (also is large)
// but does not have enough resolution for the interior. For this scenario,
// we pre-split the coarse mesh, and load the pre-split mesh in parallel,
// and then do a few levels of uniform refinements to have a fine mesh that
// potentially resolves physics features.
if (_app.isUseSplit() && !_mesh->allowUniformRefineWhenUseSplit())
return;

// uniform refinement has been done on master, so skip
if (_app.masterMesh())
Expand Down
6 changes: 6 additions & 0 deletions framework/src/mesh/MooseMesh.C
Expand Up @@ -145,6 +145,10 @@ MooseMesh::validParams()
false,
"True to build the lower-dimensional mesh for all sides.");

params.addParam<bool>("allow_uniform_refine_when_use_split",
false,
"True to allow uniform refinements when using a pre-split mesh.");

// This indicates that the derived mesh type accepts a MeshGenerator, and should be set to true in
// derived types that do so.
params.addPrivateParam<bool>("_mesh_generator_mesh", false);
Expand Down Expand Up @@ -173,6 +177,7 @@ MooseMesh::MooseMesh(const InputParameters & parameters)
_partitioner_overridden(false),
_custom_partitioner_requested(false),
_uniform_refine_level(0),
_allow_uniform_refine_when_use_split(getParam<bool>("allow_uniform_refine_when_use_split")),
_is_nemesis(getParam<bool>("nemesis")),
_node_to_elem_map_built(false),
_node_to_active_semilocal_elem_map_built(false),
Expand Down Expand Up @@ -241,6 +246,7 @@ MooseMesh::MooseMesh(const MooseMesh & other_mesh)
_partitioner_overridden(other_mesh._partitioner_overridden),
_custom_partitioner_requested(other_mesh._custom_partitioner_requested),
_uniform_refine_level(other_mesh.uniformRefineLevel()),
_allow_uniform_refine_when_use_split(other_mesh._allow_uniform_refine_when_use_split),
_is_nemesis(false),
_node_to_elem_map_built(false),
_node_to_active_semilocal_elem_map_built(false),
Expand Down

0 comments on commit bbcf186

Please sign in to comment.