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