OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

definedPressureSwirl.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "definedPressureSwirl.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "mathematicalConstants.H"
00030 
00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035 
00036 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00037 
00038 defineTypeNameAndDebug(definedPressureSwirlInjector, 0);
00039 
00040 addToRunTimeSelectionTable
00041 (
00042     injectorModel,
00043     definedPressureSwirlInjector,
00044     dictionary
00045 );
00046 
00047 
00048 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00049 
00050 // Construct from components
00051 definedPressureSwirlInjector::definedPressureSwirlInjector
00052 (
00053     const dictionary& dict,
00054     spray& sm
00055 )
00056 :
00057     injectorModel(dict, sm),
00058     definedPressureSwirlInjectorDict_(dict.subDict(typeName + "Coeffs")),
00059 
00060     coneAngle_(definedPressureSwirlInjectorDict_.lookup("ConeAngle")),
00061     coneInterval_(definedPressureSwirlInjectorDict_.lookup("ConeInterval")),
00062     maxKv_(definedPressureSwirlInjectorDict_.lookup("maxKv")),
00063 
00064     angle_(0.0)
00065 {
00066 
00067     scalar referencePressure = sm.p().average().value();
00068 
00069     // correct velocityProfile
00070     forAll(sm.injectors(), i)
00071     {
00072         sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure);
00073     }
00074 
00075 }
00076 
00077 
00078 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00079 
00080 definedPressureSwirlInjector::~definedPressureSwirlInjector()
00081 {}
00082 
00083 
00084 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00085 
00086 scalar definedPressureSwirlInjector::d0
00087 (
00088     const label n, 
00089     const scalar t
00090 ) const
00091 {
00092     const injectorType& it = injectors_[n].properties();
00093 
00094     scalar c = rndGen_.scalar01();
00095     scalar coneAngle = it.getTableValue(coneAngle_, t);
00096     scalar coneInterval = it.getTableValue(coneInterval_, t);
00097     angle_ = coneAngle ;
00098     
00099 //  modifications to take account of flash boiling....
00100 
00101     const liquidMixture& fuels = sm_.fuels();
00102     scalar chi = 0.0;
00103     scalar Tinj = it.T(t);
00104     label Nf = fuels.components().size();  
00105     scalar temperature = sm_.ambientTemperature();
00106     scalar pressure = sm_.ambientPressure();
00107     
00108           
00109     for(label i = 0; i < Nf ; i++)
00110     {
00111     
00112         if(fuels.properties()[i].pv(sm_.ambientPressure(), Tinj) >= 0.999*sm_.ambientPressure())
00113         {
00114 
00115 //          The fuel is boiling.....
00116 //          Calculation of the boiling temperature            
00117             
00118             scalar tBoilingSurface = Tinj ;
00119                         
00120             label Niter = 200;
00121             
00122             for(label k=0; k< Niter ; k++)
00123             {
00124 
00125                 scalar pBoil = fuels.properties()[i].pv(pressure, tBoilingSurface);
00126                     
00127                 if(pBoil > pressure)
00128                 {
00129                     tBoilingSurface = tBoilingSurface - (Tinj-temperature)/Niter;   
00130                 }
00131                 else
00132                 {
00133                     break;
00134                 }
00135 
00136             }
00137             
00138             scalar hl = fuels.properties()[i].hl(sm_.ambientPressure(), tBoilingSurface);
00139             scalar iTp = fuels.properties()[i].h(sm_.ambientPressure(), Tinj) - sm_.ambientPressure()/fuels.properties()[i].rho(sm_.ambientPressure(), Tinj);
00140             scalar iTb = fuels.properties()[i].h(sm_.ambientPressure(), tBoilingSurface) - sm_.ambientPressure()/fuels.properties()[i].rho(sm_.ambientPressure(), tBoilingSurface);
00141             
00142             chi += it.X()[i]*(iTp-iTb)/hl;
00143                    
00144         }
00145     }    
00146     
00147     //  bounding chi
00148     
00149     chi = max(chi, 0.0);
00150     chi = min(chi, 1.0);
00151     
00152     angle_ = angle_ + (144.0 - angle_) * sqr(chi) + 2.0 * coneInterval * (0.5 - c);
00153 
00154 //  end modifications
00155 
00156     angle_ *= mathematicalConstant::pi/360.0;
00157 
00158     scalar injectedMassFlow = it.massFlowRate(t);
00159     
00160     scalar cosAngle = cos(angle_);   
00161 
00162     scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), it.T(t), it.X()); 
00163     scalar injectorDiameter = it.d();  
00164      
00165     scalar deltaPressure = deltaPressureInj(t,n);
00166     
00167     scalar kV = kv(n, injectedMassFlow, deltaPressure, t);
00168     
00169     scalar v = kV * sqrt(2.0*deltaPressure/rhoFuel);    
00170 
00171     u_ = v * cosAngle;
00172     
00173     scalar A = injectedMassFlow/(mathematicalConstant::pi*rhoFuel*u_);
00174 
00175 /*
00176 
00177     TL
00178     The formula for the sheet tickness proposed by the authors is,
00179     in my opinion, "strange".....
00180     I modified it multiplying the sheet tickness for the cone angle cosinus.
00181 
00182 */
00183 
00184     scalar angleT = angle_;
00185     return (injectorDiameter-sqrt(pow(injectorDiameter,2.0)-4.0*A))*cos(angleT)/2.0;         
00186 
00187 //  original implementation
00188 
00189 /*
00190     return (injectorDiameter-sqrt(pow(injectorDiameter,2)-4.0*A))/2.0;
00191 */
00192 
00193     
00194 }
00195 
00196 vector definedPressureSwirlInjector::direction
00197 (
00198     const label n,
00199     const label hole,
00200     const scalar time,
00201     const scalar d
00202 ) const
00203 {
00204 
00205     scalar alpha = sin(angle_);
00206     scalar dcorr = cos(angle_);
00207     scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01();
00208 
00209     // randomly distributed vector normal to the injection vector
00210     vector normal = vector::zero;
00211     
00212     if (sm_.twoD())
00213     {
00214         scalar reduce = 0.01;
00215         // correct beta if this is a 2D run
00216         // map it onto the 'angleOfWedge'
00217 
00218         beta *= (1.0-2.0*reduce)*sm_.angleOfWedge()/(2.0*mathematicalConstant::pi);
00219         beta += reduce*sm_.angleOfWedge();
00220         normal = alpha*
00221         (
00222             sm_.axisOfWedge()*cos(beta) +
00223             sm_.axisOfWedgeNormal()*sin(beta)
00224         );
00225     }
00226     else
00227     {
00228         normal = alpha*
00229         (
00230             injectors_[n].properties()->tan1(hole)*cos(beta) +
00231             injectors_[n].properties()->tan2(hole)*sin(beta)
00232         );
00233     }
00234     
00235     // set the direction of injection by adding the normal vector
00236     vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal;
00237     dir /= mag(dir);
00238 
00239     return dir;
00240 }
00241 
00242 
00243 scalar definedPressureSwirlInjector::velocity
00244 (
00245     const label i,
00246     const scalar time
00247 ) const
00248 {
00249     return u_*sqrt(1.0 + pow(tan(angle_),2.0));
00250 }
00251 
00252 scalar definedPressureSwirlInjector::averageVelocity
00253 (
00254     const label i
00255 ) const
00256 {    
00257 
00258     const injectorType& it = sm_.injectors()[i].properties();
00259 
00260     scalar dt = it.teoi() - it.tsoi();
00261 
00262     scalar injectedMassFlow = it.mass()/(it.teoi()-it.tsoi());
00263 
00264     scalar injectionPressure = averagePressure(i);
00265 
00266     scalar Tav = it.integrateTable(it.T())/dt;
00267     scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X());  
00268 
00269     scalar kV = kv(i, injectedMassFlow, injectionPressure, 0);
00270 
00271     return  kV*sqrt(2.0*(injectionPressure-sm_.ambientPressure())/rhoFuel);
00272 
00273 }
00274 
00275 
00276 scalar definedPressureSwirlInjector::kv
00277 (
00278     const label inj,
00279     const scalar massFlow,
00280     const scalar dPressure,
00281     const scalar t
00282 ) const
00283 {
00284 
00285     const injectorType& it = injectors_[inj].properties();
00286 
00287     scalar coneAngle = it.getTableValue(coneAngle_, t);
00288 
00289     coneAngle *= mathematicalConstant::pi/360.0;
00290 
00291     scalar cosAngle = cos(coneAngle);
00292     scalar Tav = it.integrateTable(it.T())/(it.teoi()-it.tsoi());
00293 
00294     scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X()); 
00295     scalar injectorDiameter = it.d();  
00296      
00297     scalar kv = max
00298     (
00299         it.getTableValue(maxKv_, t), 
00300         4.0*massFlow
00301         *
00302         sqrt(rhoFuel/2.0/dPressure)
00303         /
00304         (mathematicalConstant::pi*pow(injectorDiameter, 2.0)*rhoFuel*cosAngle)
00305     );
00306 
00307     return min(1.0,kv);   
00308 }
00309 
00310 
00311 
00312 
00313 scalar definedPressureSwirlInjector::deltaPressureInj(const scalar time, const label inj) const
00314 {
00315     return injectors_[inj].properties()->injectionPressure(time) - sm_.ambientPressure();   
00316 }
00317 
00318 scalar definedPressureSwirlInjector::averagePressure(const label inj) const
00319 {
00320 
00321     const injectorType& it = sm_.injectors()[inj].properties();
00322 
00323     scalar dt = it.teoi() - it.tsoi();
00324     return it.integrateTable(it.injectionPressureProfile())/dt;
00325 }
00326 
00327 } // End namespace Foam
00328 
00329 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd