56 Foam::Lagrangian::turbulentDispersion::initialiseTurbField
83 template<
class InjectionFieldSourceType,
class Type>
84 void Foam::Lagrangian::turbulentDispersion::completeTurbField
101 InjectionFieldSourceType,
128 modelDict.lookupOrDefault<
label>(
"maxDiscreteEddies", 32)
132 cloud<clouds::carried>().carrierField<scalar>
134 clouds::carried::nameToCarrierName
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)
176 const word& fieldName,
177 const word& eqnFieldName
181 fieldName ==
cloud().
U.name()
183 eqnFieldName ==
cloud().
U.name()
197 if (!isA<drag>(modelList[i]))
continue;
199 if (dragPtr_ !=
nullptr)
202 <<
"Multiple drag models found. Turbulent dispersion "
203 <<
"requires exactly one drag model."
207 dragPtr_ = &refCast<const drag>(modelList[i]);
210 if (dragPtr_ ==
nullptr)
213 <<
"No drag models found. Turbulent dispersion "
214 <<
"requires exactly one drag model."
218 completeTurbField<maxLagrangianScalarFieldSource>(fractionTurb_);
219 completeTurbField<NaNLagrangianScalarFieldSource>(tTurb_);
220 completeTurbField<NaNLagrangianVectorFieldSource>(Uturb_);
257 kc_(subMesh)/
max(epsilonc_(subMesh), rootVSmallEpsilon),
258 Cmu75_*kc_(subMesh)*
sqrt(kc_(subMesh))
259 /
max(epsilonc_(subMesh)*magUrel, rootVSmallEpsilonU)
271 mesh().poly().
boundary().findIndices<wallPolyPatch>().toc()
283 if (!patchIsWall[
patchi])
continue;
285 tTurb[subi] = rootVSmall;
319 auto rndDir = [&
rndGen, &stdNormal]()
323 const scalar z = 2*
rndGen.scalar01() - 1;
324 const scalar r =
sqrt(1 -
sqr(z));
329 const scalar Dt =
max(deltaT[subi], rootVSmall);
333 if (fractionTurb0[subi] < 1)
335 dt += tTurb[subi]*(1 - fractionTurb0[subi]);
337 avgUturbPtr_()[subi] +=
min(dt/Dt, 1)*Uturb0[subi];
341 const scalar nEddies = Dt/tTurb[subi];
342 if (nEddies < maxDiscreteEddies_)
347 Uturb[subi] = rndDir()*magUturb[subi];
350 avgUturbPtr_()[subi] +=
351 (
min(dt + tTurb[subi], Dt) - dt)/Dt*Uturb[subi];
358 fractionTurb[subi] = 1 - (dt - Dt)/tTurb[subi];
363 Uturb[subi] = rndDir()*magUturb[subi];
366 avgUturbPtr_()[subi] +=
373 fractionTurb[subi] = 1;
379 rndGen_.start(!
final);
390 assertCloud<clouds::coupledToConstantDensityFluid>();
392 eqn.
Su += dragPtr_->D(deltaT.
mesh())*avgUturbPtr_();
410 eqn.
Su += dragPtr_->D(deltaT.
mesh())*avgUturbPtr_();
420 avgUturbPtr_.clear();
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const GeoMesh &mesh, const dimensionSet &, const PrimitiveField< Type > &)
Return a temporary field constructed from name, mesh,.
const GeoMesh & mesh() const
Return 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.
Generic GeometricField class.
Sources & sourcesRef()
Return a reference to the sources.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const word & name() const
Return name.
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 Time & time() const
Return time.
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.
Model for turbulent dispersion. This model creates a random turbulent velocity fluctuation based on t...
virtual wordList addSupFields() const
Return the name of the velocity field.
virtual bool addsSupToField(const word &fieldName, const word &eqnFieldName) const
Return true for the velocity or carrier 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.
virtual void preAddSup(const LagrangianSubScalarField &deltaT, const bool final)
Hook before source evaluation.
turbulentDispersion(const word &name, const LagrangianMesh &mesh, const dictionary &modelDict, const dictionary &stateDict)
Construct from components.
virtual void postAddSup(const LagrangianSubScalarField &deltaT, const bool final)
Hook after source evaluation.
const Field0Type & oldTime() const
Return the old-time field.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static Form uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
Mix-in for Lagrangian models that refer to a cloud.
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
Foam::LagrangianModels & LagrangianModels() const
Access the models.
CloudStateField< vector > U
Velocity.
static word nameToCarrierName(const word &name)
Convert a name to its disambiguated carrier equivalent name. I.e.,.
Base class for clouds which are coupled to a constant density fluid.
Base class for clouds which are coupled to a variable density fluid.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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 momentum transport models (RAS, LES and laminar).
virtual tmp< volScalarField > k() const =0
Return the turbulence kinetic energy.
bool headerOk()
Read and check header info.
virtual void writeProcessorState(Ostream &os) const
Write processor state.
A class for managing temporary objects.
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.
defineTypeNameAndDebug(collisionPhaseTransfer, 0)
addToRunTimeSelectionTable(LagrangianModel, collisionPhaseTransfer, dictionary)
const scalar twoPi(2 *pi)
const HashTable< dimensionSet > table
Table of dimensions.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
const dimensionSet & dimless
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 & dimMass
dimensionedScalar sin(const dimensionedScalar &ds)
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Vector< scalar > vector
A scalar version of the templated Vector.
const dimensionSet & dimVelocity
const dimensionSet & dimTime
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< typename powProduct< Type, r >::type, GeoMesh, Field > > pow(const DimensionedField< Type, GeoMesh, PrimitiveField > &df, typename powProduct< Type, r >::type)
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
const dimensionSet & dimEnergy
static const label labelMax
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
dimensionedScalar cos(const dimensionedScalar &ds)
static const label labelMin
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
faceListList boundary(nPatches)
randomGenerator rndGen(653213)