/[ascend]/trunk/models/johnpye/fprops/fluids/methane.c
ViewVC logotype

Contents of /trunk/models/johnpye/fprops/fluids/methane.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2298 - (show annotations) (download) (as text)
Fri Aug 20 05:50:25 2010 UTC (9 years, 10 months ago) by jpye
File MIME type: text/x-csrc
File size: 9125 byte(s)
moving fluids to subdirectory.
1 /* This file is created by Hongke Zhu, 01-21-2010.
2 Chemical & Materials Engineering Department,
3 University of Alabama in Huntsville, United States.
4
5 LITERATURE REFERENCE
6 Setzmann, U. and Wagner, W.,
7 "A New Equation of State and Tables of Thermodynamic Properties for Methane Covering the Range from the Melting Line to 625 K at Pressures up to 1000 MPa"
8 J. Phys. Chem. Ref. Data, 20(6):1061-1151, 1991.
9 */
10
11 #include "helmholtz.h"
12
13 #define METHANE_M 16.0428 /* kg/kmol */
14 #define METHANE_R 518.2705 /* J/kg/K */
15 #define METHANE_TSTAR 190.564 /* K */
16
17 const IdealData ideal_data_methane = {
18 9.91243972/METHANE_R /* constant, adjust to solver s */
19 , -6.33270087/METHANE_TSTAR/METHANE_R /* linear, adjust to solver h */
20 , METHANE_TSTAR /* Tstar */
21 , METHANE_R /* cp0star */
22 , 1 /* power terms */
23 , (const IdealPowTerm[]){
24 {1.0+3.0016, 0.0}
25 }
26 , 5 /* exponential terms */
27 , (const IdealExpTerm[]){
28 /* a_i, theta_i*METHANE_TSTAR */
29 {0.008449, 3.40043240*METHANE_TSTAR}
30 ,{4.6942, 10.26951575*METHANE_TSTAR}
31 ,{3.4865, 20.43932747*METHANE_TSTAR}
32 ,{1.6572, 29.93744884*METHANE_TSTAR}
33 ,{1.4115, 79.13351945*METHANE_TSTAR}
34 }
35 };
36
37
38 const HelmholtzData helmholtz_data_methane = {
39 "methane"
40 , /* R */ METHANE_R /* J/kg/K */
41 , /* M */ METHANE_M /* kg/kmol */
42 , /* rho_star */ 162.66 /* kg/m3(= rho_c for this model) */
43 , /* T_star */ METHANE_TSTAR /* K (= T_c for this model) */
44
45 , /* T_c */ METHANE_TSTAR
46 //REMOVED , /* p_c */ 4.599200001121e+06 /* calculated from T_c, rho_c */
47 , /* rho_c */ 162.66 /* kg/m3 */
48 , /* T_t */ 90.6941
49
50 , 0.01142 /* acentric factor */
51 , &ideal_data_methane
52 , 36 /* power terms */
53 , (const HelmholtzPowTerm[]){
54 /* n_i, t_i, d_i, c_i */
55 {0.4367901028e-01, -0.5, 1.0, 0.0}
56 , {0.6709236199e+00, 0.5, 1.0, 0.0}
57 , {-0.1765577859e+01, 1.0, 1.0, 0.0}
58 , {0.8582330241e+00, 0.5, 2.0, 0.0}
59 , {-0.1206513052e+01, 1.0, 2.0, 0.0}
60 , {0.5120467220e+00, 1.5, 2.0, 0.0}
61 , {-0.4000010791e-03, 4.5, 2.0, 0.0}
62 , {-0.1247842423e-01, 0.0, 3.0, 0.0}
63 , {0.3100269701e-01, 1.0, 4.0, 0.0}
64 , {0.1754748522e-02, 3.0, 4.0, 0.0}
65 , {-0.3171921605e-05, 1.0, 8.0, 0.0}
66 , {-0.2240346840e-05, 3.0, 9.0, 0.0}
67 , {0.2947056156e-06, 3.0, 10.0, 0.0}
68 , {0.1830487909e+00, 0.0, 1.0, 1.0}
69 , {0.1511883679e+00, 1.0, 1.0, 1.0}
70 , {-0.4289363877e+00, 2.0, 1.0, 1.0}
71 , {0.6894002446e-01, 0.0, 2.0, 1.0}
72 , {-0.1408313996e-01, 0.0, 4.0, 1.0}
73 , {-0.3063054830e-01, 2.0, 5.0, 1.0}
74 , {-0.2969906708e-01, 2.0, 6.0, 1.0}
75 , {-0.1932040831e-01, 5.0, 1.0, 2.0}
76 , {-0.1105739959e+00, 5.0, 2.0, 2.0}
77 , {0.9952548995e-01, 5.0, 3.0, 2.0}
78 , {0.8548437825e-02, 2.0, 4.0, 2.0}
79 , {-0.6150555662e-01, 4.0, 4.0, 2.0}
80 , {-0.4291792423e-01, 12.0, 3.0, 3.0}
81 , {-0.1813207290e-01, 8.0, 5.0, 3.0}
82 , {0.3445904760e-01, 10.0, 5.0, 3.0}
83 , {-0.2385919450e-02, 10.0, 8.0, 3.0}
84 , {-0.1159094939e-01, 10.0, 2.0, 4.0}
85 , {0.6641693602e-01, 14.0, 3.0, 4.0}
86 , {-0.2371549590e-01, 12.0, 4.0, 4.0}
87 , {-0.3961624905e-01, 18.0, 4.0, 4.0}
88 , {-0.1387292044e-01, 22.0, 4.0, 4.0}
89 , {0.3389489599e-01, 18.0, 5.0, 4.0}
90 , {-0.2927378753e-02, 14.0, 6.0, 4.0}
91 }
92 , 4 /* gaussian terms */
93 , (const HelmholtzGausTerm[]){
94 /* n_i, t_i, d_i, alpha_i,beta_i, gamma_i,delta_i */
95 {0.9324799946e-04, 2.0, 2.0, 20.0, 200.0, 1.07, 1.0}
96 , {-0.6287171518e+01, 0.0, 0.0, 40.0, 250.0, 1.11, 1.0}
97 , {0.1271069467e+02, 1.0, 0.0, 40.0, 250.0, 1.11, 1.0}
98 , {-0.6423953466e+01, 2.0, 0.0, 40.0, 250.0, 1.11, 1.0}
99 }
100 , 0 /* critical terms */
101 , 0
102 };
103
104 /*
105 Test suite. These tests attempt to validate the current code using a few sample figures output by REFPROP 8.0. To compile and run the test:
106
107 ./test.py methane
108 */
109
110 #ifdef TEST
111
112 #include "test.h"
113 #include <math.h>
114 #include <assert.h>
115 #include <stdio.h>
116
117 const TestData td[]; const unsigned ntd;
118
119 int main(void){
120 //return helm_check_u(&helmholtz_data_methane, ntd, td);
121 //return helm_check_dpdT_rho(&helmholtz_data_methane, ntd, td);
122 //return helm_check_dpdrho_T(&helmholtz_data_methane, ntd, td);
123 //return helm_check_dhdT_rho(&helmholtz_data_methane, ntd, td);
124 //return helm_check_dhdrho_T(&helmholtz_data_methane, ntd, td);
125 //return helm_check_dudT_rho(&helmholtz_data_methane, ntd, td);
126 //return helm_check_dudrho_T(&helmholtz_data_methane, ntd, td);
127 return helm_run_test_cases(&helmholtz_data_methane, ntd, td, 'C');
128 }
129
130 /*
131 A small set of data points calculated using REFPROP 8.0, for validation.
132 */
133
134 const TestData td[] = {
135 /* Temperature, Pressure, Density, Int. Energy, Enthalpy, Entropy, Cv, Cp, Cp0, Helmholtz */
136 /* (C), (MPa), (kg/m3), (kJ/kg), (kJ/kg), (kJ/kg-K), (kJ/kg-K), (kJ/kg-K), (kJ/kg-K), (kJ/kg) */
137 {-1.50E+2, 1.E-1, 1.60910752393E+0, 1.88364055292E+2, 2.5051030625E+2, 3.24646755336E+0, 1.58884794372E+0, 2.16355884259E+0, 2.07462358981E+0, -2.11438423904E+2}
138 , {-1.00E+2, 1.E-1, 1.12521671374E+0, 2.67839918727E+2, 3.56711687853E+2, 3.97077451396E+0, 1.56760298171E+0, 2.10524006211E+0, 2.07927247937E+0, -4.19699688365E+2}
139 , {-5.0E+1, 1.E-1, 8.68595496757E-1, 3.46951949093E+2, 4.62080337823E+2, 4.50532116069E+0, 1.58955130015E+0, 2.11765773399E+0, 2.10526664417E+0, -6.58410467916E+2}
140 , {0.E+0, 1.E-1, 7.08054601969E-1, 4.28094814898E+2, 5.69326860734E+2, 4.93876236812E+0, 1.65673274385E+0, 2.18091843032E+0, 2.17369026726E+0, -9.20928125954E+2}
141 , {5.0E+1, 1.E-1, 5.97850888069E-1, 5.13733962599E+2, 6.80999750767E+2, 5.31393189465E+0, 1.77123051413E+0, 2.29342553149E+0, 2.28871715089E+0, -1.20346312916E+3}
142 , {1.00E+2, 1.E-1, 5.1743290452E-1, 6.0603094633E+2, 7.99292718294E+2, 5.65403504747E+0, 1.92221624392E+0, 2.4432670487E+0, 2.43997440441E+0, -1.50377223163E+3}
143 , {-1.50E+2, 1.E+0, 4.0592786683E+2, -2.46295912662E+2, -2.43832420791E+2, -1.21277154163E+0, 2.00863377638E+0, 3.56590824165E+0, 2.07462358981E+0, -9.69430973104E+1}
144 , {-1.00E+2, 1.E+0, 1.24454026784E+1, 2.51262002085E+2, 3.31612957843E+2, 2.67928006416E+0, 1.64282624007E+0, 2.43144160672E+0, 2.07927247937E+0, -2.12655341024E+2}
145 , {-5.0E+1, 1.E+0, 9.06583177383E+0, 3.36753639112E+2, 4.47057913992E+2, 3.26598021589E+0, 1.6142747055E+0, 2.2439867556E+0, 2.10526664417E+0, -3.92049846064E+2}
146 , {0.E+0, 1.E+0, 7.2343327383E+0, 4.20727936078E+2, 5.58957685272E+2, 3.71843003227E+0, 1.66876403068E+0, 2.24972154513E+0, 2.17369026726E+0, -5.94961227237E+2}
147 , {5.0E+1, 1.E+0, 6.04704199259E+0, 5.07996246965E+2, 6.73366357049E+2, 4.10285606313E+0, 1.77828170834E+0, 2.33696019443E+0, 2.28871715089E+0, -8.17841689837E+2}
148 , {1.00E+2, 1.E+0, 5.20529618691E+0, 6.01354770224E+2, 7.93466796917E+2, 4.44818303594E+0, 1.92679526571E+0, 2.47327641725E+0, 2.43997440441E+0, -1.05848472964E+3}
149 , {-1.50E+2, 1.0E+1, 4.15477805411E+2, -2.5562006946E+2, -2.31551395106E+2, -1.29093085731E+0, 2.03355146179E+0, 3.44037384878E+0, 2.07462358981E+0, -9.66419343826E+1}
150 , {-1.00E+2, 1.0E+1, 3.34077241304E+2, -7.83896167065E+1, -4.84564193388E+1, -4.84543082555E-2, 1.88185883352E+0, 4.03192499701E+0, 2.07927247937E+0, -6.99997532321E+1}
151 , {-5.0E+1, 1.0E+1, 1.75209369E+2, 1.61075648239E+2, 2.18150221688E+2, 1.28698717592E+0, 1.89825927321E+0, 6.54278905296E+0, 2.10526664417E+0, -1.26115540068E+2}
152 , {0.E+0, 1.E+1, 9.00401815008E+1, 3.33721112905E+2, 4.44782639362E+2, 2.21433546784E+0, 1.7930372756E+0, 3.37028617226E+0, 2.17369026726E+0, -2.71124620137E+2}
153 , {5.0E+1, 1.0E+1, 6.65959096336E+1, 4.47146008139E+2, 5.97305380614E+2, 2.72824946532E+0, 1.84399847426E+0, 2.86499528554E+0, 2.28871715089E+0, -4.3448780658E+2}
154 , {1.00E+2, 1.0E+1, 5.43472420351E+1, 5.53936360581E+2, 7.37938337968E+2, 3.13300626553E+0, 1.96828172594E+0, 2.7946270492E+0, 2.43997440441E+0, -6.15144927403E+2}
155 , {-1.50E+2, 1.00E+2, 4.69113782774E+2, -3.0029614084E+2, -8.71282407018E+1, -1.75873991373E+0, 2.20503626373E+0, 3.13171649722E+0, 2.07462358981E+0, -8.37073204647E+1}
156 , {-1.00E+2, 1.00E+2, 4.29276748104E+2, -1.65401694257E+2, 6.75482627157E+1, -7.03866977083E-1, 2.05299273006E+0, 3.05631366144E+0, 2.07927247937E+0, -4.35271271748E+1}
157 , {-5.0E+1, 1.00E+2, 3.92213850456E+2, -3.60458221088E+1, 2.18917127016E+2, 6.44158444434E-2, 1.96845228396E+0, 3.00469029452E+0, 2.10526664417E+0, -5.04202177963E+1}
158 , {0.E+0, 1.00E+2, 3.58117509334E+2, 8.95023780059E+1, 3.68740330336E+2, 6.70262780527E-1, 1.95953351072E+0, 2.99585700068E+0, 2.17369026726E+0, -9.3579900495E+1}
159 , {5.0E+1, 1.00E+2, 3.27343116049E+2, 2.13744306819E+2, 5.1923415859E+2, 1.17612793118E+0, 2.01810349513E+0, 3.03060248389E+0, 2.28871715089E+0, -1.66321434142E+2}
160 , {1.00E+2, 1.00E+2, 3.00073853133E+2, 3.39137289979E+2, 6.72388584471E+2, 1.61667497698E+0, 2.12645626915E+0, 3.10060090144E+0, 2.43997440441E+0, -2.64124977683E+2}
161 };
162
163 const unsigned ntd = sizeof(td)/sizeof(TestData);
164
165 #endif

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