standard_chemistryModel.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) 2022-2026 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::chemistryModels::standard
26 
27 Description
28  Non-templated Base class for Foam::chemistryModels::Standard
29 
30  With run-time selected ODE solver and optional cellZone to limit the region
31  in which the chemistry is integrated to speed-up large cases in which the
32  chemistry is active in a small sub-region.
33 
34  Example of \c standard \c chemistryModel specification in
35  constant/chemistryProperties using the \c seulex ODE solver to integrate
36  the included reaction system:
37  \verbatim
38  type standard;
39 
40  initialChemicalTimeStep 1e-7;
41 
42  ode
43  {
44  solver seulex;
45  absTol 1e-8;
46  relTol 1e-1;
47  }
48 
49  #include "reactions"
50  \endverbatim
51 
52 See also
53  Foam::chemistryModel
54  Foam::chemistryModels::Standard
55  Foam::generatedCellZone
56 
57 SourceFiles
58  standard_chemistryModelI.H
59  standard_chemistryModel.C
60 
61 \*---------------------------------------------------------------------------*/
62 
63 #ifndef standard_chemistryModel_H
64 #define standard_chemistryModel_H
65 
66 #include "chemistryModel.H"
67 #include "ODESolver.H"
68 #include "generatedCellZone.H"
69 #include "OFstream.H"
70 
71 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72 
73 namespace Foam
74 {
75 
76 template<class ThermoType>
77 class chemistryReductionMethod;
78 
79 namespace chemistryModels
80 {
81 
82 /*---------------------------------------------------------------------------*\
83  Class standard Declaration
84 \*---------------------------------------------------------------------------*/
85 
86 class standard
87 :
88  public chemistryModel,
89  public ODESystem
90 {
91 protected:
92 
93  // Protected data
94 
95  //- Enumeration for the type of Jacobian to be calculated by the
96  // chemistryModel
97  enum class jacobianType
98  {
99  fast,
100  exact
101  };
102 
103  //- Jacobian type names
105 
106  //- Optional cellZone to limit where the chemistry is integrated
108 
109  //- Reference to the field of specie mass fractions
111 
112  //- Number of species
113  label nSpecie_;
114 
115  //- Is chemistry reduction active
116  bool reduction_;
117 
118  //- Temporary map from complete to simplified concentration fields
119  // c -> sc
120  mutable List<label> cTos_;
121 
122  //- Temporary map from simplified to complete concentration fields
123  // sc -> c
124  mutable DynamicList<label> sToc_;
125 
126  //- ODE solver
128 
129  // ODE solver data
130  mutable scalarField cTp_;
131 
132 
133 public:
134 
135  template<class ThermoType>
136  friend class Foam::chemistryReductionMethod;
137 
138  //- Runtime type information
139  TypeName("standard");
140 
141 
142  // Constructors
143 
144  //- Construct from thermo
146 
147  //- Disallow default bitwise copy construction
148  standard(const standard&) = delete;
149 
150 
151  //- Destructor
152  virtual ~standard();
153 
154 
155  // Member Functions
156 
157  //- Create and return a TDAC log file of the given name
158  inline autoPtr<OFstream> logFile(const word& name) const;
159 
160  //- The number of species
161  inline virtual label nSpecie() const;
162 
163  //- Allow the reduction method to reset the number of species
164  inline void setNSpecie(const label newNs);
165 
166  //- Number of ODE's to solve
167  inline virtual label nEqns() const;
168 
169  //- Return a reference to the list of mass fraction fields
170  inline const PtrList<volScalarField>& Y() const;
171 
172  //- Return true if mechanism reduction is active
173  inline bool reduction() const;
174 
175  //- Return the index in the complete set of species
176  // corresponding to the index si in the simplified set of species
177  inline label sToc(const label si) const;
178 
179  //- Return the index in the simplified set of species
180  // corresponding to the index si in the complete set of species
181  inline label cTos(const label ci) const;
182 
183 
184  // Member Operators
185 
186  //- Disallow default bitwise assignment
187  void operator=(const standard&) = delete;
188 };
189 
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 } // End namespace chemistryModels
194 } // End namespace Foam
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #endif
203 
204 // ************************************************************************* //
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:47
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Base class for chemistry models.
const fluidMulticomponentThermo & thermo() const
Return const access to the thermo.
Non-templated Base class for Foam::chemistryModels::Standard.
jacobianType
Enumeration for the type of Jacobian to be calculated by the.
autoPtr< OFstream > logFile(const word &name) const
Create and return a TDAC log file of the given name.
void setNSpecie(const label newNs)
Allow the reduction method to reset the number of species.
static const NamedEnum< jacobianType, 2 > jacobianTypeNames
Jacobian type names.
bool reduction() const
Return true if mechanism reduction is active.
generatedCellZone zone_
Optional cellZone to limit where the chemistry is integrated.
autoPtr< ODESolver > odeSolver_
ODE solver.
const PtrList< volScalarField > & Yvf_
Reference to the field of specie mass fractions.
TypeName("standard")
Runtime type information.
virtual label nEqns() const
Number of ODE's to solve.
label sToc(const label si) const
Return the index in the complete set of species.
DynamicList< label > sToc_
Temporary map from simplified to complete concentration fields.
virtual label nSpecie() const
The number of species.
label cTos(const label ci) const
Return the index in the simplified set of species.
standard(const fluidMulticomponentThermo &thermo)
Construct from thermo.
bool reduction_
Is chemistry reduction active.
List< label > cTos_
Temporary map from complete to simplified concentration fields.
void operator=(const standard &)=delete
Disallow default bitwise assignment.
const PtrList< volScalarField > & Y() const
Return a reference to the list of mass fraction fields.
An abstract class for methods of chemical mechanism reduction.
const fileName & name() const
Return the dictionary name.
Definition: dictionary.H:111
Base-class for multi-component fluid thermodynamic properties.
cellZone selection or generation class
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
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