Parent Directory | Revision Log

Revision **1996** -
(**hide annotations**)
(**download**)
(**as text**)

*Thu Feb 5 09:42:42 2009 UTC*
(13 years, 6 months ago)
by *jpye*

File MIME type: text/x-chdr

File size: 4713 byte(s)

File MIME type: text/x-chdr

File size: 4713 byte(s)

Added acentric factor to HelmholtzData. Working on adding calculation of saturation curve using Maxwell phase-equilibrium condition (per IAPWS95).

1 | jpye | 1874 | /* ASCEND modelling environment |

2 | Copyright (C) 2008 Carnegie Mellon University | ||

3 | |||

4 | This program is free software; you can redistribute it and/or modify | ||

5 | it under the terms of the GNU General Public License as published by | ||

6 | the Free Software Foundation; either version 2, or (at your option) | ||

7 | any later version. | ||

8 | |||

9 | This program is distributed in the hope that it will be useful, | ||

10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||

11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||

12 | GNU General Public License for more details. | ||

13 | |||

14 | You should have received a copy of the GNU General Public License | ||

15 | along with this program; if not, write to the Free Software | ||

16 | Foundation, Inc., 59 Temple Place - Suite 330, | ||

17 | Boston, MA 02111-1307, USA. | ||

18 | */ | ||

19 | |||

20 | jpye | 1832 | #ifndef FPROPS_HELMHOLTZ_H |

21 | #define FPROPS_HELMHOLTZ_H | ||

22 | jpye | 1822 | |

23 | jpye | 1847 | #include "ideal.h" |

24 | jpye | 1835 | |

25 | jpye | 1822 | /** |

26 | Data structure for rows of the coefficient and exponent table (allows | ||

27 | the data to be represented more concisely when declaring a fluid from | ||

28 | C code. | ||

29 | */ | ||

30 | jpye | 1838 | typedef struct HelmholtzPowTerm_struct{ |

31 | jpye | 1822 | double a; /* coefficient */ |

32 | double t; /* exponent of tau */ | ||

33 | jpye | 1826 | int d; /* exponent of delta */ |

34 | jpye | 1832 | unsigned l; /* exponent X in exp(-del^X) */ |

35 | jpye | 1838 | } HelmholtzPowTerm; |

36 | jpye | 1822 | |

37 | jpye | 1885 | /* |

38 | jpye | 1887 | Data structure for Gaussian terms in the residual expression, for |

39 | improvement of correlation in the critical region. These terms are of the | ||

40 | form as utilised in the correlations for water (see water.c) and hydrogen | ||

41 | (see hydrogen.c). According to Leachman, these terms are due to Setzmann | ||

42 | and Wagner (J Phys Chem Ref Data, 1966). | ||

43 | jpye | 1885 | |

44 | jpye | 1887 | Using the nomenclature of IAPWS-95 (see water.c), terms here for the reduced |

45 | helmholtz energy are: | ||

46 | |||

47 | n * del^d * tau^t * exp[-alpha*(delta-epsilon)^2 - beta*(tau-gamma)^2] | ||

48 | |||

49 | NOTE the minus signs preceeding 'alpha' and 'beta' and note that this is | ||

50 | in conflict with the sign convention of Leachman, who assumes a plus sign | ||

51 | in front of the corresponding parameters in his equation. | ||

52 | jpye | 1904 | |

53 | NOTE these terms are also used in Span et al, 1998, as cited in the file | ||

54 | 'nitrogen.c', but in that case, epsilon == 1 for all terms. | ||

55 | jpye | 1885 | */ |

56 | jpye | 1887 | typedef struct HelmholtzGausTerm_struct{ |

57 | jpye | 1885 | double n; /**< coefficient */ |

58 | double t; /**< power of tau */ | ||

59 | double d; /**< power of delta */ | ||

60 | double alpha,beta,gamma,epsilon; | ||

61 | jpye | 1887 | } HelmholtzGausTerm; |

62 | jpye | 1885 | |

