Skip to content
Snippets Groups Projects
Commit 5d0c0287 authored by andy's avatar andy
Browse files

ENH: lagrangian - caches cell length scale on the cloud

parent 407e46db
Branches
Tags
No related merge requests found
......@@ -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());
}
......
......@@ -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
......
......@@ -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()
......
......@@ -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);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment