50 Foam::definedInjector::definedInjector
57 propsDict_(dict.
subDict(typeName +
"Props")),
58 position_(propsDict_.lookup(
"position")),
59 direction_(propsDict_.lookup(
"direction")),
62 T_(
readScalar(propsDict_.lookup(
"temperature"))),
63 nParcels_(readLabel(propsDict_.lookup(
"nParcels"))),
64 X_(propsDict_.lookup(
"X")),
65 massFlowRateProfile_(propsDict_.lookup(
"massFlowRateProfile")),
66 velocityProfile_(propsDict_.lookup(
"velocityProfile")),
67 injectionPressureProfile_(massFlowRateProfile_),
68 CdProfile_(massFlowRateProfile_),
69 averageParcelMass_(mass_/nParcels_),
70 pressureIndependentVelocity_(
true)
73 forAll(massFlowRateProfile_, i)
75 massFlowRateProfile_[i][0] = t.
userTimeToTime(massFlowRateProfile_[i][0]);
77 injectionPressureProfile_[i][0] = massFlowRateProfile_[i][0];
78 injectionPressureProfile_[i][1] = 0.0;
79 CdProfile_[i][0] = massFlowRateProfile_[i][0];
80 CdProfile_[i][1] = 1.0;
83 forAll(velocityProfile_, i)
89 if (
mag(massFlowRateProfile_[0][0]-velocityProfile_[0][0]) > SMALL)
91 FatalError <<
"definedInjector::definedInjector(const time& t, const dictionary dict) " <<
endl
92 <<
" start-times do not match for velocityProfile and massFlowRateProfile."
96 if (
mag(massFlowRateProfile_[massFlowRateProfile_.size()-1][0]-velocityProfile_[velocityProfile_.size()-1][0]) > SMALL)
98 FatalError <<
"definedInjector::definedInjector(const time& t, const dictionary dict) " <<
endl
99 <<
" end-times do not match for velocityProfile and massFlowRateProfile."
104 scalar integratedMFR = integrateTable(massFlowRateProfile_);
107 forAll(massFlowRateProfile_, i)
109 massFlowRateProfile_[i][1] *= mass_/integratedMFR;
113 direction_ /=
mag(direction_);
115 setTangentialVectors();
124 if (
mag(Xsum - 1.0) > SMALL)
128 "definedInjector::definedInjector(const time& t, Istream& is)"
129 ) <<
"X does not add up to 1.0, correcting molar fractions."
148 void Foam::definedInjector::setTangentialVectors()
156 vector testThis = rndGen.vector01();
158 tangent = testThis - (testThis & direction_)*direction_;
162 tangentialInjectionVector1_ = tangent/magV;
163 tangentialInjectionVector2_ = direction_ ^ tangentialInjectionVector1_;
174 scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
175 label nParcels = label(mInj/averageParcelMass_ + 0.49);
190 const scalar angleOfWedge,
191 const vector& axisOfSymmetry,
192 const vector& axisOfWedge,
193 const vector& axisOfWedgeNormal,
199 scalar is = position_ & axisOfSymmetry;
200 scalar magInj =
mag(position_ - is*axisOfSymmetry);
203 axisOfWedge*
cos(0.5*angleOfWedge)
204 + axisOfWedgeNormal*
sin(0.5*angleOfWedge);
205 halfWedge /=
mag(halfWedge);
207 return (is*axisOfSymmetry + magInj*halfWedge);
212 scalar iRadius = d_*rndGen.
scalar01();
220 tangentialInjectionVector1_*
cos(iAngle)
221 + tangentialInjectionVector2_*
sin(iAngle)
254 const scalar angleOfWedge
257 scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
275 return getTableValue(massFlowRateProfile_, time);
280 return getTableValue(injectionPressureProfile_, time);
285 return getTableValue(CdProfile_, time);
305 return massFlowRateProfile_[0][0];
310 return massFlowRateProfile_[massFlowRateProfile_.size()-1][0];
313 Foam::scalar Foam::definedInjector::fractionOfInjection
318 return integrateTable(massFlowRateProfile_, time)/mass_;
326 return getTableValue(velocityProfile_, time);
334 return mass_*fractionOfInjection(t);
340 const scalar referencePressure
344 scalar pDummy = 1.0e+5;
345 scalar
rho = fuel.
rho(pDummy, T_, X_);
347 forAll(velocityProfile_, i)
349 scalar mfr = massFlowRateProfile_[i][1];
350 scalar v = velocityProfile_[i][1];
351 injectionPressureProfile_[i][1] = referencePressure + 0.5*rho*v*v;
352 CdProfile_[i][1] = mfr/(v*rho*
A);
358 return tangentialInjectionVector1_;
363 return tangentialInjectionVector2_;