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

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

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

revision 1900 by jpye, Thu Sep 25 07:34:56 2008 UTC revision 1901 by jpye, Thu Sep 25 07:40:47 2008 UTC
# Line 97  int helm_run_test_cases(const HelmholtzD Line 97  int helm_run_test_cases(const HelmholtzD
97    
98  int helm_check_u(const HelmholtzData *d, unsigned ntd, const TestData *td){  int helm_check_u(const HelmholtzData *d, unsigned ntd, const TestData *td){
99      unsigned i;      unsigned i;
100      double T,rho,u,err,se,sse;      double T,rho,u,err,se = 0,sse = 0;
101      unsigned n = ntd;      unsigned n = ntd;
102      double tol = 1e-1;      double tol = 1e-1;
103    
104      fprintf(stderr,"INTERNAL ENERGY VALUES\n\n");      fprintf(stderr,"INTERNAL ENERGY VALUES\n\n");
105      fprintf(stderr,"%-18s\t%-18s\t%-18s\t%-18s\t%-18s\n","T","rho","u","du","%err");      fprintf(stderr,"%-18s\t%-18s\t%-18s\t%-18s\t%-18s\n","T","rho","u","du","%err");
106      for(i=0; i<n;++i){      for(i=0; i<n;++i){
         if(td[i].p < 1.0) continue;  
         if(td[i].p > 1.0) break;  
107          T = td[i].T+273.15;          T = td[i].T+273.15;
108          rho = td[i].rho;          rho = td[i].rho;
109          u = td[i].u*1e3;          u = td[i].u*1e3;
# Line 113  int helm_check_u(const HelmholtzData *d, Line 111  int helm_check_u(const HelmholtzData *d,
111          se += err;          se += err;
112          sse += err*err;          sse += err*err;
113          fprintf(stderr,"%.12e\t%.12e\t%.12e\t%.12e\t%.6f\n",T,rho,u,err,err/u*100.);          fprintf(stderr,"%.12e\t%.12e\t%.12e\t%.12e\t%.6f\n",T,rho,u,err,err/u*100.);
114        }
115        fprintf(stderr,"average error = %.10e\n",se/n);
116        fprintf(stderr,"sse - n se^2 = %.3e\n",sse - n*se*se);
117    }
118    
119          if(fabs(err)>fabs(u*tol)){  int helm_check_s(const HelmholtzData *d, unsigned ntd, const TestData *td){
120              fprintf(stderr,"ERROR, exceeded error tol %f%%\n",tol*100);      unsigned i;
121              exit(1);      double T,rho,s,err,se = 0,sse = 0;
122          }      unsigned n = ntd;
123        double tol = 1e-1;
124    
125        fprintf(stderr,"ENTROPY VALUES\n\n");
126        fprintf(stderr,"%-18s\t%-18s\t%-18s\t%-18s\t%-18s\n","T","rho","s","ds","%err");
127        for(i=0; i<n;++i){
128            T = td[i].T + 273.15;
129            rho = td[i].rho;
130            s = td[i].s*1e3;
131            err = s - helmholtz_s(T,rho,d);
132            se += err;
133            sse += err*err;
134            fprintf(stderr,"%.12e\t%.12e\t%.12e\t%.12e\t%.6f\n",T,rho,s,err,err/s*100.);
135      }      }
136      fprintf(stderr,"average error = %.10e\n",se/n);      fprintf(stderr,"average error = %.10e\n",se/n);
137      fprintf(stderr,"sse - n se^2 = %.3e\n",sse - n*se*se);      fprintf(stderr,"sse - n se^2 = %.3e\n",sse - n*se*se);

Legend:
Removed from v.1900  
changed lines
  Added in v.1901

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