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

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