diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index dc42e0f9db..42cced7658 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -321,6 +321,7 @@ Foam::KinematicCloud::KinematicCloud : -1 ), cellOccupancyPtr_(), + cellLengthScale_(cbrt(mesh_.V())), rho_(rho), U_(U), mu_(mu), @@ -421,6 +422,7 @@ Foam::KinematicCloud::KinematicCloud subModelProperties_(c.subModelProperties_), rndGen_(c.rndGen_, true), cellOccupancyPtr_(NULL), + cellLengthScale_(c.cellLengthScale_), rho_(c.rho_), U_(c.U_), mu_(c.mu_), @@ -511,6 +513,7 @@ Foam::KinematicCloud::KinematicCloud subModelProperties_(dictionary::null), rndGen_(0, 0), cellOccupancyPtr_(NULL), + cellLengthScale_(c.cellLengthScale_), rho_(c.rho_), U_(c.U_), mu_(c.mu_), @@ -842,7 +845,9 @@ void Foam::KinematicCloud::patchData template void Foam::KinematicCloud::updateMesh() { + updateCellOccupancy(); injectors_.updateMesh(); + cellLengthScale_ = cbrt(mesh_.V()); } diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index e32a3bdf4f..9c2a75157b 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -165,6 +165,9 @@ protected: //- Cell occupancy information for each parcel, (demand driven) autoPtr > > cellOccupancyPtr_; + //- Cell length scale + scalarField cellLengthScale_; + // References to the carrier gas fields @@ -368,6 +371,9 @@ public: // if particles are removed or created. inline List >& cellOccupancy(); + //- Return the cell length scale + inline const scalarField& cellLengthScale() const; + // References to the carrier gas fields diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index 1bbf47b41a..ed0f74793f 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -517,6 +517,14 @@ Foam::KinematicCloud::cellOccupancy() } +template +inline const Foam::scalarField& +Foam::KinematicCloud::cellLengthScale() const +{ + return cellLengthScale_; +} + + template inline Foam::DimensionedField& Foam::KinematicCloud::UTrans() diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index b833962825..22e01b9a98 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -265,7 +265,7 @@ bool Foam::KinematicParcel::move const polyMesh& mesh = td.cloud().pMesh(); const polyBoundaryMesh& pbMesh = mesh.boundaryMesh(); - const scalarField& V = mesh.cellVolumes(); + const scalarField& cellLengthScale = td.cloud().cellLengthScale(); const scalar maxCo = td.cloud().solution().maxCo(); scalar tEnd = (1.0 - p.stepFraction())*trackTime; @@ -290,7 +290,7 @@ bool Foam::KinematicParcel::move if (p.active() && moving && (magU > ROOTVSMALL)) { const scalar d = dt*magU; - const scalar dCorr = min(d, maxCo*cbrt(V[cellI])); + const scalar dCorr = min(d, maxCo*cellLengthScale[cellI]); dt *= dCorr/d *p.trackToFace(p.position() + dCorr*U_/magU, td);