COxidationIntrinsicRate.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2014-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
30 #include "mathematicalConstants.H"
31 
32 using namespace Foam::constant;
33 
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 
36 template<class CloudType>
38 (
39  const dictionary& dict,
40  CloudType& owner
41 )
42 :
43  SurfaceReactionModel<CloudType>(dict, owner, typeName),
44  Sb_(this->coeffDict().getScalar("Sb")),
45  C1_(this->coeffDict().getScalar("C1")),
46  rMean_(this->coeffDict().getScalar("rMean")),
47  theta_(this->coeffDict().getScalar("theta")),
48  Ai_(this->coeffDict().getScalar("Ai")),
49  Ei_(this->coeffDict().getScalar("Ei")),
50  Ag_(this->coeffDict().getScalar("Ag")),
51  tau_(this->coeffDict().getOrDefault("tau", sqrt(2.0))),
52  CsLocalId_(-1),
53  O2GlobalId_(owner.composition().carrierId("O2")),
54  CO2GlobalId_(owner.composition().carrierId("CO2")),
55  WC_(0.0),
56  WO2_(0.0),
57  HcCO2_(0.0)
58 {
59  // Determine Cs ids
60  label idSolid = owner.composition().idSolid();
61  CsLocalId_ = owner.composition().localId(idSolid, "C");
62 
63  // Set local copies of thermo properties
64  WO2_ = owner.thermo().carrier().W(O2GlobalId_);
65  const scalar WCO2 = owner.thermo().carrier().W(CO2GlobalId_);
66  WC_ = WCO2 - WO2_;
67 
68  HcCO2_ = owner.thermo().carrier().Hc(CO2GlobalId_);
69 
70  if (Sb_ < 0)
71  {
73  << "Stoichiometry of reaction, Sb, must be greater than zero" << nl
74  << exit(FatalError);
75  }
76 
77  const scalar YCloc = owner.composition().Y0(idSolid)[CsLocalId_];
78  const scalar YSolidTot = owner.composition().YMixture0()[idSolid];
79  Info<< " C(s): particle mass fraction = " << YCloc*YSolidTot << endl;
80 }
81 
82 
83 template<class CloudType>
85 (
87 )
88 :
90  Sb_(srm.Sb_),
91  C1_(srm.C1_),
92  rMean_(srm.rMean_),
93  theta_(srm.theta_),
94  Ai_(srm.Ai_),
95  Ei_(srm.Ei_),
96  Ag_(srm.Ag_),
97  tau_(srm.tau_),
98  CsLocalId_(srm.CsLocalId_),
99  O2GlobalId_(srm.O2GlobalId_),
100  CO2GlobalId_(srm.CO2GlobalId_),
101  WC_(srm.WC_),
102  WO2_(srm.WO2_),
103  HcCO2_(srm.HcCO2_)
104 {}
105 
106 
107 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
108 
109 template<class CloudType>
111 (
112  const scalar dt,
113  const scalar Re,
114  const scalar nu,
115  const label celli,
116  const scalar d,
117  const scalar T,
118  const scalar Tc,
119  const scalar pc,
120  const scalar rhoc,
121  const scalar mass,
122  const scalarField& YGas,
123  const scalarField& YLiquid,
124  const scalarField& YSolid,
125  const scalarField& YMixture,
126  const scalar N,
127  scalarField& dMassGas,
128  scalarField& dMassLiquid,
129  scalarField& dMassSolid,
130  scalarField& dMassSRCarrier
131 ) const
132 {
133  // Fraction of remaining combustible material
134  const label idSolid = CloudType::parcelType::SLD;
135  const scalar Ychar = YMixture[idSolid]*YSolid[CsLocalId_];
136 
137  // Surface combustion until combustible fraction is consumed
138  if (Ychar < SMALL)
139  {
140  return 0.0;
141  }
142 
143  const SLGThermo& thermo = this->owner().thermo();
144 
145  // Local mass fraction of O2 in the carrier phase []
146  const scalar YO2 = thermo.carrier().Y(O2GlobalId_)[celli];
147 
148  // Quick exit if oxidant not present
149  if (YO2 < ROOTVSMALL)
150  {
151  return 0.0;
152  }
153 
154  // Diffusion rate coefficient [m2/s]
155  const scalar D0 = C1_/d*pow(0.5*(T + Tc), 0.75);
156 
157  // Apparent density of pyrolysis char [kg/m3]
158  const scalar rhop = 6.0*mass/(constant::mathematical::pi*pow3(d));
159 
160  // Knusden diffusion coefficient [m2/s]
161  const scalar Dkn = 97.0*rMean_*sqrt(T/WO2_);
162 
163  // Effective diffusion [m2/s]
164  const scalar De = theta_/sqr(tau_)/(1.0/Dkn + 1/D0);
165 
166  // Cell carrier phase O2 species density [kg/m^3]
167  const scalar rhoO2 = rhoc*YO2;
168 
169  // Partial pressure O2 [Pa]
170  const scalar ppO2 = rhoO2/WO2_*RR*Tc;
171 
172  // Intrinsic reactivity [1/s]
173  const scalar ki = Ai_*exp(-Ei_/RR/T);
174 
175  // Thiele modulus []
176  const scalar phi =
177  max(0.5*d*sqrt(Sb_*rhop*Ag_*ki*ppO2/(De*rhoO2)), ROOTVSMALL);
178 
179  // Effectiveness factor []
180  const scalar eta = max(3.0/sqr(phi)*(phi/tanh(phi) - 1.0), 0.0);
181 
182  // Chemical rate [kmol/m2/s]
183  const scalar R = eta*d/6.0*rhop*Ag_*ki;
184 
185  // Particle surface area [m2]
186  const scalar Ap = constant::mathematical::pi*sqr(d);
187 
188  // Change in C mass [kg]
189  scalar dmC = Ap*rhoc*RR*Tc*YO2/WO2_*D0*R/(D0 + R)*dt;
190 
191  // Limit mass transfer by availability of C
192  dmC = min(mass*Ychar, dmC);
193 
194  // Molar consumption [kmol]
195  const scalar dOmega = dmC/WC_;
196 
197  // Change in O2 mass [kg]
198  const scalar dmO2 = dOmega*Sb_*WO2_;
199 
200  // Mass of newly created CO2 [kg]
201  const scalar dmCO2 = dOmega*(WC_ + Sb_*WO2_);
202 
203  // Update local particle C mass
204  dMassSolid[CsLocalId_] += dOmega*WC_;
205 
206  // Update carrier O2 and CO2 mass
207  dMassSRCarrier[O2GlobalId_] -= dmO2;
208  dMassSRCarrier[CO2GlobalId_] += dmCO2;
209 
210  const scalar HsC = thermo.solids().properties()[CsLocalId_].Hs(T);
211 
212  // carrier sensible enthalpy exchange handled via change in mass
213 
214  // Heat of reaction [J]
215  return dmC*HsC - dmCO2*HcCO2_;
216 }
217 
218 
219 // ************************************************************************* //
Foam::constant::thermodynamic::RR
const scalar RR
Universal gas constant: default in [J/(kmol K)].
Definition: thermodynamicConstants.C:46
Foam::SurfaceReactionModel
Templated surface reaction model class.
Definition: ReactingMultiphaseCloud.H:61
mathematicalConstants.H
Foam::COxidationIntrinsicRate
Intrinsic char surface reaction mndel.
Definition: COxidationIntrinsicRate.H:55
Foam::SLGThermo
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package,...
Definition: SLGThermo.H:64
Foam::constant
Different types of constants.
Definition: atomicConstants.C:38
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:261
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
nu
volScalarField & nu
Definition: readMechanicalProperties.H:176
R
#define R(A, B, C, D, E, F, K, M)
Foam::Field< scalar >
Foam::tanh
dimensionedScalar tanh(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:272
Foam::pow3
dimensionedScalar pow3(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:89
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::COxidationIntrinsicRate::COxidationIntrinsicRate
COxidationIntrinsicRate(const dictionary &dict, CloudType &owner)
Construct from dictionary.
Definition: COxidationIntrinsicRate.C:38
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:75
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::constant::mathematical::pi
constexpr scalar pi(M_PI)
Foam::nl
constexpr char nl
Definition: Ostream.H:404
COxidationIntrinsicRate.H
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
Foam::COxidationIntrinsicRate::calculate
virtual scalar calculate(const scalar dt, const scalar Re, const scalar nu, const label celli, const scalar d, const scalar T, const scalar Tc, const scalar pc, const scalar rhoc, const scalar mass, const scalarField &YGas, const scalarField &YLiquid, const scalarField &YSolid, const scalarField &YMixture, const scalar N, scalarField &dMassGas, scalarField &dMassLiquid, scalarField &dMassSolid, scalarField &dMassSRCarrier) const
Update surface reactions.
Definition: COxidationIntrinsicRate.C:111
Foam::Re
scalarField Re(const UList< complex > &cf)
Extract real component.
Definition: complexField.C:159
N
const Vector< label > N(dict.get< Vector< label >>("N"))