36template<
class CloudType>
46 phiName_(this->
coeffDict().template getOrDefault<
word>(
"phi",
"phi")),
47 rhoName_(this->
coeffDict().template getOrDefault<
word>(
"rho",
"rho")),
48 duration_(this->
coeffDict().getScalar(
"duration")),
60 this->
coeffDict().getScalar(
"parcelConcentration")
66 this->
coeffDict().subDict(
"sizeDistribution"),
74 concentration_->userTimeToTime(time);
87template<
class CloudType>
95 phiName_(im.phiName_),
96 rhoName_(im.rhoName_),
97 duration_(im.duration_),
98 concentration_(im.concentration_.clone()),
99 parcelConcentration_(im.parcelConcentration_),
100 sizeDistribution_(im.sizeDistribution_.
clone())
106template<
class CloudType>
113template<
class CloudType>
120template<
class CloudType>
123 return this->
SOI_ + duration_;
127template<
class CloudType>
136 scalar flowRateIn = 0.0;
139 flowRateIn =
max(0.0, -
sum(phip));
146 flowRateIn =
max(0.0, -
sum(phip/rhop));
155template<
class CloudType>
162 if ((time0 >= 0.0) && (time0 < duration_))
164 scalar dt = time1 - time0;
166 scalar c = concentration_->
value(0.5*(time0 + time1));
168 scalar nParcels = parcelConcentration_*c*flowRate()*dt;
170 Random& rnd = this->owner().rndGen();
172 label nParcelsToInject = floor(nParcels);
180 nParcels - scalar(nParcelsToInject)
188 return nParcelsToInject;
195template<
class CloudType>
204 if ((time0 >= 0.0) && (time0 < duration_))
206 scalar c = concentration_->
value(0.5*(time0 + time1));
208 volume = c*(time1 - time0)*flowRate();
211 this->volumeTotal_ =
volume;
218template<
class CloudType>
232 this->owner().
mesh(),
242template<
class CloudType>
252 parcel.
U() = this->owner().U()[parcel.
cell()];
255 parcel.d() = sizeDistribution_->sample();
259template<
class CloudType>
266template<
class CloudType>
const CloudType & owner() const
Return const access to the owner cloud.
const vector & U() const
Return const access to velocity.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Templated injection model class.
static autoPtr< InjectionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector with lookup from dictionary.
scalar volumeTotal_
Total volume of particles introduced by this injector [m^3] Note: scaled to ensure massTotal is achie...
InjectionModel(CloudType &owner)
Construct null from owner.
scalar massTotal_
Total mass to inject [kg].
scalar SOI_
Start of injection [s].
Patch injection, by using patch flow rate to determine concentration and velocity.
virtual autoPtr< InjectionModel< CloudType > > clone() const
Construct and return a clone.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
virtual void setPositionAndCell(const label parcelI, const label nParcels, const scalar time, vector &position, label &cellOwner, label &tetFacei, label &tetPti)
Set the injection position and owner cell, tetFace and tetPt.
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
virtual ~PatchFlowRateInjection()
Destructor.
PatchFlowRateInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
virtual scalar flowRate() const
Return the total volumetric flow rate across the patch [m3/s].
virtual void updateMesh()
Set injector locations when mesh is updated.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
scalar timeEnd() const
Return the end-of-injection time.
Type globalPosition(const Type &start, const Type &end)
Return a sample on the interval [start,end].
virtual scalar userTimeToTime(const scalar theta) const
Convert the user-time (e.g. CA deg) to real-time (s).
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const Type & value() const noexcept
Return const reference to value.
A library of runtime-selectable doubly-truncated probability distribution models. Returns random samp...
label cell() const noexcept
Return current cell particle is in.
const label patchId_
Patch ID.
patchInjectionBase(const polyMesh &mesh, const word &patchName)
Construct from mesh and patch name.
virtual void updateMesh(const polyMesh &mesh)
Update patch geometry and derived info for injection locations.
label setPositionAndCell(const fvMesh &mesh, const scalar fraction01, Random &rnd, vector &position, label &cellOwner, label &tetFacei, label &tetPti)
Set the injection position and owner cell, tetFace and tetPt.
Mesh consisting of general polyhedral cells.
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
const dictionary & dict() const
Return const access to the cloud dictionary.
const word & modelName() const
Return const access to the name of the sub-model.
A class for handling words, derived from Foam::string.
const wordList volume
Standard volume field types (scalar, vector, tensor, etc).
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
DSMCCloud< dsmcParcel > CloudType
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
const dimensionSet dimVolume(pow3(dimLength))