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

COxidationKineticDiffusionLimitedRate.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-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 "COxidationKineticDiffusionLimitedRate.H"
00027 #include <OpenFOAM/mathematicalConstants.H>
00028 
00029 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00030 
00031 template<class CloudType>
00032 Foam::COxidationKineticDiffusionLimitedRate<CloudType>::
00033 COxidationKineticDiffusionLimitedRate
00034 (
00035     const dictionary& dict,
00036     CloudType& owner
00037 )
00038 :
00039     SurfaceReactionModel<CloudType>
00040     (
00041         dict,
00042         owner,
00043         typeName
00044     ),
00045     Sb_(dimensionedScalar(this->coeffDict().lookup("Sb")).value()),
00046     C1_(dimensionedScalar(this->coeffDict().lookup("C1")).value()),
00047     C2_(dimensionedScalar(this->coeffDict().lookup("C2")).value()),
00048     E_(dimensionedScalar(this->coeffDict().lookup("E")).value()),
00049     CsLocalId_(-1),
00050     O2GlobalId_(owner.composition().globalCarrierId("O2")),
00051     CO2GlobalId_(owner.composition().globalCarrierId("CO2")),
00052     WC_(0.0),
00053     WO2_(0.0),
00054     HcCO2_(0.0)
00055 {
00056     // Determine Cs ids
00057     label idSolid = owner.composition().idSolid();
00058     CsLocalId_ = owner.composition().localId(idSolid, "C");
00059 
00060     // Set local copies of thermo properties
00061     WO2_ = owner.mcCarrierThermo().speciesData()[O2GlobalId_].W();
00062     scalar WCO2 = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].W();
00063     WC_ = WCO2 - WO2_;
00064     HcCO2_ = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].Hc();
00065 
00066     if (Sb_ < 0)
00067     {
00068         FatalErrorIn
00069         (
00070             "COxidationKineticDiffusionLimitedRate"
00071             "("
00072                 "const dictionary&, "
00073                 "CloudType&"
00074             ")"
00075         )   << "Stoichiometry of reaction, Sb, must be greater than zero" << nl
00076             << exit(FatalError);
00077     }
00078 }
00079 
00080 
00081 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00082 
00083 template<class CloudType>
00084 Foam::COxidationKineticDiffusionLimitedRate<CloudType>::
00085 ~COxidationKineticDiffusionLimitedRate()
00086 {}
00087 
00088 
00089 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00090 
00091 template<class CloudType>
00092 bool Foam::COxidationKineticDiffusionLimitedRate<CloudType>::active() const
00093 {
00094     return true;
00095 }
00096 
00097 
00098 template<class CloudType>
00099 Foam::scalar Foam::COxidationKineticDiffusionLimitedRate<CloudType>::calculate
00100 (
00101     const scalar dt,
00102     const label cellI,
00103     const scalar d,
00104     const scalar T,
00105     const scalar Tc,
00106     const scalar pc,
00107     const scalar rhoc,
00108     const scalar mass,
00109     const scalarField& YGas,
00110     const scalarField& YLiquid,
00111     const scalarField& YSolid,
00112     const scalarField& YMixture,
00113     const scalar N,
00114     scalarField& dMassGas,
00115     scalarField& dMassLiquid,
00116     scalarField& dMassSolid,
00117     scalarField& dMassSRCarrier
00118 ) const
00119 {
00120     // Fraction of remaining combustible material
00121     const label idSolid = CloudType::parcelType::SLD;
00122     const scalar fComb = YMixture[idSolid]*YSolid[CsLocalId_];
00123 
00124     // Surface combustion active combustible fraction is consumed
00125     if (fComb < SMALL)
00126     {
00127         return 0.0;
00128     }
00129 
00130     // Local mass fraction of O2 in the carrier phase
00131     const scalar YO2 = this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
00132 
00133     // Diffusion rate coefficient
00134     const scalar D0 = C1_/d*pow(0.5*(T + Tc), 0.75);
00135 
00136     // Kinetic rate
00137     const scalar Rk = C2_*exp(-E_/(specie::RR*Tc));
00138 
00139     // Particle surface area
00140     const scalar Ap = mathematicalConstant::pi*sqr(d);
00141 
00142     // Change in C mass [kg]
00143     scalar dmC = Ap*rhoc*specie::RR*Tc*YO2/WO2_*D0*Rk/(D0 + Rk)*dt;
00144 
00145     // Limit mass transfer by availability of C
00146     dmC = min(mass*fComb, dmC);
00147 
00148     // Change in O2 mass [kg]
00149     const scalar dmO2 = dmC/WC_*Sb_*WO2_;
00150 
00151     // Mass of newly created CO2 [kg]
00152     const scalar dmCO2 = dmC + dmO2;
00153 
00154     // Update local particle C mass
00155     dMassSolid[CsLocalId_] += dmC;
00156 
00157     // Update carrier O2 and CO2 mass
00158     dMassSRCarrier[O2GlobalId_] -= dmO2;
00159     dMassSRCarrier[CO2GlobalId_] += dmCO2;
00160 
00161     // Heat of reaction [J]
00162     return -HcCO2_*dmCO2;
00163 }
00164 
00165 
00166 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines