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

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