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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2300 - (show annotations) (download) (as text)
Fri Aug 20 13:50:05 2010 UTC (13 years, 10 months ago) by jpye
File MIME type: text/x-csrc
File size: 9380 byte(s)
Fixing test routine.
1 /* This file is created by Hongke Zhu, 01-27-2010.
2 Chemical & Materials Engineering Department,
3 University of Alabama in Huntsville, United States.
4
5 LITERATURE REFERENCE
6 Dillon, H.E. and Penoncello, S.G., "A Fundamental Equation for Calculation of the Thermodynamic Properties of Ethanol"
7 Int. J. Thermophys., 25(2):321-335, 2004.
8 */
9
10 #include "../helmholtz.h"
11
12 #define ETHANOL_M 46.06904 /* kg/kmol */
13 #define ETHANOL_R (8314.472/ETHANOL_M) /* J/kg/K */
14 #define ETHANOL_TSTAR 513.9 /* K */
15
16 const IdealData ideal_data_ethanol = {
17 4.321903955/ETHANOL_R /* constant, adjust to solver s */
18 , 0.493811668/ETHANOL_TSTAR/ETHANOL_R /* linear, adjust to solver h */
19 , ETHANOL_TSTAR /* Tstar */
20 , ETHANOL_R /* cp0star */
21 , 1 /* power terms */
22 , (const IdealPowTerm[]){
23 /* d_i, theta_i */
24 {6.41129104405, 0.0}
25 }
26 , 4 /* exponential terms */
27 , (const IdealExpTerm[]){
28 /* d_i, theta_i */
29 {1.95988750679, 694.0}
30 ,{7.60084166080, 1549.0}
31 ,{3.89583440622, 2911.0}
32 ,{4.23238091363, 4659.0}
33 }
34 };
35
36 const HelmholtzData helmholtz_data_ethanol = {
37 "ethanol"
38 , /* R */ ETHANOL_R /* J/kg/K */
39 , /* M */ ETHANOL_M /* kg/kmol */
40 , /* rho_star */ 5.991*ETHANOL_M /* kg/m3(= rho_c for this model) */
41 , /* T_star */ ETHANOL_TSTAR /* K (= T_c for this model) */
42
43 , /* T_c */ ETHANOL_TSTAR
44 , /* rho_c */ 5.991*ETHANOL_M /* kg/m3 */
45 , /* T_t */ 0
46
47 , 0.644 /* acentric factor */
48 , &ideal_data_ethanol
49 , 23 /* power terms */
50 , (const HelmholtzPowTerm[]){
51 /* a_i, t_i, d_i, l_i */
52 {0.114008942201E+2, -0.5, 1.0, 0.0}
53 , {-0.395227128302E+2, 0.0, 1.0, 0.0}
54 , {0.413063408370E+2, 0.5, 1.0, 0.0}
55 , {-0.188892923721E+2, 1.5, 1.0, 0.0}
56 , {0.472310314140E+1, 2.0, 1.0, 0.0}
57 , {-0.778322827052E-2, 5.0, 1.0, 0.0}
58 , {0.171707850032E+0, -0.5, 2.0, 0.0}
59 , {-0.153758307602E+1, 1.0, 2.0, 0.0}
60 , {0.142405508571E+1, 2.0, 2.0, 0.0}
61 , {0.132732097050E+0, 0.0, 3.0, 0.0}
62 , {-0.114231649761E+0, 2.5, 3.0, 0.0}
63 , {0.327686088736E-5, 6.0, 6.0, 0.0}
64 , {0.495699527725E-3, 2.0, 7.0, 0.0}
65 , {-0.701090149558E-4, 2.0, 8.0, 0.0}
66 , {-0.225019381648E-5, 4.0, 8.0, 0.0}
67 , {-0.255406026981E+0, 5.0, 1.0, 2.0}
68 , {-0.632036870646E-1, 3.0, 3.0, 2.0}
69 , {-0.314882729522E-1, 7.0, 3.0, 2.0}
70 , {0.256187828185E-1, 5.5, 6.0, 2.0}
71 , {-0.308694499382E-1, 4.0, 7.0, 2.0}
72 , {0.722046283076E-2, 1.0, 8.0, 2.0}
73 , {0.299286406225E-2, 22.0, 2.0, 4.0}
74 , {0.972795913095E-3, 23.0, 7.0, 4.0}
75 }
76 , 0 /* gaussian terms */
77 , 0
78 , 0 /* critical terms */
79 , 0
80 };
81
82 /*
83 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:
84
85 ./test.py ethanol
86 */
87
88 #ifdef TEST
89
90 #include "../test.h"
91 #include <math.h>
92 #include <assert.h>
93 #include <stdio.h>
94
95 const TestData td[]; const unsigned ntd;
96
97 int main(void){
98 //return helm_check_u(&helmholtz_data_ethanol, ntd, td);
99 //return helm_check_dpdT_rho(&helmholtz_data_ethanol, ntd, td);
100 //return helm_check_dpdrho_T(&helmholtz_data_ethanol, ntd, td);
101 //return helm_check_dhdT_rho(&helmholtz_data_ethanol, ntd, td);
102 //return helm_check_dhdrho_T(&helmholtz_data_ethanol, ntd, td);
103 //return helm_check_dudT_rho(&helmholtz_data_ethanol, ntd, td);
104 //return helm_check_dudrho_T(&helmholtz_data_ethanol, ntd, td);
105 return helm_run_test_cases(&helmholtz_data_ethanol, ntd, td, 'C');
106 }
107
108 /*
109 A small set of data points calculated using REFPROP 8.0, for validation.
110 */
111
112 const TestData td[] = {
113 /* Temperature, Pressure, Density, Int. Energy, Enthalpy, Entropy, Cv, Cp, Cp0, Helmholtz */
114 /* (C), (MPa), (kg/m3), (kJ/kg), (kJ/kg), (kJ/kg-K), (kJ/kg-K), (kJ/kg-K), (kJ/kg-K), (kJ/kg) */
115 {0.E+0, 1.E-1, 8.06168104649E+2, -5.53951568918E+2, -5.53827525311E+2, -1.14823943134E+0, 1.91103458651E+0, 2.26894825496E+0, 1.52408577929E+0, -2.40309968248E+2}
116 , {5.0E+1, 1.00000000001E-1, 7.63613383733E+2, -4.25319137328E+2, -4.25188181006E+2, -7.17200660449E-1, 2.44116220891E+0, 2.8741347313E+0, 1.67386555377E+0, -1.93555743904E+2}
117 , {1.00E+2, 1.E-1, 1.51968453727E+0, 4.84927654568E+2, 5.50730785118E+2, 2.06917416246E+0, 1.67307497692E+0, 1.88355171038E+0, 1.82656440577E+0, -2.87184684155E+2}
118 , {1.50E+2, 1.E-1, 1.32636692726E+0, 5.7276546239E+2, 6.48159380878E+2, 2.31403203603E+0, 1.81367135187E+0, 2.01183022562E+0, 1.97502069548E+0, -4.06417193657E+2}
119 , {2.00E+2, 1.E-1, 1.17981397107E+0, 6.67159484258E+2, 7.51918609385E+2, 2.54566879695E+0, 1.94722679831E+0, 2.13851663283E+0, 2.11586130934E+0, -5.37323707019E+2}
120 , {2.50E+2, 1.E-1, 1.06384395974E+0, 7.67968830853E+2, 8.61967578587E+2, 2.76666540817E+0, 2.07522926305E+0, 2.26269337372E+0, 2.24799840204E+0, -6.79412177434E+2}
121 , {3.00E+2, 1.E-1, 9.69315583586E-1, 8.74929980624E+2, 9.78095556101E+2, 2.97858443504E+0, 2.19619863941E+0, 2.38139189772E+0, 2.3714670659E+0, -8.32245688319E+2}
122 , {3.50E+2, 1.E-1, 8.90567729767E-1, 9.87710838392E+2, 1.09999876064E+3, 3.18243818394E+0, 2.3098553921E+0, 2.49363611042E+0, 2.48675562082E+0, -9.95425515933E+2}
123 , {0.E+0, 9.99999999999E-1, 8.06872414273E+2, -5.54259427252E+2, -5.53020073939E+2, -1.14936867545E+0, 1.91128812566E+0, 2.26825493769E+0, 1.52408577929E+0, -2.40309373553E+2}
124 , {5.0E+1, 1.E+0, 7.64560508487E+2, -4.25769712597E+2, -4.24461771644E+2, -7.18597738502E-1, 2.44042672688E+0, 2.87145834504E+0, 1.67386555377E+0, -1.935548534E+2}
125 , {1.00E+2, 1.E+0, 7.1434196171E+2, -2.68705886282E+2, -2.67305996519E+2, -2.67326253028E-1, 2.79193140522E+0, 3.39930313964E+0, 1.82656440577E+0, -1.68953094965E+2}
126 , {1.50E+2, 9.99999999999E-1, 6.48313170085E+2, -8.6650261463E+1, -8.51077970397E+1, 1.90234407654E-1, 2.979022514E+0, 3.90218596763E+0, 1.97502069548E+0, -1.67147951062E+2}
127 , {2.00E+2, 1.E+0, 1.27204835883E+1, 6.43022418635E+2, 7.21635782118E+2, 2.07856851431E+0, 2.05885633369E+0, 2.38207986244E+0, 2.11586130934E+0, -3.40452273911E+2}
128 , {2.50E+2, 1.E+0, 1.11049192462E+1, 7.51128663719E+2, 8.4117884579E+2, 2.31872063728E+0, 2.14697731794E+0, 2.40956744833E+0, 2.24799840204E+0, -4.61910037671E+2}
129 , {3.00E+2, 1.E+0, 9.94128320806E+0, 8.6263977265E+2, 9.63230408594E+2, 2.54148952861E+0, 2.24389122085E+0, 2.47633992223E+0, 2.3714670659E+0, -5.94014950674E+2}
130 , {3.50E+2, 1.E+0, 9.03914635746E+0, 9.78420354476E+2, 1.08905027023E+3, 2.75191292515E+0, 2.34224442785E+0, 2.55779699233E+0, 2.48675562082E+0, -7.36434184833E+2}
131 , {0.E+0, 1.E+1, 8.13611809844E+2, -5.57186328747E+2, -5.44895455042E+2, -1.16028806099E+0, 1.91392249023E+0, 2.26226801762E+0, 1.52408577929E+0, -2.40253644889E+2}
132 , {5.0E+1, 1.E+1, 7.73470515764E+2, -4.29988711763E+2, -4.17059970724E+2, -7.31905425706E-1, 2.43381668906E+0, 2.84759740453E+0, 1.67386555377E+0, -1.93473473446E+2}
133 , {1.00E+2, 1.E+1, 7.27054565402E+2, -2.75515608989E+2, -2.61761483128E+2, -2.85926679541E-1, 2.77783044022E+0, 3.34511278546E+0, 1.82656440577E+0, -1.68822068518E+2}
134 , {1.50E+2, 1.E+1, 6.69218307661E+2, -9.89387365377E+1, -8.3995929556E+1, 1.60597243675E-1, 2.95484735795E+0, 3.75954965099E+0, 1.97502069548E+0, -1.66895460199E+2}
135 , {2.00E+2, 1.E+1, 5.91039284094E+2, 9.84978451636E+1, 1.15417194298E+2, 6.05518301078E-1, 3.02634257079E+0, 4.26260052896E+0, 2.11586130934E+0, -1.88003138992E+2}
136 , {2.50E+2, 1.E+1, 4.48888447806E+2, 3.38240901E+2, 3.60518150613E+2, 1.09651518397E+0, 3.07044017902E+0, 6.18836798995E+0, 2.24799840204E+0, -2.35401017495E+2}
137 , {3.00E+2, 1.E+1, 1.64257960973E+2, 6.84771578228E+2, 7.45651428074E+2, 1.80029088237E+0, 2.85309462142E+0, 5.54486772104E+0, 2.3714670659E+0, -3.47065141E+2}
138 , {3.50E+2, 1.0E+1, 1.13316789236E+2, 8.70533888295E+2, 9.58782064646E+2, 2.15784819653E+0, 2.68520867999E+0, 3.60913997594E+0, 2.48675562082E+0, -4.74129215375E+2}
139 , {0.E+0, 1.E+2, 8.63078991406E+2, -5.77201124795E+2, -4.61336874829E+2, -1.24656198038E+0, 1.94470991437E+0, 2.24966708097E+0, 1.52408577929E+0, -2.36702719853E+2}
140 , {5.0E+1, 1.E+2, 8.33452085093E+2, -4.56695111521E+2, -3.36712209338E+2, -8.2873259721E-1, 2.40184519314E+0, 2.7324727893E+0, 1.67386555377E+0, -1.88890172732E+2}
141 , {1.00E+2, 1.E+2, 8.02418924725E+2, -3.14424452814E+2, -1.89801270435E+2, -4.06700863564E-1, 2.70573485262E+0, 3.12116499723E+0, 1.82656440577E+0, -1.62664025575E+2}
142 , {1.50E+2, 1.00E+2, 7.68325127581E+2, -1.569972689E+2, -2.68440350537E+1, 2.78800142137E-3, 2.85052680174E+0, 3.37644236613E+0, 1.97502069548E+0, -1.58177011701E+2}
143 , {2.00E+2, 1.E+2, 7.31020692449E+2, 9.23287291916E+0, 1.46027906265E+2, 3.887826144E-1, 2.88294004401E+0, 3.52284351046E+0, 2.11586130934E+0, -1.74719621084E+2}
144 , {2.50E+2, 1.E+2, 6.91069283063E+2, 1.794175565E+2, 3.24120848124E+2, 7.46535650264E-1, 2.84698653279E+0, 3.58991349616E+0, 2.24799840204E+0, -2.11132568936E+2}
145 , {3.00E+2, 1.E+2, 6.49355035036E+2, 3.50116885061E+2, 5.04115844959E+2, 1.07512311112E+0, 2.77509668585E+0, 3.60251912093E+0, 2.3714670659E+0, -2.66089926079E+2}
146 , {3.50E+2, 1.E+2, 6.06931962837E+2, 5.18993329585E+2, 6.83756443283E+2, 1.37563959596E+0, 2.68915443079E+0, 3.57782762234E+0, 2.48675562082E+0, -3.38236484639E+2}
147 };
148
149 const unsigned ntd = sizeof(td)/sizeof(TestData);
150
151 #endif

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