29 |
#include "zeroin.h" |
#include "zeroin.h" |
30 |
|
|
31 |
// report lots of stuff |
// report lots of stuff |
32 |
//#define SAT_DEBUG |
#define SAT_DEBUG |
33 |
#define SAT_ERRORS |
#define SAT_ERRORS |
34 |
|
|
35 |
// assertions for NANs etc |
// assertions for NANs etc |
143 |
Estimate saturation pressure using acentric factor. This algorithm |
Estimate saturation pressure using acentric factor. This algorithm |
144 |
is used for first estimates for later refinement in the program REFPROP. |
is used for first estimates for later refinement in the program REFPROP. |
145 |
|
|
146 |
Is this Antoine equation or something? FIXME check this and correct. |
This is derived from the definition of the acentric factor, |
147 |
|
omega = -log10(psat(T1) - 1 where T1/Tc = Tr = 0.7 |
148 |
|
|
149 |
|
together with the saturation curve obtained if h_fg(T) is assumed constant: |
150 |
|
ln(psat(T)) = A - B/(T + C) |
151 |
|
|
152 |
|
See Sandler 5e, p 320. |
153 |
|
|
154 |
|
s Such a curve will pass through (pc,Tc) and (psat(Tr),Tr) where Tr = 0.7, |
155 |
|
but will probably be inaccurate at Tt. Given additional data, such as the |
156 |
|
normal boiling point, a better equation like the Antoine equation can be |
157 |
|
fitted. But we don't use that here. |
158 |
|
|
159 |
*/ |
*/ |
160 |
double fprops_psat_T_acentric(double T, const FluidData *data){ |
double fprops_psat_T_acentric(double T, const FluidData *data){ |
161 |
/* first guess using acentric factor */ |
/* first guess using acentric factor */ |
249 |
ERRMSG("Note: data for '%s' does not include a valid triple point temperature.",d->name); |
ERRMSG("Note: data for '%s' does not include a valid triple point temperature.",d->name); |
250 |
} |
} |
251 |
|
|
252 |
MSG("Calculating saturation for '%s' (T_c = %f, p_c = %f) at T = %f",d->name, d->data->T_c, d->data->p_c, d->data->T_t); |
MSG("Calculating for '%s' (type %d, T_t = %f, T_c = %f, p_c = %f)",d->name, d->type, d->data->T_t, d->data->T_c, d->data->p_c); |
253 |
fprops_sat_T(d->data->T_t, &p_t, &rhof_t, &rhog_t,d,err); |
fprops_sat_T(d->data->T_t, &p_t, &rhof_t, &rhog_t,d,err); |
254 |
if(*err)return; |
if(*err)return; |
255 |
d_last = d; |
d_last = d; |
256 |
*p_t_out = p_t; |
*p_t_out = p_t; |
257 |
*rhof_t_out = rhof_t; |
*rhof_t_out = rhof_t; |
258 |
*rhog_t_out = rhog_t; |
*rhog_t_out = rhog_t; |
259 |
|
MSG("p_t = %f, rhof_t = %f, rhog_t = %f", p_t, rhof_t, rhog_t); |
260 |
} |
} |
261 |
|
|
262 |
|
|