Skip to content

Commit

Permalink
Add a submeshgenerator, acting after the generate() in the symmetry t…
Browse files Browse the repository at this point in the history
…ransform, to sitich the output meshes, refs idaholab#21578
  • Loading branch information
GiudGiud committed Nov 23, 2022
1 parent abe4509 commit 69edd0d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
36 changes: 17 additions & 19 deletions framework/src/meshgenerators/SymmetryTransformGenerator.C
Expand Up @@ -59,9 +59,23 @@ SymmetryTransformGenerator::SymmetryTransformGenerator(const InputParameters & p
const auto norm = _mirror_normal_vector.norm();
if (!MooseUtils::absoluteFuzzyEqual(norm, 1))
mooseInfo("Input normal plane vector was not normalized, normalization was performed");
_mirror_normal_vector =
_mirror_normal_vector / norm; // _mirror_normal_vector[0] / norm, _mirror_normal_vector[1] /
// norm, _mirror_normal_vector[2] / norm;
_mirror_normal_vector = _mirror_normal_vector / norm;

// Add stitch sub mesh generator if stitching is requested
if (_stitch_boundaries_pairs.size() > 0)
{
auto params = _app.getFactory().getValidParams("StitchedMeshGenerator");

// order of vector elements matters for this generator
// here order by: original mesh first, our custom mesh second
params.set<std::vector<MeshGeneratorName>>("inputs") = {getParam<MeshGeneratorName>("input"),
name()};
params.set<std::vector<std::vector<std::string>>>("stitch_boundaries_pairs") =
_stitch_boundaries_pairs;

// stitch the mirrored mesh and the original mesh
addMeshSubgenerator("StitchedMeshGenerator", name() + "_stitchedMeshGenerator", params);
}
}

std::unique_ptr<MeshBase>
Expand Down Expand Up @@ -95,21 +109,5 @@ SymmetryTransformGenerator::generate()
// Fix flipped orientation from the symmetry
MeshTools::Modification::orient_elements(*mesh);

if (_stitch_boundaries_pairs.size() > 0)
{
auto params = _app.getFactory().getValidParams("StitchedMeshGenerator");

// order of vector elements matters for this generator
// here order by: original mesh first, our custom mesh second
params.set<std::vector<MeshGeneratorName>>("inputs") = {getParam<MeshGeneratorName>("input"),
name()};
params.set<std::vector<std::vector<std::string>>>("stitch_boundaries_pairs") =
_stitch_boundaries_pairs;

// stitch the newly made high-dimensional mesh back to the original mesh
return dynamic_pointer_cast<MeshBase>(
addMeshSubgenerator("StitchedMeshGenerator", name() + "_stitchedMeshGenerator", params));
}

return mesh;
}
Expand Up @@ -12,6 +12,7 @@
input = file
mirror_point = "0 1 0"
mirror_normal_vector = "0 1 0"
symmetry_stitch_sideset = "top top"
[]
[stitch]
type = StitchedMeshGenerator
Expand Down

0 comments on commit 69edd0d

Please sign in to comment.