diff --git a/framework/doc/content/source/meshgenerators/OverlayMeshGenerator.md b/framework/doc/content/source/meshgenerators/OverlayMeshGenerator.md index 2f96e6241f98..e40ebc1d0a9f 100644 --- a/framework/doc/content/source/meshgenerators/OverlayMeshGenerator.md +++ b/framework/doc/content/source/meshgenerators/OverlayMeshGenerator.md @@ -4,7 +4,7 @@ ## Overview -The `OverlayMeshGenerator` object is the built-in mesh generation capable of creating an overlaying mesh with the given mesh block. The overlay mesh uses DistributedRectilinearMeshGenerator(DistributedRectilinearMeshGenerator.md) as sub-generator. The input parameters for DistributedRectilinearMeshGenerator are all available for OverlayMeshGenerator. The required input parameters are [!param](/Mesh/OverlayMeshGenerator/dim) (the dimension of the domain) and [!param](/Mesh/OverlayMeshGenerator/input) (the base mesh we want to overlay). +The `OverlayMeshGenerator` object is the built-in mesh generation capable of creating an overlaying mesh with the given mesh block. The overlay mesh uses [DistributedRectilinearMeshGenerator.md] as sub-generator. The input parameters for DistributedRectilinearMeshGenerator are all available for OverlayMeshGenerator. The required input parameters are [!param](/Mesh/OverlayMeshGenerator/dim) (the dimension of the domain) and [!param](/Mesh/OverlayMeshGenerator/input) (the base mesh we want to overlay). ## Example Syntax diff --git a/framework/include/meshgenerators/OverlayMeshGenerator.h b/framework/include/meshgenerators/OverlayMeshGenerator.h index 68fddbeff805..ce1b903774d2 100644 --- a/framework/include/meshgenerators/OverlayMeshGenerator.h +++ b/framework/include/meshgenerators/OverlayMeshGenerator.h @@ -1,4 +1,12 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details //* https://www.gnu.org/licenses/lgpl-2.1.html + #pragma once #include "MeshGenerator.h" #include "libmesh/mesh_generation.h" diff --git a/framework/src/meshgenerators/OverlayMeshGenerator.C b/framework/src/meshgenerators/OverlayMeshGenerator.C index 2f1fc87daafb..75cc8b674391 100644 --- a/framework/src/meshgenerators/OverlayMeshGenerator.C +++ b/framework/src/meshgenerators/OverlayMeshGenerator.C @@ -6,8 +6,12 @@ //* //* Licensed under LGPL 2.1, please see LICENSE for details //* https://www.gnu.org/licenses/lgpl-2.1.html + #include "OverlayMeshGenerator.h" #include "CastUniquePointer.h" +#include "DistributedRectilinearMeshGenerator.h" +#include "InputParameters.h" + // libMesh includes #include "libmesh/mesh_generation.h" #include "libmesh/unstructured_mesh.h" @@ -16,54 +20,18 @@ #include "libmesh/mesh_tools.h" registerMooseObject("MooseApp", OverlayMeshGenerator); + InputParameters OverlayMeshGenerator::validParams() { InputParameters params = MeshGenerator::validParams(); - params.addClassDescription("This OverlayMeshGenerator creates a Cartesian mesh using " - "DistributedRectilinearMeshGenerator in " - "the mesh block region."); + + params += DistributedRectilinearMeshGenerator::validParams(); params.addRequiredParam("input", "The base mesh we want to overlay"); - MooseEnum dims("1=1 2 3"); - params.addRequiredParam( - "dim", dims, "The dimension of the mesh to be generated"); // Make this parameter required - params.addParam("nx", 1, "Number of elements in the X direction"); - params.addParam("ny", 1, "Number of elements in the Y direction"); - params.addParam("nz", 1, "Number of elements in the Z direction"); - params.addParam( - "num_cores_for_partition", - 0, - "Number of cores for partitioning the graph (dafaults to the number of MPI ranks)"); - params.addRangeCheckedParam( - "num_side_layers", - 2, - "num_side_layers>=1 & num_side_layers<5", - "Number of layers of off-processor side neighbors is reserved during mesh generation"); - MooseEnum partition("graph linear square", "graph", false); - params.addParam( - "partition", partition, "Which method (graph linear square) use to partition mesh"); - MooseEnum elem_types = MooseMesh::elemTypes(); - params.addParam("elem_type", - elem_types, - "The type of element from libMesh to " - "generate (default: linear element for " - "requested dimension)"); - - params.addRangeCheckedParam( - "bias_x", - 1., - "bias_x>=0.5 & bias_x<=2", - "The amount by which to grow (or shrink) the cells in the x-direction."); - params.addRangeCheckedParam( - "bias_y", - 1., - "bias_y>=0.5 & bias_y<=2", - "The amount by which to grow (or shrink) the cells in the y-direction."); - params.addRangeCheckedParam( - "bias_z", - 1., - "bias_z>=0.5 & bias_z<=2", - "The amount by which to grow (or shrink) the cells in the z-direction."); + + params.addClassDescription("Creates a Cartesian mesh overlaying " + "the input mesh region."); + return params; } @@ -78,35 +46,30 @@ OverlayMeshGenerator::OverlayMeshGenerator(const InputParameters & parameters) _input_mesh = &getMeshByName(_mesh_name); - auto params = _app.getFactory().getValidParams("DistributedRectilinearMeshGenerator"); - - params.set("dim") = _dim; - - params.set("nx") = getParam("nx"); - params.set("ny") = getParam("ny"); - params.set("nz") = getParam("nz"); - - params.set("xmin") = 0; - params.set("ymin") = 0; - params.set("zmin") = 0; - params.set("xmax") = 1; - params.set("ymax") = 1; - params.set("zmax") = 1; - - params.set("bias_x") = getParam("bias_x"); - params.set("bias_y") = getParam("bias_y"); - params.set("bias_z") = getParam("bias_z"); - - params.set("num_side_layers") = getParam("num_side_layers"); - params.set("num_cores_for_partition") = - getParam("num_cores_for_partition"); - - params.set("partition") = getParam("partition"); - params.set("elem_type") = getParam("elem_type"); + auto input_params = _app.getFactory().getValidParams("DistributedRectilinearMeshGenerator"); + + input_params.applySpecificParameters(parameters, + {"dim", + "nx", + "ny", + "nz", + "xmin", + "ymin", + "zmin", + "xmax", + "ymax", + "zmax", + "bias_x", + "bias_y", + "bias_z", + "num_side_layers", + "num_cores_for_partition", + "partition", + "elem_type"}); addMeshSubgenerator("DistributedRectilinearMeshGenerator", _mesh_name + "_distributedrectilinearmeshgenerator", - params); + input_params); _build_mesh = &getMeshByName(_mesh_name + "_distributedrectilinearmeshgenerator"); } std::unique_ptr @@ -126,13 +89,13 @@ OverlayMeshGenerator::generate() if (scale_factor(0) != 1 || scale_factor(1) != 1 || scale_factor(2) != 1) MeshTools::Modification::scale(*build_mesh, scale_factor(0), scale_factor(1), scale_factor(2)); - RealVectorValue translate_factor; - translate_factor = bbox_input.min(); + RealVectorValue translation_vector; + translation_vector = bbox_input.min(); // translate - if (translate_factor(0) != 0 || translate_factor(1) != 0 || translate_factor(2) != 0) + if (translation_vector(0) != 0 || translation_vector(1) != 0 || translation_vector(2) != 0) MeshTools::Modification::translate( - *build_mesh, translate_factor(0), translate_factor(1), translate_factor(2)); + *build_mesh, translation_vector(0), translation_vector(1), translation_vector(2)); return dynamic_pointer_cast(build_mesh); } diff --git a/test/tests/meshgenerators/overlay_mesh_generator/tests b/test/tests/meshgenerators/overlay_mesh_generator/tests index 8a33f14c7f9d..461eb7692f01 100644 --- a/test/tests/meshgenerators/overlay_mesh_generator/tests +++ b/test/tests/meshgenerators/overlay_mesh_generator/tests @@ -2,7 +2,7 @@ issues = '#23513' design = 'meshgenerators/OverlayMeshGenerator.md' [Test] - requirement = 'The system shall be able to create a distributedrectilinear mesh overlaying with the given mesh.' + requirement = 'The system shall be able to create in a distributed manner a rectilinear mesh overlaying with the given mesh.' type = 'Exodiff' input = 'overlay_mesh_generator.i' cli_args = '--mesh-only'