# Diff of /branches/sid/models/johnpye/fprops/test/test_ttse.c

revision 3024 by sid, Thu Jul 23 04:16:35 2015 UTC revision 3025 by sid, Thu Jul 23 18:43:12 2015 UTC
# Line 54  int main(void){ Line 54  int main(void){
54
55      double rho = 1000;      double rho = 1000;
56
57  /* //Plot in Mathematica Saturation dome  //Plot in Mathematica Saturation dome
#define SPOINTS 1000

double Tt = P->data->T_t;
double Tc = P->data->T_c;
double dt2p = (Tc - Tt)/SPOINTS;
58
59      printf("{");      printf("{");
60      for(i=0;i<SPOINTS+1;i++)      for(i=0;i<NSAT;i++)
61      {      {
62          double T = Tt + i*dt2p;          double Tt = P->data->T_t;
63            double Tc = P->data->T_c;
64            double dt2p = (Tc - Tt)/NSAT;
65            double T = Tt + (i+0.1)*dt2p;
66          double psat, rhof,rhog;          double psat, rhof,rhog;
67          fprops_sat_T(T,&psat,&rhof,&rhog,P,&err);          fprops_sat_T(T,&psat,&rhof,&rhog,P,&err);
68
69          if(i!= SPOINTS)          int j = (int)round(  ((T - Tt)/(Tc - Tt))*(NSAT)  );
70              printf("{%f, %f, %f},\n",T, rhof,rhog);          double delt = T - ( Tt + j*dt2p);
71          else          double rhofT,rhogT;
72              printf("{%f, %f, %f}};\n",T, rhof,rhog);          rhofT =   P->table->satFRho[j] + delt*P->table->satFdRhodt[j]+ 0.5*delt*delt*P->table->satFd2RhodT2[j];
73            rhogT =   P->table->satGRho[j] + delt*P->table->satGdRhodt[j]+ 0.5*delt*delt*P->table->satGd2RhodT2[j];
74
75            MSG("%f %f  %f  %f  %f  %f  %f", delt,rhof,rhofT,rhog,rhogT, 100*(rhof-rhofT)/rhof,100*(rhog-rhogT)/rhog );
76           // if(i!= SPOINTS)
77           //     printf("{%f, %f, %f},\n",T, rhof,rhog);
78           // else
79            //    printf("{%f, %f, %f}};\n",T, rhof,rhog);
80      }      }
81
82      exit(1);      exit(1);
*/
83
84
85
86
87
88  /*****************************************Two Phase Table Testing*****************************************/  /*****************************************Two Phase Table Testing*****************************************/
89    /*
90      double Tt = P->data->T_t;      double Tt = P->data->T_t;
91      double Tc = P->data->T_c;      double Tc = P->data->T_c;
92      double t = Tc - 53.341233;      double t = Tc - 53.341233;
93      double psat, rhof,rhog;      double psat, rhof,rhog;
94      fprops_sat_T(t,&psat,&rhof,&rhog,P,&err);      fprops_sat_T(t,&psat,&rhof,&rhog,P,&err);
95      double dT = (Tc-Tt)/NSAT;      double dt = (Tc-Tt)/NSAT;
96      i = (int)round(((t - Tt)/(Tc - Tt)*(NSAT-1)));      i = (int)round(((t - Tt)/(Tc - Tt)*(NSAT-1)));
97      double delt = t - ( Tt + i*dT);      double delt = t - ( Tt + i*dt);
98
99      double rhofT,rhogT;      double rhofT,rhogT;
100      rhofT =   P->table->satFRho[i] + delt*P->table->satFdRhodt[i];// + 0.5*delt*delt*P->table->satFd2RhodT2[i];      rhofT =   P->table->satFRho[i] + delt*P->table->satFdRhodt[i];// + 0.5*delt*delt*P->table->satFd2RhodT2[i];
101      rhogT =   P->table->satGRho[i] + delt*P->table->satGdRhodt[i];// + 0.5*delt*delt*P->table->satGd2RhodT2[i];      rhogT =   P->table->satGRho[i] + delt*P->table->satGdRhodt[i];// + 0.5*delt*delt*P->table->satGd2RhodT2[i];
102
103      MSG("SAT TEST ::: %f   %f",100*(rhof-rhofT)/rhof,100*(rhog-rhogT)/rhog);      MSG("SAT TEST ::: %f   %f",100*(rhof-rhofT)/rhof,100*(rhog-rhogT)/rhog);
104    */
105  /*****************************************Single Phase Table Testing*****************************************/  /*****************************************Single Phase Table Testing*****************************************/
106      #define NPOINTS 100000      #define NPOINTS 100000
107      double temp_s = 650;      double temp_s = 650;
108      double temp_f = 1650;      double temp_f = 1650;
109      int nT = NPOINTS;      int nT = NPOINTS;
110      dT = (temp_f-temp_s)/nT;      double dT = (temp_f-temp_s)/nT;
111
112
113      double pressH[NPOINTS],enthalpyH[NPOINTS];      double pressH[NPOINTS],enthalpyH[NPOINTS];

Legend:
 Removed from v.3024 changed lines Added in v.3025