1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "definedPressureSwirl.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "mathematicalConstants.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(definedPressureSwirlInjector, 0);
40 addToRunTimeSelectionTable
43 definedPressureSwirlInjector,
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 // Construct from components
51 definedPressureSwirlInjector::definedPressureSwirlInjector
53 const dictionary& dict,
57 injectorModel(dict, sm),
58 definedPressureSwirlInjectorDict_(dict.subDict(typeName + "Coeffs")),
60 coneAngle_(definedPressureSwirlInjectorDict_.lookup("ConeAngle")),
61 coneInterval_(definedPressureSwirlInjectorDict_.lookup("ConeInterval")),
62 maxKv_(definedPressureSwirlInjectorDict_.lookup("maxKv")),
67 scalar referencePressure = sm.p().average().value();
69 // correct velocityProfile
70 forAll(sm.injectors(), i)
72 sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure);
78 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
80 definedPressureSwirlInjector::~definedPressureSwirlInjector()
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
86 scalar definedPressureSwirlInjector::d0
92 const injectorType& it = injectors_[n].properties();
94 scalar c = rndGen_.scalar01();
95 scalar coneAngle = it.getTableValue(coneAngle_, t);
96 scalar coneInterval = it.getTableValue(coneInterval_, t);
99 // modifications to take account of flash boiling....
101 const liquidMixture& fuels = sm_.fuels();
103 scalar Tinj = it.T(t);
104 label Nf = fuels.components().size();
105 scalar temperature = sm_.ambientTemperature();
106 scalar pressure = sm_.ambientPressure();
109 for(label i = 0; i < Nf ; i++)
112 if(fuels.properties()[i].pv(sm_.ambientPressure(), Tinj) >= 0.999*sm_.ambientPressure())
115 // The fuel is boiling.....
116 // Calculation of the boiling temperature
118 scalar tBoilingSurface = Tinj ;
122 for(label k=0; k< Niter ; k++)
125 scalar pBoil = fuels.properties()[i].pv(pressure, tBoilingSurface);
129 tBoilingSurface = tBoilingSurface - (Tinj-temperature)/Niter;
138 scalar hl = fuels.properties()[i].hl(sm_.ambientPressure(), tBoilingSurface);
139 scalar iTp = fuels.properties()[i].h(sm_.ambientPressure(), Tinj) - sm_.ambientPressure()/fuels.properties()[i].rho(sm_.ambientPressure(), Tinj);
140 scalar iTb = fuels.properties()[i].h(sm_.ambientPressure(), tBoilingSurface) - sm_.ambientPressure()/fuels.properties()[i].rho(sm_.ambientPressure(), tBoilingSurface);
142 chi += it.X()[i]*(iTp-iTb)/hl;
152 angle_ = angle_ + (144.0 - angle_) * sqr(chi) + 2.0 * coneInterval * (0.5 - c);
156 angle_ *= mathematicalConstant::pi/360.0;
158 scalar injectedMassFlow = it.massFlowRate(t);
160 scalar cosAngle = cos(angle_);
162 scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), it.T(t), it.X());
163 scalar injectorDiameter = it.d();
165 scalar deltaPressure = deltaPressureInj(t,n);
167 scalar kV = kv(n, injectedMassFlow, deltaPressure, t);
169 scalar v = kV * sqrt(2.0*deltaPressure/rhoFuel);
173 scalar A = injectedMassFlow/(mathematicalConstant::pi*rhoFuel*u_);
178 The formula for the sheet tickness proposed by the authors is,
179 in my opinion, "strange".....
180 I modified it multiplying the sheet tickness for the cone angle cosinus.
184 scalar angleT = angle_;
185 return (injectorDiameter-sqrt(pow(injectorDiameter,2.0)-4.0*A))*cos(angleT)/2.0;
187 // original implementation
190 return (injectorDiameter-sqrt(pow(injectorDiameter,2)-4.0*A))/2.0;
196 vector definedPressureSwirlInjector::direction
205 scalar alpha = sin(angle_);
206 scalar dcorr = cos(angle_);
207 scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01();
209 // randomly distributed vector normal to the injection vector
210 vector normal = vector::zero;
214 scalar reduce = 0.01;
215 // correct beta if this is a 2D run
216 // map it onto the 'angleOfWedge'
218 beta *= (1.0-2.0*reduce)*sm_.angleOfWedge()/(2.0*mathematicalConstant::pi);
219 beta += reduce*sm_.angleOfWedge();
222 sm_.axisOfWedge()*cos(beta) +
223 sm_.axisOfWedgeNormal()*sin(beta)
230 injectors_[n].properties()->tan1(hole)*cos(beta) +
231 injectors_[n].properties()->tan2(hole)*sin(beta)
235 // set the direction of injection by adding the normal vector
236 vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal;
243 scalar definedPressureSwirlInjector::velocity
249 return u_*sqrt(1.0 + pow(tan(angle_),2.0));
252 scalar definedPressureSwirlInjector::averageVelocity
258 const injectorType& it = sm_.injectors()[i].properties();
260 scalar dt = it.teoi() - it.tsoi();
262 scalar injectedMassFlow = it.mass()/(it.teoi()-it.tsoi());
264 scalar injectionPressure = averagePressure(i);
266 scalar Tav = it.integrateTable(it.T())/dt;
267 scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X());
269 scalar kV = kv(i, injectedMassFlow, injectionPressure, 0);
271 return kV*sqrt(2.0*(injectionPressure-sm_.ambientPressure())/rhoFuel);
276 scalar definedPressureSwirlInjector::kv
279 const scalar massFlow,
280 const scalar dPressure,
285 const injectorType& it = injectors_[inj].properties();
287 scalar coneAngle = it.getTableValue(coneAngle_, t);
289 coneAngle *= mathematicalConstant::pi/360.0;
291 scalar cosAngle = cos(coneAngle);
292 scalar Tav = it.integrateTable(it.T())/(it.teoi()-it.tsoi());
294 scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X());
295 scalar injectorDiameter = it.d();
299 it.getTableValue(maxKv_, t),
302 sqrt(rhoFuel/2.0/dPressure)
304 (mathematicalConstant::pi*pow(injectorDiameter, 2.0)*rhoFuel*cosAngle)
313 scalar definedPressureSwirlInjector::deltaPressureInj(const scalar time, const label inj) const
315 return injectors_[inj].properties()->injectionPressure(time) - sm_.ambientPressure();
318 scalar definedPressureSwirlInjector::averagePressure(const label inj) const
321 const injectorType& it = sm_.injectors()[inj].properties();
323 scalar dt = it.teoi() - it.tsoi();
324 return it.integrateTable(it.injectionPressureProfile())/dt;
327 } // End namespace Foam
329 // ************************************************************************* //