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 -------------------------------------------------------------------------------
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  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 
77 template<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 
97 template<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 // ************************************************************************* //
Foam::SurfaceReactionModel
Templated surface reaction model class.
Definition: ReactingMultiphaseCloud.H:61
Foam::COxidationDiffusionLimitedRate::COxidationDiffusionLimitedRate
COxidationDiffusionLimitedRate(const dictionary &dict, CloudType &owner)
Construct from dictionary.
Definition: COxidationDiffusionLimitedRate.C:38
mathematicalConstants.H
Foam::SLGThermo
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package,...
Definition: SLGThermo.H:64
Foam::COxidationDiffusionLimitedRate::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: COxidationDiffusionLimitedRate.C:99
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::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
COxidationDiffusionLimitedRate.H
nu
volScalarField & nu
Definition: readMechanicalProperties.H:176
Foam::Field< scalar >
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::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::COxidationDiffusionLimitedRate
Diffusion limited rate surface reaction model for coal parcels. Limited to:
Definition: COxidationDiffusionLimitedRate.H:55
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::constant::mathematical::pi
constexpr scalar pi(M_PI)
Foam::nl
constexpr char nl
Definition: Ostream.H:404
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"))