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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2018-2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
31
32using namespace Foam::constant;
33
34// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35
36template<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 D_(this->coeffDict().getScalar("D")),
46 CsLocalId_(-1),
47 O2GlobalId_(owner.composition().carrierId("O2")),
48 CO2GlobalId_(owner.composition().carrierId("CO2")),
49 WC_(0.0),
50 WO2_(0.0),
51 HcCO2_(0.0)
52{
53 // Determine Cs ids
54 label idSolid = owner.composition().idSolid();
55 CsLocalId_ = owner.composition().localId(idSolid, "C");
56
57 // Set local copies of thermo properties
58 WO2_ = owner.thermo().carrier().W(O2GlobalId_);
59 const scalar WCO2 = owner.thermo().carrier().W(CO2GlobalId_);
60 WC_ = WCO2 - WO2_;
61
62 HcCO2_ = owner.thermo().carrier().Hc(CO2GlobalId_);
63
64 if (Sb_ < 0)
65 {
67 << "Stoichiometry of reaction, Sb, must be greater than zero" << nl
68 << exit(FatalError);
69 }
70
71 const scalar YCloc = owner.composition().Y0(idSolid)[CsLocalId_];
72 const scalar YSolidTot = owner.composition().YMixture0()[idSolid];
73 Info<< " C(s): particle mass fraction = " << YCloc*YSolidTot << endl;
74}
75
76
77template<class CloudType>
79(
81)
82:
84 Sb_(srm.Sb_),
85 D_(srm.D_),
86 CsLocalId_(srm.CsLocalId_),
87 O2GlobalId_(srm.O2GlobalId_),
88 CO2GlobalId_(srm.CO2GlobalId_),
89 WC_(srm.WC_),
90 WO2_(srm.WO2_),
91 HcCO2_(srm.HcCO2_)
92{}
93
94
95// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
96
97template<class CloudType>
99(
100 const scalar dt,
101 const scalar Re,
102 const scalar nu,
103 const label celli,
104 const scalar d,
105 const scalar T,
106 const scalar Tc,
107 const scalar pc,
108 const scalar rhoc,
109 const scalar mass,
110 const scalarField& YGas,
111 const scalarField& YLiquid,
112 const scalarField& YSolid,
113 const scalarField& YMixture,
114 const scalar N,
115 scalarField& dMassGas,
116 scalarField& dMassLiquid,
117 scalarField& dMassSolid,
118 scalarField& dMassSRCarrier
119) const
120{
121 // Fraction of remaining combustible material
122 const label idSolid = CloudType::parcelType::SLD;
123 const scalar fComb = YMixture[idSolid]*YSolid[CsLocalId_];
124
125 // Surface combustion active combustible fraction is consumed
126 if (fComb < SMALL)
127 {
128 return 0.0;
129 }
130
131 const SLGThermo& thermo = this->owner().thermo();
132
133 // Local mass fraction of O2 in the carrier phase
134 const scalar YO2 = thermo.carrier().Y(O2GlobalId_)[celli];
135
136 // Change in C mass [kg]
137 scalar dmC = 4.0*mathematical::pi*d*D_*YO2*Tc*rhoc/(Sb_*(T + Tc))*dt;
138
139 // Limit mass transfer by availability of C
140 dmC = min(mass*fComb, dmC);
141
142 // Change in O2 mass [kg]
143 const scalar dmO2 = dmC/WC_*Sb_*WO2_;
144
145 // Mass of newly created CO2 [kg]
146 const scalar dmCO2 = dmC + dmO2;
147
148 // Update local particle C mass
149 dMassSolid[CsLocalId_] += dmC;
150
151 // Update carrier O2 and CO2 mass
152 dMassSRCarrier[O2GlobalId_] -= dmO2;
153 dMassSRCarrier[CO2GlobalId_] += dmCO2;
154
155 const scalar HsC = thermo.solids().properties()[CsLocalId_].Hs(T);
156
157 // carrier sensible enthalpy exchange handled via change in mass
158
159 // Heat of reaction [J]
160 return dmC*HsC - dmCO2*HcCO2_;
161}
162
163
164// ************************************************************************* //
Diffusion limited rate surface reaction model for coal parcels. Limited to:
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package,...
Definition: SLGThermo.H:67
Templated surface reaction model class.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
basicSpecieMixture & composition
const volScalarField & T
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
constexpr scalar pi(M_PI)
Different types of constants.
scalarField Re(const UList< complex > &cf)
Extract real component.
Definition: complexField.C:159
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
error FatalError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
volScalarField & nu
dictionary dict
const Vector< label > N(dict.get< Vector< label > >("N"))