63 | /* | ||

64 | Data structure for 'critical terms' in the residual expression. These | ||

65 | terms are of the form described in the IAPWS-95 document, as cited in | ||

66 | the file 'water.c'. | ||

67 | |||

68 | This structure is for the second kind, with A, B, C, D. | ||

69 | */ | ||

70 | jpye | 1887 | typedef struct HelmholtzCritTerm_struct{ |

71 | jpye | 1885 | double n; /**< coefficient */ |

72 | double a,b,beta,A,B,C,D; | ||

73 | jpye | 1887 | } HelmholtzCritTerm; |

74 | jpye | 1885 | |

75 | jpye | 1838 | /** |

76 | jpye | 1822 | Data structure for fluid-specific data for the Helmholtz free energy EOS. |

77 | jpye | 1832 | See Tillner-Roth 1993 for information about 'atd' and 'a0' data. |

78 | jpye | 1822 | */ |

79 | typedef struct HelmholtzData_struct{ | ||

80 | jpye | 1832 | double R; /**< specific gas constant */ |

81 | double M; /**< molar mass, kg/kmol */ | ||

82 | double rho_star; /**< normalisation density, kg/m�� */ | ||

83 | jpye | 1996 | double T_star; /**< normalisation temperature, K */ |

84 | |||

85 | double omega; /**< Pitzer acentric factor */ | ||

86 | jpye | 1822 | |

87 | jpye | 1835 | const IdealData *ideal; /* data for ideal component of Helmholtz energy */ |

88 | jpye | 1822 | |

89 | jpye | 1838 | unsigned np; /* number of power terms in residual equation */ |

90 | const HelmholtzPowTerm *pt; /* power term data for residual eqn, maybe NULL if np == 0 */ | ||

91 | jpye | 1887 | unsigned ng; /* number of critical terms of the first kind */ |

92 | const HelmholtzGausTerm *gt; /* critical terms of the first kind */ | ||

93 | unsigned nc; /* number of critical terms of the second kind */ | ||

94 | const HelmholtzCritTerm *ct; /* critical terms of the second kind */ | ||

95 | jpye | 1822 | } HelmholtzData; |

96 | |||

97 | jpye | 1826 | double helmholtz_p(double T, double rho, const HelmholtzData *data); |

98 | double helmholtz_u(double T, double rho, const HelmholtzData *data); | ||

99 | double helmholtz_h(double T, double rho, const HelmholtzData *data); | ||

100 | jpye | 1829 | double helmholtz_s(double T, double rho, const HelmholtzData *data); |

101 | jpye | 1863 | double helmholtz_a(double T, double rho, const HelmholtzData *data); |

102 | jpye | 1988 | double helmholtz_cv(double T, double rho, const HelmholtzData *data); |

103 | jpye | 1989 | double helmholtz_cp(double T, double rho, const HelmholtzData *data); |

104 | double helmholtz_w(double T, double rho, const HelmholtzData *data); | ||

105 | jpye | 1988 | |

106 | jpye | 1996 | int helmholtz_sat_t(double T, double *p, double *rho_f, double *rho_g, const HelmholtzData *data); |

107 | |||

108 | jpye | 1850 | double helmholtz_cp0(double T, const HelmholtzData *data); |

109 | jpye | 1825 | |

110 | jpye | 1905 | double helmholtz_dpdT_rho(double T, double rho, const HelmholtzData *data); |

111 | double helmholtz_dpdrho_T(double T, double rho, const HelmholtzData *data); | ||

112 | |||

113 | jpye | 1915 | double helmholtz_dhdT_rho(double T, double rho, const HelmholtzData *data); |

114 | double helmholtz_dhdrho_T(double T, double rho, const HelmholtzData *data); | ||

115 | |||

116 | jpye | 1920 | double helmholtz_dudT_rho(double T, double rho, const HelmholtzData *data); |

117 | double helmholtz_dudrho_T(double T, double rho, const HelmholtzData *data); | ||

118 | |||

119 | jpye | 1832 | #endif |

120 |

john.pye@anu.edu.au | ViewVC Help |

Powered by ViewVC 1.1.22 |