From 02a80e4742f3029e5ab51d00824937267328a4c8 Mon Sep 17 00:00:00 2001 From: Guillaume Giudicelli Date: Thu, 25 May 2023 18:08:18 -0600 Subject: [PATCH] Add capability to down select parsed sidesets from other sidesets, closes #24354 --- .../meshgenerators/ParsedGenerateSideset.h | 3 +++ .../meshgenerators/ParsedGenerateSideset.C | 23 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/framework/include/meshgenerators/ParsedGenerateSideset.h b/framework/include/meshgenerators/ParsedGenerateSideset.h index d365ceba6fe3..a99e2786a11b 100644 --- a/framework/include/meshgenerators/ParsedGenerateSideset.h +++ b/framework/include/meshgenerators/ParsedGenerateSideset.h @@ -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; diff --git a/framework/src/meshgenerators/ParsedGenerateSideset.C b/framework/src/meshgenerators/ParsedGenerateSideset.C index 88adbacbbd33..830272e1d124 100644 --- a/framework/src/meshgenerators/ParsedGenerateSideset.C +++ b/framework/src/meshgenerators/ParsedGenerateSideset.C @@ -31,6 +31,9 @@ ParsedGenerateSideset::validParams() params.addRequiredParam("combinatorial_geometry", "Function expression encoding a combinatorial geometry"); params.addRequiredParam("new_sideset_name", "The name of the new sideset"); + params.addParam>( + "included_boundaries", + "A set of boundary names or ids whose sides will be included in the new sidesets"); params.addParam>( "included_subdomains", "A set of subdomain names or ids whose sides will be included in the new sidesets"); @@ -70,14 +73,12 @@ ParsedGenerateSideset::ParsedGenerateSideset(const InputParameters & parameters) _input(getMesh("input")), _function(parameters.get("combinatorial_geometry")), _sideset_name(getParam("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>("included_subdomain_ids") - : std::vector()), _included_neighbor_ids(isParamValid("included_neighbor_ids") ? parameters.get>("included_neighbor_ids") : std::vector()), @@ -151,6 +152,11 @@ ParsedGenerateSideset::generate() _included_neighbor_ids = MooseMeshUtils::getSubdomainIDs(*mesh, subdomains); } + std::vector restricted_boundary_ids; + if (_check_boundaries) + restricted_boundary_ids = MooseMeshUtils::getBoundaryIDs( + *mesh, getParam>("included_boundaries"), true); + // Get the BoundaryIDs from the mesh std::vector boundary_ids = MooseMeshUtils::getBoundaryIDs(*mesh, {_sideset_name}, true); @@ -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 curr_side = elem->side_ptr(side); _func_params[0] = curr_side->vertex_average()(0);