47 void Foam::Lagrangian::diskInjection::readCoeffs(
const dictionary& modelDict)
71 const bool haveDiameter = modelDict.found(
"diameter");
72 const bool haveInnerDiameter = modelDict.found(
"innerDiameter");
73 const bool haveOuterDiameter = modelDict.found(
"outerDiameter");
75 if (haveDiameter == (haveInnerDiameter || haveOuterDiameter))
78 <<
"keywords diameter and innerDiameter/outerDiameter are both "
79 << (haveDiameter ?
"" :
"un") <<
"defined in "
80 <<
"dictionary " << modelDict.name()
84 if (haveInnerDiameter != haveOuterDiameter)
87 <<
"keywords innerDiameter and outerDiameter are not both defined "
88 <<
"in dictionary " << modelDict.name()
95 outerDiameter_ = modelDict.lookup<scalar>(
"diameter",
dimLength);
99 innerDiameter_ = modelDict.lookup<scalar>(
"innerDiameter",
dimLength);
100 outerDiameter_ = modelDict.lookup<scalar>(
"outerDiameter",
dimLength);
133 numberRate_(nullptr),
134 numberDeferred_(stateDict.lookupOrDefault<scalar>(
"numberDeferred", 0)),
135 rndGen_(
"rndGen", stateDict,
name, true),
138 readCoeffs(modelDict);
151 *(
sqr(outerDiameter_) -
sqr(innerDiameter_))
159 if (!axisPtr_.valid())
162 <<
"Axis requested outside of the injection"
173 if (!rFracPtr_.valid())
176 <<
"Radius fraction requested outside of the injection"
187 if (!radialPtr_.valid())
190 <<
"Axis requested outside of the injection"
209 timeIndex_ =
time().timeIndex();
213 const scalar number = numberRate_->integral(t0, t1) + numberDeferred_;
214 const label numberInt = floor(number);
215 numberDeferred_ = number - numberInt;
233 (1 - rFrac())*
sqr(innerDiameter_/2)
234 + rFrac()*
sqr(outerDiameter_/2)
247 const pointField positions(centre + r*radial());
251 labelField celli(number, -1), facei(number), faceTrii(number);
264 checkLocation(locations, positions);
332 return injectionMesh;
340 readCoeffs(modelDict);
354 writeEntry(os,
"numberDeferred", numberDeferred_);
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,.
static autoPtr< Function1< Type > > New(const word &name, const Function1s::unitSets &units, const dictionary &dict)
Select from dictionary.
bool set(const Key &, const T &newElmt)
Set a new hashedEntry, overwriting existing entries.
Base class for Lagrangian injections. Minimal wrapper over LagrangianSource. Implements some utility ...
Class containing Lagrangian geometry and topology.
const Time & time() const
Return time.
static const word fractionName
Name of the tracked fraction field.
Base class for Lagrangian models.
const Time & time() const
Return time.
virtual bool read(const dictionary &modelDict)
Read dictionary.
const LagrangianMesh & mesh() const
The mesh.
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
Disk injection model. This injects particles continuously over a disk with a given number rate....
const LagrangianSubVectorField & radial() const
Access the cached radial vectors. Only valid during injection.
virtual void writeState(Ostream &os) const
Write state.
LagrangianSubMesh modify(LagrangianMesh &mesh, const LagrangianSubMesh &) const
Create new elements in the Lagrangian mesh.
diskInjection(const word &name, const LagrangianMesh &mesh, const dictionary &modelDict, const dictionary &stateDict)
Construct from components.
const LagrangianSubVectorField & axis() const
Access the cached axes. Only valid during injection.
const dimensionedScalar area() const
Return the area of the disk.
virtual bool read(const dictionary &modelDict)
Read dictionary.
const LagrangianSubScalarField & rFrac() const
Access the cached radius fractions. Only valid during injection.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
dimensionedScalar deltaT() const
Return time step.
const unitSet & userUnits() const
Return the user-time unit conversion.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
const Type & value() const
Return const reference to value.
const Time & time() const
Return the top-level database.
void clear()
Remove all regIOobject owned by the registry.
bool writeState(const bool write) const
Write state.
A class for managing temporary objects.
void clear() const
If object pointer points to valid object:
T & ref() const
Return non-const reference or generate a fatal error.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
defineTypeNameAndDebug(collisionPhaseTransfer, 0)
addToRunTimeSelectionTable(LagrangianModel, collisionPhaseTransfer, dictionary)
const scalar twoPi(2 *pi)
barycentric coordinates(const polyMesh &mesh, const point &position, const label celli, const label facei, const label faceTrii, const scalar stepFraction)
Return the coordinates given the position and tet topology.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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 & dimLength
dimensionedScalar sin(const dimensionedScalar &ds)
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensionSet normalised(const dimensionSet &)
const dimensionSet & dimRate
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
const dimensionSet & dimArea
dimensionSet perpendicular(const dimensionSet &)
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)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.