COxidationMurphyShaddix.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
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 
27 #include "mathematicalConstants.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 template<class CloudType>
33 
34 template<class CloudType>
36 
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
40 template<class CloudType>
42 (
43  const dictionary& dict,
44  CloudType& owner
45 )
46 :
47  SurfaceReactionModel<CloudType>(dict, owner, typeName),
48  D0_(this->coeffDict().template lookup<scalar>("D0")),
49  rho0_(this->coeffDict().template lookup<scalar>("rho0")),
50  T0_(this->coeffDict().template lookup<scalar>("T0")),
51  Dn_(this->coeffDict().template lookup<scalar>("Dn")),
52  A_(this->coeffDict().template lookup<scalar>("A")),
53  E_(this->coeffDict().template lookup<scalar>("E")),
54  n_(this->coeffDict().template lookup<scalar>("n")),
55  WVol_(this->coeffDict().template lookup<scalar>("WVol")),
56  CsLocalId_(-1),
57  O2GlobalId_(owner.composition().carrierId("O2")),
58  CO2GlobalId_(owner.composition().carrierId("CO2")),
59  WC_(0.0),
60  WO2_(0.0),
61  HcCO2_(0.0)
62 {
63  // Determine Cs ids
64  label idSolid = owner.composition().idSolid();
65  CsLocalId_ = owner.composition().localId(idSolid, "C");
66 
67  // Set local copies of thermo properties
68  WO2_ = owner.composition().carrier().WiValue(O2GlobalId_);
69  const scalar WCO2 = owner.composition().carrier().WiValue(CO2GlobalId_);
70  WC_ = WCO2 - WO2_;
71 
72  HcCO2_ = owner.composition().carrier().hfiValue(CO2GlobalId_);
73 
74  const scalar YCloc = owner.composition().Y0(idSolid)[CsLocalId_];
75  const scalar YSolidTot = owner.composition().YMixture0()[idSolid];
76  Info<< " C(s): particle mass fraction = " << YCloc*YSolidTot << endl;
77 }
78 
79 
80 template<class CloudType>
82 (
84 )
85 :
87  D0_(srm.D0_),
88  rho0_(srm.rho0_),
89  T0_(srm.T0_),
90  Dn_(srm.Dn_),
91  A_(srm.A_),
92  E_(srm.E_),
93  n_(srm.n_),
94  WVol_(srm.WVol_),
95  CsLocalId_(srm.CsLocalId_),
96  O2GlobalId_(srm.O2GlobalId_),
97  CO2GlobalId_(srm.CO2GlobalId_),
98  WC_(srm.WC_),
99  WO2_(srm.WO2_),
100  HcCO2_(srm.HcCO2_)
101 {}
102 
103 
104 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
105 
106 template<class CloudType>
108 {}
109 
110 
111 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
112 
113 template<class CloudType>
115 (
116  const scalar dt,
117  const label celli,
118  const scalar d,
119  const scalar T,
120  const scalar Tc,
121  const scalar pc,
122  const scalar rhoc,
123  const scalar mass,
124  const scalarField& YGas,
125  const scalarField& YLiquid,
126  const scalarField& YSolid,
127  const scalarField& YMixture,
128  const scalar N,
129  scalarField& dMassGas,
130  scalarField& dMassLiquid,
131  scalarField& dMassSolid,
132  scalarField& dMassSRCarrier
133 ) const
134 {
135  // Fraction of remaining combustible material
136  const label idSolid = CloudType::parcelType::SLD;
137  const scalar fComb = YMixture[idSolid]*YSolid[CsLocalId_];
138 
139  // Surface combustion until combustible fraction is consumed
140  if (fComb < small)
141  {
142  return 0.0;
143  }
144 
145  const parcelThermo& thermo = this->owner().thermo();
146  const fluidMulticomponentThermo& carrierThermo =
147  this->owner().composition().carrier();
148 
149  // Cell carrier phase O2 species density [kg/m^3]
150  const scalar rhoO2 = rhoc*carrierThermo.Y(O2GlobalId_)[celli];
151 
152  if (rhoO2 < small)
153  {
154  return 0.0;
155  }
156 
157  // Particle surface area [m^2]
158  const scalar Ap = constant::mathematical::pi*sqr(d);
159 
160  // Calculate diffusion constant at continuous phase temperature
161  // and density [m^2/s]
162  const scalar D = D0_*(rho0_/rhoc)*pow(Tc/T0_, Dn_);
163 
164  // Far field partial pressure O2 [Pa]
165  const scalar ppO2 = rhoO2/WO2_*RR*Tc;
166 
167  // Total molar concentration of the carrier phase [kmol/m^3]
168  const scalar C = pc/(RR*Tc);
169 
170  if (debug)
171  {
172  Pout<< "mass = " << mass << nl
173  << "fComb = " << fComb << nl
174  << "Ap = " << Ap << nl
175  << "dt = " << dt << nl
176  << "C = " << C << nl
177  << endl;
178  }
179 
180  // Molar reaction rate per unit surface area [kmol/m^2/s]
181  scalar qCsOld = 0;
182  scalar qCs = 1;
183 
184  const scalar qCsLim = mass*fComb/(WC_*Ap*dt);
185 
186  if (debug)
187  {
188  Pout<< "qCsLim = " << qCsLim << endl;
189  }
190 
191  label iter = 0;
192  while ((mag(qCs - qCsOld)/qCs > tolerance_) && (iter <= maxIters_))
193  {
194  qCsOld = qCs;
195  const scalar PO2Surface = ppO2*exp(-(qCs + N)*d/(2*C*D));
196  qCs = A_*exp(-E_/(RR*T))*pow(PO2Surface, n_);
197  qCs = (100.0*qCs + iter*qCsOld)/(100.0 + iter);
198  qCs = min(qCs, qCsLim);
199 
200  if (debug)
201  {
202  Pout<< "iter = " << iter
203  << ", qCsOld = " << qCsOld
204  << ", qCs = " << qCs
205  << nl << endl;
206  }
207 
208  iter++;
209  }
210 
211  if (iter > maxIters_)
212  {
214  << "iter limit reached (" << maxIters_ << ")" << nl << endl;
215  }
216 
217  // Calculate the number of molar units reacted
218  scalar dOmega = qCs*Ap*dt;
219 
220  // Add to carrier phase mass transfer
221  dMassSRCarrier[O2GlobalId_] += -dOmega*WO2_;
222  dMassSRCarrier[CO2GlobalId_] += dOmega*(WC_ + WO2_);
223 
224  // Add to particle mass transfer
225  dMassSolid[CsLocalId_] += dOmega*WC_;
226 
227  const scalar hsC = thermo.solids().properties()[CsLocalId_].hs(T);
228 
229  // carrier sensible enthalpy exchange handled via change in mass
230 
231  // Heat of reaction [J]
232  return dOmega*(WC_*hsC - (WC_ + WO2_)*HcCO2_);
233 }
234 
235 
236 // ************************************************************************* //
static const Foam::dimensionedScalar D("D", Foam::dimTemperature, 257.14)
Limited to C(s) + O2 -> CO2.
virtual scalar calculate(const scalar dt, 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.
virtual ~COxidationMurphyShaddix()
Destructor.
COxidationMurphyShaddix(const dictionary &dict, CloudType &owner)
Construct from dictionary.
Graphite solid properties.
Definition: C.H:51
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:80
Templated surface reaction model class.
virtual const IOdictionary & properties() const =0
Properties dictionary.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Base-class for multi-component fluid thermodynamic properties.
virtual PtrList< volScalarField > & Y()=0
Access the mass-fraction fields.
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package,...
Definition: parcelThermo.H:59
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar e
Elementary charge.
const dimensionedScalar RR
Universal gas constant: default SI units: [J/kmol/K].
dimensionedScalar exp(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
messageStream Info
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensioned< scalar > mag(const dimensioned< Type > &)
prefixOSstream Pout(cout, "Pout")
Definition: IOstreams.H:53
static const char nl
Definition: Ostream.H:266
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict
fluidMulticomponentThermo & thermo
Definition: createFields.H:31