OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

chemistrySolver.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::chemistrySolver
00027 
00028 Description
00029     An abstract base class for solving chemistry
00030 
00031 SourceFiles
00032     chemistrySolver.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef chemistrySolver_H
00037 #define chemistrySolver_H
00038 
00039 #include "ODEChemistryModel.H"
00040 #include "IOdictionary.H"
00041 #include "scalarField.H"
00042 #include "autoPtr.H"
00043 #include "runTimeSelectionTables.H"
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 // Forward declaration of classes
00051 template<class CompType, class ThermoType>
00052 class chemistrySolver;
00053 
00054 /*---------------------------------------------------------------------------*\
00055                       Class chemistrySolver Declaration
00056 \*---------------------------------------------------------------------------*/
00057 
00058 template<class CompType, class ThermoType>
00059 class chemistrySolver
00060 {
00061 protected:
00062 
00063     // Protected data
00064 
00065         //- Reference to the chemistry model
00066         ODEChemistryModel<CompType, ThermoType>& model_;
00067 
00068         //- Name of the chemistry solver
00069         const word name_;
00070 
00071 
00072 public:
00073 
00074         //- Runtime type information
00075         TypeName("chemistrySolver");
00076 
00077 
00078         // Declare runtime constructor selection table
00079         declareRunTimeSelectionTable
00080         (
00081             autoPtr,
00082             chemistrySolver,
00083             dictionary,
00084             (
00085                 ODEChemistryModel<CompType, ThermoType>& model,
00086                 const word& modelName
00087             ),
00088             (model, modelName)
00089         );
00090 
00091 
00092     // Constructors
00093 
00094         //- Construct from components
00095         chemistrySolver
00096         (
00097             ODEChemistryModel<CompType, ThermoType>& model,
00098             const word& modelName
00099         );
00100 
00101 
00102     //- Selector
00103     static autoPtr<chemistrySolver> New
00104     (
00105         ODEChemistryModel<CompType, ThermoType>& model,
00106         const word& compTypeName,
00107         const word& thermoTypeName
00108     );
00109 
00110 
00111     //- Destructor
00112     virtual ~chemistrySolver();
00113 
00114 
00115     // Member Functions
00116 
00117         //- Update the concentrations and return the chemical time
00118         virtual scalar solve
00119         (
00120             scalarField &c,
00121             const scalar T,
00122             const scalar p,
00123             const scalar t0,
00124             const scalar dt
00125         ) const = 0;
00126 };
00127 
00128 
00129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00130 
00131 } // End namespace Foam
00132 
00133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00134 
00135 #define makeChemistrySolver(Comp, Thermo)                                     \
00136                                                                               \
00137     typedef chemistrySolver<Comp, Thermo>                                     \
00138         chemistrySolver##Comp##Thermo;                                        \
00139                                                                               \
00140     defineTemplateTypeNameAndDebugWithName                                    \
00141     (                                                                         \
00142         chemistrySolver##Comp##Thermo,                                        \
00143         "chemistryModel<"#Comp","#Thermo">",                                  \
00144         0                                                                     \
00145     );                                                                        \
00146                                                                               \
00147     defineTemplateRunTimeSelectionTable                                       \
00148     (                                                                         \
00149         chemistrySolver##Comp##Thermo,                                        \
00150         dictionary                                                            \
00151     );
00152 
00153 
00154 #define makeChemistrySolverType(SS, Comp, Thermo)                             \
00155                                                                               \
00156     typedef SS<Comp, Thermo> SS##Comp##Thermo;                                \
00157                                                                               \
00158     defineTemplateTypeNameAndDebugWithName                                    \
00159     (                                                                         \
00160         SS##Comp##Thermo,                                                     \
00161         #SS"<"#Comp","#Thermo">",                                             \
00162         0                                                                     \
00163     );                                                                        \
00164                                                                               \
00165     chemistrySolver<Comp, Thermo>::                                           \
00166         adddictionaryConstructorToTable<SS<Comp, Thermo> >                    \
00167             add##SS##Comp##Thermo##ConstructorToTable_;
00168 
00169 
00170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00171 
00172 #ifdef NoRepository
00173 #   include "chemistrySolver.C"
00174 #   include "newChemistrySolver.C"
00175 #endif
00176 
00177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00178 
00179 #endif
00180 
00181 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd