diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index dc42e0f9db6267e8a75dff92eed00ce8706a44e8..42cced7658919002b4468a82a60d115e04ac1899 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<CloudType>::KinematicCloud : -1 ), cellOccupancyPtr_(), + cellLengthScale_(cbrt(mesh_.V())), rho_(rho), U_(U), mu_(mu), @@ -421,6 +422,7 @@ Foam::KinematicCloud<CloudType>::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<CloudType>::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<CloudType>::patchData template<class CloudType> void Foam::KinematicCloud<CloudType>::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 e32a3bdf4ff4e4aa58cfebdce6c1fc4c385ac95a..9c2a75157b9f562aed954c1bba148b7f6ed5303b 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<List<DynamicList<parcelType*> > > 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<DynamicList<parcelType*> >& 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 1bbf47b41a553037757ef18001e7671d0864041f..ed0f74793f4cbbbbaae5ec393fef45ce001aedf7 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<CloudType>::cellOccupancy() } +template<class CloudType> +inline const Foam::scalarField& +Foam::KinematicCloud<CloudType>::cellLengthScale() const +{ + return cellLengthScale_; +} + + template<class CloudType> inline Foam::DimensionedField<Foam::vector, Foam::volMesh>& Foam::KinematicCloud<CloudType>::UTrans() diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index b8339628257adc84672f39d2a93bb95a7b7419c2..22e01b9a98ced336dbbfb5e0745ed8cc93034a69 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<ParcelType>::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<ParcelType>::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);