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

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

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

revision 2733 by jpye, Mon Dec 9 11:06:00 2013 UTC revision 2734 by jpye, Tue Dec 10 12:11:46 2013 UTC
# Line 5  Line 5 
5  #include "../color.h"  #include "../color.h"
6    
7  extern const EosData eos_rpp_methane;  extern const EosData eos_rpp_methane;
8    extern const EosData eos_rpp_nitrogen;
9    extern const EosData eos_rpp_oxygen;
10    extern const EosData eos_rpp_carbon_dioxide;
11    extern const EosData eos_rpp_water;
12    
13  #include <assert.h>  #include <assert.h>
14  #include <math.h>  #include <math.h>
# Line 16  extern const EosData eos_rpp_methane; Line 20  extern const EosData eos_rpp_methane;
20  #define TOL_RHO 1e-3  #define TOL_RHO 1e-3
21    
22  int main(void){  int main(void){
     PureFluid *P;  
23      FpropsError err = FPROPS_NO_ERROR;      FpropsError err = FPROPS_NO_ERROR;
     FluidState S;  
24            
25      MSG("Testing ideal EOS");      MSG("Testing ideal EOS  ");
26    
27      ReferenceState ref = {FPROPS_REF_REF0};      ReferenceState ref = {FPROPS_REF_REF0};
28      P = ideal_prepare(&eos_rpp_methane, &ref); assert(P);      enum MyFluids{N2,O2,CO2,H2O,CH4,NFLUIDS};
29        PureFluid *P[NFLUIDS];
30        P[N2] = ideal_prepare(&eos_rpp_nitrogen, &ref);
31        P[O2] = ideal_prepare(&eos_rpp_oxygen, &ref);
32        P[CO2] = ideal_prepare(&eos_rpp_carbon_dioxide, &ref);
33        P[H2O] = ideal_prepare(&eos_rpp_water, &ref);
34        P[CH4] = ideal_prepare(&eos_rpp_methane, &ref);
35    
36        int i;
37        MSG("%-20s\t%s\t%s\t%s","comp","h(850 K)","h(1520 K)","Dh (kJ/kmol)");
38        for(i=0;i<NFLUIDS;++i){
39            double h0 = ideal_h(298.2, 0, P[i]->data, &err);
40            MSG("%-20s: hbar(298.2) = %f J/kmol",P[i]->name,h0*P[CH4]->data->M);
41        }
42    
43        MSG("%-20s\t%s\t%s\t%s","comp","h(850 K)","h(1520 K)","Dh (kJ/kmol)");
44        for(i=0;i<NFLUIDS;++i){
45            double h1 = ideal_h(850,1000,P[i]->data,&err);
46            double h2 = ideal_h(1520,1000,P[i]->data,&err);
47            double Dh = h2 - h1;
48            MSG("%-20s\t%f\t%f\t%f",P[i]->name,h1,h2,Dh);
49        }
50    
51    
52      fprintf(stderr,"\n");      fprintf(stderr,"\n");
53      color_on(stderr,ASC_FG_BRIGHTGREEN);      color_on(stderr,ASC_FG_BRIGHTGREEN);

Legend:
Removed from v.2733  
changed lines
  Added in v.2734

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