Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Water tight sideset check #28816

Merged
merged 6 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class MeshDiagnosticsGenerator : public MeshGenerator

/// whether to check that sidesets are consistently oriented using neighbor subdomains
const MooseEnum _check_sidesets_orientation;
//// whether to check that each side is assigned to a sideset
//// whether to check that each external side is assigned to a sideset
const MooseEnum _check_watertight_sidesets;
/// whether to check element volumes
const MooseEnum _check_element_volumes;
Expand Down
25 changes: 10 additions & 15 deletions framework/src/meshgenerators/MeshDiagnosticsGenerator.C
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ MeshDiagnosticsGenerator::validParams()
chk_option,
"whether to check that sidesets are consistently oriented using neighbor subdomains. If a "
"sideset is inconsistently oriented within a subdomain, this will not be detected");
params.addParam<MooseEnum>("check_for_watertight_sidesets",
chk_option,
"whether to check for sides that are not assigned to any sidesets");
params.addParam<MooseEnum>(
"check_for_watertight_sidesets",
chk_option,
"whether to check for external sides that are not assigned to any sidesets");
params.addParam<MooseEnum>(
"examine_element_volumes", chk_option, "whether to examine volume of the elements");
params.addParam<Real>("minimum_element_volumes", 1e-16, "minimum size for element volume");
Expand Down Expand Up @@ -157,11 +158,7 @@ MeshDiagnosticsGenerator::checkSidesetsOrientation(const std::unique_ptr<MeshBas
{
auto & boundary_info = mesh->get_boundary_info();
auto side_tuples = boundary_info.build_side_list();
auto sideset_map = boundary_info.get_sideset_map();
auto side_set = boundary_info.get_side_boundary_ids();
boundary_info.build_node_list_from_side_list();
auto nodeset_map = boundary_info.get_nodeset_map();
// auto & num_sides = mesh->n_sides();

for (const auto bid : boundary_info.get_boundary_ids())
{
// This check only looks at subdomains on both sides of the sideset
Expand Down Expand Up @@ -284,14 +281,12 @@ MeshDiagnosticsGenerator::checkWaterTightSidesets(const std::unique_ptr<MeshBase
/*
Algorithm Overview:
1) Loop through all elements
2) For each element loop through it's edges
3) If !neighbors it's external
2) For each element loop through all it's sides
GiudGiud marked this conversation as resolved.
Show resolved Hide resolved
3) If it has no neighbors it's an external side
4) If external check if it's part of a sideset
*/
if (mesh->mesh_dimension() < 2)
mooseError("The sideset check only works for 2D and 3D meshes");
if (!mesh->is_serial())
mooseError("Only serialized/replicated meshes are supported");
auto & boundary_info = mesh->get_boundary_info();
boundary_info.build_side_list();
const auto sideset_map = boundary_info.get_sideset_map();
Expand All @@ -306,11 +301,11 @@ MeshDiagnosticsGenerator::checkWaterTightSidesets(const std::unique_ptr<MeshBase
if (elem->neighbor_ptr(i) == nullptr)
{
// If external check if that side had a sideset
auto side_itr = sideset_map.equal_range(elem);
auto side_range = sideset_map.equal_range(elem);
bool has_boundary = false;
for (auto itr = side_itr.first; itr != side_itr.second; itr++)
for (const auto & itr : as_range(side_range))
{
if (itr->second.first == i)
if (itr.second.first == i)
{
has_boundary = true;
}
Expand Down