/[ascend]/branches/relerrorlist/models/johnpye/fprops/ideal.h
ViewVC logotype

Annotation of /branches/relerrorlist/models/johnpye/fprops/ideal.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2106 - (hide annotations) (download) (as text)
Thu Dec 3 08:29:21 2009 UTC (9 years, 4 months ago) by jpye
Original Path: trunk/models/johnpye/fprops/ideal.h
File MIME type: text/x-chdr
File size: 3866 byte(s)
Starting on CO2 properties from paper by Span and Wagner.
1 jpye 1849 /* 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 jpye 1847 #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 jpye 1865 Terms in the expression for cp0 that are power terms, of the form:
32 jpye 1847
33 jpye 1904 c * T^t
34 jpye 1847 */
35     typedef struct IdealPowTerm_struct{
36 jpye 1865 double c;
37     double t;
38 jpye 1847 } IdealPowTerm;
39    
40     /*
41 jpye 1850 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 jpye 1855
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 jpye 1850 */
61 jpye 1855 #define IDEALPOWTERM_FROM_HELM0(A0_I, P) {(A0_I)*(P)*(1-(P)), -(P)}
62 jpye 1850
63    
64     /*
65 jpye 1849 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 jpye 1850 b,beta
73 jpye 1849
74 jpye 1850 We also need to know T* where tau = T* / T, the normalisation temperature
75     used to calculate tau in the main 'residual' correlation.
76 jpye 1849
77 jpye 1847 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 jpye 1849 From the above expression, the term appearing in the reduced
83     Helmholtz function equation becomes
84 jpye 1847
85 jpye 1850 b_i ln [ 1 - exp( -beta*tau/Tstar ) ]
86 jpye 1847
87 jpye 1850 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 jpye 1849
91 jpye 1847 */
92     typedef struct IdealExpTerm_struct{
93     double b;
94 jpye 1850 double beta;
95 jpye 1847 } IdealExpTerm;
96    
97     typedef struct IdealData_struct{
98 jpye 1849 double c;
99     double m;
100 jpye 1850 double Tstar; /* normalisation temperature used in residual correlation */
101 jpye 2106 double cp0star; /* reducing parameter used for cp0, usually equals R */
102 jpye 1847 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 jpye 1877 /*-----------------------------------*/
109     typedef struct IdealPhi0PowTerm_struct{
110     double a0; /* coefficient */
111     double t0; /* power of tau */
112     } IdealPhi0PowTerm;
113    
114     typedef struct IdealPhi0ExpTerm_struct{
115     /* yet to be implemented */
116     } IdealPhi0ExpTerm;
117    
118    
119     /*
120     This data structure is used for the 'precalc' mechanism, which precalculates
121     cp0 data for those correlations where parameters are given in the form
122     of phi0 values.
123     */
124     typedef struct IdealPhi0Data_struct{
125     double T_star;
126     unsigned np;
127     const IdealPhi0PowTerm *pt;
128     unsigned ne;
129     const IdealPhi0ExpTerm *et;
130     } IdealPhi0Data;
131    
132    
133 jpye 1847 #endif
134    

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