1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::ODEChemistryModel
29 Extends base chemistry model by adding a thermo package, and ODE functions.
30 Introduces chemistry equation system and evaluation of chemical source
37 \*---------------------------------------------------------------------------*/
39 #ifndef ODEChemistryModel_H
40 #define ODEChemistryModel_H
42 #include <reactionThermophysicalModels/hCombustionThermo.H>
43 #include <specie/Reaction.H>
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 // Forward declaration of classes
52 template<class CompType, class ThermoType>
53 class chemistrySolver;
55 /*---------------------------------------------------------------------------*\
56 Class ODEChemistryModel Declaration
57 \*---------------------------------------------------------------------------*/
59 template<class CompType, class ThermoType>
60 class ODEChemistryModel
65 // Private Member Functions
67 //- Disallow default bitwise assignment
68 void operator=(const ODEChemistryModel&);
75 //- Reference to the field of specie mass fractions
76 PtrList<volScalarField>& Y_;
79 const PtrList<Reaction<ThermoType> >& reactions_;
81 //- Thermodynamic data of the species
82 const PtrList<ThermoType>& specieThermo_;
87 //- Number of reactions
91 autoPtr<chemistrySolver<CompType, ThermoType> > solver_;
93 //- Chemical source term
94 PtrList<scalarField> RR_;
97 // Protected Member Functions
99 //- Write access to chemical source terms
100 // (e.g. for multi-chemistry model)
101 inline PtrList<scalarField>& RR();
106 //- Runtime type information
107 TypeName("ODEChemistryModel");
112 //- Construct from components
116 const word& compTypeName,
117 const word& thermoTypeName
122 virtual ~ODEChemistryModel();
128 inline const PtrList<Reaction<ThermoType> >& reactions() const;
130 //- Thermodynamic data of the species
131 inline const PtrList<ThermoType>& specieThermo() const;
133 //- The number of species
134 inline label nSpecie() const;
136 //- The number of reactions
137 inline label nReaction() const;
139 //- Return the chemisty solver
140 inline const chemistrySolver<CompType, ThermoType>& solver() const;
142 //- dc/dt = omega, rate of change in concentration, for each species
143 virtual scalarField omega
145 const scalarField& c,
150 //- Return the reaction rate for reaction r and the reference
151 // species and charateristic times
154 const Reaction<ThermoType>& r,
155 const scalarField& c,
166 //- Calculates the reaction rates
167 virtual void calculate();
170 // Chemistry model functions (overriding abstract functions in
173 //- Return const access to the chemical source terms
174 inline tmp<volScalarField> RR(const label i) const;
176 //- Solve the reaction system for the given start time and time
177 // step and return the characteristic time
178 virtual scalar solve(const scalar t0, const scalar deltaT);
180 //- Return the chemical time scale
181 virtual tmp<volScalarField> tc() const;
183 //- Return the heat release
184 virtual tmp<volScalarField> dQ() const;
187 // ODE functions (overriding abstract functions in ODE.H)
189 //- Number of ODE's to solve
190 virtual label nEqns() const;
192 virtual void derivatives
195 const scalarField& c,
199 virtual void jacobian
202 const scalarField& c,
204 scalarSquareMatrix& dfdc
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 } // End namespace Foam
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 #include "ODEChemistryModelI.H"
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 # include "ODEChemistryModel.C"
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 // ************************ vim: set sw=4 sts=4 et: ************************ //