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

Contents of /trunk/models/johnpye/fprops/fluids/ethane.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: 12180 byte(s)
Fixing test routine.
1 /* This file is created by Hongke Zhu, 06-17-2010.
2 Chemical & Materials Engineering Department,
3 University of Alabama in Huntsville, United States.
4
5 LITERATURE REFERENCE
6 Buecker, D. and Wagner, W.
7 "A Reference Equation of State for the Thermodynamic Properties of Ethane for Temperatures from the Melting Line to 675 K and Pressures up to 900 MPa,"
8 J. Phys. Chem. Ref. Data, 35(1):205-266, 2006.
9 */
10
11 #include "../helmholtz.h"
12
13 #define ETHANE_M 30.06904 /* kg/kmol */
14 #define ETHANE_R (8314.472/ETHANE_M) /* J/kg/K */
15 #define ETHANE_TSTAR 305.322 /* K */
16
17 const IdealData ideal_data_ethane = {
18 9.212802589 /* constant */
19 , -4.682248550 /* linear */
20 , ETHANE_TSTAR /* Tstar */
21 , ETHANE_R /* cp0star */
22 , 1 /* power terms */
23 , (const IdealPowTerm[]){
24 {4.003039265, 0.0}
25 }
26 , 4 /* exponential terms */
27 , (const IdealExpTerm[]){
28 {1.117433359, 430.23083}
29 ,{3.467773215, 1224.31590}
30 ,{6.941944640, 2014.12064}
31 ,{5.970850948, 4268.34363}
32 }
33 };
34
35 const HelmholtzData helmholtz_data_ethane = {
36 "ethane"
37 , /* R */ ETHANE_R /* J/kg/K */
38 , /* M */ ETHANE_M /* kg/kmol */
39 , /* rho_star */ 6.856886685*ETHANE_M /* kg/m3(= rho_c for this model) */
40 , /* T_star */ ETHANE_TSTAR /* K (= T_c for this model) */
41
42 , /* T_c */ ETHANE_TSTAR
43 , /* rho_c */ 6.856886685*ETHANE_M /* kg/m3 */
44 , /* T_t */ 0
45
46 , 0.0995 /* acentric factor */
47 , &ideal_data_ethane
48 , 39 /* power terms */
49 , (const HelmholtzPowTerm[]){
50 /* a_i, t_i, d_i, l_i */
51 {0.83440745735241e+0, 0.25, 1.0, 0}
52 , {-0.14287360607171e+1, 1.00, 1.0, 0}
53 , {0.34430242210927e+0, 0.25, 2.0, 0}
54 , {-0.42096677920265e+0, 0.75, 2.0, 0}
55 , {0.12094500886549e-1, 0.75, 4.0, 0}
56 , {-0.57976201597341e+0, 2.00, 1.0, 1}
57 , {-0.33127037870838e-1, 4.25, 1.0, 1}
58 , {-0.11751654894130e+0, 0.75, 2.0, 1}
59 , {-0.11160957833067e+0, 2.25, 2.0, 1}
60 , {0.62181592654406e-1, 3.00, 3.0, 1}
61 , {0.98481795434443e-1, 1.00, 6.0, 1}
62 , {-0.98268582682358e-1, 1.25, 6.0, 1}
63 , {-0.23977831007049e-3, 2.75, 7.0, 1}
64 , {0.69885663328821e-3, 1.00, 9.0, 1}
65 , {0.19665987803305e-4, 2.00, 10.0, 1}
66 , {-0.14586152207928e-1, 2.50, 2.0, 2}
67 , {0.46354100536781e-1, 5.50, 4.0, 2}
68 , {0.60764622180645e-2, 7.00, 4.0, 2}
69 , {-0.26447330147828e-2, 0.50, 5.0, 2}
70 , {-0.42931872689904e-1, 5.50, 5.0, 2}
71 , {0.29987786517263e-2, 2.50, 6.0, 2}
72 , {0.52919335175010e-2, 4.00, 8.0, 2}
73 , {-0.10383897798198e-2, 2.00, 9.0, 2}
74 , {-0.54260348214694e-1, 10.00, 2.0, 3}
75 , {-0.21959362918493e+0, 16.00, 3.0, 3}
76 , {0.35362456650354e+0, 18.00, 3.0, 3}
77 , {-0.12477390173714e+0, 20.00, 3.0, 3}
78 , {0.18425693591517e+0, 14.00, 4.0, 3}
79 , {-0.16192256436754e+0, 18.00, 4.0, 3}
80 , {-0.82770876149064e-1, 12.00, 5.0, 3}
81 , {0.50160758096437e-1, 19.00, 5.0, 3}
82 , {0.93614326336655e-2, 7.00, 6.0, 3}
83 , {-0.27839186242864e-3, 15.00, 11.0, 3}
84 , {0.23560274071481e-4, 9.00, 14.0, 3}
85 , {0.39238329738527e-2, 26.00, 3.0, 4}
86 , {-0.76488325813618e-3, 28.00, 3.0, 4}
87 , {-0.49944304440730e-2, 28.00, 4.0, 4}
88 , {0.18593386407186e-2, 22.00, 8.0, 4}
89 , {-0.61404353331199e-3, 13.00, 10.0, 4}
90 }
91 , 5 /* gaussian terms */
92 , (const HelmholtzGausTerm[]){
93 /* n_i, t_i, d_i, alpha_i,beta_i, gamma_i,delta_i */
94 {-0.23312179367924e-2, 0.0, 1.0, 15.0, 150.0, 1.05, 1.0}
95 , {0.29301047908760e-2, 3.0, 1.0, 15.0, 150.0, 1.05, 1.0}
96 , {-0.26912472842883e-3, 3.0, 3.0, 15.0, 150.0, 1.05, 1.0}
97 , {0.18413834111814e+3, 0.0, 3.0, 20.0, 275.0, 1.22, 1.0}
98 , {-0.10397127984854e+2, 3.0, 2.0, 20.0, 400.0, 1.16, 1.0}
99
100 }
101 , 0 /* critical terms */
102 , 0
103 };
104
105 /*
106 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:
107
108 ./test.py ethane
109 */
110
111 #ifdef TEST
112
113 #include "../test.h"
114 #include <math.h>
115 #include <assert.h>
116 #include <stdio.h>
117
118 const TestData td[]; const unsigned ntd;
119
120 int main(void){
121 //return helm_check_u(&helmholtz_data_ethane, ntd, td);
122 //return helm_check_dpdT_rho(&helmholtz_data_ethane, ntd, td);
123 //return helm_check_dpdrho_T(&helmholtz_data_ethane, ntd, td);
124 //return helm_check_dhdT_rho(&helmholtz_data_ethane, ntd, td);
125 //return helm_check_dhdrho_T(&helmholtz_data_ethane, ntd, td);
126 //return helm_check_dudT_rho(&helmholtz_data_ethane, ntd, td);
127 //return helm_check_dudrho_T(&helmholtz_data_ethane, ntd, td);
128 return helm_run_test_cases(&helmholtz_data_ethane, ntd, td, 'C');
129 }
130
131 /*
132 A small set of data points calculated using REFPROP 8.0, for validation.
133 */
134
135 const TestData td[] = {
136 /* Temperature, Pressure, Density, Int. Energy, Enthalpy, Entropy, Cv, Cp, Cp0, Helmholtz */
137 /* (C), (MPa), (kg/m3), (kJ/kg), (kJ/kg), (kJ/kg-K), (kJ/kg-K), (kJ/kg-K), (kJ/kg-K), (kJ/kg) */
138 {-1.50E+2, 1.E-1, 6.15508091549E+2, -8.14074352115E+2, -8.13911884714E+2, -4.35084835408E+0, 1.47272462242E+0, 2.28315877551E+0, 1.23340615685E+0, -2.7826737731E+2}
139 , {-1.00E+2, 1.E-1, 5.57924288163E+2, -6.97493200756E+2, -6.97313964967E+2, -3.55730207586E+0, 1.43319138386E+0, 2.39683640756E+0, 1.33921915038E+0, -8.15463463211E+1}
140 , {-5.0E+1, 1.E-1, 1.6506610855E+0, -1.84257088313E+2, -1.23675300278E+2, -4.69372323988E-1, 1.20911299515E+0, 1.50677347493E+0, 1.47500607374E+0, -7.95166542153E+1}
141 , {0.E+0, 1.E-1, 1.33711322049E+0, -1.19427058448E+2, -4.46390760485E+1, -1.50320162463E-1, 1.37554352423E+0, 1.66329486468E+0, 1.64770632977E+0, -7.83671060713E+1}
142 , {5.0E+1, 1.E-1, 1.12569683934E+0, -4.55714350685E+1, 4.32624289924E+1, 1.44740666891E-1, 1.57340801762E+0, 1.85691579801E+0, 1.84756881746E+0, -9.23443815743E+1}
143 , {1.00E+2, 1.E-1, 9.72734661786E-1, 3.85164067559E+1, 1.41319364159E+2, 4.26515557391E-1, 1.7855009878E+0, 2.06675950332E+0, 2.06055304947E+0, -1.20637873485E+2}
144 , {1.50E+2, 1.E-1, 8.56686172895E-1, 1.33251710849E+2, 2.49980570452E+2, 6.99510128615E-1, 1.9993968478E+0, 2.27931863461E+0, 2.27492077928E+0, -1.62746000074E+2}
145 , {2.00E+2, 1.E-1, 7.65532193698E-1, 2.385314345E+2, 3.69159513663E+2, 9.65506465445E-1, 2.20744745702E+0, 2.48651259424E+0, 2.48324891026E+0, -2.18297949625E+2}
146 , {2.50E+2, 1.E-1, 6.91995014141E-1, 3.53965012959E+2, 4.98474724671E+2, 1.22514923762E+0, 2.40587848199E+0, 2.68436360406E+0, 2.68185570132E+0, -2.86971810704E+2}
147 , {3.00E+2, 1.E-1, 6.31396132606E-1, 4.79036463654E+2, 6.37415640903E+2, 1.47866774316E+0, 2.59336692506E+0, 2.87144237161E+0, 2.8694618797E+0, -3.6846195334E+2}
148 , {-1.50E+2, 1.E+0, 6.15951026097E+2, -8.14397400291E+2, -8.12773894594E+2, -4.35347677541E+0, 1.4738480412E+0, 2.28169516546E+0, 1.23340615685E+0, -2.782667354E+2}
149 , {-1.00E+2, 1.E+0, 5.58684411309E+2, -6.98096136336E+2, -6.96306217054E+2, -3.56079196369E+0, 1.4344409742E+0, 2.39254727436E+0, 1.33921915038E+0, -8.15450078231E+1}
150 , {-5.0E+1, 1.E+0, 4.92434824501E+2, -5.73033239153E+2, -5.71002513562E+2, -2.92644398383E+0, 1.47314126188E+0, 2.66286649615E+0, 1.47500607374E+0, 8.00027358387E+1}
151 , {0.E+0, 1.E+0, 1.4819396272E+1, -1.3469652118E+2, -6.72173889914E+1, -8.44255116701E-1, 1.43006561191E+0, 1.86687159029E+0, 1.64770632977E+0, 9.59117639465E+1}
152 , {5.0E+1, 1.E+0, 1.19101910522E+1, -5.61907916886E+1, 2.77709177094E+1, -5.25130332024E-1, 1.59719044298E+0, 1.9566449391E+0, 1.84756881746E+0, 1.13505075105E+2}
153 , {1.00E+2, 1.E+0, 1.0065262914E+1, 3.03701471884E+1, 1.2972174968E+2, -2.3208574693E-1, 1.79909383847E+0, 2.12785139896E+0, 2.06055304947E+0, 1.16972943655E+2}
154 , {1.50E+2, 1.E+0, 8.75460242192E+0, 1.26680079205E+2, 2.40905711827E+2, 4.72787513622E-2, 2.008346056E+0, 2.32103028349E+0, 2.27492077928E+0, 1.06674075566E+2}
155 , {2.00E+2, 1.E+0, 7.76369865386E+0, 2.3305870312E+2, 3.61863290287E+2, 3.17259832935E-1, 2.21381924881E+0, 2.51684931154E+0, 2.48324891026E+0, 8.29472131669E+1}
156 , {2.50E+2, 1.E+0, 6.9834034936E+0, 3.49303629783E+2, 4.92500281805E+2, 5.79564344098E-1, 2.41065572421E+0, 2.70739305233E+0, 2.68185570132E+0, 4.61045431686E+1}
157 , {3.00E+2, 1.E+0, 6.35072207042E+0, 4.74998224672E+2, 6.32460634286E+2, 8.34947371563E-1, 2.59708737672E+0, 2.88948669244E+0, 2.8694618797E+0, -3.55186133963E+0}
158 , {-1.50E+2, 1.E+1, 6.20238529246E+2, -8.17481952334E+2, -8.01359122925E+2, -4.37902016713E+0, 1.48468824424E+0, 2.26844900379E+0, 1.23340615685E+0, -2.78205618752E+2}
159 , {-1.00E+2, 1.E+1, 5.65822514688E+2, -7.03703521881E+2, -6.86030135368E+2, -3.59388039975E+0, 1.44643652958E+0, 2.35618736393E+0, 1.33921915038E+0, -8.14231306646E+1}
160 , {-5.0E+1, 1.E+1, 5.06196651557E+2, -5.83880821915E+2, -5.64125653703E+2, -2.97635892656E+0, 1.48215573067E+0, 2.54336566393E+0, 1.47500607374E+0, 8.0293672548E+1}
161 , {0.E+0, 1.E+1, 4.33348869211E+2, -4.51226532377E+2, -4.28150436625E+2, -2.4279008688E+0, 1.59437303914E+0, 2.95275059134E+0, 1.64770632977E+0, 2.11954589935E+2}
162 , {5.0E+1, 1.0E+1, 3.18739131184E+2, -2.86990730429E+2, -2.55617111624E+2, -1.85077683477E+0, 1.799465619E+0, 4.26397264806E+0, 1.84756881746E+0, 3.11087803727E+2}
163 , {1.00E+2, 1.0E+1, 1.5906233424E+2, -8.70755854494E+1, -2.42071505822E+1, -1.18382173188E+0, 1.96218405294E+0, 3.83542975292E+0, 2.06055304947E+0, 3.54667493803E+2}
164 , {1.50E+2, 1.0E+1, 1.09665032419E+2, 4.91637301755E+1, 1.40350499371E+2, -7.68928903518E-1, 2.0956305579E+0, 3.00181520921E+0, 2.27492077928E+0, 3.74535995699E+2}
165 , {2.00E+2, 1.0E+1, 8.81817475642E+1, 1.73570311573E+2, 2.86972464243E+2, -4.41325831806E-1, 2.27108349018E+0, 2.90844736711E+0, 2.48324891026E+0, 3.82383628892E+2}
166 , {2.50E+2, 1.0E+1, 7.52293148011E+1, 3.0070913338E+2, 4.33636038622E+2, -1.46715400294E-1, 2.45257722454E+0, 2.97103815812E+0, 2.68185570132E+0, 3.77463295043E+2}
167 , {3.00E+2, 1.0E+1, 6.62450463563E+1, 4.33900546181E+2, 5.84855229588E+2, 1.29270572659E-1, 2.62960924803E+0, 3.08223842962E+0, 2.8694618797E+0, 3.59809117461E+2}
168 , {-1.50E+2, 1.E+2, 6.53768635184E+2, -8.38548314736E+2, -6.85589003722E+2, -4.58445419883E+0, 1.57237690886E+0, 2.20675523181E+0, 1.23340615685E+0, -2.73972780149E+2}
169 , {-1.00E+2, 1.00E+2, 6.13800496512E+2, -7.37659549393E+2, -5.74740163423E+2, -3.82924065986E+0, 1.54558612031E+0, 2.23062335496E+0, 1.33921915038E+0, -7.46265291383E+1}
170 , {-5.0E+1, 1.00E+2, 5.76094044152E+2, -6.35603588225E+2, -4.62020818163E+2, -3.2576258984E+0, 1.58069531024E+0, 2.28573891647E+0, 1.47500607374E+0, 9.13356310021E+1}
171 , {0.E+0, 1.E+2, 5.40301904559E+2, -5.30428772339E+2, -3.45347063102E+2, -2.78620206072E+0, 1.67659976407E+0, 2.38893595946E+0, 1.64770632977E+0, 2.30622320545E+2}
172 , {5.0E+1, 1.00E+2, 5.06302411823E+2, -4.19998000506E+2, -2.22487584468E+2, -2.37349258912E+0, 1.81962065801E+0, 2.53030122275E+0, 1.84756881746E+0, 3.46996129669E+2}
173 , {1.00E+2, 1.00E+2, 4.74179392245E+2, -3.02875087361E+2, -9.19844378817E+1, -1.99827753578E+0, 1.99062537476E+0, 2.69175292166E+0, 2.06055304947E+0, 4.42782175114E+2}
174 , {1.50E+2, 1.00E+2, 4.44110129148E+2, -1.78399663071E+2, 4.67697114526E+1, -1.64954091904E+0, 2.17359275649E+0, 2.85833456889E+0, 2.27492077928E+0, 5.19603576819E+2}
175 , {2.00E+2, 1.00E+2, 4.16262775983E+2, -4.64522821732E+1, 1.93780584587E+2, -1.32132968769E+0, 2.35794320739E+0, 3.02097821763E+0, 2.48324891026E+0, 5.78734859555E+2}
176 , {2.50E+2, 1.00E+2, 3.90731674044E+2, 9.2801655458E+1, 3.48731764642E+2, -1.01014492019E+0, 2.53780576762E+0, 3.17557776184E+0, 2.68185570132E+0, 6.21258970458E+2}
177 , {3.00E+2, 1.00E+2, 3.67514428978E+2, 2.39088673647E+2, 5.11186833923E+2, -7.13670499407E-1, 2.71042944184E+0, 3.32113362064E+0, 2.8694618797E+0, 6.48128920382E+2}
178 };
179
180 const unsigned ntd = sizeof(td)/sizeof(TestData);
181
182 #endif

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