1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "definedPressureSwirl.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "mathematicalConstants.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(definedPressureSwirlInjector, 0);
39 addToRunTimeSelectionTable
42 definedPressureSwirlInjector,
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 // Construct from components
50 definedPressureSwirlInjector::definedPressureSwirlInjector
52 const dictionary& dict,
56 injectorModel(dict, sm),
57 definedPressureSwirlInjectorDict_(dict.subDict(typeName + "Coeffs")),
59 coneAngle_(definedPressureSwirlInjectorDict_.lookup("ConeAngle")),
60 coneInterval_(definedPressureSwirlInjectorDict_.lookup("ConeInterval")),
61 maxKv_(definedPressureSwirlInjectorDict_.lookup("maxKv")),
66 scalar referencePressure = sm.p().average().value();
68 // correct velocityProfile
69 forAll(sm.injectors(), i)
71 sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure);
77 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
79 definedPressureSwirlInjector::~definedPressureSwirlInjector()
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 scalar definedPressureSwirlInjector::d0
91 const injectorType& it = injectors_[n].properties();
93 scalar c = rndGen_.scalar01();
94 scalar coneAngle = it.getTableValue(coneAngle_, t);
95 scalar coneInterval = it.getTableValue(coneInterval_, t);
98 // modifications to take account of flash boiling....
100 const liquidMixture& fuels = sm_.fuels();
102 scalar Tinj = it.T(t);
103 label Nf = fuels.components().size();
104 scalar temperature = sm_.ambientTemperature();
105 scalar pressure = sm_.ambientPressure();
108 for(label i = 0; i < Nf ; i++)
111 if(fuels.properties()[i].pv(sm_.ambientPressure(), Tinj) >= 0.999*sm_.ambientPressure())
114 // The fuel is boiling.....
115 // Calculation of the boiling temperature
117 scalar tBoilingSurface = Tinj ;
121 for(label k=0; k< Niter ; k++)
124 scalar pBoil = fuels.properties()[i].pv(pressure, tBoilingSurface);
128 tBoilingSurface = tBoilingSurface - (Tinj-temperature)/Niter;
137 scalar hl = fuels.properties()[i].hl(sm_.ambientPressure(), tBoilingSurface);
138 scalar iTp = fuels.properties()[i].h(sm_.ambientPressure(), Tinj) - sm_.ambientPressure()/fuels.properties()[i].rho(sm_.ambientPressure(), Tinj);
139 scalar iTb = fuels.properties()[i].h(sm_.ambientPressure(), tBoilingSurface) - sm_.ambientPressure()/fuels.properties()[i].rho(sm_.ambientPressure(), tBoilingSurface);
141 chi += it.X()[i]*(iTp-iTb)/hl;
151 angle_ = angle_ + (144.0 - angle_) * sqr(chi) + 2.0 * coneInterval * (0.5 - c);
155 angle_ *= mathematicalConstant::pi/360.0;
157 scalar injectedMassFlow = it.massFlowRate(t);
159 scalar cosAngle = cos(angle_);
161 scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), it.T(t), it.X());
162 scalar injectorDiameter = it.d();
164 scalar deltaPressure = deltaPressureInj(t,n);
166 scalar kV = kv(n, injectedMassFlow, deltaPressure, t);
168 scalar v = kV * sqrt(2.0*deltaPressure/rhoFuel);
172 scalar A = injectedMassFlow/(mathematicalConstant::pi*rhoFuel*u_);
177 The formula for the sheet tickness proposed by the authors is,
178 in my opinion, "strange".....
179 I modified it multiplying the sheet tickness for the cone angle cosinus.
183 scalar angleT = angle_;
184 return (injectorDiameter-sqrt(pow(injectorDiameter,2.0)-4.0*A))*cos(angleT)/2.0;
186 // original implementation
189 return (injectorDiameter-sqrt(pow(injectorDiameter,2)-4.0*A))/2.0;
195 vector definedPressureSwirlInjector::direction
204 scalar alpha = sin(angle_);
205 scalar dcorr = cos(angle_);
206 scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01();
208 // randomly distributed vector normal to the injection vector
209 vector normal = vector::zero;
213 scalar reduce = 0.01;
214 // correct beta if this is a 2D run
215 // map it onto the 'angleOfWedge'
217 beta *= (1.0-2.0*reduce)*sm_.angleOfWedge()/(2.0*mathematicalConstant::pi);
218 beta += reduce*sm_.angleOfWedge();
221 sm_.axisOfWedge()*cos(beta) +
222 sm_.axisOfWedgeNormal()*sin(beta)
229 injectors_[n].properties()->tan1(hole)*cos(beta) +
230 injectors_[n].properties()->tan2(hole)*sin(beta)
234 // set the direction of injection by adding the normal vector
235 vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal;
242 scalar definedPressureSwirlInjector::velocity
248 return u_*sqrt(1.0 + pow(tan(angle_),2.0));
251 scalar definedPressureSwirlInjector::averageVelocity
257 const injectorType& it = sm_.injectors()[i].properties();
259 scalar dt = it.teoi() - it.tsoi();
261 scalar injectedMassFlow = it.mass()/(it.teoi()-it.tsoi());
263 scalar injectionPressure = averagePressure(i);
265 scalar Tav = it.integrateTable(it.T())/dt;
266 scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X());
268 scalar kV = kv(i, injectedMassFlow, injectionPressure, 0);
270 return kV*sqrt(2.0*(injectionPressure-sm_.ambientPressure())/rhoFuel);
275 scalar definedPressureSwirlInjector::kv
278 const scalar massFlow,
279 const scalar dPressure,
284 const injectorType& it = injectors_[inj].properties();
286 scalar coneAngle = it.getTableValue(coneAngle_, t);
288 coneAngle *= mathematicalConstant::pi/360.0;
290 scalar cosAngle = cos(coneAngle);
291 scalar Tav = it.integrateTable(it.T())/(it.teoi()-it.tsoi());
293 scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X());
294 scalar injectorDiameter = it.d();
298 it.getTableValue(maxKv_, t),
301 sqrt(rhoFuel/2.0/dPressure)
303 (mathematicalConstant::pi*pow(injectorDiameter, 2.0)*rhoFuel*cosAngle)
312 scalar definedPressureSwirlInjector::deltaPressureInj(const scalar time, const label inj) const
314 return injectors_[inj].properties()->injectionPressure(time) - sm_.ambientPressure();
317 scalar definedPressureSwirlInjector::averagePressure(const label inj) const
320 const injectorType& it = sm_.injectors()[inj].properties();
322 scalar dt = it.teoi() - it.tsoi();
323 return it.integrateTable(it.injectionPressureProfile())/dt;
326 } // End namespace Foam
328 // ************************************************************************* //