33template<
class CloudType>
44template<
class CloudType>
56template<
class CloudType>
63template<
class CloudType>
64Foam::scalar Foam::IsotropyModels::Stochastic<CloudType>::sampleGauss()
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);
99template<
class CloudType>
103 const scalar deltaT(this->owner().db().time().deltaTValue());
106 const scalar oneBySqrtThree =
sqrt(1.0/3.0);
108 const auto& volumeAverage =
113 const auto& radiusAverage =
118 const auto& uAverage =
123 const auto& uSqrAverage =
128 const auto& frequencyAverage =
133 const auto& massAverage =
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
195 this->owner().db().time().
timeName(),
198 this->owner().solution().
dict(),
202 AveragingMethod<vector>& uTildeAverage = uTildeAveragePtr();
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
217 this->owner().db().time().
timeName(),
220 this->owner().solution().
dict(),
224 AveragingMethod<scalar>& uTildeSqrAverage = uTildeSqrAveragePtr();
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);
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);
Base class for lagrangian averaging methods.
virtual void add(const barycentric &coordinates, const tetIndices &tetIs, const Type &value)=0
Member Functions.
static autoPtr< AveragingMethod< Type > > New(const IOobject &io, const dictionary &dict, const fvMesh &mesh)
Selector.
virtual void average()
Calculate the average.
virtual Type interpolate(const barycentric &coordinates, const tetIndices &tetIs) const =0
Interpolate.
const CloudType & owner() const
Return const access to the owner cloud.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
IsotropyModel(CloudType &owner)
Construct null from owner.
autoPtr< TimeScaleModel > timeScaleModel_
Time scale model.
Stochastic return-to-isotropy model.
virtual ~Stochastic()
Destructor.
Stochastic(const dictionary &dict, CloudType &owner)
Construct from components.
virtual void calculate()
Member Functions.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Volume discretisation.
Selector class for relaxation factors, solver type and solution.
const dictionary & dict() const
Return const access to the cloud dictionary.
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
DSMCCloud< dsmcParcel > CloudType
dimensionedScalar exp(const dimensionedScalar &ds)
dimensionedScalar log(const dimensionedScalar &ds)
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)