48 Foam::swirlInjector::swirlInjector
55 propsDict_(dict.
subDict(typeName +
"Props")),
56 position_(propsDict_.lookup(
"position")),
57 direction_(propsDict_.lookup(
"direction")),
60 injectionPressure_(
readScalar(propsDict_.lookup(
"injectionPressure"))),
61 T_(
readScalar(propsDict_.lookup(
"temperature"))),
62 nParcels_(readLabel(propsDict_.lookup(
"nParcels"))),
63 X_(propsDict_.lookup(
"X")),
64 massFlowRateProfile_(propsDict_.lookup(
"massFlowRateProfile")),
65 injectionPressureProfile_(propsDict_.lookup(
"injectionPressureProfile")),
66 velocityProfile_(massFlowRateProfile_),
67 CdProfile_(massFlowRateProfile_),
68 TProfile_(massFlowRateProfile_),
69 averageParcelMass_(mass_/nParcels_),
70 pressureIndependentVelocity_(
false)
73 forAll(massFlowRateProfile_, i)
75 massFlowRateProfile_[i][0] =
78 forAll(injectionPressureProfile_, i)
80 injectionPressureProfile_[i][0] =
85 if (
mag(massFlowRateProfile_[0][0]-injectionPressureProfile_[0][0]) > SMALL)
89 "swirlInjector::swirlInjector(const time& t, const dictionary dict)"
90 ) <<
"Start-times do not match for "
91 "injectionPressureProfile and massFlowRateProfile."
100 massFlowRateProfile_[massFlowRateProfile_.size() - 1][0]
101 - injectionPressureProfile_[injectionPressureProfile_.size() - 1][0]
107 "swirlInjector::swirlInjector(const time& t, const dictionary dict)"
108 ) <<
"End-times do not match for "
109 "injectionPressureProfile and massFlowRateProfile."
113 scalar integratedMFR = integrateTable(massFlowRateProfile_);
114 scalar integratedPressure =
115 integrateTable(injectionPressureProfile_)/(teoi()-tsoi());
117 forAll(massFlowRateProfile_, i)
120 massFlowRateProfile_[i][1] *= mass_/integratedMFR;
122 velocityProfile_[i][0] = massFlowRateProfile_[i][0];
124 TProfile_[i][0] = massFlowRateProfile_[i][0];
125 TProfile_[i][1] = T_;
127 CdProfile_[i][0] = massFlowRateProfile_[i][0];
131 forAll(injectionPressureProfile_, i)
134 injectionPressureProfile_[i][1] *=
135 injectionPressure_/integratedPressure;
139 direction_ /=
mag(direction_);
141 setTangentialVectors();
150 if (
mag(Xsum - 1.0) > SMALL)
154 "swirlInjector::swirlInjector(const time& t, const dictionary dict)"
155 ) <<
"X does not add up to 1.0, correcting molar fractions." <<
endl;
173 void Foam::swirlInjector::setTangentialVectors()
181 vector testThis = rndGen.vector01();
183 tangent = testThis - (testThis & direction_)*direction_;
187 tangentialInjectionVector1_ = tangent/magV;
188 tangentialInjectionVector2_ = direction_ ^ tangentialInjectionVector1_;
198 scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
199 label nParcels = label(mInj/averageParcelMass_ + 0.49);
214 const scalar angleOfWedge,
215 const vector& axisOfSymmetry,
216 const vector& axisOfWedge,
217 const vector& axisOfWedgeNormal,
223 scalar is = position_ & axisOfSymmetry;
224 scalar magInj =
mag(position_ - is*axisOfSymmetry);
227 axisOfWedge*
cos(0.5*angleOfWedge)
228 + axisOfWedgeNormal*
sin(0.5*angleOfWedge);
229 halfWedge /=
mag(halfWedge);
231 return (is*axisOfSymmetry + magInj*halfWedge);
236 scalar iRadius = d_*rndGen.
scalar01();
244 tangentialInjectionVector1_*
cos(iAngle)
245 + tangentialInjectionVector2_*
sin(iAngle)
278 const scalar angleOfWedge
281 scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
300 return massFlowRateProfile_;
305 return getTableValue(massFlowRateProfile_, time);
311 return injectionPressureProfile_;
316 return getTableValue(injectionPressureProfile_, time);
322 return velocityProfile_;
327 return getTableValue(velocityProfile_, time);
337 return getTableValue(CdProfile_, time);
357 return massFlowRateProfile_[0][0];
362 return massFlowRateProfile_[massFlowRateProfile_.size()-1][0];
365 Foam::scalar Foam::swirlInjector::fractionOfInjection(
const scalar time)
const
367 return integrateTable(massFlowRateProfile_, time)/mass_;
375 return mass_*fractionOfInjection(t);
381 const scalar referencePressure
386 scalar pDummy = 1.0e+5;
387 scalar
rho = fuel.
rho(pDummy, T_, X_);
389 forAll(velocityProfile_, i)
391 scalar Pinj = getTableValue
393 injectionPressureProfile_,
394 massFlowRateProfile_[i][0]
396 scalar mfr = massFlowRateProfile_[i][1]/(rho*
A);
397 scalar v =
sqrt(2.0*(Pinj - referencePressure)/rho);
398 velocityProfile_[i][1] = v;
399 CdProfile_[i][1] = mfr/v;
405 return tangentialInjectionVector1_;
410 return tangentialInjectionVector2_;