odeChemistryModel.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 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::odeChemistryModel
26 
27 Description
28  Extends base chemistry model adding an ODESystem and the reduction maps
29  needed for tabulation.
30 
31 SourceFiles
32  odeChemistryModelI.H
33  odeChemistryModel.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef odeChemistryModel_H
38 #define odeChemistryModel_H
39 
40 #include "basicChemistryModel.H"
41 #include "ODESystem.H"
42 #include "OFstream.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 template<class ThermoType>
50 class chemistryModel;
51 
52 template<class ThermoType>
53 class chemistryReductionMethod;
54 
55 
56 /*---------------------------------------------------------------------------*\
57  Class odeChemistryModel Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 :
62  public basicChemistryModel,
63  public ODESystem
64 {
65  // Private data
66 
67  //- Reference to the field of specie mass fractions
68  const PtrList<volScalarField>& Yvf_;
69 
70  //- Number of species
71  label nSpecie_;
72 
73  //- Is chemistry reduction active
74  bool reduction_;
75 
76  //- Temporary map from complete to simplified concentration fields
77  // c -> sc
78  List<label> cTos_;
79 
80  //- Temporary map from simplified to complete concentration fields
81  // sc -> c
82  DynamicList<label> sToc_;
83 
84 
85 public:
86 
87  template<class ThermoType>
88  friend class chemistryModel;
89 
90  template<class ThermoType>
91  friend class chemistryReductionMethod;
92 
93  //- Runtime type information
94  TypeName("odeChemistryModel");
95 
96 
97  // Constructors
98 
99  //- Construct from thermo
101 
102  //- Disallow default bitwise copy construction
103  odeChemistryModel(const odeChemistryModel&) = delete;
104 
105 
106  //- Destructor
107  virtual ~odeChemistryModel();
108 
109 
110  // Member Functions
111 
112  //- Create and return a TDAC log file of the given name
113  inline autoPtr<OFstream> logFile(const word& name) const;
114 
115  //- The number of species
116  inline virtual label nSpecie() const;
117 
118  //- Allow the reduction method to reset the number of species
119  inline void setNSpecie(const label newNs);
120 
121  //- Number of ODE's to solve
122  inline virtual label nEqns() const;
123 
124  //- Return a reference to the list of mass fraction fields
125  inline const PtrList<volScalarField>& Y() const;
126 
127  //- Return true if mechanism reduction is active
128  inline bool reduction() const;
129 
130  //- Return the index in the complete set of species
131  // corresponding to the index si in the simplified set of species
132  inline label sToc(const label si) const;
133 
134  //- Return the index in the simplified set of species
135  // corresponding to the index si in the complete set of species
136  inline label cTos(const label ci) const;
137 
138 
139  // Member Operators
140 
141  //- Disallow default bitwise assignment
142  void operator=(const odeChemistryModel&) = delete;
143 };
144 
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 } // End namespace Foam
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #include "odeChemistryModelI.H"
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 #endif
157 
158 // ************************************************************************* //
label cTos(const label ci) const
Return the index in the simplified set of species.
Abstract base class for the systems of ordinary differential equations.
Definition: ODESystem.H:46
const PtrList< volScalarField > & Y() const
Return a reference to the list of mass fraction fields.
autoPtr< OFstream > logFile(const word &name) const
Create and return a TDAC log file of the given name.
odeChemistryModel(const fluidReactionThermo &thermo)
Construct from thermo.
TypeName("odeChemistryModel")
Runtime type information.
Base-class for multi-component fluid thermodynamic properties.
label sToc(const label si) const
Return the index in the complete set of species.
const fileName & name() const
Return the dictionary name.
Definition: dictionary.H:109
bool reduction() const
Return true if mechanism reduction is active.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
void operator=(const odeChemistryModel &)=delete
Disallow default bitwise assignment.
A class for handling words, derived from string.
Definition: word.H:59
virtual ~odeChemistryModel()
Destructor.
void setNSpecie(const label newNs)
Allow the reduction method to reset the number of species.
const fluidReactionThermo & thermo() const
Return const access to the thermo.
Extends base chemistry model by adding a thermo package, and ODE functions. Introduces chemistry equa...
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:70
virtual label nSpecie() const
The number of species.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
An abstract class for methods of chemical mechanism reduction.
Extends base chemistry model adding an ODESystem and the reduction maps needed for tabulation...
virtual label nEqns() const
Number of ODE&#39;s to solve.
Namespace for OpenFOAM.
Base class for chemistry models.