initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / lagrangian / coalCombustion / submodels / surfaceReactionModel / COxidationDiffusionLimitedRate / COxidationDiffusionLimitedRate.C
blob2e252fbf596518b276d552225c0fc55353f48cc1
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 "COxidationDiffusionLimitedRate.H"
29 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
31 template<class CloudType>
32 Foam::COxidationDiffusionLimitedRate<CloudType>::COxidationDiffusionLimitedRate
34     const dictionary& dict,
35     CloudType& owner
38     SurfaceReactionModel<CloudType>(dict, owner, typeName),
39     Sb_(dimensionedScalar(this->coeffDict().lookup("Sb")).value()),
40     D_(dimensionedScalar(this->coeffDict().lookup("D")).value()),
41     CsLocalId_(-1),
42     O2GlobalId_(owner.composition().globalCarrierId("O2")),
43     CO2GlobalId_(owner.composition().globalCarrierId("CO2")),
44     WC_(0.0),
45     WO2_(0.0),
46     HcCO2_(0.0)
48     // Determine Cs ids
49     label idSolid = owner.composition().idSolid();
50     CsLocalId_ = owner.composition().localId(idSolid, "C");
52     // Set local copies of thermo properties
53     WO2_ = owner.mcCarrierThermo().speciesData()[O2GlobalId_].W();
54     scalar WCO2 = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].W();
55     WC_ = WCO2 - WO2_;
56     HcCO2_ = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].Hc();
58     if (Sb_ < 0)
59     {
60         FatalErrorIn
61         (
62             "COxidationDiffusionLimitedRate<CloudType>"
63             "("
64                 "const dictionary&, "
65                 "CloudType&"
66             ")"
67         )   << "Stoichiometry of reaction, Sb, must be greater than zero" << nl
68             << exit(FatalError);
69     }
73 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
75 template<class CloudType>
76 Foam::COxidationDiffusionLimitedRate<CloudType>::
77 ~COxidationDiffusionLimitedRate()
81 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
83 template<class CloudType>
84 bool Foam::COxidationDiffusionLimitedRate<CloudType>::active() const
86     return true;
90 template<class CloudType>
91 Foam::scalar Foam::COxidationDiffusionLimitedRate<CloudType>::calculate
93     const scalar dt,
94     const label cellI,
95     const scalar d,
96     const scalar T,
97     const scalar Tc,
98     const scalar pc,
99     const scalar rhoc,
100     const scalar mass,
101     const scalarField& YGas,
102     const scalarField& YLiquid,
103     const scalarField& YSolid,
104     const scalarField& YMixture,
105     const scalarField& dMassVolatile,
106     scalarField& dMassGas,
107     scalarField& dMassLiquid,
108     scalarField& dMassSolid,
109     scalarField& dMassSRCarrier
110 ) const
112     // Fraction of remaining combustible material
113     const label idSolid = CloudType::parcelType::SLD;
114     const scalar fComb = YMixture[idSolid]*YSolid[CsLocalId_];
116     // Surface combustion active combustible fraction is consumed
117     if (fComb < SMALL)
118     {
119         return 0.0;
120     }
122     // Local mass fraction of O2 in the carrier phase
123     const scalar YO2 = this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
125     // Change in C mass [kg]
126     scalar dmC =
127         4.0*mathematicalConstant::pi*d*D_*YO2*Tc*rhoc/(Sb_*(T + Tc))*dt;
129     // Limit mass transfer by availability of C
130     dmC = min(mass*fComb, dmC);
132     // Change in O2 mass [kg]
133     const scalar dmO2 = dmC/WC_*Sb_*WO2_;
135     // Mass of newly created CO2 [kg]
136     const scalar dmCO2 = dmC + dmO2;
138     // Update local particle C mass
139     dMassSolid[CsLocalId_] += dmC;
141     // Update carrier O2 and CO2 mass
142     dMassSRCarrier[O2GlobalId_] -= dmO2;
143     dMassSRCarrier[CO2GlobalId_] += dmCO2;
145     // Heat of reaction [J]
146     return -HcCO2_*dmCO2;
150 // ************************************************************************* //