56 Foam::Lagrangian::turbulentDispersion::initialiseTurbField
64 cloud().stateField<Type>
82 template<
class InjectionFieldSourceType,
class Type>
83 void Foam::Lagrangian::turbulentDispersion::completeTurbField
88 if (turbField.first())
return;
90 turbField.first() =
true;
94 turbField.second().sourcesRef().table().
transfer
102 InjectionFieldSourceType,
128 modelDict.lookupOrDefault<
label>(
"maxDiscreteEddies", 32)
132 cloud<clouds::coupled>().carrierField<scalar>
134 clouds::coupled::carrierName
136 momentumTransportModel_.
k()().
name()
140 return momentumTransportModel_.
k();
150 momentumTransportModel_.epsilon()().name()
154 return momentumTransportModel_.epsilon();
158 fractionTurb_(initialiseTurbField(
"fractionTurb",
dimless, vGreat)),
159 tTurb_(initialiseTurbField(
"tTurb",
dimTime, NaN)),
161 rndGen_(
"rndGen", stateDict,
name,
false),
162 avgUturbPtr_(
nullptr)
182 if (!isA<drag>(modelList[i]))
continue;
184 if (dragPtr_ !=
nullptr)
187 <<
"Multiple drag models found. Turbulent dispersion "
188 <<
"requires exactly one drag model."
192 dragPtr_ = &refCast<const drag>(modelList[i]);
195 if (dragPtr_ ==
nullptr)
198 <<
"No drag models found. Turbulent dispersion "
199 <<
"requires exactly one drag model."
203 completeTurbField<maxLagrangianScalarFieldSource>(fractionTurb_);
204 completeTurbField<NaNLagrangianScalarFieldSource>(tTurb_);
205 completeTurbField<NaNLagrangianVectorFieldSource>(Uturb_);
219 fractionTurb_.second().ref(subMesh);
243 kc_(subMesh)/
max(epsilonc_(subMesh), rootVSmallEpsilon),
244 Cmu75_*kc_(subMesh)*
sqrt(kc_(subMesh))
245 /
max(epsilonc_(subMesh)*magUrel, rootVSmallEpsilonU)
257 mesh().
mesh().boundaryMesh().findIndices<wallPolyPatch>().toc()
269 if (!patchIsWall[
patchi])
continue;
271 tTurb[subi] = rootVSmall;
305 auto rndDir = [&
rndGen, &stdNormal]()
309 const scalar z = 2*
rndGen.scalar01() - 1;
310 const scalar r =
sqrt(1 -
sqr(z));
315 const scalar Dt =
max(deltaT[subi], rootVSmall);
319 if (fractionTurb0[subi] < 1)
321 dt += tTurb[subi]*(1 - fractionTurb0[subi]);
323 avgUturbPtr_()[subi] +=
min(dt/Dt, 1)*Uturb0[subi];
327 const scalar nEddies = Dt/tTurb[subi];
328 if (nEddies < maxDiscreteEddies_)
333 Uturb[subi] = rndDir()*magUturb[subi];
336 avgUturbPtr_()[subi] +=
337 (
min(dt + tTurb[subi], Dt) - dt)/Dt*Uturb[subi];
344 fractionTurb[subi] = 1 - (dt - Dt)/tTurb[subi];
349 Uturb[subi] = rndDir()*magUturb[subi];
352 avgUturbPtr_()[subi] +=
359 fractionTurb[subi] = 1;
365 rndGen_.start(!
final);
376 assertCloud<clouds::coupledToIncompressibleFluid>();
378 eqn.
Su += dragPtr_->D(deltaT.
mesh())*avgUturbPtr_();
390 assertCloud<clouds::coupledToIncompressibleFluid, clouds::coupledToFluid>();
392 eqn.
Su += dragPtr_->D(deltaT.
mesh())*avgUturbPtr_();
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
A field which is stored as part of the state of the cloud. This is a light wrapper around a dynamic L...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const Mesh & mesh() const
Return mesh.
void reset(const DimensionedField< Type, GeoMesh, PrimitiveField2 > &)
Reset the field values to the given field.
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Mesh &mesh, const dimensionSet &, const PrimitiveField< Type > &)
Return a temporary field constructed from name, mesh,.
Part of a geometric field used for setting the values associated with optional sources.
const HashPtrTable< Source > & table() const
Access the underlying field table.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
This class stores the coefficients of a Lagrangian equation, and facilitates solving that equation an...
LagrangianCoeff< Type, false > Su
Explicit coefficient.
Base class for Lagrangian injections. Minimal wrapper over LagrangianSource. Implements some utility ...
Class containing Lagrangian geometry and topology.
Base class for Lagrangian models.
const LagrangianMesh & mesh() const
The mesh.
const word & name() const
The source name.
List of Lagrangian models, constructed as a (Lagrangian) mesh object. Provides similar functions to t...
HashTable< word > modelTypeFieldSourceTypes() const
Return a table of field source types that are chosen to match given.
Base class for Lagrangian sources. Minimal wrapper over LagrangianModel that provides an interface to...
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
label start() const
Return start.
virtual wordList addSupFields() const
Return the name of the velocity field.
virtual void postConstruct()
Do post construction steps which require access to other models.
virtual void addSup(const LagrangianSubScalarField &deltaT, const LagrangianSubVectorSubField &U, LagrangianEqn< vector > &eqn) const
Add a source term to the velocity equation.
virtual void writeProcessorState(Ostream &os) const
Write state.
turbulentDispersion(const word &name, const LagrangianMesh &mesh, const dictionary &modelDict, const dictionary &stateDict)
Construct from components.
virtual void calculate(const LagrangianSubScalarField &deltaT, const bool final)
Solve equations and/or update continually changing properties.
const Field0Type & oldTime() const
Return the old-time field.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A 2-tuple for storing two objects of different types.
static Form uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
Base class for Lagrangian models that refer to a cloud. Not a Lagrangian model in itself....
const Cloud & cloud() const
Get a reference to the cloud.
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
Foam::LagrangianModels & LagrangianModels() const
Access the models.
static word carrierName(const word &name)
Modify a name to disambiguate it as relating to the carrier.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
void transfer(dictionary &)
Transfer the contents of the argument and annul the argument.
Dimension set for the base types.
Generic dimensioned Type class.
Standard normal distribution. Not selectable.
virtual scalar sample() const
Sample the distribution.
This source condition retains the internal value.
Abstract base class for turbulence models (RAS, LES and laminar).
virtual tmp< volScalarField > k() const =0
Return the turbulence kinetic energy.
virtual void writeProcessorState(Ostream &os) const
Write processor state.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
addToRunTimeSelectionTable(LagrangianModel, constantCoefficientVirtualMass, dictionary)
defineTypeNameAndDebug(constantCoefficientVirtualMass, 0)
const scalar twoPi(2 *pi)
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const dimensionSet dimEnergy
const dimensionSet dimless
dimensionedScalar sin(const dimensionedScalar &ds)
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimTime
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Vector< scalar > vector
A scalar version of the templated Vector.
void pow(LagrangianPatchField< typename powProduct< Type, r >::type > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
const dimensionSet dimMass
const dimensionSet dimVelocity
static const label labelMax
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
dimensionedScalar cos(const dimensionedScalar &ds)
static const label labelMin
randomGenerator rndGen(653213)