37template<
class CloudType>
46 factor_(this->
coeffDict().getScalar(
"factor")),
51 this->
coeffDict().getWord(
"referenceField")
58 this->
coeffDict().getWord(
"thresholdField")
61 positionsFile_(this->
coeffDict().getWord(
"positionsFile")),
73 injectorCells_(positions_.size()),
74 injectorTetFaces_(positions_.size()),
75 injectorTetPts_(positions_.size()),
78 this->
coeffDict().getLabel(
"parcelsPerInjector")
90 this->
coeffDict().subDict(
"sizeDistribution"),
97 nParcelsInjected_.setSize(positions_.size(),
Zero);
100 diameters_.setSize(positions_.size());
103 diameters_[i] = sizeDistribution_->sample();
108 nParcelsPerInjector_*
sum(
pow3(diameters_))*
pi/6.0;
112template<
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())
137template<
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;
178template<
class CloudType>
185template<
class CloudType>
192 if (
sum(nParcelsInjected_) < nParcelsPerInjector_*positions_.size())
194 return positions_.size();
201template<
class CloudType>
208 if (
sum(nParcelsInjected_) < nParcelsPerInjector_*positions_.size())
210 return this->volumeTotal_/nParcelsPerInjector_;
217template<
class CloudType>
229 position = positions_[parcelI];
230 cellOwner = injectorCells_[parcelI];
231 tetFacei = injectorTetFaces_[parcelI];
232 tetPti = injectorTetPts_[parcelI];
236template<
class CloudType>
249 parcel.d() = diameters_[parcelI];
253template<
class CloudType>
260template<
class CloudType>
266 const label celli = injectorCells_[parcelI];
270 nParcelsInjected_[parcelI] < nParcelsPerInjector_
271 && factor_*referenceField_[celli] > thresholdField_[celli]
274 nParcelsInjected_[parcelI]++;
const CloudType & owner() const
Return const access to the owner cloud.
const vector & U() const
Return const access to velocity.
Conditional injection at specified positions.
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 void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
FieldActivatedInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
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.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Templated injection model class.
static autoPtr< InjectionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector with lookup from dictionary.
bool ignoreOutOfBounds_
Optional flag to indicate that injections attempted outside the mesh should be ignored.
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.
virtual bool findCellAtPosition(label &celli, label &tetFacei, label &tetPti, vector &position, bool errorOnNotFound=true)
Find the cell that contains the supplied position.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
unsigned int count(const bool on=true) const
Count number of bits set.
void flip()
Invert all bits in the addressable region.
void set(const bitSet &bitset)
Set specified bits from another bitset.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A library of runtime-selectable doubly-truncated probability distribution models. Returns random samp...
Registry of regIOobjects.
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 Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
constexpr scalar pi(M_PI)
Different types of constants.
void inplaceSubset(const BoolListType &select, ListType &input, const bool invert=false)
Inplace extract elements of the input list when select is true.
DSMCCloud< dsmcParcel > CloudType
dimensionedScalar pow3(const dimensionedScalar &ds)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
static constexpr const zero Zero
Global zero (0).
#define forAll(list, i)
Loop across all elements in list.