Skip to content

Commit

Permalink
Add capability to down select parsed sidesets from other sidesets, cl…
Browse files Browse the repository at this point in the history
  • Loading branch information
GiudGiud committed May 26, 2023
1 parent b9c8e60 commit 02a80e4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
3 changes: 3 additions & 0 deletions framework/include/meshgenerators/ParsedGenerateSideset.h
Expand Up @@ -37,6 +37,9 @@ class ParsedGenerateSideset : public SideSetsGeneratorBase, public FunctionParse
/// name of the new sideset
BoundaryName _sideset_name;

/// whether to check boundary ids when adding sides or not
bool _check_boundaries;

/// whether to check subdomain ids when adding sides or not
bool _check_subdomains;

Expand Down
23 changes: 20 additions & 3 deletions framework/src/meshgenerators/ParsedGenerateSideset.C
Expand Up @@ -31,6 +31,9 @@ ParsedGenerateSideset::validParams()
params.addRequiredParam<std::string>("combinatorial_geometry",
"Function expression encoding a combinatorial geometry");
params.addRequiredParam<BoundaryName>("new_sideset_name", "The name of the new sideset");
params.addParam<std::vector<BoundaryName>>(
"included_boundaries",
"A set of boundary names or ids whose sides will be included in the new sidesets");
params.addParam<std::vector<SubdomainName>>(
"included_subdomains",
"A set of subdomain names or ids whose sides will be included in the new sidesets");
Expand Down Expand Up @@ -70,14 +73,12 @@ ParsedGenerateSideset::ParsedGenerateSideset(const InputParameters & parameters)
_input(getMesh("input")),
_function(parameters.get<std::string>("combinatorial_geometry")),
_sideset_name(getParam<BoundaryName>("new_sideset_name")),
_check_boundaries(isParamValid("included_boundaries")),
_check_subdomains(isParamValid("included_subdomain_ids") ||
isParamValid("included_subdomains")),
_check_neighbor_subdomains(isParamValid("included_neighbor_ids") ||
isParamValid("included_neighbors")),
_check_normal(parameters.isParamSetByUser("normal")),
_included_ids(isParamValid("included_subdomain_ids")
? parameters.get<std::vector<SubdomainID>>("included_subdomain_ids")
: std::vector<SubdomainID>()),
_included_neighbor_ids(isParamValid("included_neighbor_ids")
? parameters.get<std::vector<SubdomainID>>("included_neighbor_ids")
: std::vector<SubdomainID>()),
Expand Down Expand Up @@ -151,6 +152,11 @@ ParsedGenerateSideset::generate()
_included_neighbor_ids = MooseMeshUtils::getSubdomainIDs(*mesh, subdomains);
}

std::vector<boundary_id_type> restricted_boundary_ids;
if (_check_boundaries)
restricted_boundary_ids = MooseMeshUtils::getBoundaryIDs(
*mesh, getParam<std::vector<BoundaryName>>("included_boundaries"), true);

// Get the BoundaryIDs from the mesh
std::vector<boundary_id_type> boundary_ids =
MooseMeshUtils::getBoundaryIDs(*mesh, {_sideset_name}, true);
Expand Down Expand Up @@ -191,6 +197,17 @@ ParsedGenerateSideset::generate()
if (_check_normal && std::abs(1.0 - _normal * normals[0]) > _variance)
continue;

// check that boundary is within the list of included boundaries
if (_check_boundaries)
{
bool in_included_boundaries = false;
for (auto bid : restricted_boundary_ids)
if (boundary_info.has_boundary_id(elem, side, bid))
in_included_boundaries = true;
if (!in_included_boundaries)
continue;
}

// check expression
std::unique_ptr<Elem> curr_side = elem->side_ptr(side);
_func_params[0] = curr_side->vertex_average()(0);
Expand Down

0 comments on commit 02a80e4

Please sign in to comment.