Skip to content

Commit c8bc06a

Browse files
committed
Only update paired sidesets once
refs #31025
1 parent ebfb3f0 commit c8bc06a

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

framework/include/mesh/MooseMesh.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,11 @@ class MooseMesh : public MooseObject, public Restartable, public PerfGraphInterf
991991
*/
992992
void detectPairedSidesets();
993993

994+
/**
995+
* Whether or not detectedPairedSidesets() has been called.
996+
*/
997+
bool hasDetectedPairedSidesets() const { return _paired_boundary.has_value(); }
998+
994999
/**
9951000
* This function attempts to return the paired boundary ids for the given component. For example,
9961001
* in a generated 2D mesh, passing 0 for the "x" component will return (3, 1).

framework/src/mesh/MooseMesh.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2397,7 +2397,7 @@ MooseMesh::getPairedBoundaryMapping(unsigned int component) const
23972397

23982398
mooseAssert(component < dimension(), "Requested dimension out of bounds");
23992399

2400-
if (!_paired_boundary)
2400+
if (!hasDetectedPairedSidesets())
24012401
mooseError("MooseMesh::getPairedBoundaryMapping(): Paired boundaries not built; must call "
24022402
"detectPairedSidesets() first");
24032403

framework/src/utils/PeriodicBCHelper.C

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ PeriodicBCHelper::setupPeriodicBoundaries(FEProblemBase & problem)
6666
mooseAssert(_periodic_boundaries.empty(), "Already set");
6767

6868
// Setup paired sidesets to be able to call MooseMesh::getPairedBoundaryMapping()
69-
problem.mesh().detectPairedSidesets();
69+
if (!problem.mesh().hasDetectedPairedSidesets())
70+
problem.mesh().detectPairedSidesets();
7071

7172
if (_params.isParamValid("auto_direction"))
7273
setupAutoPeriodicBoundaries(problem.mesh());

0 commit comments

Comments
 (0)