From 544608d4a5b2a8487e6707a66e00365405e718f7 Mon Sep 17 00:00:00 2001 From: Kyle Gamble Date: Mon, 4 Nov 2024 16:26:00 -0700 Subject: [PATCH] Add error checking to GeneratedMeshGenerator. Closes #28998. --- .../meshgenerators/GeneratedMeshGenerator.C | 6 ++++ .../generated_mesh_generator/tests | 30 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/framework/src/meshgenerators/GeneratedMeshGenerator.C b/framework/src/meshgenerators/GeneratedMeshGenerator.C index b07adba3801a..85a1eae40565 100644 --- a/framework/src/meshgenerators/GeneratedMeshGenerator.C +++ b/framework/src/meshgenerators/GeneratedMeshGenerator.C @@ -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 diff --git a/test/tests/meshgenerators/generated_mesh_generator/tests b/test/tests/meshgenerators/generated_mesh_generator/tests index 241cb5c136d2..ed2e68d9a986 100644 --- a/test/tests/meshgenerators/generated_mesh_generator/tests +++ b/test/tests/meshgenerators/generated_mesh_generator/tests @@ -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.' + [] + [] []