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

setRelaxationTimes.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 <dieselSpray/parcel.H>
00027 
00028 #include <dieselSpray/spray.H>
00029 #include <dieselSpray/dragModel.H>
00030 #include <dieselSpray/evaporationModel.H>
00031 #include <dieselSpray/heatTransferModel.H>
00032 #include <reactionThermophysicalModels/basicMultiComponentMixture.H>
00033 
00034 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00035 
00036 namespace Foam
00037 {
00038 
00039 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00040 
00041 void parcel::setRelaxationTimes
00042 (
00043     label celli,
00044     scalar& tauMomentum,
00045     scalarField& tauEvaporation,
00046     scalar& tauHeatTransfer,
00047     scalarField& tauBoiling,
00048     const spray& sDB,
00049     const scalar rho,
00050     const vector& Up,
00051     const scalar temperature,
00052     const scalar pressure,
00053     const scalarField& Yfg,
00054     const scalarField& m0,
00055     const scalar dt
00056 )
00057 {
00058 
00059     const liquidMixture& fuels = sDB.fuels();
00060 
00061     scalar mCell = rho*sDB.mesh().V()[cell()];
00062     scalarField mfg(Yfg*mCell);
00063 
00064     label Ns = sDB.composition().Y().size();
00065     label Nf = fuels.components().size();
00066 
00067     // Tf is based on the 1/3 rule
00068     scalar Tf  = T() + (temperature - T())/3.0;
00069 
00070     // calculate mixture properties
00071     scalar W = 0.0;
00072     scalar kMixture = 0.0;
00073     scalar cpMixture = 0.0;
00074     scalar muf = 0.0;
00075 
00076     for(label i=0; i<Ns; i++)
00077     {
00078         scalar Y = sDB.composition().Y()[i][celli];
00079         W += Y/sDB.gasProperties()[i].W();
00080         // Using mass-fractions to average...
00081         kMixture += Y*sDB.gasProperties()[i].kappa(Tf);
00082         cpMixture += Y*sDB.gasProperties()[i].Cp(Tf);
00083         muf += Y*sDB.gasProperties()[i].mu(Tf);
00084     }
00085     W = 1.0/W;
00086 
00087     scalarField Xf(Nf, 0.0);
00088     scalarField Yf(Nf, 0.0);
00089     scalarField psat(Nf, 0.0);
00090     scalarField msat(Nf, 0.0);
00091 
00092     for(label i=0; i<Nf; i++)
00093     {
00094         label j = sDB.liquidToGasIndex()[i];
00095         scalar Y = sDB.composition().Y()[j][celli];
00096         scalar Wi = sDB.gasProperties()[j].W();
00097         Yf[i] = Y;
00098         Xf[i] = Y*W/Wi;
00099         psat[i] = fuels.properties()[i].pv(pressure, temperature);
00100         msat[i] = min(1.0, psat[i]/pressure)*Wi/W;
00101     }
00102 
00103     scalar nuf = muf/rho;
00104 
00105     scalar liquidDensity = fuels.rho(pressure, T(), X());
00106     scalar liquidcL = fuels.cp(pressure, T(), X());
00107     scalar heatOfVapour = fuels.hl(pressure, T(), X());
00108 
00109     // calculate the partial rho of the fuel vapour
00110     // alternative is to use the mass fraction
00111     // however, if rhoFuelVap is small (zero)
00112     // d(mass)/dt = 0 => no evaporation... hmmm... is that good? NO!
00113 
00114     // Assume equilibrium at drop-surface => pressure @ surface
00115     // = vapour pressure to calculate fuel-vapour density @ surface
00116     scalar pressureAtSurface = fuels.pv(pressure, T(), X());
00117     scalar rhoFuelVap = pressureAtSurface*fuels.W(X())/(specie::RR*Tf);
00118 
00119     scalarField Xs(sDB.fuels().Xs(pressure, temperature, T(), Xf, X()));
00120     scalarField Ys(Nf, 0.0);
00121     scalar Wliq = 0.0;
00122 
00123     for(label i=0; i<Nf; i++)
00124     {
00125         label j = sDB.liquidToGasIndex()[i];
00126         scalar Wi = sDB.gasProperties()[j].W();
00127         Wliq += Xs[i]*Wi;
00128     }
00129 
00130     for(label i=0; i<Nf; i++)
00131     {
00132         label j = sDB.liquidToGasIndex()[i];
00133         scalar Wi = sDB.gasProperties()[j].W();
00134         Ys[i] = Xs[i]*Wi/Wliq;
00135     }
00136 
00137     scalar Reynolds = Re(Up, nuf);
00138     scalar Prandtl = Pr(cpMixture, muf, kMixture);
00139 
00140     // calculate the characteritic times
00141 
00142     if(liquidCore_> 0.5)
00143     {
00144 //      no drag for parcels in the liquid core..
00145         tauMomentum = GREAT;
00146     }
00147     else
00148     {
00149         tauMomentum = sDB.drag().relaxationTime
00150         (
00151             Urel(Up),
00152             d(),
00153             rho,
00154             liquidDensity,
00155             nuf,
00156             dev()
00157         );
00158     }
00159 
00160     // store the relaxationTime since it is needed in some breakup models.
00161     tMom_ = tauMomentum;
00162 
00163     tauHeatTransfer = sDB.heatTransfer().relaxationTime
00164     (
00165         liquidDensity,
00166         d(),
00167         liquidcL,
00168         kMixture,
00169         Reynolds,
00170         Prandtl
00171     );
00172 
00173     // evaporation-properties are evaluated at averaged temperature
00174     // set the boiling conditions true if pressure @ surface is 99.9%
00175     // of the pressure
00176     // this is mainly to put a limit on the evaporation time,
00177     // since tauEvaporation is very very small close to the boiling point.
00178 
00179     for(label i=0; i<Nf; i++)
00180     {
00181         scalar Td = min(T(), 0.999*fuels.properties()[i].Tc());
00182         bool boiling = fuels.properties()[i].pv(pressure, Td) >= 0.999*pressure;
00183         scalar Di = fuels.properties()[i].D(pressure, Td);
00184         scalar Schmidt = Sc(nuf, Di);
00185 
00186         scalar partialPressure = Xf[i]*pressure;
00187 
00188 //      saturated vapour
00189         if(partialPressure > psat[i])
00190         {
00191             tauEvaporation[i] = GREAT;
00192         }
00193 //      not saturated vapour
00194         else
00195         {
00196             if (!boiling)
00197             {
00198                 // for saturation evaporation, only use 99.99% for numerical robustness
00199                 scalar dm = max(SMALL, 0.9999*msat[i] - mfg[i]);
00200 
00201                 tauEvaporation[i] = sDB.evaporation().relaxationTime
00202                 (
00203                     d(),
00204                     fuels.properties()[i].rho(pressure, Td),
00205                     rhoFuelVap,
00206                     Di,
00207                     Reynolds,
00208                     Schmidt,
00209                     Xs[i],
00210                     Xf[i],
00211                     m0[i],
00212                     dm,
00213                     dt
00214                 );
00215             }
00216             else
00217             {
00218                 scalar Nusselt =
00219                     sDB.heatTransfer().Nu(Reynolds, Prandtl);
00220 
00221 //              calculating the boiling temperature of the liquid at ambient pressure
00222                 scalar tBoilingSurface = Td;
00223 
00224                 label Niter = 0;
00225                 scalar deltaT = 10.0;
00226                 scalar dp0 = fuels.properties()[i].pv(pressure, tBoilingSurface) - pressure;
00227                 while ((Niter < 200) && (mag(deltaT) > 1.0e-3))
00228                 {
00229                     Niter++;
00230                     scalar pBoil = fuels.properties()[i].pv(pressure, tBoilingSurface);
00231                     scalar dp = pBoil - pressure;
00232                     if ( (dp > 0.0) && (dp0 > 0.0) )
00233                     {
00234                         tBoilingSurface -= deltaT;
00235                     }
00236                     else
00237                     {
00238                         if ( (dp < 0.0) && (dp0 < 0.0) )
00239                         {
00240                             tBoilingSurface += deltaT;
00241                         }
00242                         else
00243                         {
00244                             deltaT *= 0.5;
00245                             if ( (dp > 0.0) && (dp0 < 0.0) )
00246                             {
00247                                 tBoilingSurface -= deltaT;
00248                             }
00249                             else
00250                             {
00251                                 tBoilingSurface += deltaT;
00252                             }
00253                         }
00254                     }
00255                     dp0 = dp;
00256                 }
00257 
00258                 scalar vapourSurfaceEnthalpy = 0.0;
00259                 scalar vapourFarEnthalpy = 0.0;
00260 
00261                 for(label k = 0; k < sDB.gasProperties().size(); k++)
00262                 {
00263                     vapourSurfaceEnthalpy += sDB.composition().Y()[k][celli]*sDB.gasProperties()[k].H(tBoilingSurface);
00264                     vapourFarEnthalpy += sDB.composition().Y()[k][celli]*sDB.gasProperties()[k].H(temperature);
00265                 }
00266 
00267                 scalar kLiquid = fuels.properties()[i].K(pressure, 0.5*(tBoilingSurface+T()));
00268 
00269                 tauBoiling[i] = sDB.evaporation().boilingTime
00270                 (
00271                     fuels.properties()[i].rho(pressure, Td),
00272                     fuels.properties()[i].cp(pressure, Td),
00273                     heatOfVapour,
00274                     kMixture,
00275                     Nusselt,
00276                     temperature - T(),
00277                     d(),
00278                     liquidCore(),
00279                     sDB.runTime().value() - ct(),
00280                     Td,
00281                     tBoilingSurface,
00282                     vapourSurfaceEnthalpy,
00283                     vapourFarEnthalpy,
00284                     cpMixture,
00285                     temperature,
00286                     kLiquid
00287                 );
00288             }
00289 
00290         }
00291     }
00292 }
00293 
00294 
00295 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00296 
00297 } // End namespace Foam
00298 
00299 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines