SingleKineticRateDevolatilisation.H
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) 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 Class
28  Foam::SingleKineticRateDevolatilisation
29 
30 Group
31  grpLagrangianIntermediateDevolatilisationSubModels
32 
33 Description
34  Single kinetic rate devolatisation model.
35  - acts on a per-specie basis
36  - Rate given by Arrhenius eqn
37 
38  kappa = A1.exp(- E/R.T)
39 
40  Where:
41  kappa = rate constant
42  A1 = activation energy (user input)
43  E = pre-exponential factor (user input)
44  R = universal gas constant
45  T = temperature
46 
47  Usage:
48 
49  SingleKineticRateDevolatilisationCoeffs
50  {
51  volatileData
52  (
53  (CH4 12 0.5) // (name A1 E)
54  (CO2 12 0.5) // (name A1 E)
55  );
56 
57  volatileResidualCoeff 1e-6;
58  }
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef SingleKineticRateDevolatilisation_H
63 #define SingleKineticRateDevolatilisation_H
64 
65 #include "DevolatilisationModel.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class SingleKineticRateDevolatilisation Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 template<class CloudType>
78 :
79  public DevolatilisationModel<CloudType>
80 {
81  //- Helper class to store specie-local volatile data
82  class volatileData
83  {
84  // Private Data
85 
86  //- Specie name
87  word name_;
88 
89  //- Activation energy
90  scalar A1_;
91 
92  //- Pre-exponential factor
93  scalar E_;
94 
95  public:
96 
97  // Constructors
98 
99  //- Default construct
100  volatileData()
101  :
102  name_(),
103  A1_(0),
104  E_(0)
105  {}
106 
107  //- Construct from Istream
108  explicit volatileData(Istream& is)
109  :
110  name_(is),
111  A1_(readScalar(is)),
112  E_(readScalar(is))
113  {}
114 
115 
116  // Member Functions
117 
118  // Access
119 
120  //- Return const access to the name
121  const word& name() const
122  {
123  return name_;
124  }
125 
126  //- Return const access to the activation energy
127  scalar A1() const
128  {
129  return A1_;
130  }
131 
132  //- Return const access to the pre-exponential factor
133  scalar E() const
134  {
135  return E_;
136  }
137 
138 
139  // IOstream Operators
140 
141  //- Read from Istream
142  friend Istream& operator>>(Istream& is, volatileData& vd)
143  {
144  is.readBegin("volatileData");
145  is >> vd.name_ >> vd.A1_ >> vd.E_;
146  is.readEnd("volatileData");
147 
148  return is;
149  }
150 
151  //- Write to Ostream
152  friend Ostream& operator<<(Ostream& os, const volatileData& vd)
153  {
155  << vd.name_ << token::SPACE
156  << vd.A1_ << token::SPACE
157  << vd.E_
158  << token::END_LIST;
159 
160  return os;
161  }
162  };
163 
164 
165  // Private Data
166 
167  // Model Constants
168 
169  //- List of volatile data - (name A1 E)
170  List<volatileData> volatileData_;
171 
172  //- List of initial volatile mass fractions
173  List<scalar> YVolatile0_;
174 
175  //- Mapping between local and cloud gaseous species
176  List<label> volatileToGasMap_;
177 
178  //- Volatile residual coefficient (0-1)
179  // When the fraction of volatiles are depleted below this
180  // threshold, combustion can occur
181  const scalar residualCoeff_;
182 
183 
184 public:
185 
186  //- Declare type-name, virtual type (with debug switch)
187  TypeName("singleKineticRateDevolatilisation");
188 
189 
190  // Constructors
191 
192  //- Construct from dictionary
194  (
195  const dictionary& dict,
196  CloudType& owner
197  );
198 
199  //- Construct and return a clone
201  {
203  (
205  );
206  }
207 
208 
209  //- Destructor
210  virtual ~SingleKineticRateDevolatilisation() = default;
211 
212 
213  // Member Functions
214 
215  //- Update model
216  virtual void calculate
217  (
218  const scalar dt,
219  const scalar age,
220  const scalar mass0,
221  const scalar mass,
222  const scalar T,
223  const scalarField& YGasEff,
224  const scalarField& YLiquidEff,
225  const scalarField& YSolidEff,
226  label& canCombust,
227  scalarField& dMassDV
228  ) const;
229 };
230 
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 } // End namespace Foam
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #ifdef NoRepository
240 #endif
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #endif
245 
246 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::SingleKineticRateDevolatilisation::~SingleKineticRateDevolatilisation
virtual ~SingleKineticRateDevolatilisation()=default
Destructor.
Foam::SingleKineticRateDevolatilisation::TypeName
TypeName("singleKineticRateDevolatilisation")
Declare type-name, virtual type (with debug switch)
SingleKineticRateDevolatilisation.C
Foam::SingleKineticRateDevolatilisation::clone
virtual autoPtr< DevolatilisationModel< CloudType > > clone() const
Construct and return a clone.
Definition: SingleKineticRateDevolatilisation.H:199
DevolatilisationModel.H
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::Istream::readEnd
bool readEnd(const char *funcName)
End read of data chunk, ends with ')'.
Definition: Istream.C:129
Foam::Istream::readBegin
bool readBegin(const char *funcName)
Begin read of data chunk, starts with '('.
Definition: Istream.C:111
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::SingleKineticRateDevolatilisation::SingleKineticRateDevolatilisation
SingleKineticRateDevolatilisation(const dictionary &dict, CloudType &owner)
Construct from dictionary.
Definition: SingleKineticRateDevolatilisation.C:35
Foam::Field< scalar >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::DevolatilisationModel
Templated devolatilisation model class.
Definition: ReactingMultiphaseCloud.H:58
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SingleKineticRateDevolatilisation
Single kinetic rate devolatisation model.
Definition: SingleKineticRateDevolatilisation.H:76
Foam::SingleKineticRateDevolatilisation::calculate
virtual void calculate(const scalar dt, const scalar age, const scalar mass0, const scalar mass, const scalar T, const scalarField &YGasEff, const scalarField &YLiquidEff, const scalarField &YSolidEff, label &canCombust, scalarField &dMassDV) const
Update model.
Definition: SingleKineticRateDevolatilisation.C:78
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::List< volatileData >
Foam::token::SPACE
Space [isspace].
Definition: token.H:125
Foam::token::END_LIST
End list [isseparator].
Definition: token.H:156
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::token::BEGIN_LIST
Begin list [isseparator].
Definition: token.H:155