diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPolyPatch.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPolyPatch.C index 8bbfd26c6d..c06928ea13 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPolyPatch.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPolyPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,7 +50,8 @@ Foam::mappedPolyPatch::mappedPolyPatch ) : polyPatch(name, size, start, index, bm, patchType), - mappedPatchBase(static_cast(*this)) + mappedPatchBase(static_cast(*this)), + reMapAfterMove_(true) { // mapped is not constraint type so add mapped group explicitly if (findIndex(inGroups(), typeName) == -1) @@ -70,7 +71,8 @@ Foam::mappedPolyPatch::mappedPolyPatch ) : polyPatch(name, dict, index, bm, patchType), - mappedPatchBase(*this, dict, false) + mappedPatchBase(*this, dict, false), + reMapAfterMove_(dict.lookupOrDefault("reMapAfterMove", true)) { // mapped is not constraint type so add mapped group explicitly if (findIndex(inGroups(), typeName) == -1) @@ -87,7 +89,8 @@ Foam::mappedPolyPatch::mappedPolyPatch ) : polyPatch(pp, bm), - mappedPatchBase(*this, pp) + mappedPatchBase(*this, pp), + reMapAfterMove_(true) {} @@ -101,7 +104,8 @@ Foam::mappedPolyPatch::mappedPolyPatch ) : polyPatch(pp, bm, index, newSize, newStart), - mappedPatchBase(*this, pp) + mappedPatchBase(*this, pp), + reMapAfterMove_(true) {} @@ -143,7 +147,10 @@ void Foam::mappedPolyPatch::movePoints ) { polyPatch::movePoints(pBufs, p); - mappedPatchBase::clearOut(); + if (reMapAfterMove_) + { + mappedPatchBase::clearOut(); + } } @@ -164,6 +171,7 @@ void Foam::mappedPolyPatch::write(Ostream& os) const { polyPatch::write(os); mappedPatchBase::write(os); + writeEntryIfDifferent(os, "reMapAfterMove", true, reMapAfterMove_); } diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPolyPatch.H b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPolyPatch.H index 66734f93da..6457414704 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPolyPatch.H +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPolyPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,9 +55,17 @@ class mappedPolyPatch public polyPatch, public mappedPatchBase { + // Private Data + + //- Do we need to re-calculate the mapping if mesh motion takes place? + // Defaults to true. + const bool reMapAfterMove_; + protected: + // Protected Member Functions + //- Initialise the calculation of the patch geometry virtual void initCalcGeometry(PstreamBuffers&); diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C index 1d21c5af48..9be1b14278 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,8 @@ Foam::mappedWallPolyPatch::mappedWallPolyPatch ) : wallPolyPatch(name, size, start, index, bm, patchType), - mappedPatchBase(static_cast(*this)) + mappedPatchBase(static_cast(*this)), + reMapAfterMove_(true) { // mapped is not constraint type so add mapped group explicitly if (findIndex(inGroups(), mappedPolyPatch::typeName) == -1) @@ -84,7 +85,8 @@ Foam::mappedWallPolyPatch::mappedWallPolyPatch neighbourRegion, neighbourPatch, cyclicTransform(true) - ) + ), + reMapAfterMove_(true) {} @@ -98,7 +100,8 @@ Foam::mappedWallPolyPatch::mappedWallPolyPatch ) : wallPolyPatch(name, dict, index, bm, patchType), - mappedPatchBase(*this, dict, true) + mappedPatchBase(*this, dict, true), + reMapAfterMove_(dict.lookupOrDefault("reMapAfterMove", true)) { // mapped is not constraint type so add mapped group explicitly if (findIndex(inGroups(), mappedPolyPatch::typeName) == -1) @@ -115,7 +118,8 @@ Foam::mappedWallPolyPatch::mappedWallPolyPatch ) : wallPolyPatch(pp, bm), - mappedPatchBase(*this, pp) + mappedPatchBase(*this, pp), + reMapAfterMove_(true) {} @@ -129,7 +133,8 @@ Foam::mappedWallPolyPatch::mappedWallPolyPatch ) : wallPolyPatch(pp, bm, index, newSize, newStart), - mappedPatchBase(*this, pp) + mappedPatchBase(*this, pp), + reMapAfterMove_(true) {} @@ -171,7 +176,10 @@ void Foam::mappedWallPolyPatch::movePoints ) { wallPolyPatch::movePoints(pBufs, p); - mappedPatchBase::clearOut(); + if (reMapAfterMove_) + { + mappedPatchBase::clearOut(); + } } @@ -192,6 +200,7 @@ void Foam::mappedWallPolyPatch::write(Ostream& os) const { wallPolyPatch::write(os); mappedPatchBase::write(os); + writeEntryIfDifferent(os, "reMapAfterMove", true, reMapAfterMove_); } diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedWallPolyPatch.H b/src/meshTools/mappedPatches/mappedPolyPatch/mappedWallPolyPatch.H index 41b2ad046e..f6ceb0860b 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedWallPolyPatch.H +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedWallPolyPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,9 +55,17 @@ class mappedWallPolyPatch public wallPolyPatch, public mappedPatchBase { + // Private Data + + //- Do we need to re-calculate the mapping if mesh motion takes place? + // Defaults to true. + const bool reMapAfterMove_; + protected: + // Protected Member Functions + //- Initialise the calculation of the patch geometry virtual void initCalcGeometry(PstreamBuffers&);