38 template<
class CloudType>
47 positionAxis_(this->coeffDict().
lookup(
"positionAxis")),
48 injectorCells_(positionAxis_.size()),
49 injectorTetFaces_(positionAxis_.size()),
50 injectorTetPts_(positionAxis_.size()),
51 duration_(this->coeffDict().getScalar(
"duration")),
54 this->coeffDict().getScalar(
"parcelsPerInjector")
96 this->coeffDict().subDict(
"sizeDistribution"), owner.
rndGen()
99 nInjected_(
Pstream::master() ? this->parcelsAddedTotal() : 0),
100 injectorOrder_(
identity(positionAxis_.size())),
106 tanVec1_.
setSize(positionAxis_.size());
107 tanVec2_.
setSize(positionAxis_.size());
112 flowRateProfile_->userTimeToTime(time);
113 Umag_->userTimeToTime(time);
114 thetaInner_->userTimeToTime(time);
115 thetaOuter_->userTimeToTime(time);
121 vector& axis = positionAxis_[i].second();
125 scalar magTangent = 0.0;
128 while (magTangent < SMALL)
132 tangent = v - (v & axis)*axis;
133 magTangent =
mag(tangent);
136 tanVec1_[i] = tangent/magTangent;
137 tanVec2_[i] = axis^tanVec1_[i];
141 this->
volumeTotal_ = flowRateProfile_->integrate(0.0, duration_);
145 template<
class CloudType>
152 positionAxis_(im.positionAxis_),
153 injectorCells_(im.injectorCells_),
154 injectorTetFaces_(im.injectorTetFaces_),
155 injectorTetPts_(im.injectorTetPts_),
156 duration_(im.duration_),
157 parcelsPerInjector_(im.parcelsPerInjector_),
158 flowRateProfile_(im.flowRateProfile_.clone()),
159 Umag_(im.Umag_.clone()),
160 thetaInner_(im.thetaInner_.clone()),
161 thetaOuter_(im.thetaOuter_.clone()),
162 sizeDistribution_(im.sizeDistribution_.clone()),
163 nInjected_(im.nInjected_),
164 injectorOrder_(im.injectorOrder_),
165 tanVec1_(im.tanVec1_),
166 tanVec2_(im.tanVec2_)
172 template<
class CloudType>
175 bitSet reject(positionAxis_.size());
182 !this->findCellAtPosition
185 injectorTetFaces_[i],
187 positionAxis_[i].first(),
188 !this->ignoreOutOfBounds_
197 const label nRejected = reject.count();
208 <<
" positions rejected, out of bounds" <<
endl;
213 template<
class CloudType>
216 return this->SOI_ + duration_;
220 template<
class CloudType>
227 if ((time0 >= 0.0) && (time0 < duration_))
229 const scalar targetVolume = flowRateProfile_->integrate(0, time1);
231 const scalar volumeFraction = targetVolume/this->volumeTotal_;
233 const label targetParcels =
234 ceil(positionAxis_.size()*parcelsPerInjector_*volumeFraction);
243 template<
class CloudType>
250 if ((time0 >= 0.0) && (time0 < duration_))
252 return flowRateProfile_->integrate(time0, time1);
259 template<
class CloudType>
274 const label i = injectorOrder_[parcelI % positionAxis_.size()];
275 position = positionAxis_[i].first();
276 cellOwner = injectorCells_[i];
277 tetFacei = injectorTetFaces_[i];
278 tetPti = injectorTetPts_[i];
282 template<
class CloudType>
293 const label i = injectorOrder_[parcelI % positionAxis_.size()];
296 scalar t = time - this->SOI_;
297 scalar ti = thetaInner_->value(t);
298 scalar to = thetaOuter_->value(t);
302 scalar dcorr =
cos(coneAngle);
306 vector dirVec = dcorr*positionAxis_[i].second();
311 parcel.U() = Umag_->value(t)*dirVec;
314 parcel.d() = sizeDistribution_().sample();
321 template<
class CloudType>
328 template<
class CloudType>
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
ConeInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Templated injection model class.
Unit conversion functions.
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
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.
Lookup type of boundary radiation properties.
void inplaceSubset(const BoolListType &select, ListType &input, const bool invert=false)
Inplace extract elements of the input list when select is true.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
const CloudType & owner() const
Return const access to the owner cloud.
#define forAll(list, i)
Loop across all elements in list.
void shuffle(UList< Type > &values)
Shuffle the values in the list.
Type sample01()
Return a sample whose components lie in the range [0,1].
void setSize(const label n)
Alias for resize()
dimensionedScalar cos(const dimensionedScalar &ds)
virtual scalar userTimeToTime(const scalar theta) const
Convert the user-time (e.g. CA deg) to real-time (s).
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
constexpr scalar twoPi(2 *M_PI)
A class for handling words, derived from Foam::string.
Random & rndGen()
Return reference to the random object.
const Time & time() const noexcept
Return time registry.
Inter-processor communications stream.
scalar timeEnd() const
Return the end-of-injection time.
const objectRegistry & db() const noexcept
Return the local objectRegistry.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
dimensionedScalar sin(const dimensionedScalar &ds)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
virtual void updateMesh()
Set injector locations when mesh is updated.
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)
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
scalar volumeTotal_
Total volume of particles introduced by this injector [m^3] Note: scaled to ensure massTotal is achie...
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
Templated base class for dsmc cloud.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
Type position(const Type &start, const Type &end)
Return a sample on the interval [start,end].
Multi-point cone injection model.
static constexpr const zero Zero
Global zero (0)