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

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