FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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