/[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 1904 by jpye, Thu Sep 25 07:40:47 2008 UTC revision 1905 by jpye, Sat Sep 27 04:54:12 2008 UTC
# Line 137  int helm_check_s(const HelmholtzData *d, Line 137  int helm_check_s(const HelmholtzData *d,
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);
138  }  }
139    
140    int helm_check_p_T(const HelmholtzData *d, unsigned ntd, const TestData *td){
141        unsigned i;
142        double T,rho,p,T1,p1,dpdT,dpdT_est,err,se = 0,sse = 0;
143        unsigned n = ntd;
144        double tol = 1e-1;
145    
146        double dT = 0.01 /* finite difference in temperature, in K */;
147    
148        fprintf(stderr,"(dP/dT)_rho RESULTS\n\n");
149        fprintf(stderr,"%-18s\t%-18s\t%-18s\t%-18s\t%-18s\t%-18s\n","T","rho","p","dp/dT","dp/dT est","%err");
150        for(i=0; i<n;++i){
151            T = td[i].T + 273.15;
152            rho = td[i].rho;
153            p = helmholtz_p(T,rho,d);
154            dpdT = helmholtz_dpdT_rho(T,rho,d);
155            T1 = T + dT;
156            p1 = helmholtz_p(T1, rho, d);
157            dpdT_est = (p1 - p)/dT;
158            err = (dpdT_est - dpdT);
159            se += err;
160            sse += err*err;
161            fprintf(stderr,"%.12e\t%.12e\t%.12e\t%.12e\t%.12e\t%.6e\t%.2e\n",T,rho,p,dpdT,dpdT_est,err,err/dpdT*100);
162        }
163        fprintf(stderr,"average error = %.10e\n",se/n);
164        fprintf(stderr,"sse - n se^2 = %.3e\n",sse - n*se*se);
165    }      
166    

Legend:
Removed from v.1904  
changed lines
  Added in v.1905

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