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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2147 - (show annotations) (download) (as text)
Fri Jan 22 04:15:50 2010 UTC (13 years, 8 months ago) by kchittur
File MIME type: text/x-csrc
File size: 8174 byte(s)


1 /* This file is created by Hongke Zhu, 01-21-2010.
2 Chemical & Materials Engineering Department,
3 University of Alabama in Huntsville.
4 */
5 #include "methane.h"
6
7 #define METHANE_M 16.0428 /* kg/kmol */
8 #define METHANE_R (8314.51/ METHANE_M) /* J/kg/K */
9 #define METHANE_TSTAR 190.564 /* K */
10
11 /*
12 It is understood that this is the same correlation as implemented by REFPROP version 8.0.
13 */
14
15 const IdealData ideal_data_methane = {
16 9.91243972 /* constant term*/
17 , -6.33270087 /* linear term*/
18 , METHANE_TSTAR /* Tstar */
19 , METHANE_R /* cp0star */
20 , 1 /* power terms */
21 , (const IdealPowTerm[]){
22 {3.0016, 0.0}
23 }
24 , 5 /* exponential terms */
25 , (const IdealExpTerm[]){
26 {0.008449, 3.40043240}
27 ,{4.6942, 10.26951575}
28 ,{3.4865, 20.43932747}
29 ,{1.6572, 29.93744884}
30 ,{1.4115, 79.13351945}
31 }
32 };
33
34 /*
35 It is understood that this is the same correlation as implemented by REFPROP version 8.0.
36 */
37
38 const HelmholtzData helmholtz_data_methane = {
39 /* R */ METHANE_R /* J/kg/K */
40 , /* M */ METHANE_M /* kg/kmol */
41 , /* rho_star */ 162.66 /* kg/m3(= rho_c for this model) */
42 , /* T_star */ METHANE_TSTAR /* K (= T_c for this model) */
43 , /* T_c */ METHANE_TSTAR
44 , /* p_c */ 4.5922 /* MPa */ /* why set p_c to 0 in the example code?*/
45 , /* rho_c */ 162.66 /* kg/m3 */
46 , /* p_t */ 0.011696 /* MPa */ /* why set p_t to 0 in the example code?*/
47 , 0.011 /* acentric factor, from Reid, Prausnitz & Polling */
48 , &ideal_data_methane
49 , 36 /* power terms */
50 , (const HelmholtzPowTerm[]){
51 /* a_i, t_i, d_i, l_i */
52 {0.4367901028e-01, -0.5, 1.0, 0.0}
53 , {0.6709236199, 0.5, 1.0, 0.0}
54 , {-0.1765577859e+01, 1.0, 1.0, 0.0}
55 , {0.8582330241, 0.5, 2.0, 0.0}
56 , {-0.1206513052e+01, 1.0, 2.0, 0.0}
57 , {0.5120467220, 1.5, 2.0, 0.0}
58 , {-0.4000010791e-03, 4.5, 2.0, 0.0}
59 , {-0.1247842423e-01, 0.0, 3.0, 0.0}
60 , {0.3100269701e-01, 1.0, 4.0, 0.0}
61 , {0.1754748522e-02, 3.0, 4.0, 0.0}
62 , {-0.3171921605e-05, 1.0, 8.0, 0.0}
63 , {-0.2240346840e-05, 3.0, 9.0, 0.0}
64 , {0.2947056156e-06, 3.0, 10.0, 0.0}
65 , {0.1830487909, 0.0, 1.0, 1.0}
66 , {0.1511883679, 1.0, 1.0, 1.0}
67 , {-0.4289363877, 2.0, 1.0, 1.0}
68 , {0.6894002446e-01, 0.0, 2.0, 1.0}
69 , {-0.1408313996e-01, 0.0, 4.0, 1.0}
70 , {-0.3063054830e-01, 2.0, 5.0, 1.0}
71 , {-0.2969906708e-01, 2.0, 6.0, 1.0}
72 , {-0.1932040831e-01, 5.0, 1.0, 2.0}
73 , {-0.1105739959, 5.0, 2.0, 2.0}
74 , {0.9952548995e-01, 5.0, 3.0, 2.0}
75 , {0.8548437825e-02, 2.0, 4.0, 2.0}
76 , {-0.6150555662e-01, 4.0, 4.0, 2.0}
77 , {-0.4291792423e-01, 12.0, 3.0, 3.0}
78 , {-0.1813207290e-01, 8.0, 5.0, 3.0}
79 , {0.3445904760e-01, 10.0, 5.0, 3.0}
80 , {-0.2385919450e-02, 10.0, 8.0, 3.0}
81 , {-0.1159094939e-01, 10.0, 2.0, 4.0}
82 , {0.6641693602e-01, 14.0, 3.0, 4.0}
83 , {-0.2371549590e-01, 12.0, 4.0, 4.0}
84 , {-0.3961624905e-01, 18.0, 4.0, 4.0}
85 , {-0.1387292044e-01, 22.0, 4.0, 4.0}
86 , {0.3389489599e-01, 18.0, 5.0, 4.0}
87 , {-0.2927378753e-02, 14.0, 6.0, 4.0}
88 }
89 , 4 /* gaussian terms */
90 , (const HelmholtzGausTerm[]){
91 /* a, t, d, alpha, beta, gamma, epsilon */
92 {0.9324799946e-04, 2.0, 2.0, 20.0, 200.0, 1.07, 1.0}
93 , {-0.6287171518e+01, 0.0, 0.0, 40.0, 250.0, 1.11, 1.0}
94 , {0.1271069467e+02, 1.0, 0.0, 40.0, 250.0, 1.11, 1.0}
95 , {-0.6423953466e+01, 2.0, 0.0, 40.0, 250.0, 1.11, 1.0}
96 }
97 , 0 /* critical terms */
98 , 0
99 };
100
101 /*
102 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:
103
104 ./test.py methane
105 */
106
107 #ifdef TEST
108
109 #include "test.h"
110 #include <math.h>
111 #include <assert.h>
112 #include <stdio.h>
113
114 const TestData td[]; const unsigned ntd;
115
116 int main(void){
117 //return helm_check_u(&helmholtz_data_methane, ntd, td);
118 //return helm_check_dpdT_rho(&helmholtz_data_methane, ntd, td);
119 //return helm_check_dpdrho_T(&helmholtz_data_methane, ntd, td);
120 //return helm_check_dhdT_rho(&helmholtz_data_methane, ntd, td);
121 //return helm_check_dhdrho_T(&helmholtz_data_methane, ntd, td);
122 //return helm_check_dudT_rho(&helmholtz_data_methane, ntd, td);
123 //return helm_check_dudrho_T(&helmholtz_data_methane, ntd, td);
124 return helm_run_test_cases(&helmholtz_data_methane, ntd, td, 'C');
125 }
126
127 /*
128 A small set of data points calculated using REFPROP 8.0, for validation.
129 Maybe some data go inside the saturated region, which are not right.
130 */
131
132 const TestData td[] = {
133 /* Temperature, Pressure, Density, Int. Energy, Enthalpy, Entropy, Cv, Cp, Cp0, Helmholtz */
134 /* (C), (MPa), (kg/m3), (kJ/kg), (kJ/kg), (kJ/kg-K), (kJ/kg-K), (kJ/kg-K), (kJ/kg-K), (kJ/kg) */
135 {-100.0, 0.1, 1.1252, 553.35, 642.22, 5.5202, 1.5676, 2.1052, 2.0793, -402.48}
136 , {-50.0, 0.1, 0.8686, 632.46, 747.59, 6.0548, 1.5896, 2.1177, 2.1053, -718.67}
137 , {0.0, 0.1, 0.70805, 713.6, 854.83, 6.4882, 1.6567, 2.1809, 2.1737, -1058.7}
138 , {50.0, 0.1, 0.59785, 799.24, 966.51, 6.8634, 1.7712, 2.2934, 2.2887, -1418.7}
139 , {100.0, 0.1, 0.51743, 891.54, 1084.8, 7.2035, 1.9222, 2.4433, 2.44, -1796.4}
140 , {150.0, 0.1, 0.45613, 991.98, 1211.2, 7.5212, 2.0956, 2.616, 2.6135, -2190.6}
141 , {200.0, 0.1, 0.40784, 1101.4, 1346.6, 7.8234, 2.28, 2.7999, 2.7981, -2600.2}
142 , {250.0, 0.1, 0.36881, 1220.1, 1491.3, 8.1139, 2.468, 2.9875, 2.986, -3024.7}
143 , {300.0, 0.1, 0.3366, 1348.2, 1645.3, 8.395, 2.6549, 3.1742, 3.173, -3463.4}
144 , {-100.0, 1.0, 12.445, 536.77, 617.12, 4.2287, 1.6428, 2.4314, 2.0793, -195.44}
145 , {-50.0, 1.0, 9.0658, 622.26, 732.56, 4.8154, 1.6143, 2.244, 2.1053, -452.3}
146 , {0.0, 1.0, 7.2343, 706.23, 844.46, 5.2679, 1.6688, 2.2497, 2.1737, -732.69}
147 , {50.0, 1.0, 6.047, 793.5, 958.87, 5.6523, 1.7783, 2.337, 2.2887, -1033.0}
148 , {100.0, 1.0, 5.2053, 886.86, 1079.0, 5.9976, 1.9268, 2.4733, 2.44, -1351.2}
149 , {150.0, 1.0, 4.5741, 988.05, 1206.7, 6.3186, 2.0988, 2.6378, 2.6135, -1685.7}
150 , {200.0, 1.0, 4.0819, 1098.0, 1343.0, 6.6229, 2.2823, 2.8165, 2.7981, -2035.6}
151 , {250.0, 1.0, 3.6867, 1217.2, 1488.4, 6.9149, 2.4697, 3.0005, 2.986, -2400.4}
152 , {300.0, 1.0, 3.362, 1345.6, 1643.0, 7.1971, 2.6562, 3.1846, 3.173, -2779.4}
153 , {-100.0, 10.0, 334.08, 207.12, 237.05, 1.501, 1.8819, 4.0319, 2.0793, -52.782}
154 , {-50.0, 10.0, 175.21, 446.58, 503.66, 2.8364, 1.8983, 6.5428, 2.1053, -186.37}
155 , {0.0, 10.0, 90.04, 619.23, 730.29, 3.7638, 1.793, 3.3703, 2.1737, -408.85}
156 , {50.0, 10.0, 66.596, 732.65, 882.81, 4.2777, 1.844, 2.865, 2.2887, -649.69}
157 , {100.0, 10.0, 54.347, 839.44, 1023.4, 4.6825, 1.9683, 2.7946, 2.44, -907.82}
158 , {150.0, 10.0, 46.435, 949.07, 1164.4, 5.0369, 2.1275, 2.8581, 2.6135, -1182.3}
159 , {200.0, 10.0, 40.77, 1064.9, 1310.2, 5.3624, 2.3033, 2.9782, 2.7981, -1472.3}
160 , {250.0, 10.0, 36.458, 1188.4, 1462.7, 5.6686, 2.4855, 3.1247, 2.986, -1777.2}
161 , {300.0, 10.0, 33.039, 1320.2, 1622.8, 5.9609, 2.6685, 3.2832, 3.173, -2096.3}
162 , {-100.0, 100.0, 429.28, 120.11, 353.06, 0.84559, 2.053, 3.0563, 2.0793, -26.309}
163 , {-50.0, 100.0, 392.21, 249.46, 504.42, 1.6139, 1.9685, 3.0047, 2.1053, -110.68}
164 , {0.0, 100.0, 358.12, 375.01, 654.25, 2.2197, 1.9595, 2.9959, 2.1737, -231.31}
165 , {50.0, 100.0, 327.34, 499.25, 804.74, 2.7256, 2.0181, 3.0306, 2.2887, -381.52}
166 , {100.0, 100.0, 300.07, 624.64, 957.9, 3.1661, 2.1265, 3.1006, 2.44, -556.8}
167 , {150.0, 100.0, 276.22, 753.2, 1115.2, 3.5617, 2.2664, 3.196, 2.6135, -753.93}
168 , {200.0, 100.0, 255.5, 886.4, 1277.8, 3.9247, 2.4241, 3.3089, 2.7981, -970.56}
169 , {250.0, 100.0, 237.51, 1025.3, 1446.3, 4.2632, 2.5904, 3.4334, 2.986, -1205.0}
170 , {300.0, 100.0, 221.86, 1170.5, 1621.3, 4.5824, 2.7594, 3.5653, 3.173, -1455.9}
171 };
172
173 const unsigned ntd = sizeof(td)/sizeof(TestData);
174
175 #endif
176

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