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