Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef Reaction_H
00038 #define Reaction_H
00039
00040 #include <specie/speciesTable.H>
00041 #include <OpenFOAM/HashPtrTable.H>
00042 #include <OpenFOAM/scalarField.H>
00043 #include <OpenFOAM/typeInfo.H>
00044 #include <OpenFOAM/runTimeSelectionTables.H>
00045
00046
00047
00048 namespace Foam
00049 {
00050
00051
00052
00053 template<class ReactionThermo>
00054 class Reaction;
00055
00056 template<class ReactionThermo>
00057 inline Ostream& operator<<(Ostream&, const Reaction<ReactionThermo>&);
00058
00059
00060
00061
00062
00063
00064 template<class ReactionThermo>
00065 class Reaction
00066 :
00067 public ReactionThermo
00068 {
00069
00070 public:
00071
00072
00073
00074
00075
00076 struct specieCoeffs
00077 {
00078 label index;
00079 scalar stoichCoeff;
00080 scalar exponent;
00081
00082 specieCoeffs()
00083 :
00084 index(-1),
00085 stoichCoeff(0),
00086 exponent(1)
00087 {}
00088
00089 specieCoeffs(const speciesTable& species, Istream& is);
00090
00091 bool operator==(const specieCoeffs& sc) const
00092 {
00093 return index == sc.index;
00094 }
00095
00096 bool operator!=(const specieCoeffs& sc) const
00097 {
00098 return index != sc.index;
00099 }
00100
00101 friend Ostream& operator<<(Ostream& os, const specieCoeffs& sc)
00102 {
00103 os << sc.index << token::SPACE
00104 << sc.stoichCoeff << token::SPACE
00105 << sc.exponent;
00106 return os;
00107 }
00108 };
00109
00110
00111 private:
00112
00113
00114
00115
00116 const speciesTable& species_;
00117
00118
00119 List<specieCoeffs> lhs_;
00120
00121
00122 List<specieCoeffs> rhs_;
00123
00124
00125
00126
00127 void setLRhs(Istream&);
00128 void setThermo(const HashPtrTable<ReactionThermo>& thermoDatabase);
00129
00130
00131 void operator=(const Reaction<ReactionThermo>&);
00132
00133
00134 public:
00135
00136
00137 TypeName("Reaction");
00138
00139
00140
00141
00142 declareRunTimeSelectionTable
00143 (
00144 autoPtr,
00145 Reaction,
00146 Istream,
00147 (
00148 const speciesTable& species,
00149 const HashPtrTable<ReactionThermo>& thermoDatabase,
00150 Istream& is
00151 ),
00152 (species, thermoDatabase, is)
00153 );
00154
00155
00156
00157
00158
00159 class iNew
00160 {
00161 const speciesTable& species_;
00162 const HashPtrTable<ReactionThermo>& thermoDatabase_;
00163
00164 public:
00165
00166 iNew
00167 (
00168 const speciesTable& species,
00169 const HashPtrTable<ReactionThermo>& thermoDatabase
00170 )
00171 :
00172 species_(species),
00173 thermoDatabase_(thermoDatabase)
00174 {}
00175
00176 autoPtr<Reaction> operator()(Istream& is) const
00177 {
00178 return autoPtr<Reaction>
00179 (
00180 Reaction::New(species_, thermoDatabase_, is)
00181 );
00182 }
00183 };
00184
00185
00186
00187
00188
00189 Reaction
00190 (
00191 const speciesTable& species,
00192 const List<specieCoeffs>& lhs,
00193 const List<specieCoeffs>& rhs,
00194 const HashPtrTable<ReactionThermo>& thermoDatabase
00195 );
00196
00197
00198 Reaction(const Reaction<ReactionThermo>&, const speciesTable& species);
00199
00200
00201 Reaction
00202 (
00203 const speciesTable& species,
00204 const HashPtrTable<ReactionThermo>& thermoDatabase,
00205 Istream& is
00206 );
00207
00208
00209 virtual autoPtr<Reaction<ReactionThermo> > clone() const
00210 {
00211 return autoPtr<Reaction<ReactionThermo> >
00212 (
00213 new Reaction<ReactionThermo>(*this)
00214 );
00215 }
00216
00217
00218 virtual autoPtr<Reaction<ReactionThermo> > clone
00219 (
00220 const speciesTable& species
00221 ) const
00222 {
00223 return autoPtr<Reaction<ReactionThermo> >
00224 (
00225 new Reaction<ReactionThermo>(*this, species)
00226 );
00227 }
00228
00229
00230
00231
00232
00233 static autoPtr<Reaction<ReactionThermo> > New
00234 (
00235 const speciesTable& species,
00236 const HashPtrTable<ReactionThermo>& thermoDatabase,
00237 Istream&
00238 );
00239
00240
00241
00242
00243 virtual ~Reaction()
00244 {}
00245
00246
00247
00248
00249
00250
00251 inline const List<specieCoeffs>& lhs() const;
00252 inline const List<specieCoeffs>& rhs() const;
00253
00254
00255
00256
00257
00258 virtual scalar kf
00259 (
00260 const scalar T,
00261 const scalar p,
00262 const scalarField& c
00263 ) const;
00264
00265
00266 virtual scalar kr
00267 (
00268 const scalar kfwd,
00269 const scalar T,
00270 const scalar p,
00271 const scalarField& c
00272 ) const;
00273
00274
00275
00276
00277 virtual scalar kr
00278 (
00279 const scalar T,
00280 const scalar p,
00281 const scalarField& c
00282 ) const;
00283
00284
00285
00286 virtual void write(Ostream&) const;
00287
00288
00289
00290
00291 friend Ostream& operator<< <ReactionThermo>
00292 (
00293 Ostream&,
00294 const Reaction<ReactionThermo>&
00295 );
00296 };
00297
00298
00299
00300
00301 }
00302
00303
00304
00305 #include <specie/ReactionI.H>
00306
00307
00308
00309 #ifdef NoRepository
00310 # include <specie/Reaction.C>
00311 #endif
00312
00313
00314
00315 #endif
00316
00317