/[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 1881 by jpye, Thu Sep 18 13:10:28 2008 UTC revision 1882 by jpye, Thu Sep 18 13:33:46 2008 UTC
# Line 33  by NIST in its program REFPROP 7.0. */ Line 33  by NIST in its program REFPROP 7.0. */
33  #define NITROGEN_TSTAR 126.192  #define NITROGEN_TSTAR 126.192
34    
35  const IdealData ideal_data_nitrogen = {  const IdealData ideal_data_nitrogen = {
36      -12.76953      -12.76953 +(8.66460942220E-4)/NITROGEN_R
37      , -0.007841630 /* -1011666.23/NITROGEN_R/NITROGEN_TSTAR */      , -0.007841630
38      , NITROGEN_TSTAR /* Tstar */      , NITROGEN_TSTAR /* Tstar */
39      , NITROGEN_R /* cp0star */      , NITROGEN_R /* cp0star */
40      , 4 /* power terms */      , 4 /* power terms */
# Line 263  int main(void){ Line 263  int main(void){
263          ASSERT_TOL(helmholtz_p, T, rho, d, p, p*1e-6);          ASSERT_TOL(helmholtz_p, T, rho, d, p, p*1e-6);
264      }      }
265    
266  #if 1  #if 0
267      /* can only use this check if c,m haven't been offset from original */      /* can only use this check if c,m haven't been offset from original */
268      fprintf(stderr,"CONSISTENCY TESTS (with handwritten phi0 expr)\n");      fprintf(stderr,"CONSISTENCY TESTS (with handwritten phi0 expr)\n");
269      for(i=10;i<n;++i){      for(i=10;i<n;++i){
# Line 282  int main(void){ Line 282  int main(void){
282          ASSERT_TOL(helm_ideal_tau,tau,del, d->ideal, p0t, p0t*1e-3);          ASSERT_TOL(helm_ideal_tau,tau,del, d->ideal, p0t, p0t*1e-3);
283    
284      }      }
     exit(0);  
285  #endif  #endif
286    
287    
# Line 292  int main(void){ Line 291  int main(void){
291          rho = td[i].rho;          rho = td[i].rho;
292          u = td[i].u*1e3;          u = td[i].u*1e3;
293          //fprintf(stderr,"%.20e\t%.20e\t%.20e\n",T,rho,(u - helmholtz_u(T,rho,d)));          //fprintf(stderr,"%.20e\t%.20e\t%.20e\n",T,rho,(u - helmholtz_u(T,rho,d)));
294          ASSERT_TOL(helmholtz_u, td[i].T+273.15, td[i].rho, d, u, u*1e-3);          ASSERT_TOL(helmholtz_u, td[i].T+273.15, td[i].rho, d, u, u*1e-6);
295      }      }
     //exit(1);  
296    
297      fprintf(stderr,"ENTROPY TESTS\n");      fprintf(stderr,"ENTROPY TESTS\n");
298        double se = 0, sse = 0;
299      for(i=0; i<n;++i){      for(i=0; i<n;++i){
300          T = td[i].T+273.15;          T = td[i].T+273.15;
301          rho = td[i].rho;          rho = td[i].rho;
302          s = td[i].s*1e3;          s = td[i].s*1e3;
303          fprintf(stderr,"%.20e\t%.20e\t%.20e\n",T,rho,(s - helmholtz_s(T,rho,d)));          double err = s - helmholtz_s(T,rho,d);
304          //ASSERT_TOL(helmholtz_s, T, rho, d, s, 1e-3*s);          se += err;
305            sse += err*err;
306            //fprintf(stderr,"%.20e\t%.20e\t%.20e\n",T,rho,(s - helmholtz_s(T,rho,d)));
307            ASSERT_TOL(helmholtz_s, T, rho, d, s, 1e-6*s);
308      }      }
309      exit(1);      //fprintf(stderr,"average error = %.10e\n",se/n);
310        //fprintf(stderr,"sse - n se^2 = %.3e\n",sse - n*se*se);
311        //exit(1);
312    
313      fprintf(stderr,"HELMHOLTZ ENERGY TESTS\n");      fprintf(stderr,"HELMHOLTZ ENERGY TESTS\n");
314      for(i=0; i<n;++i){      for(i=0; i<n;++i){
315          T = td[i].T+273.15;          T = td[i].T+273.15;
316          rho = td[i].rho;          rho = td[i].rho;
317          a = td[i].a*1e3;          a = td[i].a*1e3;
318          fprintf(stderr,"%.20e\t%.20e\t%.20e\n",T,rho,(a - helmholtz_a(T,rho,d)));          //fprintf(stderr,"%.20e\t%.20e\t%.20e\n",T,rho,(a - helmholtz_a(T,rho,d)));
319          //ASSERT_TOL(helmholtz_a, T, rho, d, a, a*1e-3);          ASSERT_TOL(helmholtz_a, T, rho, d, a, a*1e-6);
320      }      }
321      exit(1);      //exit(1);
322    
323      fprintf(stderr,"ENTHALPY TESTS\n");      fprintf(stderr,"ENTHALPY TESTS\n");
324      for(i=0; i<n;++i){      for(i=0; i<n;++i){

Legend:
Removed from v.1881  
changed lines
  Added in v.1882

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