From ab92fc5a3918dc4a4f67a4dcb094c957f686eb56 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 13 Jul 2022 16:21:05 +0100 Subject: [PATCH] fvMesh: Moved functionObject mesh change updates from polyMesh -> fvMesh Many functionObjects operate on fvMesh objects, in particular vol and surface fields and they cannot be updated in polyMesh as they depend on fvMesh data which is updated after polyMesh. --- src/OpenFOAM/meshes/polyMesh/polyMesh.C | 5 ----- src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C | 4 ---- src/finiteVolume/fvMesh/fvMesh.C | 8 ++++++++ .../fieldValues/surfaceFieldValue/surfaceFieldValue.C | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index 2424630c75..ac506bde4f 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -1335,8 +1335,6 @@ void Foam::polyMesh::setPoints(const pointField& newPoints) meshObject::movePoints(*this); meshObject::movePoints(*this); - - const_cast(time()).functionObjects().movePoints(*this); } @@ -1415,9 +1413,6 @@ Foam::tmp Foam::polyMesh::movePoints meshObject::movePoints(*this); meshObject::movePoints(*this); - const_cast(time()).functionObjects().movePoints(*this); - - if (debug && moveError) { // Write mesh to ease debugging. Note we want to avoid calling diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C index b5125336b8..0afb71f7e5 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C @@ -122,8 +122,6 @@ void Foam::polyMesh::topoChange(const polyTopoChangeMap& map) // Reset valid directions (could change by faces put into empty patches) geometricD_ = Zero; solutionD_ = Zero; - - const_cast(time()).functionObjects().topoChange(map); } @@ -131,8 +129,6 @@ void Foam::polyMesh::mapMesh(const polyMeshMap& map) { meshObject::mapMesh(*this, map); meshObject::mapMesh(*this, map); - - const_cast(time()).functionObjects().mapMesh(map); } diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index cb667371dd..30c536b272 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -1021,6 +1021,8 @@ void Foam::fvMesh::setPoints(const pointField& p) meshObject::movePoints(*this); meshObject::movePoints(*this); + + const_cast(time()).functionObjects().movePoints(*this); } @@ -1104,6 +1106,8 @@ Foam::tmp Foam::fvMesh::movePoints(const pointField& p) meshObject::movePoints(*this); meshObject::movePoints(*this); + const_cast(time()).functionObjects().movePoints(*this); + return tsweptVols; } @@ -1202,6 +1206,8 @@ void Foam::fvMesh::topoChange(const polyTopoChangeMap& map) meshObject::topoChange(*this, map); meshObject::topoChange(*this, map); + const_cast(time()).functionObjects().topoChange(map); + if (topoChanger_.valid()) { topoChanger_->topoChange(map); @@ -1236,6 +1242,8 @@ void Foam::fvMesh::mapMesh(const polyMeshMap& map) meshObject::mapMesh(*this, map); meshObject::mapMesh(*this, map); + const_cast(time()).functionObjects().mapMesh(map); + topoChanger_->mapMesh(map); distributor_->mapMesh(map); mover_->mapMesh(map); diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C index ac5d4e58e6..efc824304e 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C @@ -836,7 +836,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::movePoints if (&mesh == &mesh_) { // It may be necessary to reset if the mesh moves - // initialise(dict_); + initialise(dict_); } }