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

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

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

revision 2109 by jpye, Mon Dec 7 01:53:33 2009 UTC revision 2110 by jpye, Mon Dec 7 04:13:05 2009 UTC
# Line 25  Line 25 
25  #define CARBONDIOXIDE_PC 73773e6  #define CARBONDIOXIDE_PC 73773e6
26  #define CARBONDIOXIDE_RHOC 467.6  #define CARBONDIOXIDE_RHOC 467.6
27    
28    #define CARBONDIOXIDE_TREF 298.15
29    #define CARBONDIOXIDE_PREF 103.325e3
30    
31  /**  /**
32      Ideal gas data for CO2      Ideal gas data for CO2
33  */  */
34  const IdealData ideal_data_carbondioxide = {  const IdealData ideal_data_carbondioxide = {
35      8.37304456 /* constant */      1.5759375242e+03/CARBONDIOXIDE_R /* constant, adjust to solve s */
36      , -3.70454304 /* linear */      , (-2.1189540883e+05 + 2.6222371192e+05)/CARBONDIOXIDE_TSTAR/CARBONDIOXIDE_R /* linear, adjust to solver h */
37      , CARBONDIOXIDE_TSTAR /* Tstar / [K] */      , CARBONDIOXIDE_TSTAR /* Tstar / [K] */
38      , CARBONDIOXIDE_R /* cpstar / [J/kgK] */      , CARBONDIOXIDE_R /* cpstar / [J/kgK] */
39      , 1 /* power terms */      , 1 /* power terms */
# Line 45  const IdealData ideal_data_carbondioxide Line 48  const IdealData ideal_data_carbondioxide
48          ,{1.04028922, 11.32384 * CARBONDIOXIDE_TSTAR}          ,{1.04028922, 11.32384 * CARBONDIOXIDE_TSTAR}
49          ,{0.08327678, 27.08792 * CARBONDIOXIDE_TSTAR}          ,{0.08327678, 27.08792 * CARBONDIOXIDE_TSTAR}
50      }      }
51  };  };
   
52    
53  /**  /**
54      Residual (non-ideal) property data for ,....      Residual (non-ideal) property data for ,....
# Line 66  const HelmholtzData helmholtz_data_carbo Line 68  const HelmholtzData helmholtz_data_carbo
68          ,{-0.55867188534934e01,  1.000,   1.00,    0}          ,{-0.55867188534934e01,  1.000,   1.00,    0}
69          ,{-0.76753199592477e00,  2.000,   1.00,    0}          ,{-0.76753199592477e00,  2.000,   1.00,    0}
70          ,{ 0.31729005580416e00,  0.750,   2.00,    0}          ,{ 0.31729005580416e00,  0.750,   2.00,    0}
71          ,{ 0.548033158977867e00,  2.000,   2.00,    0}          ,{ 0.54803315897767e00,  2.000,   2.00,    0}
72          ,{ 0.12279411220335e00,  0.750,   3.00,    0}          ,{ 0.12279411220335e00,  0.750,   3.00,    0}
73          ,{ 0.21658961543220e01,   1.500,   1.00,    1}          ,{ 0.21658961543220e01,   1.500,   1.00,    1}
74          ,{ 0.15841735109724e01,   1.500,   2.00,    1}          ,{ 0.15841735109724e01,   1.500,   2.00,    1}
# Line 181  int main(void){ Line 183  int main(void){
183          ASSERT_TOL(helmholtz_p, td[i].T, td[i].rho, d, p, p*2e-4);          ASSERT_TOL(helmholtz_p, td[i].T, td[i].rho, d, p, p*2e-4);
184      }      }
185    
186    #if 0
187        fprintf(stderr,"REFERENCE POINT CHECK\n");
188        /* solve rho to give p = PREF */
189        T = CARBONDIOXIDE_TREF;
190        rho = 100;
191        p = CARBONDIOXIDE_PREF;
192        double err;
193        for(i=0; i<100; ++i){
194            fprintf(stderr,"rho = %f\n", rho);
195            double dpdrho = helmholtz_dpdrho_T(T, rho, d);
196            err = helmholtz_p(T,rho,d) - CARBONDIOXIDE_PREF;
197            if(fabs(err) < 1e-6)break;
198            rho -= err/dpdrho;
199        }
200        if(fabs(err) < 1e-6){
201            fprintf(stderr,"err = %f -> T = %f, rho = %f --> p = %f\n", err, T, rho, helmholtz_p(T,rho,d));
202            fprintf(stderr,"h(Tref, pref) = %.10e\n", helmholtz_h(T,rho,d));
203            fprintf(stderr,"s(Tref, pref) = %.10e\n", helmholtz_s(T,rho,d));
204        }
205        exit(1);
206    #endif
207    
208      fprintf(stderr,"ENTHALPY TESTS\n");      fprintf(stderr,"ENTHALPY TESTS\n");
209      for(i=0; i<n;++i){      for(i=0; i<n;++i){
210          T = td[i].T+273.15;          T = td[i].T+273.15;

Legend:
Removed from v.2109  
changed lines
  Added in v.2110

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