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 |
|
20 |
#ifndef FPROPS_HELMHOLTZ_H |
21 |
#define FPROPS_HELMHOLTZ_H |
22 |
|
23 |
#include "ideal.h" |
24 |
|
25 |
/** |
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 |
typedef struct HelmholtzPowTerm_struct{ |
31 |
double a; /* coefficient */ |
32 |
double t; /* exponent of tau */ |
33 |
int d; /* exponent of delta */ |
34 |
unsigned l; /* exponent X in exp(-del^X) */ |
35 |
} HelmholtzPowTerm; |
36 |
|
37 |
/* |
38 |
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 |
|
44 |
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 |
|
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 |
*/ |
56 |
typedef struct HelmholtzGausTerm_struct{ |
57 |
double n; /**< coefficient */ |
58 |
double t; /**< power of tau */ |
59 |
double d; /**< power of delta */ |
60 |
double alpha,beta,gamma,epsilon; |
61 |
} HelmholtzGausTerm; |
62 |
|
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 |
typedef struct HelmholtzCritTerm_struct{ |
71 |
double n; /**< coefficient */ |
72 |
double a,b,beta,A,B,C,D; |
73 |
} HelmholtzCritTerm; |
74 |
|
75 |
/** |
76 |
Data structure for fluid-specific data for the Helmholtz free energy EOS. |
77 |
See Tillner-Roth 1993 for information about 'atd' and 'a0' data. |
78 |
*/ |
79 |
typedef struct HelmholtzData_struct{ |
80 |
double R; /**< specific gas constant */ |
81 |
double M; /**< molar mass, kg/kmol */ |
82 |
double rho_star; /**< normalisation density, kg/m�� */ |
83 |
double T_star; /* normalisation temperature, K */ |
84 |
|
85 |
const IdealData *ideal; /* data for ideal component of Helmholtz energy */ |
86 |
|
87 |
unsigned np; /* number of power terms in residual equation */ |
88 |
const HelmholtzPowTerm *pt; /* power term data for residual eqn, maybe NULL if np == 0 */ |
89 |
unsigned ng; /* number of critical terms of the first kind */ |
90 |
const HelmholtzGausTerm *gt; /* critical terms of the first kind */ |
91 |
unsigned nc; /* number of critical terms of the second kind */ |
92 |
const HelmholtzCritTerm *ct; /* critical terms of the second kind */ |
93 |
} HelmholtzData; |
94 |
|
95 |
double helmholtz_p(double T, double rho, const HelmholtzData *data); |
96 |
double helmholtz_u(double T, double rho, const HelmholtzData *data); |
97 |
double helmholtz_h(double T, double rho, const HelmholtzData *data); |
98 |
double helmholtz_s(double T, double rho, const HelmholtzData *data); |
99 |
double helmholtz_a(double T, double rho, const HelmholtzData *data); |
100 |
double helmholtz_cv(double T, double rho, const HelmholtzData *data); |
101 |
double helmholtz_cp(double T, double rho, const HelmholtzData *data); |
102 |
double helmholtz_w(double T, double rho, const HelmholtzData *data); |
103 |
|
104 |
double helmholtz_cp0(double T, const HelmholtzData *data); |
105 |
|
106 |
double helmholtz_dpdT_rho(double T, double rho, const HelmholtzData *data); |
107 |
double helmholtz_dpdrho_T(double T, double rho, const HelmholtzData *data); |
108 |
|
109 |
double helmholtz_dhdT_rho(double T, double rho, const HelmholtzData *data); |
110 |
double helmholtz_dhdrho_T(double T, double rho, const HelmholtzData *data); |
111 |
|
112 |
double helmholtz_dudT_rho(double T, double rho, const HelmholtzData *data); |
113 |
double helmholtz_dudrho_T(double T, double rho, const HelmholtzData *data); |
114 |
|
115 |
#endif |
116 |
|