initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / lagrangian / coalCombustion / submodels / surfaceReactionModel / COxidationKineticDiffusionLimitedRate / COxidationKineticDiffusionLimitedRate.C
blob682bac3ec67c9bd4eb4634daa0e7315ea9d24140
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2008-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "COxidationKineticDiffusionLimitedRate.H"
29 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
31 template<class CloudType>
32 Foam::COxidationKineticDiffusionLimitedRate<CloudType>::
33 COxidationKineticDiffusionLimitedRate
35     const dictionary& dict,
36     CloudType& owner
39     SurfaceReactionModel<CloudType>
40     (
41         dict,
42         owner,
43         typeName
44     ),
45     Sb_(dimensionedScalar(this->coeffDict().lookup("Sb")).value()),
46     C1_(dimensionedScalar(this->coeffDict().lookup("C1")).value()),
47     C2_(dimensionedScalar(this->coeffDict().lookup("C2")).value()),
48     E_(dimensionedScalar(this->coeffDict().lookup("E")).value()),
49     CsLocalId_(-1),
50     O2GlobalId_(owner.composition().globalCarrierId("O2")),
51     CO2GlobalId_(owner.composition().globalCarrierId("CO2")),
52     WC_(0.0),
53     WO2_(0.0),
54     HcCO2_(0.0)
56     // Determine Cs ids
57     label idSolid = owner.composition().idSolid();
58     CsLocalId_ = owner.composition().localId(idSolid, "C");
60     // Set local copies of thermo properties
61     WO2_ = owner.mcCarrierThermo().speciesData()[O2GlobalId_].W();
62     scalar WCO2 = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].W();
63     WC_ = WCO2 - WO2_;
64     HcCO2_ = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].Hc();
66     if (Sb_ < 0)
67     {
68         FatalErrorIn
69         (
70             "COxidationKineticDiffusionLimitedRate"
71             "("
72                 "const dictionary&, "
73                 "CloudType&"
74             ")"
75         )   << "Stoichiometry of reaction, Sb, must be greater than zero" << nl
76             << exit(FatalError);
77     }
81 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
83 template<class CloudType>
84 Foam::COxidationKineticDiffusionLimitedRate<CloudType>::
85 ~COxidationKineticDiffusionLimitedRate()
89 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
91 template<class CloudType>
92 bool Foam::COxidationKineticDiffusionLimitedRate<CloudType>::active() const
94     return true;
98 template<class CloudType>
99 Foam::scalar Foam::COxidationKineticDiffusionLimitedRate<CloudType>::calculate
101     const scalar dt,
102     const label cellI,
103     const scalar d,
104     const scalar T,
105     const scalar Tc,
106     const scalar pc,
107     const scalar rhoc,
108     const scalar mass,
109     const scalarField& YGas,
110     const scalarField& YLiquid,
111     const scalarField& YSolid,
112     const scalarField& YMixture,
113     const scalarField& dMassVolatile,
114     scalarField& dMassGas,
115     scalarField& dMassLiquid,
116     scalarField& dMassSolid,
117     scalarField& dMassSRCarrier
118 ) const
120     // Fraction of remaining combustible material
121     const label idSolid = CloudType::parcelType::SLD;
122     const scalar fComb = YMixture[idSolid]*YSolid[CsLocalId_];
124     // Surface combustion active combustible fraction is consumed
125     if (fComb < SMALL)
126     {
127         return 0.0;
128     }
130     // Local mass fraction of O2 in the carrier phase
131     const scalar YO2 = this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
133     // Diffusion rate coefficient
134     const scalar D0 = C1_/d*pow(0.5*(T + Tc), 0.75);
136     // Kinetic rate
137     const scalar Rk = C2_*exp(-E_/(specie::RR*Tc));
139     // Particle surface area
140     const scalar Ap = mathematicalConstant::pi*sqr(d);
142     // Change in C mass [kg]
143     scalar dmC = Ap*rhoc*specie::RR*Tc*YO2/WO2_*D0*Rk/(D0 + Rk);
145     // Limit mass transfer by availability of C
146     dmC = min(mass*fComb, dmC);
148     // Change in O2 mass [kg]
149     const scalar dmO2 = dmC/WC_*Sb_*WO2_;
151     // Mass of newly created CO2 [kg]
152     const scalar dmCO2 = dmC + dmO2;
154     // Update local particle C mass
155     dMassSolid[CsLocalId_] += dmC;
157     // Update carrier O2 and CO2 mass
158     dMassSRCarrier[O2GlobalId_] -= dmO2;
159     dMassSRCarrier[CO2GlobalId_] += dmCO2;
161     // Heat of reaction [J]
162     return -HcCO2_*dmCO2;
166 // ************************************************************************* //