49 Foam::commonRailInjector::commonRailInjector
56 propsDict_(dict.
subDict(typeName +
"Props")),
57 position_(propsDict_.lookup(
"position")),
58 direction_(propsDict_.lookup(
"direction")),
61 injectionPressure_(
readScalar(propsDict_.lookup(
"injectionPressure"))),
62 T_(
readScalar(propsDict_.lookup(
"temperature"))),
63 nParcels_(readLabel(propsDict_.lookup(
"nParcels"))),
64 X_(propsDict_.lookup(
"X")),
65 massFlowRateProfile_(propsDict_.lookup(
"massFlowRateProfile")),
66 velocityProfile_(massFlowRateProfile_),
67 injectionPressureProfile_(propsDict_.lookup(
"injectionPressureProfile")),
68 CdProfile_(massFlowRateProfile_),
69 TProfile_(massFlowRateProfile_),
70 averageParcelMass_(mass_/nParcels_),
71 pressureIndependentVelocity_(
false)
75 forAll(massFlowRateProfile_, i)
77 massFlowRateProfile_[i][0] = t.
userTimeToTime(massFlowRateProfile_[i][0]);
78 velocityProfile_[i][0] = t.
userTimeToTime(massFlowRateProfile_[i][0]);
81 forAll(injectionPressureProfile_, i)
83 injectionPressureProfile_[i][0] = t.
userTimeToTime(injectionPressureProfile_[i][0]);
86 if (
mag(injectionPressureProfile_[0][0]-massFlowRateProfile_[0][0]) > SMALL)
88 FatalError <<
"commonRailInjector::commonRailInjector(const time& t, const dictionary dict) " <<
endl
89 <<
" start-time entries for injectionPressureProfile and massFlowRateProfile do no match"
92 Info <<
"injectionPressureProfile_.size() = " << injectionPressureProfile_.size()
93 <<
", massFlowRateProfile_.size() = " << massFlowRateProfile_.size()
96 if (
mag(injectionPressureProfile_[injectionPressureProfile_.size()-1][0]-massFlowRateProfile_[massFlowRateProfile_.size()-1][0]) > SMALL)
98 FatalError <<
"commonRailInjector::commonRailInjector(const time& t, const dictionary dict) " <<
endl
99 <<
" end-time entries for injectionPressureProfile and massFlowRateProfile do no match"
103 scalar integratedMFR = integrateTable(massFlowRateProfile_);
104 scalar integratedP = integrateTable(injectionPressureProfile_)/(teoi()-tsoi());
106 forAll(massFlowRateProfile_, i)
109 massFlowRateProfile_[i][1] *= mass_/integratedMFR;
111 TProfile_[i][0] = massFlowRateProfile_[i][0];
112 TProfile_[i][1] = T_;
114 CdProfile_[i][0] = massFlowRateProfile_[i][0];
118 forAll(injectionPressureProfile_, i)
120 injectionPressureProfile_[i][1] *= injectionPressure_/integratedP;
123 direction_ /=
mag(direction_);
125 setTangentialVectors();
134 if (
mag(Xsum - 1.0) > SMALL)
136 Info <<
"Warning!!!\n commonRailInjector::commonRailInjector(const time& t, Istream& is)"
137 <<
"X does not add up to 1.0, correcting molar fractions."
144 Info <<
"end constructor. in commonRail" <<
endl;
156 void Foam::commonRailInjector::setTangentialVectors()
164 vector testThis = rndGen.vector01();
166 tangent = testThis - (testThis & direction_)*direction_;
170 tangentialInjectionVector1_ = tangent/magV;
171 tangentialInjectionVector2_ = direction_ ^ tangentialInjectionVector1_;
183 scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
184 label nParcels = label(mInj/averageParcelMass_ + 0.49);
199 const scalar angleOfWedge,
200 const vector& axisOfSymmetry,
201 const vector& axisOfWedge,
202 const vector& axisOfWedgeNormal,
208 scalar is = position_ & axisOfSymmetry;
209 scalar magInj =
mag(position_ - is*axisOfSymmetry);
212 axisOfWedge*
cos(0.5*angleOfWedge)
213 + axisOfWedgeNormal*
sin(0.5*angleOfWedge);
214 halfWedge /=
mag(halfWedge);
216 return (is*axisOfSymmetry + magInj*halfWedge);
221 scalar iRadius = d_*rndGen.
scalar01();
229 tangentialInjectionVector1_*
cos(iAngle)
230 + tangentialInjectionVector2_*
sin(iAngle)
263 const scalar angleOfWedge
266 scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
299 return massFlowRateProfile_[0][0];
304 return massFlowRateProfile_[massFlowRateProfile_.size()-1][0];
312 return getTableValue(massFlowRateProfile_, time);
320 return getTableValue(injectionPressureProfile_, time);
328 return getTableValue(velocityProfile_, time);
341 return getTableValue(CdProfile_, time);
344 Foam::scalar Foam::commonRailInjector::fractionOfInjection(
const scalar time)
const
346 return integrateTable(massFlowRateProfile_, time)/mass_;
354 return mass_*fractionOfInjection(t);
361 const scalar referencePressure
365 scalar pDummy = 1.0e+5;
366 scalar
rho = fuel.
rho(pDummy, T_, X_);
368 forAll(velocityProfile_, i)
370 scalar Pinj = getTableValue(injectionPressureProfile_, velocityProfile_[i][0]);
371 scalar Vinj =
sqrt(2.0*(Pinj - referencePressure)/rho);
372 scalar mfr = massFlowRateProfile_[i][1]/(rho*
A);
373 scalar Cd = mfr/Vinj;
374 velocityProfile_[i][1] = Vinj;
375 CdProfile_[i][1] = Cd;
381 return tangentialInjectionVector1_;
386 return tangentialInjectionVector2_;