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

Diff of /trunk/models/johnpye/fprops/nitrogen.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1837 by jpye, Mon Aug 25 08:18:23 2008 UTC revision 1838 by jpye, Thu Aug 28 08:32:29 2008 UTC
# Line 24  const IdealData ideal_data_nitrogen = { Line 24  const IdealData ideal_data_nitrogen = {
24      }      }
25  };  };
26    
27  const HelmholtzData helmholtz_data_ammonia = {  const HelmholtzData helmholtz_data_nitrogen = {
28      /* R */ 8.31451 / 28.01348e-3 /* J/molK * kg/mol = J/kg/K */      /* R */ 8.31451 / 28.01348e-3 /* J/molK * kg/mol = J/kg/K */
29      , /* M */ 28.01348 /* kg/kmol */      , /* M */ 28.01348 /* kg/kmol */
30      , /* rho_star */ 11.1839 * 28.01348 /* mol/L * kg/kmol = kg/kL = kg/m³ = rho_c for this model*/      , /* rho_star */ 11.1839 * 28.01348 /* mol/L * kg/kmol = kg/kL = kg/m³ = rho_c for this model*/
31      , /* T_star */ 126.192 /* K = T_c for this model */      , /* T_star */ 126.192 /* K = T_c for this model */
32      , &ideal_data_nitrogen      , &ideal_data_nitrogen
33      , 21 /* nr */      , 21 /* np */
34      , (const HelmholtzATDL[]){      , (const HelmholtzPowTerm[]){
35          /* a_i, t_i, d_i, l_i */          /* a_i, t_i, d_i, l_i */
36          { 0.924803575275,      0.25,    1,  0}          { 0.924803575275,      0.25,    1,  0}
37          ,{-0.492448489428,     0.875,   1,  0}          ,{-0.492448489428,     0.875,   1,  0}
# Line 67  const HelmholtzData helmholtz_data_ammon Line 67  const HelmholtzData helmholtz_data_ammon
67          ,{ 0.264832491957E-3, 16.,      9,  4}          ,{ 0.264832491957E-3, 16.,      9,  4}
68          /* more terms here still to come */          /* more terms here still to come */
69      }      }
70        , 4 /* ne */
71        , (const HelmholtzExpTerm[]){
72            {0.196688194015e2, 0., 1, 20, 325, 1.16}
73            , {-0.209115600730e2, 1., 1, 20, 325, 1.16}
74            , {0.167788306989e-1, 2., 3, 15, 300, 1.13}
75            , {0.262767566274e4, 3., 2, 25, 275, 1.25}
76        }
77  };  };
78    
79    
# Line 90  const HelmholtzData helmholtz_data_ammon Line 97  const HelmholtzData helmholtz_data_ammon
97  #include <math.h>  #include <math.h>
98    
99  /* a simple macro to actually do the testing */  /* a simple macro to actually do the testing */
100  #define ASSERT_TOL(EXPR,VAL,TOL) {\  #define ASSERT_TOL(FN,PARAM1,PARAM2,PARAM3,VAL,TOL) {\
101          double cval; cval = (EXPR);\          double cval; cval = FN(PARAM1,PARAM2,PARAM3);\
102          double err; err = cval - (double)(VAL);\          double err; err = cval - (double)(VAL);\
103          double relerrpc = (cval-(VAL))/(VAL)*100;\          double relerrpc = (cval-(VAL))/(VAL)*100;\
104          if(fabs(relerrpc)>maxerr)maxerr=fabs(relerrpc);\          if(fabs(relerrpc)>maxerr)maxerr=fabs(relerrpc);\
105          if(fabs(err)>TOL){\          if(fabs(err)>TOL){\
106              fprintf(stderr,"ERROR in line %d: value of '%s' = %f, should be %f, error is %f (%.2f%%)!\n"\              fprintf(stderr,"ERROR in line %d: value of '%s(%f,%f,%s)' = %f, should be %f, error is %f (%.2f%%)!\n"\
107                  , __LINE__, #EXPR, cval, VAL,cval-(VAL),relerrpc);\                  , __LINE__, #FN,PARAM1,PARAM2,#PARAM3, cval, VAL,cval-(VAL),relerrpc);\
108              exit(1);\              exit(1);\
109          }else{\          }else{\
110              fprintf(stderr,"    OK, %s = %8.2e with %.2f%% err.\n",#EXPR,VAL,relerrpc);\              fprintf(stderr,"    OK, %s(%f,%f,%s) = %8.2e with %.2f%% err.\n",#FN,PARAM1,PARAM2,#PARAM3,VAL,relerrpc);\
111              /*fprintf(stderr,"        (err = %8.2e, tol = %8.2e, calc = %8.2e)\n",fabs(err),TOL,cval);*/\              /*fprintf(stderr,"        (err = %8.2e, tol = %8.2e, calc = %8.2e)\n",fabs(err),TOL,cval);*/\
112          }\          }\
113      }      }
114    
115    typedef struct{double T,p,rho,h,s;} TestData;
116    
117    
118    /*
119        A small set of data points calculated using REFPROP 7.0, for validation
120    */
121    const TestData td[] = {
122    /* {T / K    , p / MPa    , rho / kg/m3, h / kJ/kg, s / kJ/kgK} */
123        {-200.00000, 0.10000000, 824.94146, -130.56454, 2.7206049}
124        , {-195.90650, 0.10000000, 806.59036, -122.24684, 2.8312405}
125        , {-195.90650, 0.10000000, 4.5564811, 77.072848, 5.4116477}
126        , {-150.00000, 0.10000000, 2.7651079, 126.49637, 5.9149401}
127        , {-100.00000, 0.10000000, 1.9528859, 178.96289, 6.2726011}
128        , {-50.000000, 0.10000000, 1.5119231, 231.14631, 6.5373809}
129        , {0.00000000, 0.10000000, 1.2340278, 283.23654, 6.7480133}
130        , {50.000000, 0.10000000, 1.0426377, 335.30559, 6.9230643}
131        , {100.00000, 0.10000000, 0.90273132, 387.42000, 7.0730090}
132        , {150.00000, 0.10000000, 0.79597134, 439.66508, 7.2043968}
133        , {200.00000, 0.10000000, 0.71181434, 492.14150, 7.3216082}
134        , {250.00000, 0.10000000, 0.64376369, 544.95214, 7.4277045}
135        , {300.00000, 0.10000000, 0.58759653, 598.18966, 7.5248876}
136        , {350.00000, 0.10000000, 0.54044842, 651.92860, 7.6147756}
137        , {400.00000, 0.10000000, 0.50030750, 706.22257, 7.6985791}
138        , {450.00000, 0.10000000, 0.46571913, 761.10483, 7.7772186}
139        , {500.00000, 0.10000000, 0.43560536, 816.59095, 7.8514061}
140        , {550.00000, 0.10000000, 0.40915040, 872.68219, 7.9217018}
141        , {600.00000, 0.10000000, 0.38572547, 929.36893, 7.9885535}
142        , {650.00000, 0.10000000, 0.36483807, 986.63370, 8.0523256}
143        , {700.00000, 0.10000000, 0.34609700, 1044.4538, 8.1133192}
144        , {750.00000, 0.10000000, 0.32918753, 1102.8031, 8.1717867}
145        , {800.00000, 0.10000000, 0.31385363, 1161.6539, 8.2279428}
146        , {850.00000, 0.10000000, 0.29988486, 1220.9778, 8.2819723}
147        , {900.00000, 0.10000000, 0.28710667, 1280.7465, 8.3340357}
148        , {950.00000, 0.10000000, 0.27537304, 1340.9326, 8.3842743}
149        , {1000.0000, 0.10000000, 0.26456092, 1401.5096, 8.4328132}
150        , {-200.00000, 1.0000000, 826.97227, -129.89700, 2.7148345}
151        , {-169.40309, 1.0000000, 665.82825, -64.326777, 3.4600526}
152        , {-169.40309, 1.0000000, 41.331104, 87.734007, 4.9257424}
153        , {-150.00000, 1.0000000, 30.899666, 114.98204, 5.1673819}
154        , {-100.00000, 1.0000000, 20.189927, 173.16514, 5.5653573}
155        , {-50.000000, 1.0000000, 15.303926, 227.54808, 5.8414656}
156        , {0.00000000, 1.0000000, 12.387522, 280.82813, 6.0569512}
157        , {50.000000, 1.0000000, 10.426157, 333.64490, 6.2345305}
158        , {100.00000, 1.0000000, 9.0097433, 386.27217, 6.3859570}
159        , {150.00000, 1.0000000, 7.9362666, 438.89007, 6.5182852}
160        , {200.00000, 1.0000000, 7.0935035, 491.64902, 6.6361293}
161        , {250.00000, 1.0000000, 6.4137509, 544.68060, 6.7426703}
162        , {300.00000, 1.0000000, 5.8536009, 598.09515, 6.8401771}
163        , {350.00000, 1.0000000, 5.3838822, 651.97879, 6.9303076}
164        , {400.00000, 1.0000000, 4.9842388, 706.39293, 7.0142967}
165        , {450.00000, 1.0000000, 4.6400213, 761.37636, 7.0930813}
166        , {500.00000, 1.0000000, 4.3404109, 816.94862, 7.1673842}
167        , {550.00000, 1.0000000, 4.0772408, 873.11393, 7.2377727}
168        , {600.00000, 1.0000000, 3.8442281, 929.86491, 7.3047002}
169        , {650.00000, 1.0000000, 3.6364590, 987.18580, 7.3685349}
170        , {700.00000, 1.0000000, 3.4500344, 1045.0552, 7.4295806}
171        , {750.00000, 1.0000000, 3.2818204, 1103.4482, 7.4880919}
172        , {800.00000, 1.0000000, 3.1292688, 1162.3378, 7.5442851}
173        , {850.00000, 1.0000000, 2.9902865, 1221.6964, 7.5983461}
174        , {900.00000, 1.0000000, 2.8631379, 1281.4962, 7.6504366}
175        , {950.00000, 1.0000000, 2.7463717, 1341.7103, 7.7006986}
176        , {1000.0000, 1.0000000, 2.6387646, 1402.3126, 7.7492578}
177        , {-200.00000, 10.000000, 845.26732, -122.98508, 2.6622174}
178        , {-150.00000, 10.000000, 614.63170, -20.755043, 3.7210595}
179        , {-100.00000, 10.000000, 274.08684, 108.33718, 4.5999308}
180        , {-50.000000, 10.000000, 165.69732, 193.43373, 5.0356176}
181        , {0.00000000, 10.000000, 125.24775, 259.27189, 5.3024487}
182        , {50.000000, 10.000000, 102.49734, 319.26216, 5.5043023}
183        , {100.00000, 10.000000, 87.427859, 376.62733, 5.6694209}
184        , {150.00000, 10.000000, 76.534477, 432.63584, 5.8103035}
185        , {200.00000, 10.000000, 68.216292, 487.94924, 5.9338674}
186        , {250.00000, 10.000000, 61.619660, 542.97600, 6.0444247}
187        , {300.00000, 10.000000, 56.240667, 597.99135, 6.1448586}
188        , {350.00000, 10.000000, 51.759585, 653.18645, 6.2371858}
189        , {400.00000, 10.000000, 47.962302, 708.69313, 6.3228633}
190        , {450.00000, 10.000000, 44.699287, 764.59931, 6.4029715}
191        , {500.00000, 10.000000, 41.862548, 820.95992, 6.4783293}
192        , {550.00000, 10.000000, 39.371915, 877.80536, 6.5495709}
193        , {600.00000, 10.000000, 37.166488, 935.14803, 6.6171967}
194        , {650.00000, 10.000000, 35.199092, 992.98747, 6.6816092}
195        , {700.00000, 10.000000, 33.432569, 1051.3142, 6.7431376}
196        , {750.00000, 10.000000, 31.837217, 1110.1129, 6.8020556}
197        , {800.00000, 10.000000, 30.388987, 1169.3641, 6.8585940}
198        , {850.00000, 10.000000, 29.068188, 1229.0464, 6.9129500}
199        , {900.00000, 10.000000, 27.858530, 1289.1373, 6.9652942}
200        , {950.00000, 10.000000, 26.746414, 1349.6141, 7.0157755}
201        , {1000.0000, 10.000000, 25.720391, 1410.4542, 7.0645253}
202        , {-150.00000, 100.00000, 842.03632, 39.237402, 3.2425037}
203        , {-100.00000, 100.00000, 748.08407, 118.90189, 3.7864991}
204        , {-50.000000, 100.00000, 668.62180, 193.68381, 4.1663797}
205        , {0.00000000, 100.00000, 602.00192, 264.67164, 4.4536512}
206        , {50.000000, 100.00000, 546.37705, 332.63655, 4.6822703}
207        , {100.00000, 100.00000, 499.86285, 398.18975, 4.8709587}
208        , {150.00000, 100.00000, 460.71962, 461.86446, 5.0311389}
209        , {200.00000, 100.00000, 427.47644, 524.12999, 5.1702472}
210        , {250.00000, 100.00000, 398.95507, 585.38730, 5.2933342}
211        , {300.00000, 100.00000, 374.23539, 645.96722, 5.4039354}
212        , {350.00000, 100.00000, 352.60470, 706.13381, 5.5045853}
213        , {400.00000, 100.00000, 333.51020, 766.09157, 5.5971384}
214        , {450.00000, 100.00000, 316.52039, 825.99447, 5.6829774}
215        , {500.00000, 100.00000, 301.29531, 885.95525, 5.7631519}
216        , {550.00000, 100.00000, 287.56440, 946.05406, 5.8384731}
217        , {600.00000, 100.00000, 275.11003, 1006.3459, 5.9095787}
218        , {650.00000, 100.00000, 263.75533, 1066.8665, 5.9769785}
219        , {700.00000, 100.00000, 253.35515, 1127.6376, 6.0410866}
220        , {750.00000, 100.00000, 243.78927, 1188.6704, 6.1022442}
221        , {800.00000, 100.00000, 234.95724, 1249.9686, 6.1607365}
222        , {850.00000, 100.00000, 226.77444, 1311.5305, 6.2168049}
223        , {900.00000, 100.00000, 219.16910, 1373.3507, 6.2706560}
224        , {950.00000, 100.00000, 212.07988, 1435.4217, 6.3224685}
225        , {1000.0000, 100.00000, 205.45406, 1497.7339, 6.3723982}
226    };
227    
228    
229  int main(void){  int main(void){
230    
231      double rho, T, p, h, u;      double rho, T, p, h, u;
232      const HelmholtzData *d;      const HelmholtzData *d;
233    
234      d = &helmholtz_data_ammonia;      d = &helmholtz_data_nitrogen;
235      double maxerr = 0;      double maxerr = 0;
236    
237      fprintf(stderr,"ENTROPY TESTS\n");      unsigned i;
238        const unsigned n = sizeof(td)/sizeof(TestData);
     /* offset required to attain agreement with REFPROP */  
     double Y = -471.596704;  
   
     fprintf(stderr,"s(T,rho) at p = 0.1 MPa\n");  
     ASSERT_TOL(helmholtz_s(273.15+-60, 713.65,d), Y+0.36737e3, 0.5);  
     ASSERT_TOL(helmholtz_s(273.15+  0,0.76124,d), Y+6.8900e3, 0.5);  
     ASSERT_TOL(helmholtz_s(273.15+ 50,0.63869,d), Y+7.2544e3, 0.5);  
     ASSERT_TOL(helmholtz_s(273.15+200,0.43370,d), Y+8.1232e3, 0.5);  
     ASSERT_TOL(helmholtz_s(273.15+300,0.35769,d), Y+8.6084e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+420,0.29562,d), Y+9.1365e3, 1);  
   
     fprintf(stderr,"s(T,rho) at p = 1 MPa\n");  
     ASSERT_TOL(helmholtz_s(273.15+-50,702.49,d), Y+0.56381e3, 0.5);  
     ASSERT_TOL(helmholtz_s(273.15+150,4.9817,d), Y+6.7008e3, 0.5);  
     ASSERT_TOL(helmholtz_s(273.15+200,4.4115,d), Y+6.9770e3, 0.5);  
     ASSERT_TOL(helmholtz_s(273.15+350,3.3082,d), Y+7.7012e3, 0.5);  
     ASSERT_TOL(helmholtz_s(273.15+420,2.9670,d), Y+8.0059e3, 0.5);  
   
     fprintf(stderr,"s(T,rho) at p = 10 MPa\n");  
     ASSERT_TOL(helmholtz_s(273.15+-70,728.11,d), Y+0.14196e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+-50,706.21,d), Y+0.54289e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+-20,670.55,d), Y+1.0975e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+  0,645.04,d), Y+1.4403e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+125.17,356.70,d), Y+3.5463e3, 1);  
   
     ASSERT_TOL(helmholtz_s(273.15+125.17,121.58,d), Y+4.5150e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+200,54.389,d), Y+5.5906e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+350,35.072,d), Y+6.4850e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+420,30.731,d), Y+6.8171e3, 1);  
   
     fprintf(stderr,"s(T,rho) at p = 20 MPa\n");  
     ASSERT_TOL(helmholtz_s(273.15+-50,710.19,d), Y+0.52061e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+ 30,612.22,d), Y+1.8844e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+150,359.41,d), Y+3.7164e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+200,152.83,d), Y+4.8376e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+350,74.590,d), Y+6.0407e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+420,63.602,d), Y+6.4066e3, 1);  
   
     fprintf(stderr,"s(T,rho) at p = 100 MPa\n");  
     ASSERT_TOL(helmholtz_s(273.15+  0,690.41,d), Y+1.2158e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+100,591.07,d), Y+2.5499e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+250,437.69,d), Y+4.0264e3, 1);  
     ASSERT_TOL(helmholtz_s(273.15+420,298.79,d), Y+5.2620e3, 1);  
