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 | Copyright (C) 2011-2016 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 = activation energy (user input)
37  E = pre-exponential factor (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  //- Construct as copy
110  volatileData(const volatileData& vd)
111  :
112  name_(vd.name_),
113  A1_(vd.A1_),
114  E_(vd.E_)
115  {}
116 
117 
118  //- Destructor
119  ~volatileData()
120  {}
121 
122 
123  // Public Member Functions
124 
125  // Access
126 
127  //- Return const access to the name
128  const word& name() const
129  {
130  return name_;
131  }
132 
133  //- Return const access to the activation energy
134  scalar A1() const
135  {
136  return A1_;
137  }
138 
139  //- Return const access to the pre-exponential factor
140  scalar E() const
141  {
142  return E_;
143  }
144 
145 
146  // IOstream Operators
147 
148  //- Read from Istream
149  friend Istream& operator>>(Istream& is, volatileData& vd)
150  {
151  is.readBeginList("volatileData");
152  is >> vd.name_ >> vd.A1_ >> vd.E_;
153  is.readEndList("volatileData");
154 
155  return is;
156  }
157 
158  //- Write to Ostream
159  friend Ostream& operator<<(Ostream& os, const volatileData& vd)
160  {
161  os << token::BEGIN_LIST
162  << vd.name_ << token::SPACE
163  << vd.A1_ << token::SPACE
164  << vd.E_
165  << token::END_LIST;
166 
167  return os;
168  }
169  };
170 
171 
172  // Private data
173 
174  // Model constants
175 
176  //- List of volatile data - (name A1 E)
177  List<volatileData> volatileData_;
178 
179  //- List of initial volatile mass fractions
180  List<scalar> YVolatile0_;
181 
182  //- Mapping between local and cloud gaseous species
183  List<label> volatileToGasMap_;
184 
185  //- Volatile residual coefficient (0-1)
186  // When the fraction of volatiles are depleted below this
187  // threshold, combustion can occur
188  const scalar residualCoeff_;
189 
190 
191 public:
192 
193  //- Runtime type information
194  TypeName("singleKineticRateDevolatilisation");
195 
196 
197  // Constructors
198 
199  //- Construct from dictionary
201  (
202  const dictionary& dict,
204  );
205 
206  //- Construct copy
208  (
210  );
211 
212  //- Construct and return a clone
214  {
216  (
218  );
219  }
220 
221 
222  //- Destructor
224 
225 
226  // Member Functions
227 
228  //- Update model
229  virtual void calculate
230  (
231  const scalar dt,
232  const scalar age,
233  const scalar mass0,
234  const scalar mass,
235  const scalar T,
236  const scalarField& YGasEff,
237  const scalarField& YLiquidEff,
238  const scalarField& YSolidEff,
239  label& canCombust,
240  scalarField& dMassDV
241  ) const;
242 };
243 
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 } // End namespace Foam
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #ifdef NoRepository
253 #endif
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 #endif
258 
259 // ************************************************************************* //
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
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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
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.
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 succesful.
Definition: doubleScalar.H:63
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:53
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 &)
const CloudType & owner() const
Return const access to the owner cloud.
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:53
TypeName("singleKineticRateDevolatilisation")
Runtime type information.
virtual autoPtr< DevolatilisationModel< CloudType > > clone() const
Construct and return a clone.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Namespace for OpenFOAM.
SingleKineticRateDevolatilisation(const dictionary &dict, CloudType &owner)
Construct from dictionary.
Single kinetic rate devolatisation model.