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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2114 - (hide annotations) (download) (as text)
Tue Dec 8 08:08:00 2009 UTC (10 years, 8 months ago) by jpye
File MIME type: text/x-chdr
File size: 5013 byte(s)
Starting some more work on saturation curves.
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 jpye 2107 C code. Firstly, terms of the type:
29    
30     a * tau^t * delta^d
31 jpye 1822 */
32 jpye 1838 typedef struct HelmholtzPowTerm_struct{
33 jpye 1822 double a; /* coefficient */
34     double t; /* exponent of tau */
35 jpye 1826 int d; /* exponent of delta */
36 jpye 1832 unsigned l; /* exponent X in exp(-del^X) */
37 jpye 1838 } HelmholtzPowTerm;
38 jpye 1822
39 jpye 1885 /*
40 jpye 1887 Data structure for Gaussian terms in the residual expression, for
41     improvement of correlation in the critical region. These terms are of the
42     form as utilised in the correlations for water (see water.c) and hydrogen
43     (see hydrogen.c). According to Leachman, these terms are due to Setzmann
44     and Wagner (J Phys Chem Ref Data, 1966).
45 jpye 1885
46 jpye 1887 Using the nomenclature of IAPWS-95 (see water.c), terms here for the reduced
47     helmholtz energy are:
48    
49     n * del^d * tau^t * exp[-alpha*(delta-epsilon)^2 - beta*(tau-gamma)^2]
50    
51     NOTE the minus signs preceeding 'alpha' and 'beta' and note that this is
52     in conflict with the sign convention of Leachman, who assumes a plus sign
53     in front of the corresponding parameters in his equation.
54 jpye 1904
55     NOTE these terms are also used in Span et al, 1998, as cited in the file
56     'nitrogen.c', but in that case, epsilon == 1 for all terms.
57 jpye 1885 */
58 jpye 1887 typedef struct HelmholtzGausTerm_struct{
59 jpye 1885 double n; /**< coefficient */
60     double t; /**< power of tau */
61     double d; /**< power of delta */
62     double alpha,beta,gamma,epsilon;
63 jpye 1887 } HelmholtzGausTerm;
64 jpye 1885
65     /*
66     Data structure for 'critical terms' in the residual expression. These
67     terms are of the form described in the IAPWS-95 document, as cited in
68     the file 'water.c'.
69    
70 jpye 2107 This structure is for terms are of the form:
71    
72     n *& DELTA^b * delta * exp(-C (delta-1)^2 - D (tau-1)^2)
73    
74     where DELTA = {(1-tau) + A*[(delta-1)^2]^(1/(2*beta)^}^2 + B[(delta-1)^2]^a
75 jpye 1885 */
76 jpye 1887 typedef struct HelmholtzCritTerm_struct{
77 jpye 1885 double n; /**< coefficient */
78     double a,b,beta,A,B,C,D;
79 jpye 1887 } HelmholtzCritTerm;
80 jpye 1885
81 jpye 1838 /**
82 jpye 1822 Data structure for fluid-specific data for the Helmholtz free energy EOS.
83 jpye 1832 See Tillner-Roth 1993 for information about 'atd' and 'a0' data.
84 jpye 1822 */
85     typedef struct HelmholtzData_struct{
86 jpye 1832 double R; /**< specific gas constant */
87     double M; /**< molar mass, kg/kmol */
88     double rho_star; /**< normalisation density, kg/m�� */
89 jpye 1996 double T_star; /**< normalisation temperature, K */
90    
91 jpye 2114 double T_c; /**< critical temperature */
92     double p_c; /**< critical pressure */
93     double rho_c; /**< critical density */
94    
95 jpye 1996 double omega; /**< Pitzer acentric factor */
96 jpye 1822
97 jpye 1835 const IdealData *ideal; /* data for ideal component of Helmholtz energy */
98 jpye 1822
99 jpye 1838 unsigned np; /* number of power terms in residual equation */
100     const HelmholtzPowTerm *pt; /* power term data for residual eqn, maybe NULL if np == 0 */
101 jpye 1887 unsigned ng; /* number of critical terms of the first kind */
102     const HelmholtzGausTerm *gt; /* critical terms of the first kind */
103     unsigned nc; /* number of critical terms of the second kind */
104     const HelmholtzCritTerm *ct; /* critical terms of the second kind */
105 jpye 1822 } HelmholtzData;
106    
107 jpye 1826 double helmholtz_p(double T, double rho, const HelmholtzData *data);
108     double helmholtz_u(double T, double rho, const HelmholtzData *data);
109     double helmholtz_h(double T, double rho, const HelmholtzData *data);
110 jpye 1829 double helmholtz_s(double T, double rho, const HelmholtzData *data);
111 jpye 1863 double helmholtz_a(double T, double rho, const HelmholtzData *data);
112 jpye 1988 double helmholtz_cv(double T, double rho, const HelmholtzData *data);
113 jpye 1989 double helmholtz_cp(double T, double rho, const HelmholtzData *data);
114     double helmholtz_w(double T, double rho, const HelmholtzData *data);
115 jpye 1988
116 jpye 1996 int helmholtz_sat_t(double T, double *p, double *rho_f, double *rho_g, const HelmholtzData *data);
117    
118 jpye 1850 double helmholtz_cp0(double T, const HelmholtzData *data);
119 jpye 1825
120 jpye 1905 double helmholtz_dpdT_rho(double T, double rho, const HelmholtzData *data);
121     double helmholtz_dpdrho_T(double T, double rho, const HelmholtzData *data);
122    
123 jpye 1915 double helmholtz_dhdT_rho(double T, double rho, const HelmholtzData *data);
124     double helmholtz_dhdrho_T(double T, double rho, const HelmholtzData *data);
125    
126 jpye 1920 double helmholtz_dudT_rho(double T, double rho, const HelmholtzData *data);
127     double helmholtz_dudrho_T(double T, double rho, const HelmholtzData *data);
128    
129 jpye 1832 #endif
130    

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