From 01ea17f4522d93163671290e7736123e27aa7d0f Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 19 Jun 2023 19:53:47 +0100 Subject: [PATCH] fvMesh: Register V, Sf, magSf, C and Cf fields required modification of fvMeshDistributors to ensure these sliced fields are deleted before distribution. --- src/dynamicMesh/fvMeshSubset/fvMeshSubset.C | 1 + src/finiteVolume/fvMesh/fvMesh.H | 3 ++- .../fvMeshDistributor/fvMeshDistributor.C | 10 +++++++++- .../fvMeshDistributor/fvMeshDistributor.H | 4 ++-- src/finiteVolume/fvMesh/fvMeshGeometry.C | 12 ++++++------ .../distributor/fvMeshDistributorsDistributor.C | 5 ++++- 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C index c333737c7b..3b20bce179 100644 --- a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C +++ b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.C @@ -807,6 +807,7 @@ void Foam::fvMeshSubset::setCellSubset // Delete any old mesh fvMeshSubsetPtr_.clear(); + // Make a new mesh fvMeshSubsetPtr_.reset ( diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index 0f32b86912..e4a1fe3c90 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -168,7 +168,7 @@ private: // will take care of the old-time levels. mutable label curTimeIndex_; - //- Cell volumes old time level + //- Cell volumes mutable SlicedDimensionedField* VPtr_; //- Cell volumes old time level @@ -316,6 +316,7 @@ public: typedef fvBoundaryMesh BoundaryMesh; friend fvMeshTopoChangers::list; + friend fvMeshDistributor; // Declare name of the class and its debug switch ClassName("fvMesh"); diff --git a/src/finiteVolume/fvMesh/fvMeshDistributors/fvMeshDistributor/fvMeshDistributor.C b/src/finiteVolume/fvMesh/fvMeshDistributors/fvMeshDistributor/fvMeshDistributor.C index 279a990491..d76f86f1b0 100644 --- a/src/finiteVolume/fvMesh/fvMeshDistributors/fvMeshDistributor/fvMeshDistributor.C +++ b/src/finiteVolume/fvMesh/fvMeshDistributors/fvMeshDistributor/fvMeshDistributor.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-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -91,4 +91,12 @@ void Foam::fvMeshDistributor::velocityMotionCorrection::update() const } } + +bool Foam::fvMeshDistributor::update() +{ + mesh_.clearGeomNotOldVol(); + return true; +} + + // ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvMeshDistributors/fvMeshDistributor/fvMeshDistributor.H b/src/finiteVolume/fvMesh/fvMeshDistributors/fvMeshDistributor/fvMeshDistributor.H index 7d6ee58daa..478b898ef3 100644 --- a/src/finiteVolume/fvMesh/fvMeshDistributors/fvMeshDistributor/fvMeshDistributor.H +++ b/src/finiteVolume/fvMesh/fvMeshDistributors/fvMeshDistributor/fvMeshDistributor.H @@ -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-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -154,7 +154,7 @@ public: return true; } - //- Update the mesh for both mesh motion and topology change + //- Update the mesh virtual bool update() = 0; //- Update corresponding to the given map diff --git a/src/finiteVolume/fvMesh/fvMeshGeometry.C b/src/finiteVolume/fvMesh/fvMeshGeometry.C index 3b420e0f54..9d5615b577 100644 --- a/src/finiteVolume/fvMesh/fvMeshGeometry.C +++ b/src/finiteVolume/fvMesh/fvMeshGeometry.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 @@ -60,7 +60,7 @@ void Foam::fvMesh::makeSf() const *this, IOobject::NO_READ, IOobject::NO_WRITE, - false + true ), *this, dimArea, @@ -95,7 +95,7 @@ void Foam::fvMesh::makeMagSf() const *this, IOobject::NO_READ, IOobject::NO_WRITE, - false + true ), *this, dimArea, @@ -132,7 +132,7 @@ void Foam::fvMesh::makeC() const *this, IOobject::NO_READ, IOobject::NO_WRITE, - false + true ), *this, dimLength, @@ -170,7 +170,7 @@ void Foam::fvMesh::makeCf() const *this, IOobject::NO_READ, IOobject::NO_WRITE, - false + true ), *this, dimLength, @@ -276,7 +276,7 @@ const Foam::volScalarField::Internal& Foam::fvMesh::V() const *this, IOobject::NO_READ, IOobject::NO_WRITE, - false + true ), *this, dimVolume, diff --git a/src/fvMeshDistributors/distributor/fvMeshDistributorsDistributor.C b/src/fvMeshDistributors/distributor/fvMeshDistributorsDistributor.C index 7c7fd7d94d..f76822b40d 100644 --- a/src/fvMeshDistributors/distributor/fvMeshDistributorsDistributor.C +++ b/src/fvMeshDistributors/distributor/fvMeshDistributorsDistributor.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-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -70,6 +70,9 @@ void Foam::fvMeshDistributors::distributor::distribute // Mesh distribution engine fvMeshDistribute distributor(mesh); + // Clear sliced and other non-distributable mesh data + fvMeshDistributor::update(); + // Do actual sending/receiving of mesh autoPtr map (