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
59 FatalErrorIn(
"Foam::InjectionModel<CloudType>::setInjectionMethod()")
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;
87 FatalErrorIn(
"Foam::InjectionModel<CloudType>::setFlowType()")
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_)
167 "Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection" 169 "const dictionary&, " 173 )<<
"innerNozzleDiameter >= outerNozzleDiameter" <<
nl 177 duration_ = owner.db().time().userTimeToTime(duration_);
179 setInjectionMethod();
186 direction_ /=
mag(direction_);
190 scalar magTangent = 0.0;
192 while(magTangent < SMALL)
196 tangent = v - (v & direction_)*direction_;
197 magTangent =
mag(tangent);
200 tanVec1_ = tangent/magTangent;
201 tanVec2_ = direction_^tanVec1_;
204 this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_);
210 template<
class CloudType>
217 injectionMethod_(im.injectionMethod_),
218 flowType_(im.flowType_),
219 outerDiameter_(im.outerDiameter_),
220 innerDiameter_(im.innerDiameter_),
221 duration_(im.duration_),
222 position_(im.position_),
223 injectorCell_(im.injectorCell_),
224 tetFaceI_(im.tetFaceI_),
226 direction_(im.direction_),
227 parcelsPerSecond_(im.parcelsPerSecond_),
228 flowRateProfile_(im.flowRateProfile_),
229 thetaInner_(im.thetaInner_),
230 thetaOuter_(im.thetaOuter_),
231 sizeDistribution_(im.sizeDistribution_().clone().ptr()),
232 tanVec1_(im.tanVec1_),
233 tanVec2_(im.tanVec2_),
243 template<
class CloudType>
250 template<
class CloudType>
254 switch (injectionMethod_)
258 this->findCellAtPosition
274 template<
class CloudType>
277 return this->SOI_ + duration_;
281 template<
class CloudType>
288 if ((time0 >= 0.0) && (time0 < duration_))
290 return floor((time1 - time0)*parcelsPerSecond_);
299 template<
class CloudType>
306 if ((time0 >= 0.0) && (time0 < duration_))
308 return flowRateProfile_.integrate(time0, time1);
317 template<
class CloudType>
332 normal_ = tanVec1_*
cos(beta) + tanVec2_*
sin(beta);
334 switch (injectionMethod_)
338 position = position_;
339 cellOwner = injectorCell_;
340 tetFaceI = tetFaceI_;
347 scalar frac = rndGen.
sample01<scalar>();
348 scalar dr = outerDiameter_ - innerDiameter_;
349 scalar r = 0.5*(innerDiameter_ + frac*dr);
350 position = position_ + r*normal_;
352 this->findCellAtPosition
366 "void Foam::ConeNozzleInjection<CloudType>::setPositionAndCell" 376 )<<
"Unknown injectionMethod type" <<
nl 383 template<
class CloudType>
397 scalar t = time - this->SOI_;
398 scalar ti = thetaInner_.value(t);
399 scalar to = thetaOuter_.value(t);
400 scalar coneAngle = rndGen.
sample01<scalar>()*(to - ti) + ti;
402 coneAngle *= deg2Rad;
404 scalar dcorr =
cos(coneAngle);
407 vector dirVec = dcorr*direction_;
409 dirVec /=
mag(dirVec);
413 case ftConstantVelocity:
415 parcel.U() = UMag_*dirVec;
418 case ftPressureDrivenVelocity:
420 scalar pAmbient = this->owner().pAmbient();
421 scalar
rho = parcel.rho();
422 scalar UMag =
::sqrt(2.0*(Pinj_.value(t) - pAmbient)/rho);
423 parcel.U() = UMag*dirVec;
426 case ftFlowRateAndDischarge:
430 scalar massFlowRate =
432 *flowRateProfile_.value(t)
433 /this->volumeTotal();
435 scalar Umag = massFlowRate/(parcel.rho()*Cd_.value(t)*(Ao - Ai));
436 parcel.U() = Umag*dirVec;
445 parcel.d() = sizeDistribution_->sample();
449 template<
class CloudType>
456 template<
class CloudType>
dimensionedScalar sqrt(const dimensionedScalar &ds)
cachedRandom rndGen(label(0),-1)
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
virtual ~ConeNozzleInjection()
Destructor.
dimensioned< scalar > mag(const dimensioned< Type > &)
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
virtual void updateMesh()
Set injector locations when mesh is updated.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
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...
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.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, typename CloudType::parcelType &parcel)
Set the parcel properties.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
stressControl lookup("compactNormalStress") >> compactNormalStress
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
Templated injection model class.
dimensionedScalar cos(const dimensionedScalar &ds)
ConeNozzleInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
static autoPtr< distributionModel > New(const dictionary &dict, cachedRandom &rndGen)
Selector.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
scalar timeEnd() const
Return the end-of-injection time.
virtual scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
A normal distribution model.
Type sample01()
Return a sample whose components lie in the range 0-1.
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
Templated base class for dsmc cloud.
const scalar twoPi(2 *pi)
dimensionedScalar sin(const dimensionedScalar &ds)