Skip to content

Commit

Permalink
Merge pull request #29000 from gambka/gmg_error_checks
Browse files Browse the repository at this point in the history
Add error checking to GeneratedMeshGenerator
  • Loading branch information
GiudGiud authored Nov 5, 2024
2 parents 7c0efca + 544608d commit c4d759f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
6 changes: 6 additions & 0 deletions framework/src/meshgenerators/GeneratedMeshGenerator.C
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ GeneratedMeshGenerator::GeneratedMeshGenerator(const InputParameters & parameter
{
if (_gauss_lobatto_grid && (_bias_x != 1.0 || _bias_y != 1.0 || _bias_z != 1.0))
mooseError("Cannot apply both Gauss-Lobatto mesh grading and biasing at the same time.");
if (_xmax < _xmin)
paramError("xmax", "xmax must be larger than xmin.");
if (_ymax < _ymin)
paramError("ymax", "ymax must be larger than ymin.");
if (_zmax < _zmin)
paramError("zmax", "zmax must be larger than zmin.");
}

std::unique_ptr<MeshBase>
Expand Down
30 changes: 30 additions & 0 deletions test/tests/meshgenerators/generated_mesh_generator/tests
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,34 @@
design = 'meshgenerators/GeneratedMeshGenerator.md'
recover = false
[]

[error_check]
issues = '#28998'
design = 'meshgenerators/GeneratedMeshGenerator.md'
requirement = 'The system shall error when unphysical input combinations are provided to the generated mesh generator, including when'
[xmax]
type = 'RunException'
input = 'generated_mesh_generator.i'
cli_args = 'Mesh/gmg/xmin=2 --mesh-only'
expect_err = 'xmax must be larger than xmin.'
recover = false
detail = 'the specified maximum X-coordinate is less than the minimum X-coordinate, and'
[]
[ymax]
type = 'RunException'
input = 'generated_mesh_generator.i'
cli_args = 'Mesh/gmg/ymin=2 --mesh-only'
expect_err = 'ymax must be larger than ymin.'
recover = false
detail = 'the specified maximum Y-coordinate is less than the minimum Y-coordinate, and'
[]
[zmax]
type = 'RunException'
input = 'generated_mesh_generator.i'
cli_args = 'Mesh/gmg/zmin=2 --mesh-only'
expect_err = 'zmax must be larger than zmin.'
recover = false
detail = 'the specified maximum Z-coordinate is less than the minimum Z-coordinate.'
[]
[]
[]

0 comments on commit c4d759f

Please sign in to comment.