pyrolysisChemistryModel.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) 2013-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::pyrolysisChemistryModel
28 
29 Description
30  Pyrolysis chemistry model. It includes gas phase in the solid
31  reaction.
32 
33 SourceFiles
34  pyrolysisChemistryModelI.H
35  pyrolysisChemistryModel.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef pyrolysisChemistryModel_H
40 #define pyrolysisChemistryModel_H
41 
42 #include "volFieldsFwd.H"
43 #include "DimensionedField.H"
44 #include "solidChemistryModel.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declaration of classes
52 class fvMesh;
53 
54 /*---------------------------------------------------------------------------*\
55  Class pyrolysisChemistryModel Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 template<class CompType, class SolidThermo, class GasThermo>
60 :
61  public solidChemistryModel<CompType, SolidThermo>
62 {
63  // Private Member Functions
64 
65  //- No copy assignment
66  void operator=(const pyrolysisChemistryModel&) = delete;
67 
68 
69 protected:
70 
71  //- List of gas species present in reaction system
73 
74  //- Thermodynamic data of gases
76 
77  //- Number of gas species
78  label nGases_;
79 
80  //- Number of components being solved by ODE
81  label nSpecie_;
82 
83  //- List of reaction rate per gas [kg/m3/s]
85 
86 
87  // Protected Member Functions
88 
89  //- Write access to source terms for gases
91 
92 
93 private:
94 
95  //- List of accumulative solid concentrations
96  mutable PtrList<volScalarField> Ys0_;
97 
98  //- Cell counter
99  label cellCounter_;
100 
101 
102 public:
103 
104  //- Runtime type information
105  TypeName("pyrolysis");
106 
107 
108  // Constructors
109 
110  //- Construct from thermo
111  pyrolysisChemistryModel(typename CompType::reactionThermo& thermo);
112 
113 
114  //- Destructor
115  virtual ~pyrolysisChemistryModel();
116 
117 
118  // Member Functions
119 
120  //- Thermodynamic data of gases
121  inline const PtrList<GasThermo>& gasThermo() const;
122 
123  //- Gases table
124  inline const speciesTable& gasTable() const;
125 
126  //- The number of solids
127  inline label nSpecie() const;
128 
129  //- The number of solids
130  inline label nGases() const;
131 
132 
133  //- dc/dt = omega, rate of change in concentration, for each species
134  virtual scalarField omega
135  (
136  const scalarField& c,
137  const scalar T,
138  const scalar p,
139  const bool updateC0 = false
140  ) const;
141 
142  //- Return the reaction rate for reaction r
143  // NOTE: Currently does not calculate reference specie and
144  // characteristic times (pf, cf,l Ref, etc.)
145  virtual scalar omega
146  (
147  const Reaction<SolidThermo>& r,
148  const scalarField& c,
149  const scalar T,
150  const scalar p,
151  scalar& pf,
152  scalar& cf,
153  label& lRef,
154  scalar& pr,
155  scalar& cr,
156  label& rRef
157  ) const;
158 
159 
160  //- Return the reaction rate for iReaction
161  // NOTE: Currently does not calculate reference specie and
162  // characteristic times (pf, cf,l Ref, etc.)
163  virtual scalar omegaI
164  (
165  label iReaction,
166  const scalarField& c,
167  const scalar T,
168  const scalar p,
169  scalar& pf,
170  scalar& cf,
171  label& lRef,
172  scalar& pr,
173  scalar& cr,
174  label& rRef
175  ) const;
176 
177 
178  //- Calculates the reaction rates
179  virtual void calculate();
180 
181 
182  // Chemistry model functions
183 
184  //- Return const access to the chemical source terms for gases
185  inline const volScalarField::Internal& RRg
186  (
187  const label i
188  ) const;
189 
190  //- Return total gas source term
191  inline tmp<volScalarField::Internal> RRg() const;
192 
193  //- Return sensible enthalpy for gas i [J/Kg]
194  virtual tmp<volScalarField> gasHs
195  (
196  const volScalarField& p,
197  const volScalarField& T,
198  const label i
199  ) const;
200 
201  //- Solve the reaction system for the given time step
202  // and return the characteristic time
203  virtual scalar solve(const scalar deltaT);
204 
205 
206  // ODE functions (overriding abstract functions in ODE.H)
207 
208  //- Number of ODE's to solve
209  virtual label nEqns() const;
210 
211  virtual void derivatives
212  (
213  const scalar t,
214  const scalarField& c,
215  scalarField& dcdt
216  ) const;
217 
218  virtual void jacobian
219  (
220  const scalar t,
221  const scalarField& c,
222  scalarField& dcdt,
223  scalarSquareMatrix& dfdc
224  ) const;
225 
226  virtual void solve
227  (
228  scalarField &c,
229  scalar& T,
230  scalar& p,
231  scalar& deltaT,
232  scalar& subDeltaT
233  ) const;
234 };
235 
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 } // End namespace Foam
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243  #include "pyrolysisChemistryModelI.H"
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 #ifdef NoRepository
248  #include "pyrolysisChemistryModel.C"
249 #endif
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 #endif
254 
255 // ************************************************************************* //
volFieldsFwd.H
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::pyrolysisChemistryModel::omega
virtual scalarField omega(const scalarField &c, const scalar T, const scalar p, const bool updateC0=false) const
dc/dt = omega, rate of change in concentration, for each species
Definition: pyrolysisChemistryModel.C:183
Foam::pyrolysisChemistryModel::RRg_
PtrList< volScalarField::Internal > RRg_
List of reaction rate per gas [kg/m3/s].
Definition: pyrolysisChemistryModel.H:83
Foam::pyrolysisChemistryModel::pyrolisisGases_
speciesTable pyrolisisGases_
List of gas species present in reaction system.
Definition: pyrolysisChemistryModel.H:71
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
DimensionedField.H
pyrolysisChemistryModelI.H
Foam::pyrolysisChemistryModel::nGases
label nGases() const
The number of solids.
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::pyrolysisChemistryModel::jacobian
virtual void jacobian(const scalar t, const scalarField &c, scalarField &dcdt, scalarSquareMatrix &dfdc) const
Calculate the Jacobian of the system.
Definition: pyrolysisChemistryModel.C:347
Foam::pyrolysisChemistryModel::nSpecie
label nSpecie() const
The number of solids.
Definition: pyrolysisChemistryModelI.H:62
Foam::pyrolysisChemistryModel::nEqns
virtual label nEqns() const
Number of ODE's to solve.
Definition: pyrolysisChemistryModel.C:443
Foam::pyrolysisChemistryModel::TypeName
TypeName("pyrolysis")
Runtime type information.
Foam::Field< scalar >
Foam::hashedWordList
A wordList with hashed named lookup, which can be faster in some situations than using the normal lis...
Definition: hashedWordList.H:54
Foam::pyrolysisChemistryModel::solve
virtual scalar solve(const scalar deltaT)
Solve the reaction system for the given time step.
Definition: pyrolysisChemistryModel.C:520
Foam::solidChemistryModel
Extends base solid chemistry model by adding a thermo package, and ODE functions.
Definition: solidChemistryModel.H:63
Foam::pyrolysisChemistryModel::derivatives
virtual void derivatives(const scalar t, const scalarField &c, scalarField &dcdt) const
Calculate the derivatives in dydx.
Definition: pyrolysisChemistryModel.C:305
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
solidChemistryModel.H
Foam::PtrList< GasThermo >
Foam::pyrolysisChemistryModel::gasHs
virtual tmp< volScalarField > gasHs(const volScalarField &p, const volScalarField &T, const label i) const
Return sensible enthalpy for gas i [J/Kg].
Definition: pyrolysisChemistryModel.C:618
Foam::pyrolysisChemistryModel::gasThermo_
PtrList< GasThermo > gasThermo_
Thermodynamic data of gases.
Definition: pyrolysisChemistryModel.H:74
pyrolysisChemistryModel.C
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::pyrolysisChemistryModel::omegaI
virtual scalar omegaI(label iReaction, const scalarField &c, const scalar T, const scalar p, scalar &pf, scalar &cf, label &lRef, scalar &pr, scalar &cr, label &rRef) const
Return the reaction rate for iReaction.
Definition: pyrolysisChemistryModel.C:282
Foam::pyrolysisChemistryModel
Pyrolysis chemistry model. It includes gas phase in the solid reaction.
Definition: pyrolysisChemistryModel.H:58
Foam::pyrolysisChemistryModel::gasTable
const speciesTable & gasTable() const
Gases table.
Definition: pyrolysisChemistryModelI.H:53
Foam::SquareMatrix< scalar >
Foam::pyrolysisChemistryModel::nSpecie_
label nSpecie_
Number of components being solved by ODE.
Definition: pyrolysisChemistryModel.H:80
Foam::pyrolysisChemistryModel::calculate
virtual void calculate()
Calculates the reaction rates.
Definition: pyrolysisChemistryModel.C:452
Foam::pyrolysisChemistryModel::~pyrolysisChemistryModel
virtual ~pyrolysisChemistryModel()
Destructor.
Definition: pyrolysisChemistryModel.C:174
Foam::pyrolysisChemistryModel::gasThermo
const PtrList< GasThermo > & gasThermo() const
Thermodynamic data of gases.
Definition: pyrolysisChemistryModelI.H:44
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::Reaction
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
Definition: Reaction.H:56
Foam::pyrolysisChemistryModel::nGases_
label nGases_
Number of gas species.
Definition: pyrolysisChemistryModel.H:77
Foam::pyrolysisChemistryModel::RRg
PtrList< volScalarField::Internal > & RRg()
Write access to source terms for gases.
Definition: pyrolysisChemistryModelI.H:35
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::pyrolysisChemistryModel::pyrolysisChemistryModel
pyrolysisChemistryModel(typename CompType::reactionThermo &thermo)
Construct from thermo.
Definition: pyrolysisChemistryModel.C:38