239    
240      /* successful entropy tests means that helm_ideal_tau, helm_real_tau, helm_ideal and helm_resid are all OK */      fprintf(stderr,"Running through %d test points...\n",n);
241    
242      fprintf(stderr,"PRESSURE TESTS\n");      fprintf(stderr,"PRESSURE TESTS\n");
243        for(i=0; i<n;++i){
244            ASSERT_TOL(helmholtz_p, td[i].T+273.15, td[i].rho, d, td[i].p*1e6, 1E3);
245        }
246    
247      fprintf(stderr,"p(T,rho) = 0.1 MPa\n");      /* offset required to attain agreement with REFPROP */
248      ASSERT_TOL(helmholtz_p(273.15 -70,724.74783,d), 0.1E6,  1E3);      double Y = -471.596704;
     ASSERT_TOL(helmholtz_p(273.15 -60,713.64815,d), 0.1E6,  1E3);  
     ASSERT_TOL(helmholtz_p(273.15 -50,702.11130,d), 0.1E6,  1E3);  
     ASSERT_TOL(helmholtz_p(273.15 -40,690.16351,d), 0.1E6,   1E3);  
     ASSERT_TOL(helmholtz_p(273.15 -33.588341,682.29489,d), 0.1E6,1E3);  
     ASSERT_TOL(helmholtz_p(273.15+  0,0.76123983,d), 0.1E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+100,0.55135,d), 0.1E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+250,0.39203,d), 0.1E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+420,0.29562,d), 0.1E6, 1E3);  
   
     fprintf(stderr,"p(T,rho) = 1 MPa\n");  
     ASSERT_TOL(helmholtz_p(273.15 -70,725.05815,d), 1E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+  0,638.97275,d), 1E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+ 30,7.5736465,d), 1E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+150,4.9816537,d), 1E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+200,4.4115,d), 1E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+350,3.3082,d), 1E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+420,2.9670,d), 1E6, 1E3);  
   
     fprintf(stderr,"p(T,rho) = 10 MPa\n");  
     ASSERT_TOL(helmholtz_p(273.15+-40.,694.67407,d), 10E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+-20.,670.54741,d), 10E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+50,573.07306,d), 10E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+110,441.76869,d), 10E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+150,74.732,d), 10E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+200,54.389,d), 10E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+350,35.072,d), 10E6, 1E3);  
     ASSERT_TOL(helmholtz_p(273.15+420,30.731,d), 10E6, 1E3);  
   
     fprintf(stderr,"p(T,rho) = 20 MPa\n");  
     ASSERT_TOL(helmholtz_p(273.15+150,359.40683,d), 20E6, 1E4);  
     ASSERT_TOL(helmholtz_p(273.15+200,152.83430,d), 20E6, 1E4);  
     ASSERT_TOL(helmholtz_p(273.15+350,74.590236,d), 20E6, 1E4);  
     ASSERT_TOL(helmholtz_p(273.15+420,63.601873,d), 20E6, 1E4);  
   
     //fprintf(stderr,"IDEAL HELMHOLTZ COMPONENT\n");  
     //ASSERT_TOL(helm_ideal(273.15, 0)  
