33 template<
class CloudType>
44 template<
class CloudType>
56 template<
class CloudType>
63 template<
class CloudType>
66 static bool isCached =
true;
67 static scalar xCached;
77 Random&
rndGen = this->owner().rndGen();
83 x = 2.0*
rndGen.sample01<scalar>() - 1.0;
84 y = 2.0*
rndGen.sample01<scalar>() - 1.0;
86 }
while (m >= 1.0 || m == 0.0);
99 template<
class CloudType>
103 const scalar deltaT(this->owner().db().time().deltaTValue());
106 const scalar oneBySqrtThree =
sqrt(1.0/3.0);
111 this->owner().name() +
":volumeAverage" 116 this->owner().name() +
":radiusAverage" 121 this->owner().name() +
":uAverage" 126 this->owner().name() +
":uSqrAverage" 131 this->owner().name() +
":frequencyAverage" 136 this->owner().name() +
":massAverage" 146 this->owner().
name() +
":exponentAverage",
147 this->owner().db().time().
timeName(),
159 *this->timeScaleModel_->oneByTau
173 const scalar
x = exponentAverage.
interpolate(
p.coordinates(), tetIs);
175 if (
x <
rndGen.sample01<scalar>())
177 const vector r(sampleGauss(), sampleGauss(), sampleGauss());
183 p.U() = u + r*uRms*oneBySqrtThree;
188 autoPtr<AveragingMethod<vector>> uTildeAveragePtr
194 this->owner().
name() +
":uTildeAverage",
195 this->owner().db().time().
timeName(),
198 this->owner().solution().
dict(),
202 AveragingMethod<vector>& uTildeAverage = uTildeAveragePtr();
203 for (
typename CloudType::parcelType&
p : this->owner())
205 const tetIndices tetIs(
p.currentTetIndices());
206 uTildeAverage.add(
p.coordinates(), tetIs,
p.nParticle()*
p.mass()*
p.U());
208 uTildeAverage.average(massAverage);
210 autoPtr<AveragingMethod<scalar>> uTildeSqrAveragePtr
216 this->owner().
name() +
":uTildeSqrAverage",
217 this->owner().db().time().
timeName(),
220 this->owner().solution().
dict(),
224 AveragingMethod<scalar>& uTildeSqrAverage = uTildeSqrAveragePtr();
225 for (
typename CloudType::parcelType&
p : this->owner())
227 const tetIndices tetIs(
p.currentTetIndices());
228 const vector uTilde = uTildeAverage.interpolate(
p.coordinates(), tetIs);
233 p.nParticle()*
p.mass()*
magSqr(
p.U() - uTilde)
236 uTildeSqrAverage.average(massAverage);
239 for (
typename CloudType::parcelType&
p : this->owner())
241 const tetIndices tetIs(
p.currentTetIndices());
247 const vector uTilde = uTildeAverage.interpolate(
p.coordinates(), tetIs);
248 const scalar uTildeRms =
251 max(uTildeSqrAverage.interpolate(
p.coordinates(), tetIs), 0.0)
254 p.U() = u + (
p.U() - uTilde)*uRms/
max(uTildeRms, SMALL);
dimensionedScalar log(const dimensionedScalar &ds)
static autoPtr< AveragingMethod< scalar > > New(const IOobject &io, const dictionary &dict, const fvMesh &mesh)
Selector.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Stochastic return-to-isotropy model.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedScalar sqrt(const dimensionedScalar &ds)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
dimensionedScalar exp(const dimensionedScalar &ds)
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
Stochastic(const dictionary &dict, CloudType &owner)
Construct from components.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Base class for collisional return-to-isotropy models.
virtual ~Stochastic()
Destructor.
virtual Type interpolate(const barycentric &coordinates, const tetIndices &tetIs) const =0
Interpolate.
virtual void calculate()
Member Functions.
Mesh data needed to do the Finite Volume discretisation.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Selector class for relaxation factors, solver type and solution.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Templated base class for dsmc cloud.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)