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

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

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

revision 1984 by jpye, Sat Sep 27 03:32:21 2008 UTC revision 1985 by jpye, Tue Feb 3 01:15:17 2009 UTC
# Line 112  const HelmholtzData helmholtz_data_water Line 112  const HelmholtzData helmholtz_data_water
112          ,{0.31777497330738, 46, 6, 6}          ,{0.31777497330738, 46, 6, 6}
113          ,{-0.11841182425981, 50, 6, 6}          ,{-0.11841182425981, 50, 6, 6}
114      }      }
115      , 0, 0 /* no gaussian terms (YET -- NEED TO BE ADDED */      , 3 /* gaussian terms */
116      , 0, 0 /* no critical terms (YET -- NEED TO BE ADDED */      , (const HelmholtzGausTerm[]){
117            /* n, t, d, alpha, beta, gamma, epsilon */
118            {-0.31306260323435E2, 0, 3, 20, 150, 1.21, 1}
119            ,{0.31546140237781E2, 1, 3, 20, 150, 1.21, 1}
120            ,{-0.25213154341695E4,4, 3, 20, 250, 1.25, 1}
121        }
122        , 2 /* critical terms */
123        , (const HelmholtzCritTerm[]){
124            /* n, a, b, beta, A, B, C, D */
125            {-0.14874640856724, 3.5, 0.85, 0.3, 0.32, 0.2, 28, 700}
126            ,{0.31806110878444, 3.5, 0.95, 0.3, 0.32, 0.2, 32, 800}
127        }
128  };  };
129    
130    
# Line 157  enum Limits{ Line 168  enum Limits{
168  #include <stdio.h>  #include <stdio.h>
169  #include <math.h>  #include <math.h>
170  #include "ideal_impl.h"  #include "ideal_impl.h"
171    #include "helmholtz_impl.h"
172    
173  double phi0(const double delta, const double tau){  double phi0(const double delta, const double tau){
174      int i;      int i;
# Line 190  int main(void){ Line 202  int main(void){
202              );\              );\
203              exit(1);\              exit(1);\
204          }else{\          }else{\
205              fprintf(stderr,"    OK, %s(%f,%f,%s) = %8.2e with %.6f%% err.\n"\              fprintf(stderr,"    OK, %s(%f,%f,%s) = %8.2e with %.8f%% err.\n"\
206                  ,#FN,PARAM1,PARAM2,#PARAM3,VAL,relerrpc\                  ,#FN,PARAM1,PARAM2,#PARAM3,VAL,relerrpc\
207              );\              );\
208          }\          }\
# Line 208  int main(void){ Line 220  int main(void){
220          }          }
221      }      }
222    
223        fprintf(stderr,"IAPWS95 TABLE 6 TESTS\n");
224        T = 500.; /* K */
225        rho = 838.025; /* kg/m³ */
226        double tau = d->T_star / T;
227        double delta = rho / d->rho_star;
228    
229        ASSERT_TOL(helm_ideal, tau, delta, d->ideal, 0.204797733E1, 1e-6);
230        ASSERT_TOL(helm_ideal_tau, tau, delta, d->ideal, 0.904611106E1, 1e-6);
231        ASSERT_TOL(HELM_IDEAL_DELTAU, tau, delta, d->ideal, 0., 1e-6);
232        
233        double phitt = helm_ideal_tautau(tau, d->ideal);
234        double val = (-0.193249185E1);
235        double err = phitt - val;
236        if(fabs(err) > 1e-6){
237            fprintf(stderr,"ERROR in helm_ideal_tautau near line %d\n",__LINE__);
238            exit(1);
239        }else{
240            fprintf(stderr,"    OK, helm_ideal_tautau(%f) = %8.2e with %.6f%% err.\n"
241                ,tau,val,err/val*100.
242            );
243        }
244    
245        /* FIXME still need to implement helm_ideal_del, helm_ideal_deldel, helm_ideal_deltau */
246    
247        ASSERT_TOL(helm_resid, tau, delta, d, -0.342693206E1, 1e-8);
248        ASSERT_TOL(helm_resid_del, tau, delta, d, -0.364366650, 1e-8);
249        ASSERT_TOL(helm_resid_deldel, tau, delta, d, 0.856063701, 1e-8);
250        ASSERT_TOL(helm_resid_tau, tau, delta, d, -0.581403435E1, 1e-8);
251        ASSERT_TOL(helm_resid_tautau, tau, delta, d, -0.223440737E1, 1e-8);
252        ASSERT_TOL(helm_resid_deltau, tau, delta, d, -0.112176915e1, 1e-8);
253    
254      fprintf(stderr,"Tests completed OK (maximum error = %0.2f%%)\n",maxerr);      fprintf(stderr,"Tests completed OK (maximum error = %0.2f%%)\n",maxerr);
255      exit(0);      exit(0);
256  }  }

Legend:
Removed from v.1984  
changed lines
  Added in v.1985

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