249    
250      fprintf(stderr,"ENTHALPY TESTS\n");      fprintf(stderr,"ENTROPY TESTS\n");
251        for(i=0; i<n;++i){
252            ASSERT_TOL(helmholtz_s, td[i].T+273.15, td[i].rho, d, td[i].s*1e3 + Y, 1E3);
253        }
254    
255      /* this offset is required to attain agreement with values from REFPROP */      /* this offset is required to attain agreement with values from REFPROP */
256      double Z = -1635.7e3 + 1492.411e3;      double Z = -1635.7e3 + 1492.411e3;
257    
258      fprintf(stderr,"h(T,rho) at p = 0.1 MPa\n");      fprintf(stderr,"ENTHALPY TESTS\n");
259      ASSERT_TOL(helmholtz_h(273.15+-60, 713.65,d), Z+75.166e3, 0.2e3);      for(i=0; i<n;++i){
260      ASSERT_TOL(helmholtz_h(273.15+  0,0.76124,d), Z+1635.7e3, 0.2e3);          ASSERT_TOL(helmholtz_h, td[i].T+273.15, td[i].rho, d, td[i].h*1e3 + Z, 1E3);
261      ASSERT_TOL(helmholtz_h(273.15+ 50,0.63869,d), Z+1744.0e3, 0.2e3);      }
     ASSERT_TOL(helmholtz_h(273.15+200,0.43370,d), Z+2087.0e3, 0.2e3);  
     ASSERT_TOL(helmholtz_h(273.15+300,0.35769,d), Z+2340.0e3, 1e3);  
     ASSERT_TOL(helmholtz_h(273.15+420,0.29562,d), Z+2674.3e3, 1e3);  
   
     fprintf(stderr,"h(T,rho) at p = 1 MPa\n");  
     ASSERT_TOL(helmholtz_h(273.15+150,4.9817,d), Z+1949.1e3, 1e3);  
     ASSERT_TOL(helmholtz_h(273.15+200,4.4115,d), Z+2072.7e3, 1e3);  
     ASSERT_TOL(helmholtz_h(273.15+350,3.3082,d), Z+2468.2e3, 1e3);  
     ASSERT_TOL(helmholtz_h(273.15+420,2.9670,d), Z+2668.6e3, 1e3);  
   
     fprintf(stderr,"h(T,rho) at p = 10 MPa\n");  
     ASSERT_TOL(helmholtz_h(273.15+-50,706.21,d), Z+127.39e3, 2e3);  
     ASSERT_TOL(helmholtz_h(273.15+-0,645.04,d), Z+349.53e3, 2e3);  
       
     ASSERT_TOL(helmholtz_h(273.15+150,74.732,d), Z+1688.5e3, 1e3);  
     ASSERT_TOL(helmholtz_h(273.15+200,54.389,d), Z+1908.0e3, 1e3);  
     ASSERT_TOL(helmholtz_h(273.15+350,35.072,d), Z+2393.4e3, 1e3);  
     ASSERT_TOL(helmholtz_h(273.15+420,30.731,d), Z+2611.8e3, 1e3);  
   
     fprintf(stderr,"h(T,rho) at p = 20 MPa\n");  
     /* note rather larger errors in the following few lines -- why? */  
     ASSERT_TOL(helmholtz_h(273.15 -70,731.41,d), Z+51.734e3, 0.5e3);  
     ASSERT_TOL(helmholtz_h(273.15 -60,721.00318,d), Z+93.871419e3, 0.5e3);  
     ASSERT_TOL(helmholtz_h(273.15 -50,710.19289,d), Z+136.54351e3, 1e3);  
     ASSERT_TOL(helmholtz_h(273.15 -40,699.02472,d), Z+179.72030e3, 0.5e3);  
     ASSERT_TOL(helmholtz_h(273.15+ 30,612.22,d), Z+493.28e3, 0.5e3);  
     ASSERT_TOL(helmholtz_h(273.15+150,359.40683,d), Z+1162.5e3, 0.5e3);  
     ASSERT_TOL(helmholtz_h(273.15+200,152.83430,d), Z+1662.9e3, 0.5e3);  
     ASSERT_TOL(helmholtz_h(273.15+250,106.31299,d), Z+1928.6499e3, 0.5e3);  
     ASSERT_TOL(helmholtz_h(273.15+300,86.516941,d), Z+2128.9031e3, 0.5e3);  
     ASSERT_TOL(helmholtz_h(273.15+330,78.784703,d), Z+2238.2416e3, 0.5e3);  
     ASSERT_TOL(helmholtz_h(273.15+350,74.590236,d), Z+2308.8516e3, 10e3);  
     ASSERT_TOL(helmholtz_h(273.15+420,63.601873,d), Z+2549.2872e3, 10e3);  
   
     fprintf(stderr,"h(T,rho) at p = 100 MPa\n");  
     ASSERT_TOL(helmholtz_h(273.15+  0,690.41,d), Z+422.69e3, 0.5e3);  
     ASSERT_TOL(helmholtz_h(273.15+100,591.07,d), Z+850.44e3, 0.1e3);  
     ASSERT_TOL(helmholtz_h(273.15+250,437.69,d), Z+1506.6e3, 1e3);  
     ASSERT_TOL(helmholtz_h(273.15+420,298.79,d), Z+2252.3e3, 1e3);  
262    
263      fprintf(stderr,"Tests completed OK (maximum error = %0.2f%%)\n",maxerr);      fprintf(stderr,"Tests completed OK (maximum error = %0.2f%%)\n",maxerr);
264      exit(0);      exit(0);
265  }  }
266  #endif  #endif
267    

Legend:
Removed from v.1837  
changed lines
  Added in v.1838

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