COxidationDiffusionLimitedRate.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-2021 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 using namespace Foam::constant;
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class CloudType>
35 (
36  const dictionary& dict,
37  CloudType& owner
38 )
39 :
40  SurfaceReactionModel<CloudType>(dict, owner, typeName),
41  Sb_(this->coeffDict().template lookup<scalar>("Sb")),
42  D_(this->coeffDict().template lookup<scalar>("D")),
43  CsLocalId_(-1),
44  O2GlobalId_(owner.composition().carrierId("O2")),
45  CO2GlobalId_(owner.composition().carrierId("CO2")),
46  WC_(0.0),
47  WO2_(0.0),
48  HcCO2_(0.0)
49 {
50  // Determine Cs ids
51  label idSolid = owner.composition().idSolid();
52  CsLocalId_ = owner.composition().localId(idSolid, "C");
53 
54  // Set local copies of thermo properties
55  WO2_ = owner.composition().carrier().Wi(O2GlobalId_);
56  const scalar WCO2 = owner.composition().carrier().Wi(CO2GlobalId_);
57  WC_ = WCO2 - WO2_;
58 
59  HcCO2_ = owner.composition().carrier().Hf(CO2GlobalId_);
60 
61  if (Sb_ < 0)
62  {
64  << "Stoichiometry of reaction, Sb, must be greater than zero" << nl
65  << exit(FatalError);
66  }
67 
68  const scalar YCloc = owner.composition().Y0(idSolid)[CsLocalId_];
69  const scalar YSolidTot = owner.composition().YMixture0()[idSolid];
70  Info<< " C(s): particle mass fraction = " << YCloc*YSolidTot << endl;
71 }
72 
73 
74 template<class CloudType>
76 (
78 )
79 :
81  Sb_(srm.Sb_),
82  D_(srm.D_),
83  CsLocalId_(srm.CsLocalId_),
84  O2GlobalId_(srm.O2GlobalId_),
85  CO2GlobalId_(srm.CO2GlobalId_),
86  WC_(srm.WC_),
87  WO2_(srm.WO2_),
88  HcCO2_(srm.HcCO2_)
89 {}
90 
91 
92 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
93 
94 template<class CloudType>
97 {}
98 
99 
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 
102 template<class CloudType>
104 (
105  const scalar dt,
106  const label celli,
107  const scalar d,
108  const scalar T,
109  const scalar Tc,
110  const scalar pc,
111  const scalar rhoc,
112  const scalar mass,
113  const scalarField& YGas,
114  const scalarField& YLiquid,
115  const scalarField& YSolid,
116  const scalarField& YMixture,
117  const scalar N,
118  scalarField& dMassGas,
119  scalarField& dMassLiquid,
120  scalarField& dMassSolid,
121  scalarField& dMassSRCarrier
122 ) const
123 {
124  // Fraction of remaining combustible material
125  const label idSolid = CloudType::parcelType::SLD;
126  const scalar fComb = YMixture[idSolid]*YSolid[CsLocalId_];
127 
128  // Surface combustion active combustible fraction is consumed
129  if (fComb < small)
130  {
131  return 0.0;
132  }
133 
134  const parcelThermo& thermo = this->owner().thermo();
135  const basicSpecieMixture& carrier = this->owner().composition().carrier();
136 
137  // Local mass fraction of O2 in the carrier phase
138  const scalar YO2 = carrier.Y(O2GlobalId_)[celli];
139 
140  // Change in C mass [kg]
141  scalar dmC = 4.0*mathematical::pi*d*D_*YO2*Tc*rhoc/(Sb_*(T + Tc))*dt;
142 
143  // Limit mass transfer by availability of C
144  dmC = min(mass*fComb, dmC);
145 
146  // Change in O2 mass [kg]
147  const scalar dmO2 = dmC/WC_*Sb_*WO2_;
148 
149  // Mass of newly created CO2 [kg]
150  const scalar dmCO2 = dmC + dmO2;
151 
152  // Update local particle C mass
153  dMassSolid[CsLocalId_] += dmC;
154 
155  // Update carrier O2 and CO2 mass
156  dMassSRCarrier[O2GlobalId_] -= dmO2;
157  dMassSRCarrier[CO2GlobalId_] += dmCO2;
158 
159  const scalar HsC = thermo.solids().properties()[CsLocalId_].Hs(T);
160 
161  // carrier sensible enthalpy exchange handled via change in mass
162 
163  // Heat of reaction [J]
164  return dmC*HsC - dmCO2*HcCO2_;
165 }
166 
167 
168 // ************************************************************************* //
Collection of constants.
dictionary dict
fluidReactionThermo & thermo
Definition: createFields.H:28
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
COxidationDiffusionLimitedRate(const dictionary &dict, CloudType &owner)
Construct from dictionary.
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
const PtrList< solidProperties > & properties() const
Return the solidProperties properties.
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package, and provides:
Definition: parcelThermo.H:58
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Specialisation of basicMixture for a mixture consisting of a number for molecular species...
Diffusion limited rate surface reaction model for coal parcels. Limited to:
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.
const solidMixtureProperties & solids() const
Return reference to the global (additional) solids.
Definition: parcelThermo.C:95
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
static const char nl
Definition: Ostream.H:260
messageStream Info
PtrList< volScalarField > & Y()
Return the mass-fraction fields.
Templated surface reaction model class.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75