55 Foam::Lagrangian::turbulentDispersion::initialiseTurbField
63 cloud().stateField<Type>
81 template<
class InjectionFieldSourceType,
class Type>
82 void Foam::Lagrangian::turbulentDispersion::completeTurbField
87 if (turbField.first())
return;
89 turbField.first() =
true;
93 turbField.second().sourcesRef().table().
transfer
101 InjectionFieldSourceType,
126 cloud<clouds::coupled>().carrierField<scalar>
128 clouds::coupled::carrierName
130 momentumTransportModel_.
k()().
name()
134 return momentumTransportModel_.
k();
144 momentumTransportModel_.epsilon()().name()
148 return momentumTransportModel_.epsilon();
152 fractionTurb_(initialiseTurbField(
"fractionTurb",
dimless, vGreat)),
153 tTurb_(initialiseTurbField(
"tTurb",
dimTime, NaN)),
155 rndGen_(
"rndGen", stateDict,
name,
false),
156 avgUturbPtr_(
nullptr)
176 if (!isA<drag>(modelList[i]))
continue;
178 if (dragPtr_ !=
nullptr)
181 <<
"Multiple drag models found. Turbulent dispersion "
182 <<
"requires exactly one drag model."
186 dragPtr_ = &refCast<const drag>(modelList[i]);
189 if (dragPtr_ ==
nullptr)
192 <<
"No drag models found. Turbulent dispersion "
193 <<
"requires exactly one drag model."
197 completeTurbField<maxLagrangianScalarFieldSource>(fractionTurb_);
198 completeTurbField<NaNLagrangianScalarFieldSource>(tTurb_);
199 completeTurbField<NaNLagrangianVectorFieldSource>(Uturb_);
213 fractionTurb_.second().ref(subMesh);
238 kc_(subMesh)/
max(epsilonc_(subMesh), rootVSmallEpsilon),
239 cps*kc_(subMesh)*
sqrt(kc_(subMesh))
240 /
max(epsilonc_(subMesh)*magUrel, rootVSmallEpsilonU)
275 const scalar Dt =
max(deltaT[subi], rootVSmall);
279 if (fractionTurb0[subi] < 1)
281 dt += tTurb[subi]*(1 - fractionTurb0[subi]);
283 avgUturbPtr_()[subi] +=
min(dt/Dt, 1)*Uturb0[subi];
289 const scalar dtPrev = dt;
295 const scalar u = 2*
rndGen.scalar01() - 1;
296 const scalar a =
sqrt(1 -
sqr(u));
300 Uturb[subi] = dir*stdNormal.
sample()*magUturb[subi];
303 avgUturbPtr_()[subi] += (
min(dt, Dt) - dtPrev)/Dt*Uturb[subi];
307 fractionTurb[subi] = 1 - (dt - Dt)/tTurb[subi];
312 rndGen_.start(!
final);
323 assertCloud<clouds::coupledToIncompressibleFluid>();
325 eqn.
Su += dragPtr_->D(deltaT.
mesh())*avgUturbPtr_();
337 assertCloud<clouds::coupledToIncompressibleFluid, clouds::coupledToFluid>();
339 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.
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...
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.
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)
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)