diff --git a/modules/heat_transfer/include/relationshipmanagers/GhostBoundary.h b/framework/include/relationshipmanagers/GhostBoundary.h similarity index 100% rename from modules/heat_transfer/include/relationshipmanagers/GhostBoundary.h rename to framework/include/relationshipmanagers/GhostBoundary.h diff --git a/modules/heat_transfer/src/relationshipmanagers/GhostBoundary.C b/framework/src/relationshipmanagers/GhostBoundary.C similarity index 84% rename from modules/heat_transfer/src/relationshipmanagers/GhostBoundary.C rename to framework/src/relationshipmanagers/GhostBoundary.C index 5f06fe9050cf..01a250e94d82 100644 --- a/modules/heat_transfer/src/relationshipmanagers/GhostBoundary.C +++ b/framework/src/relationshipmanagers/GhostBoundary.C @@ -18,7 +18,7 @@ #include "libmesh/mesh_base.h" #include "libmesh/boundary_info.h" -registerMooseObject("HeatTransferApp", GhostBoundary); +registerMooseObject("MooseApp", GhostBoundary); using namespace libMesh; @@ -98,9 +98,19 @@ GhostBoundary::operator()(const MeshBase::const_element_iterator & /*range_begin bool GhostBoundary::operator>=(const RelationshipManager & other) const { - if (auto asoi = dynamic_cast(&other)) - if (_boundary_name == asoi->_boundary_name && baseGreaterEqual(*asoi)) + if (auto asoi = dynamic_cast(&other); asoi && baseGreaterEqual(*asoi)) + { + std::set our_set(_boundary_name.begin(), _boundary_name.end()); + std::set their_set(asoi->_boundary_name.begin(), asoi->_boundary_name.end()); + std::set difference; + std::set_difference(their_set.begin(), + their_set.end(), + our_set.begin(), + our_set.end(), + std::inserter(difference, difference.end())); + if (difference.empty()) return true; + } return false; } diff --git a/framework/src/relationshipmanagers/GhostEverything.C b/framework/src/relationshipmanagers/GhostEverything.C index 43b49a84252c..8e37650272fd 100644 --- a/framework/src/relationshipmanagers/GhostEverything.C +++ b/framework/src/relationshipmanagers/GhostEverything.C @@ -59,7 +59,7 @@ GhostEverything::operator()(const MeshBase::const_element_iterator & range_begin bool GhostEverything::operator>=(const RelationshipManager & other) const { - return dynamic_cast(&other); + return baseGreaterEqual(other); } std::unique_ptr diff --git a/test/include/userobjects/TestGhostBoundarySideUserObject.h b/test/include/userobjects/TestGhostBoundarySideUserObject.h new file mode 100644 index 000000000000..6ca8c1d3ee11 --- /dev/null +++ b/test/include/userobjects/TestGhostBoundarySideUserObject.h @@ -0,0 +1,24 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#pragma once + +#include "SideUserObject.h" + +class TestGhostBoundarySideUserObject : public SideUserObject +{ +public: + static InputParameters validParams(); + + TestGhostBoundarySideUserObject(const InputParameters & parameters); + virtual void initialize() override {} + virtual void execute() override {} + virtual void finalize() override {} + virtual void threadJoin(const UserObject &) override {} +}; diff --git a/test/src/userobjects/TestGhostBoundarySideUserObject.C b/test/src/userobjects/TestGhostBoundarySideUserObject.C new file mode 100644 index 000000000000..afc7568f6b2c --- /dev/null +++ b/test/src/userobjects/TestGhostBoundarySideUserObject.C @@ -0,0 +1,32 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#include "TestGhostBoundarySideUserObject.h" +#include "MooseMesh.h" + +registerMooseObject("MooseTestApp", TestGhostBoundarySideUserObject); + +InputParameters +TestGhostBoundarySideUserObject::validParams() +{ + InputParameters params = SideUserObject::validParams(); + params.addRelationshipManager("GhostBoundary", + Moose::RelationshipManagerType::GEOMETRIC, + [](const InputParameters & obj_params, InputParameters & rm_params) + { + rm_params.set>("boundary") = + obj_params.get>("boundary"); + }); + return params; +} + +TestGhostBoundarySideUserObject::TestGhostBoundarySideUserObject(const InputParameters & parameters) + : SideUserObject(parameters) +{ +} diff --git a/test/tests/relationship_managers/ghost_boundary/gold/test_out.csv b/test/tests/relationship_managers/ghost_boundary/gold/test_out.csv new file mode 100644 index 000000000000..a9d9a3d56e68 --- /dev/null +++ b/test/tests/relationship_managers/ghost_boundary/gold/test_out.csv @@ -0,0 +1,3 @@ +time,num_rms +0,0 +1,2 diff --git a/test/tests/relationship_managers/ghost_boundary/test.i b/test/tests/relationship_managers/ghost_boundary/test.i new file mode 100644 index 000000000000..84cb27ab18f2 --- /dev/null +++ b/test/tests/relationship_managers/ghost_boundary/test.i @@ -0,0 +1,42 @@ +[Mesh] + [gen] + type = GeneratedMeshGenerator + dim = 2 + nx = 5 + ny = 5 + [] +[] + +[UserObjects] + [all] + type = TestGhostBoundarySideUserObject + boundary = 'left right top bottom' + [] + [some] + type = TestGhostBoundarySideUserObject + boundary = 'left right' + [] +[] + +[Postprocessors] + [num_rms] + type = NumRelationshipManagers + rm_type = 'geometric' + [] +[] + +[Problem] + solve = false +[] + +[Executioner] + type = Steady +[] + +[Outputs] + [info] + type = Console + system_info = 'relationship' + [] + csv = true +[] diff --git a/test/tests/relationship_managers/ghost_boundary/tests b/test/tests/relationship_managers/ghost_boundary/tests new file mode 100644 index 000000000000..f0f5109eabac --- /dev/null +++ b/test/tests/relationship_managers/ghost_boundary/tests @@ -0,0 +1,10 @@ +[Tests] + design = 'RelationshipManager.md' + issues = '#28330' + [test] + type = CSVDiff + input = test.i + csvdiff = test_out.csv + requirement = 'The system shall not add a relationship manager ghosting boundaries that are a subset of the boundaries ghosted by another relationship manager.' + [] +[]