Skip to content

Commit

Permalink
Tweak to SidesetsEnclosedBlocks (idaholab#20621)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Schunert committed Nov 1, 2023
1 parent e637b74 commit 4f0f4ee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions framework/include/meshgenerators/SidesetsEncloseBlocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ class SidesetsEncloseBlocks : public MeshGenerator
protected:
/// the mesh that is passed from the meshgen executed before this meshgen
std::unique_ptr<MeshBase> & _input;

/// if mesh generator looks for sidesets on the neighbor elems
bool _neighbor_sideset;
};
18 changes: 17 additions & 1 deletion framework/src/meshgenerators/SidesetsEncloseBlocks.C
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ SidesetsEncloseBlocks::validParams()
params.addParam<std::vector<BoundaryName>>("boundary",
"The name of the boundaries enclosing the ");
params.addParam<BoundaryName>("new_boundary", "The name of the boundary to create");
params.addParam<bool>(
"allow_sideset_on_neighbor",
false,
"If true the mesh generator searches the neighbor side for a sideset as well");
params.addClassDescription(
"MeshGenerator that checks if a set of blocks is enclosed by a set of sidesets."
"It can either add sides that are not covered by a sideset by a new sidesets or"
Expand All @@ -37,7 +41,9 @@ SidesetsEncloseBlocks::validParams()
}

SidesetsEncloseBlocks::SidesetsEncloseBlocks(const InputParameters & parameters)
: MeshGenerator(parameters), _input(getMesh("input"))
: MeshGenerator(parameters),
_input(getMesh("input")),
_neighbor_sideset(getParam<bool>("allow_sideset_on_neighbor"))
{
}

Expand Down Expand Up @@ -113,6 +119,16 @@ SidesetsEncloseBlocks::generate()
std::vector<boundary_id_type> side_boundary_ids_vec;
boundary_info.raw_boundary_ids(elem, j, side_boundary_ids_vec);

// in case there is a neighbor, boundaries defined on the other side
// may also count
if (neigh && _neighbor_sideset)
{
std::vector<boundary_id_type> add_sides;
boundary_info.raw_boundary_ids(neigh, neigh->which_neighbor_am_i(elem), add_sides);
side_boundary_ids_vec.insert(
side_boundary_ids_vec.end(), add_sides.begin(), add_sides.end());
}

std::set<boundary_id_type> intersection;
std::set_intersection(side_boundary_ids_vec.begin(),
side_boundary_ids_vec.end(),
Expand Down

0 comments on commit 4f0f4ee

Please sign in to comment.