All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SingleKineticRateDevolatilisation.H
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-2019 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 Class
25  Foam::SingleKineticRateDevolatilisation
26 
27 Description
28  Single kinetic rate devolatisation model.
29  - acts on a per-specie basis
30  - Rate given by Arrhenius eqn
31 
32  kappa = A1.exp(- E/R.T)
33 
34  Where:
35  kappa = rate constant
36  A1 = pre-exponential factor (user input)
37  E = activation energy (user input)
38  R = universal gas constant
39  T = temperature
40 
41  Usage:
42 
43  SingleKineticRateDevolatilisationCoeffs
44  {
45  volatileData
46  (
47  (CH4 12 0.5) // (name A1 E)
48  (CO2 12 0.5) // (name A1 E)
49  );
50 
51  volatileResidualCoeff 1e-6;
52  }
53 
54 \*---------------------------------------------------------------------------*/
55 
56 #ifndef SingleKineticRateDevolatilisation_H
57 #define SingleKineticRateDevolatilisation_H
58 
59 #include "DevolatilisationModel.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 /*---------------------------------------------------------------------------*\
66  Class SingleKineticRateDevolatilisation Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 template<class CloudType>
71 :
72  public DevolatilisationModel<CloudType>
73 {
74  // Helper class to store specie-local volatile data
75  class volatileData
76  {
77  // Private Data
78 
79  //- Specie name
80  word name_;
81 
82  //- Activation energy
83  scalar A1_;
84 
85  //- Pre-exponential factor
86  scalar E_;
87 
88 
89  public:
90 
91  // Constructors
92 
93  //- Null constructor
94  volatileData()
95  :
96  name_(word::null),
97  A1_(0.0),
98  E_(0.0)
99  {}
100 
101  //- Construct from Istream
102  volatileData(Istream& is)
103  :
104  name_(is),
105  A1_(readScalar(is)),
106  E_(readScalar(is))
107  {}
108 
109 
110  //- Destructor
111  ~volatileData()
112  {}
113 
114 
115  // Public Member Functions
116 
117  // Access
118 
119  //- Return const access to the name
120  const word& name() const
121  {
122  return name_;
123  }
124 
125  //- Return const access to the activation energy
126  scalar A1() const
127  {
128  return A1_;
129  }
130 
131  //- Return const access to the pre-exponential factor
132  scalar E() const
133  {
134  return E_;
135  }
136 
137 
138  // IOstream Operators
139 
140  //- Read from Istream
141  friend Istream& operator>>(Istream& is, volatileData& vd)
142  {
143  is.readBeginList("volatileData");
144  is >> vd.name_ >> vd.A1_ >> vd.E_;
145  is.readEndList("volatileData");
146 
147  return is;
148  }
149 
150  //- Write to Ostream
151  friend Ostream& operator<<(Ostream& os, const volatileData& vd)
152  {
153  os << token::BEGIN_LIST
154  << vd.name_ << token::SPACE
155  << vd.A1_ << token::SPACE
156  << vd.E_
157  << token::END_LIST;
158 
159  return os;
160  }
161  };
162 
163 
164  // Private Data
165 
166  // Model constants
167 
168  //- List of volatile data - (name A1 E)
169  List<volatileData> volatileData_;
170 
171  //- List of initial volatile mass fractions
172  List<scalar> YVolatile0_;
173 
174  //- Mapping between local and cloud gaseous species
175  List<label> volatileToGasMap_;
176 
177  //- Volatile residual coefficient (0-1)
178  // When the fraction of volatiles are depleted below this
179  // threshold, combustion can occur
180  const scalar residualCoeff_;
181 
182 
183 public:
184 
185  //- Runtime type information
186  TypeName("singleKineticRateDevolatilisation");
187 
188 
189  // Constructors
190 
191  //- Construct from dictionary
193  (
194  const dictionary& dict,
196  );
197 
198  //- Construct and return a clone
200  {
202  (
204  );
205  }
206 
207 
208  //- Destructor
210 
211 
212  // Member Functions
213 
214  //- Update model
215  virtual void calculate
216  (
217  const scalar dt,
218  const scalar age,
219  const scalar mass0,
220  const scalar mass,
221  const scalar T,
222  const scalarField& YGasEff,
223  const scalarField& YLiquidEff,
224  const scalarField& YSolidEff,
225  label& canCombust,
226  scalarField& dMassDV
227  ) const;
228 };
229 
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace Foam
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #ifdef NoRepository
239 #endif
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #endif
244 
245 // ************************************************************************* //
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
char readEndList(const char *funcName)
Definition: Istream.C:148
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const CloudType & owner() const
Return const access to the owner cloud.
virtual autoPtr< DevolatilisationModel< CloudType > > clone() const
Construct and return a clone.
A class for handling words, derived from string.
Definition: word.H:59
Istream & operator>>(Istream &, directionInfo &)
static const word null
An empty word.
Definition: word.H:77
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
Definition: doubleScalar.H:75
char readBeginList(const char *funcName)
Definition: Istream.C:127
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Ostream & operator<<(Ostream &, const ensightPart &)
Templated devolatilisation model class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
TypeName("singleKineticRateDevolatilisation")
Runtime type information.
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.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69
Namespace for OpenFOAM.
SingleKineticRateDevolatilisation(const dictionary &dict, CloudType &owner)
Construct from dictionary.
Single kinetic rate devolatisation model.