FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::chemistrySolver
00026 
00027 Description
00028     An abstract base class for solving chemistry
00029 
00030 SourceFiles
00031     chemistrySolver.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef chemistrySolver_H
00036 #define chemistrySolver_H
00037 
00038 #include <chemistryModel/ODEChemistryModel.H>
00039 #include <OpenFOAM/IOdictionary.H>
00040 #include <OpenFOAM/scalarField.H>
00041 #include <OpenFOAM/autoPtr.H>
00042 #include <OpenFOAM/runTimeSelectionTables.H>
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 // Forward declaration of classes
00050 template<class CompType, class ThermoType>
00051 class chemistrySolver;
00052 
00053 /*---------------------------------------------------------------------------*\
00054                       Class chemistrySolver Declaration
00055 \*---------------------------------------------------------------------------*/
00056 
00057 template<class CompType, class ThermoType>
00058 class chemistrySolver
00059 {
00060 protected:
00061 
00062     // Protected data
00063 
00064         //- Reference to the chemistry model
00065         ODEChemistryModel<CompType, ThermoType>& model_;
00066 
00067         //- Name of the chemistry solver
00068         const word name_;
00069 
00070 
00071 public:
00072 
00073         //- Runtime type information
00074         TypeName("chemistrySolver");
00075 
00076 
00077         // Declare runtime constructor selection table
00078         declareRunTimeSelectionTable
00079         (
00080             autoPtr,
00081             chemistrySolver,
00082             dictionary,
00083             (
00084                 ODEChemistryModel<CompType, ThermoType>& model,
00085                 const word& modelName
00086             ),
00087             (model, modelName)
00088         );
00089 
00090 
00091     // Constructors
00092 
00093         //- Construct from components
00094         chemistrySolver
00095         (
00096             ODEChemistryModel<CompType, ThermoType>& model,
00097             const word& modelName
00098         );
00099 
00100 
00101     //- Selector
00102     static autoPtr<chemistrySolver> New
00103     (
00104         ODEChemistryModel<CompType, ThermoType>& model,
00105         const word& compTypeName,
00106         const word& thermoTypeName
00107     );
00108 
00109 
00110     //- Destructor
00111     virtual ~chemistrySolver();
00112 
00113 
00114     // Member Functions
00115 
00116         //- Update the concentrations and return the chemical time
00117         virtual scalar solve
00118         (
00119             scalarField &c,
00120             const scalar T,
00121             const scalar p,
00122             const scalar t0,
00123             const scalar dt
00124         ) const = 0;
00125 };
00126 
00127 
00128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00129 
00130 } // End namespace Foam
00131 
00132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00133 
00134 #define makeChemistrySolver(Comp, Thermo)                                     \
00135                                                                               \
00136     typedef chemistrySolver<Comp, Thermo>                                     \
00137         chemistrySolver##Comp##Thermo;                                        \
00138                                                                               \
00139     defineTemplateTypeNameAndDebugWithName                                    \
00140     (                                                                         \
00141         chemistrySolver##Comp##Thermo,                                        \
00142         "chemistryModel<"#Comp","#Thermo">",                                  \
00143         0                                                                     \
00144     );                                                                        \
00145                                                                               \
00146     defineTemplateRunTimeSelectionTable                                       \
00147     (                                                                         \
00148         chemistrySolver##Comp##Thermo,                                        \
00149         dictionary                                                            \
00150     );
00151 
00152 
00153 #define makeChemistrySolverType(SS, Comp, Thermo)                             \
00154                                                                               \
00155     typedef SS<Comp, Thermo> SS##Comp##Thermo;                                \
00156                                                                               \
00157     defineTemplateTypeNameAndDebugWithName                                    \
00158     (                                                                         \
00159         SS##Comp##Thermo,                                                     \
00160         #SS"<"#Comp","#Thermo">",                                             \
00161         0                                                                     \
00162     );                                                                        \
00163                                                                               \
00164     chemistrySolver<Comp, Thermo>::                                           \
00165         adddictionaryConstructorToTable<SS<Comp, Thermo> >                    \
00166             add##SS##Comp##Thermo##ConstructorToTable_;
00167 
00168 
00169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00170 
00171 #ifdef NoRepository
00172 #   include "chemistrySolver.C"
00173 #   include "newChemistrySolver.C"
00174 #endif
00175 
00176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00177 
00178 #endif
00179 
00180 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines