44 void Foam::Lagrangian::pointInjection::readCoeffs(
const dictionary& modelDict)
51 mesh().time().userUnits(),
62 mesh().time().userUnits(),
70 injectionLocation_ = injectionLocation::unset;
87 numberDeferred_(stateDict.lookupOrDefault<scalar>(
"numberDeferred", 0)),
88 rndGen_(
"rndGen", stateDict,
name, true),
90 injectionLocation_(injectionLocation::unset),
96 readCoeffs(modelDict);
106 if (
mesh().
mesh().moving() || !point_->constant())
109 injectionLocation::multiplePoints;
116 injectionLocation_ == injectionLocation::unset
117 || injectionLocation_ == injectionLocation::multiplePoints
124 const point p = point_->value(t0);
128 mesh().locate(
p, coordinates_, celli_, facei_, faceTrii_, 0);
136 ? injectionLocation::fixedPointOnThisProcessor
137 : injectionLocation::fixedPointOnAnotherProcessor;
152 rndGen_.start(timeIndex_ == db().time().
timeIndex());
153 timeIndex_ = db().time().timeIndex();
157 const scalar number = numberRate_->integral(t0, t1) + numberDeferred_;
158 const label numberInt = floor(number);
159 numberDeferred_ = number - numberInt;
165 switch (injectionLocation_)
167 case injectionLocation::unset:
169 <<
"Injection location has not been set"
173 case injectionLocation::fixedPointOnThisProcessor:
189 case injectionLocation::fixedPointOnAnotherProcessor:
207 case injectionLocation::multiplePoints:
210 const pointField positions(point_->value(t0 + fraction*(t1 - t0)));
214 labelField celli(numberInt), facei(numberInt), faceTrii(numberInt);
227 checkLocation(locations, positions);
230 filter(
coordinates, celli, facei, faceTrii, fraction);
253 injectionLocation_ = injectionLocation::unset;
259 injectionLocation_ = injectionLocation::unset;
265 injectionLocation_ = injectionLocation::unset;
273 readCoeffs(modelDict);
287 writeEntry(os,
"numberDeferred", numberDeferred_);
Macros for easy insertion into run-time selection tables.
static autoPtr< Function1< Type > > New(const word &name, const Function1s::unitConversions &units, const dictionary &dict)
Select from dictionary.
Base class for Lagrangian injections. Minimal wrapper over LagrangianSource. Implements some utility ...
Class containing Lagrangian geometry and topology.
location
Enumeration for the locations of searched positions.
static const word fractionName
Name of the tracked fraction field.
Base class for Lagrangian models.
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...
pointInjection(const word &name, const LagrangianMesh &mesh, const dictionary &modelDict, const dictionary &stateDict)
Construct from components.
virtual void correct()
Correct the LagrangianModel.
virtual void writeState(Ostream &os) const
Write state.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
LagrangianSubMesh modify(LagrangianMesh &mesh, const LagrangianSubMesh &) const
Create new elements in the Lagrangian mesh.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual bool read(const dictionary &modelDict)
Read dictionary.
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.
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.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
bool writeState(const bool write) const
Write 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)
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)
Field< barycentric > barycentricField
Barycentric field.
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 dimRate
const dimensionSet dimLength
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Field< label > labelField
Specialisation of Field<T> for label.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.