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