Parent Directory | Revision Log

Revision **1855** -
(**show annotations**)
(**download**)
(**as text**)

*Thu Sep 11 13:50:55 2008 UTC*
(15 years, 9 months ago)
by *jpye*

File MIME type: text/x-chdr

File size: 3241 byte(s)

File MIME type: text/x-chdr

File size: 3241 byte(s)

Fixed evaluation of cp0 for both ammonia and nitrogen now.

1 | /* 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 | #ifndef FPROPS_IDEAL_H |

20 | #define FPROPS_IDEAL_H |

21 | |

22 | /* |

23 | Data types for declaration of ideal fluid components of property |

24 | correlations. Frequently property correlations for 'real' fluids are |

25 | given in terms of ideal gas components plus 'residual' or 'real' |

26 | components. For these cases, this file defines the data structures |

27 | used to declare those ideal component curves. |

28 | */ |

29 | |

30 | /* |

31 | Terms containing powers of 'tau', like |

32 | |

33 | a0 * tau^t0 |

34 | */ |

35 | typedef struct IdealPowTerm_struct{ |

36 | double a0; |

37 | double t0; |

38 | } IdealPowTerm; |

39 | |

40 | /* |

41 | When cp0(T) values are not provided, eg in Tillner-Roth (ammonia.c) we |

42 | are given the terms of the ideal component of the Helmholtz function. |

43 | This macro converts power terms from the Helmholtz function back into |

44 | terms for the cp0 function. The Helmholtz terms are assumed to be |

45 | of the form |

46 | |

47 | A0_I * tau^P |

48 | |

49 | and this converts to terms of the form |

50 | |

51 | C_I * tau^P |

52 | |

53 | however, we need terms of the form |

54 | |

55 | c_i * T^P |

56 | |

57 | so we need to convert |

58 | |

59 | c_i = C_i * Tstar^P |

60 | */ |

61 | #define IDEALPOWTERM_FROM_HELM0(A0_I, P) {(A0_I)*(P)*(1-(P)), -(P)} |

62 | |

63 | |

64 | /* |

65 | Terms containing exponential expressions with tau, like |

66 | |

67 | b x^2 exp(-x) / [1-exp(-x)]^2 |

68 | |

69 | where x = beta / T. Instead of representing in terms of beta, we ask the |

70 | user to provide (b,beta) in the form of |

71 | |

72 | b,beta |

73 | |

74 | We also need to know T* where tau = T* / T, the normalisation temperature |

75 | used to calculate tau in the main 'residual' correlation. |

76 | |

77 | See J R Cooper 'Representation of the Ideal-Gas Thermaldynamic |

78 | Properties of Water', Int J Thermophys v 3 no 1, 1982 and also |

79 | Span, Lemmon, Jacobsen & Wagner 'A Reference Quality Equation of State |

80 | for Nitrogen' 1998. |

81 | |

82 | From the above expression, the term appearing in the reduced |

83 | Helmholtz function equation becomes |

84 | |

85 | b_i ln [ 1 - exp( -beta*tau/Tstar ) ] |

86 | |

87 | As well as this term, there is a constant term and a term linear in tau |

88 | that we can ignore because the values of those constants can be determined |

89 | from fixing the value of h0 and s0. |

90 | |

91 | */ |

92 | typedef struct IdealExpTerm_struct{ |

93 | double b; |

94 | double beta; |

95 | } IdealExpTerm; |

96 | |

97 | typedef struct IdealData_struct{ |

98 | double c; |

99 | double m; |

100 | double Tstar; /* normalisation temperature used in residual correlation */ |

101 | double cp0star; /* reducing parameter used for cp0 */ |

102 | unsigned np; /* number of power terms */ |

103 | const IdealPowTerm *pt; /* power term data, may be NULL if np == 0 */ |

104 | unsigned ne; /* number of 'exponential' terms */ |

105 | const IdealExpTerm *et; /* exponential term data, maybe NULL if ne == 0 */ |

106 | } IdealData; |

107 | |

108 | #endif |

109 |

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

Powered by ViewVC 1.1.22 |