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

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