1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "definedPressureSwirl.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "mathematicalConstants.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 defineTypeNameAndDebug(definedPressureSwirlInjector, 0);
36 addToRunTimeSelectionTable
39 definedPressureSwirlInjector,
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 Foam::definedPressureSwirlInjector::definedPressureSwirlInjector
49 const dictionary& dict,
53 injectorModel(dict, sm),
54 definedPressureSwirlInjectorDict_(dict.subDict(typeName + "Coeffs")),
56 coneAngle_(definedPressureSwirlInjectorDict_.lookup("ConeAngle")),
57 coneInterval_(definedPressureSwirlInjectorDict_.lookup("ConeInterval")),
58 maxKv_(definedPressureSwirlInjectorDict_.lookup("maxKv")),
63 scalar referencePressure = sm.p().average().value();
65 // correct velocityProfile
66 forAll(sm.injectors(), i)
68 sm.injectors()[i].properties()->correctProfiles
77 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
79 Foam::definedPressureSwirlInjector::~definedPressureSwirlInjector()
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 Foam::scalar Foam::definedPressureSwirlInjector::d0
91 const injectorType& it = injectors_[n].properties();
93 scalar c = rndGen_.sample01<scalar>();
94 scalar coneAngle = it.getTableValue(coneAngle_, t);
95 scalar coneInterval = it.getTableValue(coneInterval_, t);
98 // modifications to take account of flash boiling....
100 const liquidMixtureProperties& 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();
107 for (label i = 0; i < Nf ; i++)
112 fuels.properties()[i].pv(sm_.ambientPressure(), Tinj)
113 >= 0.999*sm_.ambientPressure()
116 // The fuel is boiling.....
117 // Calculation of the boiling temperature
119 scalar tBoilingSurface = Tinj ;
123 for (label k=0; k< Niter ; k++)
126 fuels.properties()[i].pv(pressure, tBoilingSurface);
128 if (pBoil > pressure)
131 tBoilingSurface - (Tinj-temperature)/Niter;
141 fuels.properties()[i].hl
143 sm_.ambientPressure(),
147 fuels.properties()[i].h(sm_.ambientPressure(), Tinj)
148 - sm_.ambientPressure()
149 /fuels.properties()[i].rho(sm_.ambientPressure(), Tinj);
151 fuels.properties()[i].h(sm_.ambientPressure(), tBoilingSurface)
152 - sm_.ambientPressure()
153 /fuels.properties()[i].rho
155 sm_.ambientPressure(),
159 chi += it.X()[i]*(iTp-iTb)/hl;
169 angle_ + (144.0 - angle_) * sqr(chi) + 2.0*coneInterval*(0.5 - c);
173 angle_ *= constant::mathematical::pi/360.0;
175 scalar injectedMassFlow = it.massFlowRate(t);
177 scalar cosAngle = cos(angle_);
179 scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), it.T(t), it.X());
180 scalar injectorDiameter = it.d();
182 scalar deltaPressure = deltaPressureInj(t,n);
184 scalar kV = kv(n, injectedMassFlow, deltaPressure, t);
186 scalar v = kV*sqrt(2.0*deltaPressure/rhoFuel);
190 scalar A = injectedMassFlow/(constant::mathematical::pi*rhoFuel*u_);
192 // Not using the authors definition for sheet thickness
193 // modified by multiplying the sheet tickness for the cone angle cosinus.
195 scalar angleT = angle_;
197 (injectorDiameter - sqrt(sqr(injectorDiameter) - 4.0*A))
200 // original implementation
201 // return (injectorDiameter-sqrt(sqr(injectorDiameter) - 4.0*A))/2.0;
205 Foam::vector Foam::definedPressureSwirlInjector::direction
213 scalar alpha = sin(angle_);
214 scalar dcorr = cos(angle_);
215 scalar beta = constant::mathematical::twoPi*rndGen_.sample01<scalar>();
217 // randomly distributed vector normal to the injection vector
218 vector normal = vector::zero;
222 scalar reduce = 0.01;
223 // correct beta if this is a 2D run
224 // map it onto the 'angleOfWedge'
229 /(constant::mathematical::twoPi);
230 beta += reduce*sm_.angleOfWedge();
234 sm_.axisOfWedge()*cos(beta)
235 + sm_.axisOfWedgeNormal()*sin(beta)
243 injectors_[n].properties()->tan1(hole)*cos(beta)
244 + injectors_[n].properties()->tan2(hole)*sin(beta)
248 // set the direction of injection by adding the normal vector
250 dcorr*injectors_[n].properties()->direction(hole, time) + normal;
257 Foam::scalar Foam::definedPressureSwirlInjector::velocity
263 return u_*sqrt(1.0 + pow(tan(angle_),2.0));
267 Foam::scalar Foam::definedPressureSwirlInjector::averageVelocity
272 const injectorType& it = sm_.injectors()[i].properties();
274 scalar dt = it.teoi() - it.tsoi();
276 scalar injectedMassFlow = it.mass()/(it.teoi()-it.tsoi());
278 scalar injectionPressure = averagePressure(i);
280 scalar Tav = it.integrateTable(it.T())/dt;
281 scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X());
283 scalar kV = kv(i, injectedMassFlow, injectionPressure, 0);
285 return kV*sqrt(2.0*(injectionPressure-sm_.ambientPressure())/rhoFuel);
289 Foam::scalar Foam::definedPressureSwirlInjector::kv
292 const scalar massFlow,
293 const scalar dPressure,
297 const injectorType& it = injectors_[inj].properties();
299 scalar coneAngle = it.getTableValue(coneAngle_, t);
301 coneAngle *= constant::mathematical::pi/360.0;
303 scalar cosAngle = cos(coneAngle);
304 scalar Tav = it.integrateTable(it.T())/(it.teoi() - it.tsoi());
306 scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X());
307 scalar injectorDiameter = it.d();
311 it.getTableValue(maxKv_, t),
313 *sqrt(rhoFuel/2.0/dPressure)
314 /(constant::mathematical::pi*sqr(injectorDiameter)*rhoFuel*cosAngle)
321 Foam::scalar Foam::definedPressureSwirlInjector::deltaPressureInj
328 injectors_[inj].properties()->injectionPressure(time)
329 - sm_.ambientPressure();
334 Foam::definedPressureSwirlInjector::averagePressure(const label inj) const
336 const injectorType& it = sm_.injectors()[inj].properties();
338 scalar dt = it.teoi() - it.tsoi();
339 return it.integrateTable(it.injectionPressureProfile())/dt;
343 // ************************************************************************* //