37 template<
class CloudType>
46 factor_(this->coeffDict().getScalar(
"factor")),
51 this->coeffDict().getWord(
"referenceField")
58 this->coeffDict().getWord(
"thresholdField")
61 positionsFile_(this->coeffDict().getWord(
"positionsFile")),
67 owner.db().time().constant(),
73 injectorCells_(positions_.size()),
74 injectorTetFaces_(positions_.size()),
75 injectorTetPts_(positions_.size()),
78 this->coeffDict().getLabel(
"parcelsPerInjector")
83 this->coeffDict().template
get<
vector>(
"U0")
90 this->coeffDict().subDict(
"sizeDistribution"),
103 diameters_[i] = sizeDistribution_->sample();
108 nParcelsPerInjector_*
sum(
pow3(diameters_))*
pi/6.0;
112 template<
class CloudType>
120 referenceField_(im.referenceField_),
121 thresholdField_(im.thresholdField_),
122 positionsFile_(im.positionsFile_),
123 positions_(im.positions_),
124 injectorCells_(im.injectorCells_),
125 injectorTetFaces_(im.injectorTetFaces_),
126 injectorTetPts_(im.injectorTetPts_),
127 nParcelsPerInjector_(im.nParcelsPerInjector_),
128 nParcelsInjected_(im.nParcelsInjected_),
130 diameters_(im.diameters_),
131 sizeDistribution_(im.sizeDistribution_.clone())
137 template<
class CloudType>
140 bitSet reject(positions_.size());
147 !this->findCellAtPosition
150 injectorTetFaces_[i],
153 !this->ignoreOutOfBounds_
162 const label nRejected = reject.count();
173 <<
" positions rejected, out of bounds" <<
endl;
178 template<
class CloudType>
185 template<
class CloudType>
192 if (
sum(nParcelsInjected_) < nParcelsPerInjector_*positions_.size())
194 return positions_.size();
201 template<
class CloudType>
208 if (
sum(nParcelsInjected_) < nParcelsPerInjector_*positions_.size())
210 return this->volumeTotal_/nParcelsPerInjector_;
217 template<
class CloudType>
229 position = positions_[parcelI];
230 cellOwner = injectorCells_[parcelI];
231 tetFacei = injectorTetFaces_[parcelI];
232 tetPti = injectorTetPts_[parcelI];
236 template<
class CloudType>
249 parcel.d() = diameters_[parcelI];
253 template<
class CloudType>
260 template<
class CloudType>
266 const label celli = injectorCells_[parcelI];
270 nParcelsInjected_[parcelI] < nParcelsPerInjector_
271 && factor_*referenceField_[celli] > thresholdField_[celli]
274 nParcelsInjected_[parcelI]++;
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
scalar timeEnd() const
Return the end-of-injection time.
void size(const label n)
Older name for setAddressableSize.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Templated injection model class.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
virtual void updateMesh()
Set injector locations when mesh is updated.
void inplaceSubset(const BoolListType &select, ListType &input, const bool invert=false)
Inplace extract elements of the input list when select is true.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
#define forAll(list, i)
Loop across all elements in list.
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.
void setSize(const label n)
Alias for resize()
A class for handling words, derived from Foam::string.
constexpr scalar pi(M_PI)
ParcelType parcelType
Type of parcel the cloud was instantiated for.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Conditional injection at specified positions.
dimensionedScalar pow3(const dimensionedScalar &ds)
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A library of runtime-selectable doubly-truncated probability distribution models. Returns random samp...
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
scalar volumeTotal_
Total volume of particles introduced by this injector [m^3] Note: scaled to ensure massTotal is achie...
FieldActivatedInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Registry of regIOobjects.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Templated base class for dsmc cloud.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
static constexpr const zero Zero
Global zero (0)