From ecc357646e8a88ad24d34a359a89d834b72ec7ce Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 20 Feb 2024 09:38:08 +0000 Subject: [PATCH] fvPatch: Removed movePoints The FV patches don't hold any data that requires updating. If they did, then they would require a full set of mesh change hooks (i.e., topoChange, distribute, and mesh mapping, as well as move). The poly patches currently hold all of this sort of data, and have a complete system of methods to handle mesh changes. --- .../fvMesh/fvBoundaryMesh/fvBoundaryMesh.C | 16 +------ .../fvMesh/fvBoundaryMesh/fvBoundaryMesh.H | 5 +-- src/finiteVolume/fvMesh/fvMesh.C | 2 - .../fvPatches/basic/coupled/coupledFvPatch.H | 21 +++------- .../nonConformalCyclicFvPatch.C | 26 ++++++------ .../nonConformalCyclicFvPatch.H | 13 ++---- .../nonConformalProcessorCyclicFvPatch.C | 42 +++++++++---------- .../nonConformalProcessorCyclicFvPatch.H | 13 ++---- .../constraint/processor/processorFvPatch.C | 6 +-- .../constraint/processor/processorFvPatch.H | 14 +++---- .../fvMesh/fvPatches/fvPatch/fvPatch.C | 10 +---- .../fvMesh/fvPatches/fvPatch/fvPatch.H | 25 ++--------- 12 files changed, 60 insertions(+), 133 deletions(-) diff --git a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C index 15626ed359..42c7e41a64 100644 --- a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C +++ b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -97,20 +97,6 @@ Foam::labelList Foam::fvBoundaryMesh::findIndices } -void Foam::fvBoundaryMesh::movePoints() -{ - forAll(*this, patchi) - { - operator[](patchi).initMovePoints(); - } - - forAll(*this, patchi) - { - operator[](patchi).movePoints(); - } -} - - void Foam::fvBoundaryMesh::shuffle ( const labelUList& newToOld, diff --git a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H index 7b0dd0b8d9..50015765fe 100644 --- a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H +++ b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -113,9 +113,6 @@ public: labelList findIndices(const wordRe&, const bool useGroups) const; - //- Correct patches after moving points - void movePoints(); - //- Reorders patches. Ordering does not have to be done in // ascending or descending order. Reordering has to be unique. // (is shuffle). If validBoundary call needs to be parallel diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 5858843953..1df9e202cb 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -1089,7 +1089,6 @@ void Foam::fvMesh::setPoints(const pointField& p) clearGeom(); // Update other local data - boundary_.movePoints(); surfaceInterpolation::movePoints(); meshObjects::movePoints(*this); @@ -1211,7 +1210,6 @@ Foam::tmp Foam::fvMesh::movePoints(const pointField& p) updateGeomNotOldVol(); // Update other local data - boundary_.movePoints(); surfaceInterpolation::movePoints(); meshObjects::movePoints(*this); diff --git a/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H index fa2f89b886..12299df2f5 100644 --- a/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/basic/coupled/coupledFvPatch.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-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,13 +56,10 @@ class coupledFvPatch { // Private Data + //- Reference to the coupled polyPatch const coupledPolyPatch& coupledPolyPatch_; -protected: - - // Protected Member Functions - protected: // Protected Member functions @@ -75,21 +72,12 @@ protected: const vectorField& nbrDelta ) const; - //- Make patch weighting factors - virtual void makeWeights(scalarField& w) const = 0; - //- Return delta (P to N) vectors across coupled patch - tmp delta - ( - const vectorField& nbrDelta - ) const; + tmp delta(const vectorField& nbrDelta) const; public: - friend class surfaceInterpolation; - - //- Runtime type information TypeName(coupledPolyPatch::typeName_()); @@ -139,6 +127,9 @@ public: return fvPatch::faceCells(); } + //- Make patch weighting factors + virtual void makeWeights(scalarField& w) const = 0; + //- Return delta (P to N) vectors across coupled patch virtual tmp delta() const = 0; diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalCyclic/nonConformalCyclicFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalCyclic/nonConformalCyclicFvPatch.C index e9854d9fca..925de71bdf 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalCyclic/nonConformalCyclicFvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalCyclic/nonConformalCyclicFvPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,19 +38,6 @@ namespace Foam } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -void Foam::nonConformalCyclicFvPatch::makeWeights(scalarField& w) const -{ - nonConformalCoupledFvPatch::makeWeights - ( - w, - nbrPatch().Sf(), - nbrPatch().coupledFvPatch::delta() - ); -} - - // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // Foam::nonConformalCyclicFvPatch::nonConformalCyclicFvPatch @@ -114,6 +101,17 @@ const Foam::labelUList& Foam::nonConformalCyclicFvPatch::faceCells() const } +void Foam::nonConformalCyclicFvPatch::makeWeights(scalarField& w) const +{ + nonConformalCoupledFvPatch::makeWeights + ( + w, + nbrPatch().Sf(), + nbrPatch().coupledFvPatch::delta() + ); +} + + Foam::tmp Foam::nonConformalCyclicFvPatch::delta() const { diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalCyclic/nonConformalCyclicFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalCyclic/nonConformalCyclicFvPatch.H index 4440a298c9..d74db2fd85 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalCyclic/nonConformalCyclicFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalCyclic/nonConformalCyclicFvPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -66,14 +66,6 @@ class nonConformalCyclicFvPatch const nonConformalCyclicPolyPatch& nonConformalCyclicPolyPatch_; -protected: - - // Protected Member functions - - //- Make patch weighting factors - void makeWeights(scalarField&) const; - - public: //- Runtime type information @@ -132,6 +124,9 @@ public: virtual const labelUList& faceCells() const; + //- Make patch weighting factors + void makeWeights(scalarField&) const; + //- Return delta (P to N) vectors across coupled patch virtual tmp delta() const; }; diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalProcessorCyclic/nonConformalProcessorCyclicFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalProcessorCyclic/nonConformalProcessorCyclicFvPatch.C index e11354bb2e..50d0120155 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalProcessorCyclic/nonConformalProcessorCyclicFvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalProcessorCyclic/nonConformalProcessorCyclicFvPatch.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-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,27 +42,6 @@ namespace Foam } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -void Foam::nonConformalProcessorCyclicFvPatch::makeWeights(scalarField& w) const -{ - if (Pstream::parRun()) - { - nonConformalCoupledFvPatch::makeWeights - ( - w, - - boundaryMesh().mesh().Sf().boundaryField()[index()], - boundaryMesh().mesh().Cf().boundaryField()[index()] - - boundaryMesh().mesh().C().boundaryField()[index()] - ); - } - else - { - w = 1; - } -} - - // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // Foam::nonConformalProcessorCyclicFvPatch::nonConformalProcessorCyclicFvPatch @@ -121,6 +100,25 @@ Foam::nonConformalProcessorCyclicFvPatch::faceCells() const } +void Foam::nonConformalProcessorCyclicFvPatch::makeWeights(scalarField& w) const +{ + if (Pstream::parRun()) + { + nonConformalCoupledFvPatch::makeWeights + ( + w, + - boundaryMesh().mesh().Sf().boundaryField()[index()], + boundaryMesh().mesh().Cf().boundaryField()[index()] + - boundaryMesh().mesh().C().boundaryField()[index()] + ); + } + else + { + w = 1; + } +} + + Foam::tmp Foam::nonConformalProcessorCyclicFvPatch::delta() const { diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalProcessorCyclic/nonConformalProcessorCyclicFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalProcessorCyclic/nonConformalProcessorCyclicFvPatch.H index 8ce6a39292..d64984fc2b 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalProcessorCyclic/nonConformalProcessorCyclicFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/nonConformalProcessorCyclic/nonConformalProcessorCyclicFvPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,14 +65,6 @@ class nonConformalProcessorCyclicFvPatch nonConformalProcessorCyclicPolyPatch_; -protected: - - // Protected Member functions - - //- Make patch weighting factors - virtual void makeWeights(scalarField& w) const; - - public: //- Runtime type information @@ -129,6 +121,9 @@ public: virtual const labelUList& faceCells() const; + //- Make patch weighting factors + virtual void makeWeights(scalarField& w) const; + //- Return delta (P to N) vectors across coupled patch virtual tmp delta() const; }; diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.C index a157f81012..1f727ae32b 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.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-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,7 @@ namespace Foam } -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // void Foam::processorFvPatch::makeWeights(scalarField& w) const { @@ -57,8 +57,6 @@ void Foam::processorFvPatch::makeWeights(scalarField& w) const } -// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // - Foam::tmp Foam::processorFvPatch::delta() const { if (Pstream::parRun()) diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H index 9758cf1014..1a38ba84da 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.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-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,17 +55,10 @@ class processorFvPatch { // Private Data + //- Reference to the processor polyPatch const processorPolyPatch& procPolyPatch_; -protected: - - // Protected Member functions - - //- Make patch weighting factors - virtual void makeWeights(scalarField& w) const; - - public: //- Runtime type information @@ -127,6 +120,9 @@ public: return procPolyPatch_.transform(); } + //- Make patch weighting factors + virtual void makeWeights(scalarField& w) const; + //- Return delta (P to N) vectors across coupled patch virtual tmp delta() const; diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C index debae5b2eb..d4027df0c3 100644 --- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -173,14 +173,6 @@ void Foam::fvPatch::makeWeights(scalarField& w) const } -void Foam::fvPatch::initMovePoints() -{} - - -void Foam::fvPatch::movePoints() -{} - - const Foam::scalarField& Foam::fvPatch::deltaCoeffs() const { return boundaryMesh().mesh().deltaCoeffs().boundaryField()[index()]; diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H index 9aa666c97d..281450e769 100644 --- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -72,28 +72,8 @@ class fvPatch const fvBoundaryMesh& boundaryMesh_; -protected: - - // Protected Member Functions - - //- Make patch weighting factors - virtual void makeWeights(scalarField&) const; - - //- Initialise the patches for moving points - virtual void initMovePoints(); - - //- Correct patches after moving points - virtual void movePoints(); - - public: - typedef fvBoundaryMesh BoundaryMesh; - - friend class fvBoundaryMesh; - friend class surfaceInterpolation; - - //- Runtime type information TypeName(polyPatch::typeName_()); @@ -229,6 +209,9 @@ public: // Access functions for demand driven data + //- Make patch weighting factors + virtual void makeWeights(scalarField&) const; + //- Return patch weighting factors const scalarField& weights() const;