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.
This commit is contained in:
Henry Weller
2023-06-15 11:38:37 +01:00
parent b6c34fd361
commit 0c4722a15d
2 changed files with 22 additions and 1 deletions

View File

@ -58,6 +58,7 @@ Foam::fv::filmCloudTransfer::filmCloudTransfer
:
fvModel(sourceName, modelType, mesh, dict),
film_(mesh.lookupObject<solvers::isothermalFilm>(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<const fvMesh>(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);

View File

@ -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_;