From 0c4722a15d221091df92ad94dd14e170367a0b49 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 15 Jun 2023 11:38:37 +0100 Subject: [PATCH] fvModels::filmCloudTransfer: Added a bool to keep track of the state of the transferred fields This resolves a parallel transfer issue and a potential mesh consistency issue following mesh topology change. --- .../filmCloudTransfer/filmCloudTransfer.C | 20 ++++++++++++++++++- .../filmCloudTransfer/filmCloudTransfer.H | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/filmCloudTransfer.C b/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/filmCloudTransfer.C index 620eca2d72..5e5b847c86 100644 --- a/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/filmCloudTransfer.C +++ b/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/filmCloudTransfer.C @@ -58,6 +58,7 @@ Foam::fv::filmCloudTransfer::filmCloudTransfer : fvModel(sourceName, modelType, mesh, dict), film_(mesh.lookupObject(solver::typeName)), + cloudFieldsTransferred_(false), correctEjection_(false), ejection_ ( @@ -113,7 +114,7 @@ inline Foam::fv::filmCloudTransfer::CloudToFilmTransferRate ) ); - if (prop.size()) + if (cloudFieldsTransferred_) { const fvMesh& cloudMesh = refCast(film_.surfacePatchMap().nbrMesh()); @@ -268,6 +269,8 @@ void Foam::fv::filmCloudTransfer::resetFromCloudFields() pressureFromCloud_ = 0; energyFromCloud_ = 0; + cloudFieldsTransferred_ = true; + // Enable ejection correction on next call to correct() correctEjection_ = true; } @@ -367,6 +370,11 @@ Foam::fv::filmCloudTransfer::CpToCloud() const void Foam::fv::filmCloudTransfer::topoChange(const polyTopoChangeMap& map) { + // Set the cloud field state to false, will be updated by the cloud tracking + // If the film is evaluated before the cloud it would be better + // if the cloud fields were mapped + cloudFieldsTransferred_ = false; + if (ejection_.valid()) { ejection_->topoChange(map); @@ -376,6 +384,11 @@ void Foam::fv::filmCloudTransfer::topoChange(const polyTopoChangeMap& map) void Foam::fv::filmCloudTransfer::mapMesh(const polyMeshMap& map) { + // Set the cloud field state to false, will be updated by the cloud tracking + // If the film is evaluated before the cloud it would be better + // if the cloud fields were mapped + cloudFieldsTransferred_ = false; + if (ejection_.valid()) { ejection_->mapMesh(map); @@ -385,6 +398,11 @@ void Foam::fv::filmCloudTransfer::mapMesh(const polyMeshMap& map) void Foam::fv::filmCloudTransfer::distribute(const polyDistributionMap& map) { + // Set the cloud field state to false, will be updated by the cloud tracking + // If the film is evaluated before the cloud it would be better + // if the cloud fields were mapped + cloudFieldsTransferred_ = false; + if (ejection_.valid()) { ejection_->distribute(map); diff --git a/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/filmCloudTransfer.H b/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/filmCloudTransfer.H index 8f14837245..e7afbaf6b1 100644 --- a/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/filmCloudTransfer.H +++ b/applications/modules/isothermalFilm/fvModels/filmCloudTransfer/filmCloudTransfer.H @@ -70,6 +70,9 @@ class filmCloudTransfer // Transfers from cloud + //- Switch to indicate the cloud fields have been transferred + bool cloudFieldsTransferred_; + scalarField massFromCloud_; vectorField momentumFromCloud_; scalarField pressureFromCloud_;