/[ascend]/trunk/models/johnpye/fprops/helmholtz.h
ViewVC logotype

Contents of /trunk/models/johnpye/fprops/helmholtz.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1996 - (show 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)
Added acentric factor to HelmholtzData.
Working on adding calculation of saturation curve using Maxwell phase-equilibrium condition (per IAPWS95).
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 double omega; /**< Pitzer acentric factor */
86
87 const IdealData *ideal; /* data for ideal component of Helmholtz energy */
88
89 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 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 } HelmholtzData;
96
97 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 double helmholtz_s(double T, double rho, const HelmholtzData *data);
101 double helmholtz_a(double T, double rho, const HelmholtzData *data);
102 double helmholtz_cv(double T, double rho, const HelmholtzData *data);
103 double helmholtz_cp(double T, double rho, const HelmholtzData *data);
104 double helmholtz_w(double T, double rho, const HelmholtzData *data);
105
106 int helmholtz_sat_t(double T, double *p, double *rho_f, double *rho_g, const HelmholtzData *data);
107
108 double helmholtz_cp0(double T, const HelmholtzData *data);
109
110 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 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 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 #endif
120

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