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

pressureSwirlInjector.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 "pressureSwirlInjector.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "mathematicalConstants.H"
00030 
00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035 
00036 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00037 
00038 defineTypeNameAndDebug(pressureSwirlInjector, 0);
00039 
00040 addToRunTimeSelectionTable
00041 (
00042     injectorModel,
00043     pressureSwirlInjector,
00044     dictionary
00045 );
00046 
00047 
00048 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00049 
00050 // Construct from components
00051 pressureSwirlInjector::pressureSwirlInjector
00052 (
00053     const dictionary& dict,
00054     spray& sm
00055 )
00056 :
00057     injectorModel(dict, sm),
00058     pressureSwirlInjectorDict_(dict.subDict(typeName + "Coeffs")),
00059 
00060     coneAngle_(pressureSwirlInjectorDict_.lookup("ConeAngle")),
00061     coneInterval_(pressureSwirlInjectorDict_.lookup("ConeInterval")),
00062     maxKv_(pressureSwirlInjectorDict_.lookup("maxKv")),
00063 
00064     angle_(0.0)
00065 {
00066 
00067     if (sm.injectors().size() != coneAngle_.size())
00068     {
00069         FatalError << "pressureSwirlInjector::pressureSwirlInjector"
00070             << "(const dictionary& dict, spray& sm)\n"
00071             << "Wrong number of entries in innerAngle"
00072             << abort(FatalError);
00073     }
00074 
00075     scalar referencePressure = sm.p().average().value();
00076 
00077     // correct velocityProfile
00078     forAll(sm.injectors(), i)
00079     {
00080         sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure);
00081     }
00082 
00083 }
00084 
00085 
00086 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00087 
00088 pressureSwirlInjector::~pressureSwirlInjector()
00089 {}
00090 
00091 
00092 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00093 
00094 scalar pressureSwirlInjector::d0
00095 (
00096     const label n, 
00097     const scalar t
00098 ) const
00099 {
00100     const injectorType& it = injectors_[n].properties();
00101 
00102     scalar c = rndGen_.scalar01();
00103     angle_ = coneAngle_[n]  + 2.0 * coneInterval_[n] * (0.5 - c) ;
00104 
00105     angle_ *= mathematicalConstant::pi/360.0;
00106 
00107     scalar injectedMassFlow = it.massFlowRate(t);
00108     
00109     scalar cosAngle = cos(angle_);   
00110 
00111     scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), it.T(t), it.X()); 
00112     scalar injectorDiameter = it.d();  
00113      
00114     scalar deltaPressure = deltaPressureInj(t,n);
00115     scalar kV = kv(n, injectedMassFlow, deltaPressure);
00116     scalar v = kV * sqrt(2.0*deltaPressure/rhoFuel);    
00117 
00118     u_ = v * cosAngle;
00119     
00120     scalar A = injectedMassFlow/(mathematicalConstant::pi*rhoFuel*u_);
00121 
00122     return (injectorDiameter-sqrt(pow(injectorDiameter,2)-4.0*A))/2.0;
00123 }
00124 
00125 vector pressureSwirlInjector::direction
00126 (
00127     const label n,
00128     const label hole,
00129     const scalar time,
00130     const scalar d
00131 ) const
00132 {
00133 
00134     scalar alpha = sin(angle_);
00135     scalar dcorr = cos(angle_);
00136     scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01();
00137 
00138     // randomly distributed vector normal to the injection vector
00139     vector normal = vector::zero;
00140     
00141     if (sm_.twoD())
00142     {
00143         scalar reduce = 0.01;
00144         // correct beta if this is a 2D run
00145         // map it onto the 'angleOfWedge'
00146 
00147         beta *= (1.0-2.0*reduce)*sm_.angleOfWedge()/(2.0*mathematicalConstant::pi);
00148         beta += reduce*sm_.angleOfWedge();
00149         normal = alpha*
00150         (
00151             sm_.axisOfWedge()*cos(beta) +
00152             sm_.axisOfWedgeNormal()*sin(beta)
00153         );
00154     }
00155     else
00156     {
00157         normal = alpha*
00158         (
00159             injectors_[n].properties()->tan1(hole)*cos(beta) +
00160             injectors_[n].properties()->tan2(hole)*sin(beta)
00161         );
00162     }
00163     
00164     // set the direction of injection by adding the normal vector
00165     vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal;
00166     dir /= mag(dir);
00167 
00168     return dir;
00169 }
00170 
00171 
00172 scalar pressureSwirlInjector::velocity
00173 (
00174     const label i,
00175     const scalar time
00176 ) const
00177 {
00178     return u_*sqrt(1.0 + pow(tan(angle_),2.0));
00179 }
00180 
00181 scalar pressureSwirlInjector::averageVelocity
00182 (
00183     const label i
00184 ) const
00185 {    
00186 
00187     const injectorType& it = sm_.injectors()[i].properties();
00188 
00189     scalar dt = it.teoi() - it.tsoi();
00190 
00191     scalar injectedMassFlow = it.mass()/(it.teoi()-it.tsoi());
00192 
00193     scalar injectionPressure = averagePressure(i);
00194 
00195     scalar Tav = it.integrateTable(it.T())/dt;
00196     scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X());  
00197 
00198     scalar kV = kv(i, injectedMassFlow, injectionPressure);
00199 
00200     return  kV*sqrt(2.0*(injectionPressure-sm_.ambientPressure())/rhoFuel);
00201 }
00202 
00203 
00204 scalar pressureSwirlInjector::kv
00205 (
00206     const label inj,
00207     const scalar massFlow,
00208     const scalar dPressure
00209 ) const
00210 {
00211 
00212     const injectorType& it = injectors_[inj].properties();
00213 
00214     scalar coneAngle = coneAngle_[inj];
00215 
00216     coneAngle *= mathematicalConstant::pi/360.0;
00217 
00218     scalar cosAngle = cos(coneAngle);
00219     scalar Tav = it.integrateTable(it.T())/(it.teoi()-it.tsoi());
00220 
00221     scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X()); 
00222     scalar injectorDiameter = it.d();  
00223      
00224     scalar kv = max
00225     (
00226         maxKv_[inj], 
00227         4.0*massFlow
00228         *
00229         sqrt(rhoFuel/2.0/dPressure)
00230         /
00231         (mathematicalConstant::pi*pow(injectorDiameter, 2.0)*rhoFuel*cosAngle)
00232     );
00233 
00234     return min(1.0, kv);   
00235 }
00236 
00237 
00238 
00239 
00240 scalar pressureSwirlInjector::deltaPressureInj(const scalar time, const label inj) const
00241 {
00242     return injectors_[inj].properties()->injectionPressure(time) - sm_.ambientPressure();   
00243 }
00244 
00245 scalar pressureSwirlInjector::averagePressure(const label inj) const
00246 {
00247 
00248     const injectorType& it = sm_.injectors()[inj].properties();
00249 
00250     scalar dt = it.teoi() - it.tsoi();
00251     return it.integrateTable(it.injectionPressureProfile())/dt;
00252 }
00253 
00254 } // End namespace Foam
00255 
00256 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd