53 void Foam::Lagrangian::collisionPhaseTransfer::addSupType
57 LagrangianEqn<scalar>& eqn
60 const LagrangianSubMesh& subMesh = deltaT.mesh();
61 const SubList<LagrangianState> subStates = subMesh.sub(
mesh().states());
66 if (sumDeltaTSp_.valid()) sumDeltaTSp_.ref() += PhitPtr_();
69 eqn.deltaTSp -= PhitPtr_();
74 tmp<LagrangianSubScalarField> deltaTSu = PhitPtr_()*vOrM;
81 deltaTSu.ref()[subi] *= 1 + 1/
max(sumDeltaTSp_()[subi], small);
86 eqn.deltaTSu -= deltaTSu;
92 void Foam::Lagrangian::collisionPhaseTransfer::addSupType
95 const LagrangianSubSubField<Type>& field,
96 LagrangianEqn<Type>& eqn
100 <<
"The Lagrangian model '" <<
name() <<
"' of cloud '"
101 <<
mesh().
name() <<
"' cannot add a transfer for the field '"
102 << field.name() <<
"' because the equation is not volume or "
108 void Foam::Lagrangian::collisionPhaseTransfer::addSupType
112 const LagrangianSubSubField<Type>& field,
113 LagrangianEqn<Type>& eqn
116 const LagrangianSubMesh& subMesh = deltaT.mesh();
117 const SubList<LagrangianState> subStates = subMesh.sub(
mesh().states());
119 if (eqn.isPsi(field))
122 eqn.deltaTSp -= PhitPtr_()*vOrM;
127 tmp<LagrangianSubField<Type>> deltaTSu = PhitPtr_()*vOrM*field;
134 deltaTSu.ref()[subi] *= 1 + 1/
max(sumDeltaTSp_()[subi], small);
139 eqn.deltaTSu -= deltaTSu;
158 isCloud<clouds::grouped>()
164 cloud<clouds::carried>().carrierField
171 cloud<clouds::carried>().carrierPhaseName()
176 rndGen_(
"rndGen", stateDict,
name, false),
187 const bool isGrouped = isCloud<clouds::grouped>();
191 result[isGrouped ? 1 : 0] =
192 isCloud<clouds::massive>()
202 const word& fieldName,
203 const word& eqnFieldName
209 const bool isCarrierEqn = eqnMember[eqnMember.size() - 1] ==
'c';
227 auto sampleUniform01 = [&]()
235 rndGen_.sample01<scalar>(subMesh.
size())
239 auto sampleStandardNormal = [&]()
244 "sampleStandardNormal",
277 max(
mag(alphac_.grad(subMesh)), rootVSmall/L)
279 /
max(alphac_(subMesh), rootVSmall)
286 if (!isCloud<clouds::grouped>())
288 Phit =
pos(Phit - sampleUniform01());
302 Phit.
maxMin(scalar(0), scalar(1));
303 Phit +=
sqrt(Phit*(1 - Phit)/number)*sampleStandardNormal();
304 Phit.
maxMin(scalar(0), scalar(1));
309 Phit *=
pos(Phit - minFraction_/
max(number, scalar(1)));
314 rndGen_.start(!
final);
332 const word& fieldName,
385 Lagrangian::collisionPhaseTransfer
392 Lagrangian::collisionPhaseTransfer
404 if (
final) sumDeltaTSp_.clear();
#define IMPLEMENT_LAGRANGIAN_MODEL_ADD_FIELD_SUP(Type, modelType)
#define IMPLEMENT_LAGRANGIAN_MODEL_ADD_V_OR_M_FIELD_SUP(Type, modelType)
Functions for calculating sources in a Lagrangian equation.
#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,.
void maxMin(const dimensioned< Type > &minDt, const dimensioned< Type > &maxDt)
Clip the field to between two values.
const GeoMesh & mesh() const
Return mesh.
Generic GeometricField class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
word group() const
Return group (extension part of name)
word member() const
Return member (name without the extension)
This class stores the coefficients of a Lagrangian equation, and facilitates solving that equation an...
LagrangianCoeff< scalar, true > deltaTSp
Implicit time-coefficient.
Class containing Lagrangian geometry and topology.
const labelIODynamicField & celli() const
Access the cell indices.
const polyMesh & poly() const
Access the poly mesh.
Base class for Lagrangian models.
const LagrangianMesh & mesh() const
The mesh.
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 size() const
Return size.
const LagrangianMesh & mesh() const
Return the mesh.
word sub(const word &fieldName) const
Return the name of a field corresponding to this sub-mesh.
Model to represent the absorption of droplets or bubbles into a corresponding Eulerian phase as a res...
virtual void addSup(const LagrangianSubScalarField &deltaT, LagrangianEqn< scalar > &eqn) const
Add a fractional source term.
virtual wordList addSupFields() const
Return the name of the volume or mass field.
virtual bool addsSupToField(const word &fieldName, const word &eqnFieldName) const
Return true if this is a Lagrangian field or a field of the.
virtual tmp< LagrangianSubScalarField > source(const word &fieldName, const LagrangianSubMesh &subMesh) const
Return the source value.
collisionPhaseTransfer(const word &name, const LagrangianMesh &mesh, const dictionary &modelDict, const dictionary &stateDict)
Construct from components.
virtual void writeProcessorState(Ostream &os) const
Write state.
virtual void preAddSup(const LagrangianSubScalarField &deltaT, const bool final)
Hook before source evaluation.
virtual void postAddSup(const LagrangianSubScalarField &deltaT, const bool final)
Add a source term to an equation.
virtual void calculate(const LagrangianSubScalarField &deltaT, const bool final)
Update the transfer rate and remove any consumed particles.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A List obtained as a section of another List.
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...
static const word mName
Name of mass fields.
static const word vName
Name of volume fields.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Standard normal distribution. Not selectable.
virtual scalar sample() const
Sample the distribution.
const word & name() const
Return reference to name.
const scalarField & cellVolumes() const
virtual void writeProcessorState(Ostream &os) const
Write processor state.
A class for managing temporary objects.
A class for handling words, derived from string.
static const word null
An empty word.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
defineTypeNameAndDebug(collisionPhaseTransfer, 0)
addToRunTimeSelectionTable(LagrangianModel, collisionPhaseTransfer, dictionary)
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar pos(const dimensionedScalar &ds)
const dimensionSet & dimless
const dimensionSet & dimLength
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
void cbrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
LagrangianSubSubField< scalar > LagrangianSubScalarSubField
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
static const label labelMax
LagrangianSubField< scalar > LagrangianSubScalarField
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
static const label labelMin
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.