49 Foam::unitInjector::unitInjector
56 propsDict_(dict.
subDict(typeName +
"Props")),
57 position_(propsDict_.lookup(
"position")),
58 direction_(propsDict_.lookup(
"direction")),
62 nParcels_(readLabel(propsDict_.lookup(
"nParcels"))),
63 X_(propsDict_.lookup(
"X")),
64 massFlowRateProfile_(propsDict_.lookup(
"massFlowRateProfile")),
65 velocityProfile_(massFlowRateProfile_),
66 injectionPressureProfile_(massFlowRateProfile_),
67 CdProfile_(massFlowRateProfile_),
68 TProfile_(propsDict_.lookup(
"temperatureProfile")),
69 averageParcelMass_(mass_/nParcels_),
70 pressureIndependentVelocity_(
true)
74 if (
mag(massFlowRateProfile_[0][0]-TProfile_[0][0]) > SMALL)
78 "unitInjector::unitInjector(const time& t, const dictionary dict)"
79 )<<
"start-times do not match for TemperatureProfile and "
85 mag(massFlowRateProfile_[massFlowRateProfile_.size()-1][0]
86 - TProfile_[TProfile_.size()-1][0])
92 "unitInjector::unitInjector(const time& t, const dictionary dict)"
93 )<<
"end-times do not match for TemperatureProfile and "
98 forAll(massFlowRateProfile_, i)
100 massFlowRateProfile_[i][0] =
102 velocityProfile_[i][0] = massFlowRateProfile_[i][0];
103 injectionPressureProfile_[i][0] = massFlowRateProfile_[i][0];
111 scalar integratedMFR = integrateTable(massFlowRateProfile_);
113 forAll(massFlowRateProfile_, i)
116 massFlowRateProfile_[i][1] *= mass_/integratedMFR;
118 CdProfile_[i][0] = massFlowRateProfile_[i][0];
119 CdProfile_[i][1] = Cd_;
123 direction_ /=
mag(direction_);
125 setTangentialVectors();
134 if (
mag(Xsum - 1.0) > SMALL)
136 WarningIn(
"unitInjector::unitInjector(const time& t, Istream& is)")
137 <<
"X does not sum to 1.0, correcting molar fractions."
155 void Foam::unitInjector::setTangentialVectors()
163 vector testThis = rndGen.vector01();
165 tangent = testThis - (testThis & direction_)*direction_;
169 tangentialInjectionVector1_ = tangent/magV;
170 tangentialInjectionVector2_ = direction_ ^ tangentialInjectionVector1_;
181 scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
182 label nParcels = label(mInj/averageParcelMass_ + 0.49);
198 const scalar angleOfWedge,
199 const vector& axisOfSymmetry,
200 const vector& axisOfWedge,
201 const vector& axisOfWedgeNormal,
207 scalar is = position_ & axisOfSymmetry;
208 scalar magInj =
mag(position_ - is*axisOfSymmetry);
211 axisOfWedge*
cos(0.5*angleOfWedge)
212 + axisOfWedgeNormal*
sin(0.5*angleOfWedge);
213 halfWedge /=
mag(halfWedge);
215 return (is*axisOfSymmetry + magInj*halfWedge);
220 scalar iRadius = d_*rndGen.
scalar01();
228 tangentialInjectionVector1_*
cos(iAngle)
229 + tangentialInjectionVector2_*
sin(iAngle)
266 const scalar angleOfWedge
269 scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
301 return getTableValue(TProfile_, time);
307 return massFlowRateProfile_[0][0];
313 return massFlowRateProfile_[massFlowRateProfile_.size()-1][0];
319 return getTableValue(massFlowRateProfile_, time);
325 return getTableValue(injectionPressureProfile_, time);
331 return getTableValue(velocityProfile_, time);
347 Foam::scalar Foam::unitInjector::fractionOfInjection(
const scalar time)
const
349 return integrateTable(massFlowRateProfile_, time)/mass_;
355 return mass_*fractionOfInjection(t);
362 const scalar referencePressure
366 scalar pDummy = 1.0e+5;
368 forAll(velocityProfile_, i)
370 scalar time = velocityProfile_[i][0];
371 scalar
rho = fuel.
rho(pDummy,
T(time), X_);
372 scalar v = massFlowRateProfile_[i][1]/(Cd_*rho*
A);
373 velocityProfile_[i][1] = v;
374 injectionPressureProfile_[i][1] = referencePressure + 0.5*rho*v*v;
381 return tangentialInjectionVector1_;
387 return tangentialInjectionVector2_;