/[ascend]/branches/sid/models/johnpye/fprops/sat.c
ViewVC logotype

Diff of /branches/sid/models/johnpye/fprops/sat.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3023 by sid, Mon Jun 1 05:55:00 2015 UTC revision 3024 by sid, Thu Jul 23 04:16:35 2015 UTC
# Line 145  double fprops_psat_T_xiang(double T, con Line 145  double fprops_psat_T_xiang(double T, con
145    
146      This is derived from the definition of the acentric factor,      This is derived from the definition of the acentric factor,
147      omega = -log10(psat(T1) - 1 where T1/Tc = Tr = 0.7      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:      together with the saturation curve obtained if h_fg(T) is assumed constant:
150      ln(psat(T)) = A - B/(T + C)      ln(psat(T)) = A - B/(T + C)
151    
152      See Sandler 5e, p 320.        See Sandler 5e, p 320.
153    
154  s   Such a curve will pass through (pc,Tc) and (psat(Tr),Tr) where Tr = 0.7,  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      but will probably be inaccurate at Tt. Given additional data, such as the
# Line 229  double fprops_rhog_T_chouaieb(double T, Line 229  double fprops_rhog_T_chouaieb(double T,
229  }  }
230    
231  void fprops_sat_T(double T, double *psat, double *rhof, double *rhog, const PureFluid *d, FpropsError *err){  void fprops_sat_T(double T, double *psat, double *rhof, double *rhog, const PureFluid *d, FpropsError *err){
232    
233    
234    
235      *psat = d->sat_fn(T,rhof,rhog,d->data,err);      *psat = d->sat_fn(T,rhof,rhog,d->data,err);
236  }  }
237    
# Line 289  static double sat_p_resid(double rT, voi Line 292  static double sat_p_resid(double rT, voi
292    
293    
294  /**  /**
295      Solve saturation conditions as a function of pressure.      Solve saturation conditions as a function of pressure.
296    
297      Currently this is just a Brent solver. We've tried to improve it slightly      Currently this is just a Brent solver. We've tried to improve it slightly
298      by solving for the residual of log(p)-log(p1) as a function of 1/T, which      by solving for the residual of log(p)-log(p1) as a function of 1/T, which
# Line 299  static double sat_p_resid(double rT, voi Line 302  static double sat_p_resid(double rT, voi
302      the Clapeyron equation?      the Clapeyron equation?
303    
304      dp/dT = h_fg/(T*v_fg)      dp/dT = h_fg/(T*v_fg)
305        
306      where      where
307    
308      h_fg = h(T, rhog) - h(T, rhof)      h_fg = h(T, rhog) - h(T, rhof)
# Line 307  static double sat_p_resid(double rT, voi Line 310  static double sat_p_resid(double rT, voi
310      rhof, rhog are evaluated at T.      rhof, rhog are evaluated at T.
311    
312      We guess T, calculate saturation conditions at T, then evaluate dp/dT,      We guess T, calculate saturation conditions at T, then evaluate dp/dT,
313      use Newton solver to converge, while checking that we remain within      use Newton solver to converge, while checking that we remain within
314      Tt < T < Tc. It may be faster to iterate using 1/T as the free variable,      Tt < T < Tc. It may be faster to iterate using 1/T as the free variable,
315      and log(p) as the residual variable.      and log(p) as the residual variable.
316    
# Line 328  void fprops_sat_p(double p, double *T_sa Line 331  void fprops_sat_p(double p, double *T_sa
331          return;          return;
332      }      }
333      /* FIXME what about checking triple point pressure? */      /* FIXME what about checking triple point pressure? */
334        
335    
336      SatPResidData D = {      SatPResidData D = {
337          P, log(p), err, 0          P, log(p), err, 0

Legend:
Removed from v.3023  
changed lines
  Added in v.3024

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22