1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
25 Foam::ODESolidChemistryModel
28 Extends base chemistry model by adding a thermo package, and ODE functions.
29 Introduces chemistry equation system and evaluation of chemical source
33 ODESolidChemistryModelI.H
34 ODESolidChemistryModel.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef ODESolidChemistryModel_H
39 #define ODESolidChemistryModel_H
41 #include "solidReaction.H"
43 #include "volFieldsFwd.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Forward declaration of classes
53 /*---------------------------------------------------------------------------*\
54 Class ODESolidChemistryModel Declaration
55 \*---------------------------------------------------------------------------*/
57 template<class CompType, class SolidThermo, class GasThermo>
58 class ODESolidChemistryModel
63 // Private Member Functions
65 //- Disallow default bitwise assignment
66 void operator=(const ODESolidChemistryModel&);
71 //- Reference to solid mass fractions
72 PtrList<volScalarField>& Ys_;
74 //- List of gas species present in reaction system
75 speciesTable pyrolisisGases_;
78 const PtrList<solidReaction>& reactions_;
80 //- Thermodynamic data of solids
81 const PtrList<SolidThermo>& solidThermo_;
83 //- Thermodynamic data of gases
84 PtrList<GasThermo> gasThermo_;
86 //- Number of gas species
89 //- Number of components being solved by ODE
92 //- Number of solid components
95 //- Number of solid reactions
98 //- List of reaction rate per solid [kg/m3/s]
99 PtrList<scalarField> RRs_;
101 //- List of reaction rate per gas [kg/m3/s]
102 PtrList<scalarField> RRg_;
105 // Protected Member Functions
107 //- Write access to source terms for solids
108 inline PtrList<scalarField>& RRs();
110 //- Write access to source terms for gases
111 inline PtrList<scalarField>& RRg();
116 //- List of accumulative solid concentrations
117 mutable PtrList<volScalarField> Ys0_;
122 //- List of active reacting cells
123 List<bool> reactingCells_;
128 //- Set reacting status of cell, cellI
129 void setCellReacting(const label cellI, const bool active);
134 //- Runtime type information
135 TypeName("ODESolidChemistryModel");
140 //- Construct from components
141 ODESolidChemistryModel
144 const word& compTypeName,
145 const word& SolidThermoName
150 virtual ~ODESolidChemistryModel();
156 inline const PtrList<solidReaction>& reactions() const;
158 //- Thermodynamic data of gases
159 inline const PtrList<GasThermo>& gasThermo() const;
162 inline const speciesTable& gasTable() const;
164 //- The number of solids
165 inline label nSpecie() const;
167 //- The number of solids
168 inline label nGases() const;
170 //- The number of reactions
171 inline label nReaction() const;
174 //- dc/dt = omega, rate of change in concentration, for each species
175 virtual scalarField omega
177 const scalarField& c,
180 const bool updateC0 = false
183 //- Return the reaction rate for reaction r and the reference
184 // species and charateristic times
187 const solidReaction& r,
188 const scalarField& c,
199 //- Calculates the reaction rates
200 virtual void calculate();
203 // Chemistry model functions
205 //- Return const access to the chemical source terms for solids
206 inline tmp<volScalarField> RRs(const label i) const;
208 //- Return const access to the chemical source terms for gases
209 inline tmp<volScalarField> RRg(const label i) const;
211 //- Return total gas source term
212 inline tmp<volScalarField> RRg() const;
214 //- Return total solid source term
215 inline tmp<volScalarField> RRs() const;
217 //- Return const access to the total source terms
218 inline tmp<volScalarField> RR(const label i) const;
220 //- Return sensible enthalpy for gas i [J/Kg]
221 virtual tmp<volScalarField> gasHs
223 const volScalarField& T,
227 //- Solve the reaction system for the given start time and time
228 // step and return the characteristic time
229 virtual scalar solve(const scalar t0, const scalar deltaT);
231 //- Return the chemical time scale
232 virtual tmp<volScalarField> tc() const;
234 //- Return source for enthalpy equation [kg/m/s3]
235 virtual tmp<volScalarField> Sh() const;
237 //- Return the heat release, i.e. enthalpy/sec [m2/s3]
238 virtual tmp<volScalarField> dQ() const;
241 // ODE functions (overriding abstract functions in ODE.H)
243 //- Number of ODE's to solve
244 virtual label nEqns() const;
246 virtual void derivatives
249 const scalarField& c,
253 virtual void jacobian
256 const scalarField& c,
258 scalarSquareMatrix& dfdc
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
274 } // End namespace Foam
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
278 # include "ODESolidChemistryModelI.H"
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283 # include "ODESolidChemistryModel.C"
286 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
290 // ************************************************************************* //