Skip to content

Commit

Permalink
Add and test ability to suppress creation of displaced mesh closes #1…
Browse files Browse the repository at this point in the history
  • Loading branch information
bwspenc committed Dec 5, 2018
1 parent 3dbbda1 commit 7c5a3dc
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 5 deletions.
11 changes: 9 additions & 2 deletions framework/src/actions/CreateDisplacedProblemAction.C
Expand Up @@ -23,7 +23,14 @@ validParams<CreateDisplacedProblemAction>()
"displacements",
"The variables corresponding to the x y z displacements of the mesh. If "
"this is provided then the displacements will be taken into account during "
"the computation.");
"the computation. Creation of the displaced mesh can be suppressed even if "
"this is set by setting 'use_displaced_mesh = false'.");
params.addParam<bool>(
"use_displaced_mesh",
true,
"Create the displaced mesh if the 'displacements' "
"parameter is set. If this is 'false', a displaced mesh will not be created, "
"regardless of whether 'displacements' is set.");

return params;
}
Expand All @@ -36,7 +43,7 @@ CreateDisplacedProblemAction::CreateDisplacedProblemAction(InputParameters param
void
CreateDisplacedProblemAction::act()
{
if (isParamValid("displacements"))
if (isParamValid("displacements") && getParam<bool>("use_displaced_mesh"))
{
if (!_displaced_mesh)
mooseError("displacements were set but a displaced mesh wasn't created!");
Expand Down
13 changes: 10 additions & 3 deletions framework/src/actions/SetupMeshAction.C
Expand Up @@ -50,7 +50,14 @@ validParams<SetupMeshAction>()
"displacements",
"The variables corresponding to the x y z displacements of the mesh. If "
"this is provided then the displacements will be taken into account during "
"the computation.");
"the computation. Creation of the displaced mesh can be suppressed even if "
"this is set by setting 'use_displaced_mesh = false'.");
params.addParam<bool>(
"use_displaced_mesh",
true,
"Create the displaced mesh if the 'displacements' "
"parameter is set. If this is 'false', a displaced mesh will not be created, "
"regardless of whether 'displacements' is set.");
params.addParam<std::vector<BoundaryName>>("ghosted_boundaries",
"Boundaries to be ghosted if using Nemesis");
params.addParam<std::vector<Real>>("ghosted_boundaries_inflation",
Expand Down Expand Up @@ -208,14 +215,14 @@ SetupMeshAction::act()
}

_mesh = _factory.create<MooseMesh>(_type, "mesh", _moose_object_pars);
if (isParamValid("displacements"))
if (isParamValid("displacements") && getParam<bool>("use_displaced_mesh"))
_displaced_mesh = _factory.create<MooseMesh>(_type, "displaced_mesh", _moose_object_pars);
}
else if (_current_task == "init_mesh")
{
_mesh->init();

if (isParamValid("displacements"))
if (isParamValid("displacements") && getParam<bool>("use_displaced_mesh"))
{
// Initialize the displaced mesh
_displaced_mesh->init();
Expand Down
15 changes: 15 additions & 0 deletions modules/tensor_mechanics/test/tests/elastic_patch/tests
Expand Up @@ -37,6 +37,21 @@
'ComputeSmallStrain.md ComputeLinearElasticStress.md'
issues = '#12584'
[../]
[./elastic_patch_incremental_small_no_disp_mesh]
prereq = elastic_patch_total_small
type = 'Exodiff'
input = 'elastic_patch.i'
cli_args = 'Mesh/use_displaced_mesh=false Materials/strain/type=ComputeIncrementalSmallStrain Kernels/TensorMechanics/use_displaced_mesh=false Outputs/file_base=elastic_patch_small_out'
exodiff = 'elastic_patch_small_out.e'
requirement = 'The tensor mechanics module shall have the ability to '
'compute spatially uniform stresses under prescribed '
'linearly varying displacements on a set of irregular hexes '
'using an incremental small-strain calculation with no displaced '
'mesh created.'
design = 'ElasticEnergyAux.md ComputeIsotropicElasticityTensor.md '
'ComputeIncrementalSmallStrain.md ComputeFiniteStrainElasticStress.md'
issues = '#12584 #12580'
[../]
[./elastic_patch_Bbar]
type = 'Exodiff'
input = 'elastic_patch.i'
Expand Down
14 changes: 14 additions & 0 deletions test/tests/outputs/displaced/tests
Expand Up @@ -7,6 +7,9 @@
exodiff = 'displaced_adapt_test_out.e-s003'
recover = false
max_parallel = 1
requirement = "The system shall be able to output the displaced mesh for a model with adaptive mesh refinement."
design = "Outputs/index.md Adaptivity/index.md"
issues = "#1927"
[../]

[./non_displaced_fallback]
Expand All @@ -17,4 +20,15 @@
design = "Outputs/index.md"
issues = "#11309"
[../]

[./mesh_use_displaced_mesh_false]
prereq = non_displaced_fallback
type = 'RunException'
input = 'non_displaced_fallback.i'
cli_args = 'Mesh/displacements=a Mesh/use_displaced_mesh=false'
expect_err = "Parameter 'use_displaced' ignored, there is no displaced problem in your simulation."
requirement = "If the user asks for no displaced mesh to be created, even though displacements are provided in the mesh block, the system shall not create a displaced mesh"
design = "syntax/Mesh/index.md"
issues = "#12580"
[../]
[]

0 comments on commit 7c5a3dc

Please sign in to comment.