FreeFOAM The Cross-Platform CFD Toolkit
COxidationDiffusionLimitedRate.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class CloudType>
33 (
34  const dictionary& dict,
35  CloudType& owner
36 )
37 :
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)
47 {
48  // Determine Cs ids
49  label idSolid = owner.composition().idSolid();
50  CsLocalId_ = owner.composition().localId(idSolid, "C");
51 
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();
57 
58  if (Sb_ < 0)
59  {
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  }
70 }
71 
72 
73 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
74 
75 template<class CloudType>
78 {}
79 
80 
81 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
82 
83 template<class CloudType>
85 {
86  return true;
87 }
88 
89 
90 template<class CloudType>
92 (
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 scalar N,
106  scalarField& dMassGas,
107  scalarField& dMassLiquid,
108  scalarField& dMassSolid,
109  scalarField& dMassSRCarrier
110 ) const
111 {
112  // Fraction of remaining combustible material
113  const label idSolid = CloudType::parcelType::SLD;
114  const scalar fComb = YMixture[idSolid]*YSolid[CsLocalId_];
115 
116  // Surface combustion active combustible fraction is consumed
117  if (fComb < SMALL)
118  {
119  return 0.0;
120  }
121 
122  // Local mass fraction of O2 in the carrier phase
123  const scalar YO2 = this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
124 
125  // Change in C mass [kg]
126  scalar dmC =
127  4.0*mathematicalConstant::pi*d*D_*YO2*Tc*rhoc/(Sb_*(T + Tc))*dt;
128 
129  // Limit mass transfer by availability of C
130  dmC = min(mass*fComb, dmC);
131 
132  // Change in O2 mass [kg]
133  const scalar dmO2 = dmC/WC_*Sb_*WO2_;
134 
135  // Mass of newly created CO2 [kg]
136  const scalar dmCO2 = dmC + dmO2;
137 
138  // Update local particle C mass
139  dMassSolid[CsLocalId_] += dmC;
140 
141  // Update carrier O2 and CO2 mass
142  dMassSRCarrier[O2GlobalId_] -= dmO2;
143  dMassSRCarrier[CO2GlobalId_] += dmCO2;
144 
145  // Heat of reaction [J]
146  return -HcCO2_*dmCO2;
147 }
148 
149 
150 // ************************ vim: set sw=4 sts=4 et: ************************ //