35 template<
class CloudType>
38 word injectionMethodType = this->coeffDict().lookup(
"injectionMethod");
39 if (injectionMethodType ==
"disc")
41 injectionMethod_ = imDisc;
43 else if (injectionMethodType ==
"point")
45 injectionMethod_ = imPoint;
48 this->findCellAtPosition
60 <<
"injectionMethod must be either 'point' or 'disc'" 66 template<
class CloudType>
69 word flowType = this->coeffDict().lookup(
"flowType");
70 if (flowType ==
"constantVelocity")
72 this->coeffDict().lookup(
"UMag") >> UMag_;
73 flowType_ = ftConstantVelocity;
75 else if (flowType ==
"pressureDrivenVelocity")
77 Pinj_.reset(this->coeffDict());
78 flowType_ = ftPressureDrivenVelocity;
80 else if (flowType ==
"flowRateAndDischarge")
82 Cd_.reset(this->coeffDict());
83 flowType_ = ftFlowRateAndDischarge;
88 <<
"flowType must be either 'constantVelocity', " 89 <<
"'pressureDrivenVelocity' or 'flowRateAndDischarge'" 97 template<
class CloudType>
102 const word& modelName
106 injectionMethod_(imPoint),
107 flowType_(ftConstantVelocity),
111 position_(this->coeffDict().
lookup(
"position")),
115 direction_(this->coeffDict().
lookup(
"direction")),
151 this->coeffDict().subDict(
"sizeDistribution"),
160 Cd_(owner.db().time(),
"Cd"),
161 Pinj_(owner.db().time(),
"Pinj")
163 if (innerDiameter_ >= outerDiameter_)
166 <<
"innerNozzleDiameter >= outerNozzleDiameter" <<
nl 170 duration_ = owner.db().time().userTimeToTime(duration_);
172 setInjectionMethod();
177 direction_ /=
mag(direction_);
184 this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_);
190 template<
class CloudType>
197 injectionMethod_(im.injectionMethod_),
198 flowType_(im.flowType_),
199 outerDiameter_(im.outerDiameter_),
200 innerDiameter_(im.innerDiameter_),
201 duration_(im.duration_),
202 position_(im.position_),
203 injectorCell_(im.injectorCell_),
204 tetFacei_(im.tetFacei_),
206 direction_(im.direction_),
207 parcelsPerSecond_(im.parcelsPerSecond_),
208 flowRateProfile_(im.flowRateProfile_),
209 thetaInner_(im.thetaInner_),
210 thetaOuter_(im.thetaOuter_),
211 sizeDistribution_(im.sizeDistribution_().clone().ptr()),
212 tanVec1_(im.tanVec1_),
213 tanVec2_(im.tanVec2_),
223 template<
class CloudType>
230 template<
class CloudType>
234 switch (injectionMethod_)
238 this->findCellAtPosition
252 template<
class CloudType>
255 return this->SOI_ + duration_;
259 template<
class CloudType>
266 if ((time0 >= 0.0) && (time0 < duration_))
268 return floor((time1 - time0)*parcelsPerSecond_);
277 template<
class CloudType>
284 if ((time0 >= 0.0) && (time0 < duration_))
286 return flowRateProfile_.integrate(time0, time1);
295 template<
class CloudType>
310 normal_ = tanVec1_*
cos(beta) + tanVec2_*
sin(beta);
312 switch (injectionMethod_)
316 position = position_;
317 cellOwner = injectorCell_;
318 tetFacei = tetFacei_;
326 scalar dr = outerDiameter_ - innerDiameter_;
327 scalar r = 0.5*(innerDiameter_ + frac*dr);
328 position = position_ + r*normal_;
330 this->findCellAtPosition
343 <<
"Unknown injectionMethod type" <<
nl 350 template<
class CloudType>
364 scalar t = time - this->SOI_;
365 scalar ti = thetaInner_.value(t);
366 scalar to = thetaOuter_.value(t);
367 scalar coneAngle = rndGen.
sample01<scalar>()*(to - ti) + ti;
369 coneAngle *= deg2Rad;
371 scalar dcorr =
cos(coneAngle);
373 vector normal = alpha*normal_;
374 vector dirVec = dcorr*direction_;
376 dirVec /=
mag(dirVec);
380 case ftConstantVelocity:
382 parcel.U() = UMag_*dirVec;
385 case ftPressureDrivenVelocity:
387 scalar pAmbient = this->owner().pAmbient();
388 scalar
rho = parcel.rho();
389 scalar UMag =
::sqrt(2.0*(Pinj_.value(t) - pAmbient)/rho);
390 parcel.U() = UMag*dirVec;
393 case ftFlowRateAndDischarge:
397 scalar massFlowRate =
399 *flowRateProfile_.value(t)
400 /this->volumeTotal();
402 scalar Umag = massFlowRate/(parcel.rho()*Cd_.value(t)*(Ao - Ai));
403 parcel.U() = Umag*dirVec;
412 parcel.d() = sizeDistribution_->sample();
416 template<
class CloudType>
423 template<
class CloudType>
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
VectorSpace< Form, Cmpt, Ncmpts > normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Templated injection model class.
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.
dimensionedScalar sqrt(const dimensionedScalar &ds)
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
Type sample01()
Advance the state and return a sample of a given type from a.
stressControl lookup("compactNormalStress") >> compactNormalStress
dimensionedScalar cos(const dimensionedScalar &ds)
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
A class for handling words, derived from string.
scalar globalScalar01()
Advance the state and return a scalar sample from a uniform.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
const scalar twoPi(2 *pi)
ParcelType parcelType
Type of parcel the cloud was instantiated for.
dimensionedScalar sin(const dimensionedScalar &ds)
scalar timeEnd() const
Return the end-of-injection time.
virtual void updateMesh()
Set injector locations when mesh is updated.
Vector< Cmpt > perpendicular(const Vector< Cmpt > &v)
virtual ~ConeNozzleInjection()
Destructor.
static autoPtr< distributionModel > New(const dictionary &dict, Random &rndGen)
Selector.
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
dimensioned< scalar > mag(const dimensioned< Type > &)
ConeNozzleInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
Templated base class for dsmc cloud.