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 template<class equationOfState>
00029 inline Foam::eConstThermo<equationOfState>::eConstThermo
00030 (
00031     const equationOfState& st,
00032     const scalar cv,
00033     const scalar hf
00034 )
00035 :
00036     equationOfState(st),
00037     Cv_(cv),
00038     Hf_(hf)
00039 {}
00040 
00041 
00042 
00043 
00044 template<class equationOfState>
00045 inline Foam::eConstThermo<equationOfState>::eConstThermo
00046 (
00047     const word& name,
00048     const eConstThermo<equationOfState>& ct
00049 )
00050 :
00051     equationOfState(name, ct),
00052     Cv_(ct.Cv_),
00053     Hf_(ct.Hf_)
00054 {}
00055 
00056 
00057 template<class equationOfState>
00058 inline Foam::autoPtr<Foam::eConstThermo<equationOfState> >
00059 Foam::eConstThermo<equationOfState>::clone() const
00060 {
00061     return autoPtr<eConstThermo<equationOfState> >
00062     (
00063         new eConstThermo<equationOfState>(*this)
00064     );
00065 }
00066 
00067 
00068 template<class equationOfState>
00069 inline Foam::autoPtr<Foam::eConstThermo<equationOfState> >
00070 Foam::eConstThermo<equationOfState>::New(Istream& is)
00071 {
00072     return autoPtr<eConstThermo<equationOfState> >
00073     (
00074         new eConstThermo<equationOfState>(is)
00075     );
00076 }
00077 
00078 
00079 
00080 
00081 template<class equationOfState>
00082 inline Foam::scalar Foam::eConstThermo<equationOfState>::cp
00083 (
00084     const scalar
00085 ) const
00086 {
00087     return Cv_*this->W() + specie::RR;
00088 }
00089 
00090 
00091 template<class equationOfState>
00092 inline Foam::scalar Foam::eConstThermo<equationOfState>::h
00093 (
00094     const scalar T
00095 ) const
00096 {
00097     return cp(T)*T + Hf_*this->W();
00098 }
00099 
00100 
00101 template<class equationOfState>
00102 inline Foam::scalar Foam::eConstThermo<equationOfState>::hs
00103 (
00104     const scalar T
00105 ) const
00106 {
00107     return cp(T)*T;
00108 }
00109 
00110 
00111 template<class equationOfState>
00112 inline Foam::scalar Foam::eConstThermo<equationOfState>::hc() const
00113 {
00114     return Hf_*this->W();
00115 }
00116 
00117 
00118 template<class equationOfState>
00119 inline Foam::scalar Foam::eConstThermo<equationOfState>::s
00120 (
00121     const scalar T
00122 ) const
00123 {
00124     notImplemented("scalar eConstThermo::s(const scalar T) const");
00125     return T;
00126 }
00127 
00128 
00129 
00130 
00131 template<class equationOfState>
00132 inline void Foam::eConstThermo<equationOfState>::operator+=
00133 (
00134     const eConstThermo<equationOfState>& ct
00135 )
00136 {
00137     scalar molr1 = this->nMoles();
00138 
00139     equationOfState::operator+=(ct);
00140 
00141     molr1 /= this->nMoles();
00142     scalar molr2 = ct.nMoles()/this->nMoles();
00143 
00144     Cv_ = molr1*Cv_ + molr2*ct.Cv_;
00145     Hf_ = molr1*Hf_ + molr2*ct.Hf_;
00146 }
00147 
00148 
00149 template<class equationOfState>
00150 inline void Foam::eConstThermo<equationOfState>::operator-=
00151 (
00152     const eConstThermo<equationOfState>& ct
00153 )
00154 {
00155     scalar molr1 = this->nMoles();
00156 
00157     equationOfState::operator-=(ct);
00158 
00159     molr1 /= this->nMoles();
00160     scalar molr2 = ct.nMoles()/this->nMoles();
00161 
00162     Cv_ = molr1*Cv_ - molr2*ct.Cv_;
00163     Hf_ = molr1*Hf_ - molr2*ct.Hf_;
00164 }
00165 
00166 
00167 
00168 
00169 template<class equationOfState>
00170 inline Foam::eConstThermo<equationOfState> Foam::operator+
00171 (
00172     const eConstThermo<equationOfState>& ct1,
00173     const eConstThermo<equationOfState>& ct2
00174 )
00175 {
00176     equationOfState eofs
00177     (
00178         static_cast<const equationOfState&>(ct1)
00179       + static_cast<const equationOfState&>(ct2)
00180     );
00181 
00182     return eConstThermo<equationOfState>
00183     (
00184         eofs,
00185         ct1.nMoles()/eofs.nMoles()*ct1.Cv_
00186       + ct2.nMoles()/eofs.nMoles()*ct2.Cv_,
00187         ct1.nMoles()/eofs.nMoles()*ct1.Hf_
00188       + ct2.nMoles()/eofs.nMoles()*ct2.Hf_
00189     );
00190 }
00191 
00192 
00193 template<class equationOfState>
00194 inline Foam::eConstThermo<equationOfState> Foam::operator-
00195 (
00196     const eConstThermo<equationOfState>& ct1,
00197     const eConstThermo<equationOfState>& ct2
00198 )
00199 {
00200     equationOfState eofs
00201     (
00202         static_cast<const equationOfState&>(ct1)
00203       - static_cast<const equationOfState&>(ct2)
00204     );
00205 
00206     return eConstThermo<equationOfState>
00207     (
00208         eofs,
00209         ct1.nMoles()/eofs.nMoles()*ct1.Cv_
00210       - ct2.nMoles()/eofs.nMoles()*ct2.Cv_,
00211         ct1.nMoles()/eofs.nMoles()*ct1.Hf_
00212       - ct2.nMoles()/eofs.nMoles()*ct2.Hf_
00213     );
00214 }
00215 
00216 
00217 template<class equationOfState>
00218 inline Foam::eConstThermo<equationOfState> Foam::operator*
00219 (
00220     const scalar s,
00221     const eConstThermo<equationOfState>& ct
00222 )
00223 {
00224     return eConstThermo<equationOfState>
00225     (
00226         s*static_cast<const equationOfState&>(ct),
00227         ct.Cv_,
00228         ct.Hf_
00229     );
00230 }
00231 
00232 
00233 template<class equationOfState>
00234 inline Foam::eConstThermo<equationOfState> Foam::operator==
00235 (
00236     const eConstThermo<equationOfState>& ct1,
00237     const eConstThermo<equationOfState>& ct2
00238 )
00239 {
00240     return ct2 - ct1;
00241 }
00242 
00243 
00244