194 |
|
|
195 |
@param T temperature in K |
@param T temperature in K |
196 |
@param rho mass density in kg/m³ |
@param rho mass density in kg/m³ |
197 |
@param Specific heat capacity in J/kg/K. |
@return Isochoric specific heat capacity in J/kg/K. |
198 |
*/ |
*/ |
199 |
double helmholtz_cv(double T, double rho, const HelmholtzData *data){ |
double helmholtz_cv(double T, double rho, const HelmholtzData *data){ |
200 |
double tau = data->T_star / T; |
double tau = data->T_star / T; |
204 |
} |
} |
205 |
|
|
206 |
/** |
/** |
207 |
|
Function to calculate isobaric heat capacity from the Helmholtz free energy |
208 |
|
EOS given temperature and mass density. |
209 |
|
|
210 |
|
@param T temperature in K |
211 |
|
@param rho mass density in kg/m³ |
212 |
|
@return Isobaric specific heat capacity in J/kg/K. |
213 |
|
*/ |
214 |
|
double helmholtz_cp(double T, double rho, const HelmholtzData *data){ |
215 |
|
double tau = data->T_star / T; |
216 |
|
double delta = rho / data->rho_star; |
217 |
|
|
218 |
|
double phir_d = helm_resid_del(tau,delta,data); |
219 |
|
double phir_dd = helm_resid_deldel(tau,delta,data); |
220 |
|
double phir_dt = helm_resid_deltau(tau,delta,data); |
221 |
|
|
222 |
|
/* note similarities with helmholtz_w */ |
223 |
|
double temp1 = 1 + 2*delta*phir_d + SQ(delta)*phir_dd; |
224 |
|
double temp2 = 1 + delta*phir_d - delta*tau*phir_dt; |
225 |
|
double temp3 = SQ(tau)*(helm_ideal_tautau(tau,data->ideal) + helm_resid_tautau(tau,delta,data)); |
226 |
|
|
227 |
|
return data->R * (-temp3 + SQ(temp2)/temp1); |
228 |
|
} |
229 |
|
|
230 |
|
|
231 |
|
/** |
232 |
|
Function to calculate the speed of sound in a fluid from the Helmholtz free |
233 |
|
energy EOS, given temperature and mass density. |
234 |
|
|
235 |
|
@param T temperature in K |
236 |
|
@param rho mass density in kg/m³ |
237 |
|
@return Speed of sound in m/s. |
238 |
|
*/ |
239 |
|
double helmholtz_w(double T, double rho, const HelmholtzData *data){ |
240 |
|
|
241 |
|
double tau = data->T_star / T; |
242 |
|
double delta = rho / data->rho_star; |
243 |
|
|
244 |
|
double phir_d = helm_resid_del(tau,delta,data); |
245 |
|
double phir_dd = helm_resid_deldel(tau,delta,data); |
246 |
|
double phir_dt = helm_resid_deltau(tau,delta,data); |
247 |
|
|
248 |
|
/* note similarities with helmholtz_cp */ |
249 |
|
double temp1 = 1 + 2*delta*phir_d + SQ(delta)*phir_dd; |
250 |
|
double temp2 = 1 + delta*phir_d - delta*tau*phir_dt; |
251 |
|
double temp3 = SQ(tau)*(helm_ideal_tautau(tau,data->ideal) + helm_resid_tautau(tau,delta,data)); |
252 |
|
|
253 |
|
return sqrt(data->R * T *(temp1 - SQ(temp2)/temp3)); |
254 |
|
|
255 |
|
} |
256 |
|
|
257 |
|
/** |
258 |
Calculation zero-pressure specific heat capacity |
Calculation zero-pressure specific heat capacity |
259 |
*/ |
*/ |
260 |
double helmholtz_cp0(double T, const HelmholtzData *data){ |
double helmholtz_cp0(double T, const HelmholtzData *data){ |
667 |
++ct; |
++ct; |
668 |
} |
} |
669 |
|
|
|
/* FIXME add critical terms calculation */ |
|
|
|
|
670 |
return res; |
return res; |
671 |
} |
} |
672 |
|
|
750 |
Second derivative of helmholtz residual function with respect to |
Second derivative of helmholtz residual function with respect to |
751 |
delta (twice). |
delta (twice). |
752 |
|
|
753 |
FIXME this function is WRONG. |
FIXME this function is WRONG. (UPDATE? is this still true? Think not) |
754 |
*/ |
*/ |
755 |
double helm_resid_deldel(double tau,double delta,const HelmholtzData *data){ |
double helm_resid_deldel(double tau,double delta,const HelmholtzData *data){ |
756 |
double sum = 0, res = 0; |
double sum = 0, res = 0; |
908 |
++ct; |
++ct; |
909 |
} |
} |
910 |
|
|
|
/* FIXME add critical terms calculation */ |
|
|
|
|
911 |
#ifdef RESID_DEBUG |
#ifdef RESID_DEBUG |
912 |
fprintf(stderr,"phir_tautau = %f\n",res); |
fprintf(stderr,"phir_tautau = %f\n",res); |
913 |
#endif |
#endif |