Go to the documentation of this file.
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>
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 <<
"Inner diameter must be less than the outer diameter:" <<
nl
167 <<
" innerDiameter: " << innerDiameter_ <<
nl
168 <<
" outerDiameter: " << outerDiameter_
172 duration_ = owner.db().time().userTimeToTime(duration_);
174 setInjectionMethod();
181 direction_ /=
mag(direction_);
185 scalar magTangent = 0.0;
187 while(magTangent < SMALL)
191 tangent = v - (v & direction_)*direction_;
192 magTangent =
mag(tangent);
195 tanVec1_ = tangent/magTangent;
196 tanVec2_ = direction_^tanVec1_;
199 this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_);
205 template<
class CloudType>
238 template<
class CloudType>
245 template<
class CloudType>
249 switch (injectionMethod_)
253 this->findCellAtPosition
269 template<
class CloudType>
272 return this->SOI_ + duration_;
276 template<
class CloudType>
283 if ((time0 >= 0.0) && (time0 < duration_))
285 return floor((time1 - time0)*parcelsPerSecond_);
294 template<
class CloudType>
301 if ((time0 >= 0.0) && (time0 < duration_))
303 return flowRateProfile_.integrate(time0, time1);
312 template<
class CloudType>
329 switch (injectionMethod_)
333 position = position_;
334 cellOwner = injectorCell_;
335 tetFaceI = tetFaceI_;
342 scalar frac =
rndGen.globalSample01<scalar>();
343 scalar dr = outerDiameter_ - innerDiameter_;
344 scalar r = 0.5*(innerDiameter_ + frac*dr);
346 position = position_ + r*normal_;
348 this->findCellAtPosition
360 <<
"Unknown injectionMethod type" <<
nl
367 template<
class CloudType>
381 scalar t = time - this->SOI_;
382 scalar ti = thetaInner_.value(t);
383 scalar to = thetaOuter_.value(t);
384 scalar coneAngle =
rndGen.sample01<scalar>()*(to - ti) + ti;
386 coneAngle *= deg2Rad;
388 scalar dcorr =
cos(coneAngle);
391 vector dirVec = dcorr*direction_;
393 dirVec /=
mag(dirVec);
397 case ftConstantVelocity:
399 parcel.U() = UMag_*dirVec;
402 case ftPressureDrivenVelocity:
404 scalar pAmbient = this->owner().pAmbient();
405 scalar
rho = parcel.rho();
406 scalar UMag =
::sqrt(2.0*(Pinj_.value(t) - pAmbient)/
rho);
407 parcel.U() = UMag*dirVec;
410 case ftFlowRateAndDischarge:
414 scalar massFlowRate =
416 *flowRateProfile_.value(t)
417 /this->volumeTotal();
419 scalar Umag = massFlowRate/(parcel.rho()*Cd_.value(t)*(Ao - Ai));
420 parcel.U() = Umag*dirVec;
429 parcel.d() = sizeDistribution_->sample();
433 template<
class CloudType>
440 template<
class CloudType>
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
const TimeDataEntry< scalar > flowRateProfile_
Flow rate profile relative to SOI [].
A class for handling words, derived from string.
scalar UMag_
Constant velocity [m/s].
vector position_
Injector position [m].
virtual label parcelsToInject(const scalar time0, const scalar time1)
Number of parcels to introduce relative to SOI.
vector direction_
Injector direction [].
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
dimensionedScalar sin(const dimensionedScalar &ds)
vector normal_
Injection vector orthogonal to direction.
virtual bool validInjection(const label parcelI)
Return flag to identify whether or not injection of parcelI is.
Templated injection model class.
static autoPtr< distributionModel > New(const dictionary &dict, cachedRandom &rndGen)
Selector.
const scalar twoPi(2 *pi)
label tetFaceI_
Index of tet face for injector cell.
dimensioned< scalar > mag(const dimensioned< Type > &)
label injectorCell_
Cell containing injector position [].
vector tanVec1_
First tangential vector.
Random & rndGen()
Return refernce to the random object.
void setInjectionMethod()
Set the injection type.
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 scalar volumeToInject(const scalar time0, const scalar time1)
Volume of parcels to introduce relative to SOI.
void setFlowType()
Set the injection flow type.
const label parcelsPerSecond_
Number of parcels to introduce per second [].
ConeNozzleInjection(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
TimeDataEntry< scalar > Cd_
Discharge coefficient, relative to SOI [m/s].
flowType flowType_
Flow type.
virtual void updateMesh()
Set injector locations when mesh is updated.
const TimeDataEntry< scalar > thetaInner_
Inner half-cone angle relative to SOI [deg].
Templated base class for dsmc cloud.
A list of keyword definitions, which are a keyword followed by any number of values (e....
TimeDataEntry< scalar > Pinj_
Injection pressure [Pa].
errorManipArg< error, int > exit(error &err, const int errNo=1)
injectionMethod injectionMethod_
Point/disc injection method.
const scalar innerDiameter_
Inner nozzle diameter [m].
scalar timeEnd() const
Return the end-of-injection time.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
label tetPtI_
Index of tet point for injector cell.
flowType
Flow type enumeration.
dimensionedScalar sqrt(const dimensionedScalar &ds)
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.
virtual bool fullyDescribed() const
Flag to identify whether model fully describes the parcel.
const TimeDataEntry< scalar > thetaOuter_
Outer half-cone angle relative to SOI [deg].
ParcelType parcelType
Type of parcel the cloud was instantiated for.
scalar duration_
Injection duration [s].
cachedRandom rndGen(label(0), -1)
const autoPtr< distributionModels::distributionModel > sizeDistribution_
Parcel size PDF model.
virtual ~ConeNozzleInjection()
Destructor.
const scalar outerDiameter_
Outer nozzle diameter [m].
A normal distribution model.
stressControl lookup("compactNormalStress") >> compactNormalStress
dimensionedScalar cos(const dimensionedScalar &ds)