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 25, 2022
1 parent abe4509 commit e284971
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
Expand Up @@ -5,6 +5,11 @@
!alert note
Only the plane or mirror symmetry is currently implemented in the `SymmetryTransformGenerator`. Point or rotational symmetries are not implemented.

!alert warning
If using the [!param](/Mesh/SymmetryTransformGenerator/symmetry_stitch_sideset) parameter,
the name of the output mesh generator is not the name of the `SymmetryTransformGenerator`!
It is that name suffixed with `_stitchedMeshGenerator`.

## Overview

The `SymmetryTransformGenerator` makes a mirror reflection of a mesh across an arbitrary plane (or line in 2D) supplied by the user.
Expand Down
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 e284971

Please sign in to comment.