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

COxidationMurphyShaddix.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) 2008-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 "COxidationMurphyShaddix.H"
00028 
00029 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00030 
00031 template<class CloudType>
00032 Foam::label Foam::COxidationMurphyShaddix<CloudType>::maxIters_ = 1000;
00033 
00034 template<class CloudType>
00035 Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::tolerance_ = 1e-06;
00036 
00037 
00038 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00039 
00040 template<class CloudType>
00041 Foam::COxidationMurphyShaddix<CloudType>::COxidationMurphyShaddix
00042 (
00043     const dictionary& dict,
00044     CloudType& owner
00045 )
00046 :
00047     SurfaceReactionModel<CloudType>
00048     (
00049         dict,
00050         owner,
00051         typeName
00052     ),
00053     D0_(dimensionedScalar(this->coeffDict().lookup("D0")).value()),
00054     rho0_(dimensionedScalar(this->coeffDict().lookup("rho0")).value()),
00055     T0_(dimensionedScalar(this->coeffDict().lookup("T0")).value()),
00056     Dn_(dimensionedScalar(this->coeffDict().lookup("Dn")).value()),
00057     A_(dimensionedScalar(this->coeffDict().lookup("A")).value()),
00058     E_(dimensionedScalar(this->coeffDict().lookup("E")).value()),
00059     n_(dimensionedScalar(this->coeffDict().lookup("n")).value()),
00060     WVol_(dimensionedScalar(this->coeffDict().lookup("WVol")).value()),
00061     CsLocalId_(-1),
00062     O2GlobalId_(owner.composition().globalCarrierId("O2")),
00063     CO2GlobalId_(owner.composition().globalCarrierId("CO2")),
00064     WC_(0.0),
00065     WO2_(0.0)
00066 {
00067     // Determine Cs ids
00068     label idSolid = owner.composition().idSolid();
00069     CsLocalId_ = owner.composition().localId(idSolid, "C");
00070 
00071     // Set local copies of thermo properties
00072     WO2_ = owner.mcCarrierThermo().speciesData()[O2GlobalId_].W();
00073     scalar WCO2 = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].W();
00074     WC_ = WCO2 - WO2_;
00075 }
00076 
00077 
00078 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00079 
00080 template<class CloudType>
00081 Foam::COxidationMurphyShaddix<CloudType>::~COxidationMurphyShaddix()
00082 {}
00083 
00084 
00085 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00086 
00087 template<class CloudType>
00088 bool Foam::COxidationMurphyShaddix<CloudType>::active() const
00089 {
00090     return true;
00091 }
00092 
00093 
00094 template<class CloudType>
00095 Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::calculate
00096 (
00097     const scalar dt,
00098     const label cellI,
00099     const scalar d,
00100     const scalar T,
00101     const scalar Tc,
00102     const scalar pc,
00103     const scalar rhoc,
00104     const scalar mass,
00105     const scalarField& YGas,
00106     const scalarField& YLiquid,
00107     const scalarField& YSolid,
00108     const scalarField& YMixture,
00109     const scalarField& dMassVolatile,
00110     scalarField& dMassGas,
00111     scalarField& dMassLiquid,
00112     scalarField& dMassSolid,
00113     scalarField& dMassSRCarrier
00114 ) const
00115 {
00116     // Fraction of remaining combustible material
00117     const label idSolid = CloudType::parcelType::SLD;
00118     const scalar fComb = YMixture[idSolid]*YSolid[CsLocalId_];
00119 
00120     // Surface combustion until combustible fraction is consumed
00121     if (fComb < SMALL)
00122     {
00123         return 0.0;
00124     }
00125 
00126     // Cell carrier phase O2 species density [kg/m^3]
00127     const scalar rhoO2 =
00128         rhoc*this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
00129 
00130     if (rhoO2 < SMALL)
00131     {
00132         return 0.0;
00133     }
00134 
00135     // Particle surface area [m^2]
00136     const scalar Ap = mathematicalConstant::pi*sqr(d);
00137 
00138     // Calculate diffision constant at continuous phase temperature
00139     // and density [m^2/s]
00140     const scalar D = D0_*(rho0_/rhoc)*pow(Tc/T0_, Dn_);
00141 
00142     // Far field partial pressure O2 [Pa]
00143     const scalar ppO2 = rhoO2/WO2_*specie::RR*Tc;
00144 
00145     // Molar emission rate of volatiles per unit surface area
00146     const scalar qVol = sum(dMassVolatile)/(WVol_*Ap);
00147 
00148     // Total molar concentration of the carrier phase [kmol/m^3]
00149     const scalar C = pc/(specie::RR*Tc);
00150 
00151     if (debug)
00152     {
00153         Pout<< "mass  = " << mass << nl
00154             << "fComb = " << fComb << nl
00155             << "Ap    = " << Ap << nl
00156             << "dt    = " << dt << nl
00157             << "C     = " << C << nl
00158             << endl;
00159     }
00160 
00161     // Molar reaction rate per unit surface area [kmol/(m^2.s)]
00162     scalar qCsOld = 0;
00163     scalar qCs = 1;
00164 
00165     const scalar qCsLim = mass*fComb/(WC_*Ap*dt);
00166 
00167     if (debug)
00168     {
00169         Pout << "qCsLim = " << qCsLim << endl;
00170     }
00171 
00172     label iter = 0;
00173     while ((mag(qCs - qCsOld)/qCs > tolerance_) && (iter <= maxIters_))
00174     {
00175         qCsOld = qCs;
00176         const scalar PO2Surface = ppO2*exp(-(qCs + qVol)*d/(2*C*D));
00177         qCs = A_*exp(-E_/(specie::RR*T))*pow(PO2Surface, n_);
00178         qCs = (100.0*qCs + iter*qCsOld)/(100.0 + iter);
00179         qCs = min(qCs, qCsLim);
00180 
00181         if (debug)
00182         {
00183             Pout<< "iter = " << iter
00184                 << ", qCsOld = " << qCsOld
00185                 << ", qCs = " << qCs
00186                 << nl << endl;
00187         }
00188 
00189         iter++;
00190     }
00191 
00192     if (iter > maxIters_)
00193     {
00194         WarningIn
00195         (
00196             "scalar Foam::COxidationMurphyShaddix<CloudType>::calculate(...)"
00197         )   << "iter limit reached (" << maxIters_ << ")" << nl << endl;
00198     }
00199 
00200     // Calculate the number of molar units reacted
00201     scalar dOmega = qCs*Ap*dt;
00202 
00203     // Add to carrier phase mass transfer
00204     dMassSRCarrier[O2GlobalId_] += -dOmega*WO2_;
00205     dMassSRCarrier[CO2GlobalId_] += dOmega*(WC_ + WO2_);
00206 
00207     // Add to particle mass transfer
00208     dMassSolid[CsLocalId_] += dOmega*WC_;
00209 
00210     const scalar HC =
00211         this->owner().composition().solids().properties()[CsLocalId_].Hf()
00212       + this->owner().composition().solids().properties()[CsLocalId_].cp()*T;
00213     const scalar HCO2 =
00214         this->owner().mcCarrierThermo().speciesData()[CO2GlobalId_].H(T);
00215     const scalar HO2 =
00216         this->owner().mcCarrierThermo().speciesData()[O2GlobalId_].H(T);
00217 
00218     // Heat of reaction
00219     return dOmega*(WC_*HC + WO2_*HO2 - (WC_ + WO2_)*HCO2);
00220 }
00221 
00222 
00223 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd