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

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

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

revision 2733 by jpye, Tue Dec 10 11:14:47 2013 UTC revision 2734 by jpye, Tue Dec 10 12:11:46 2013 UTC
# Line 62  PureFluid *ideal_prepare(const EosData * Line 62  PureFluid *ideal_prepare(const EosData *
62      P->data = FPROPS_NEW(FluidData);      P->data = FPROPS_NEW(FluidData);
63  #define D P->data  #define D P->data
64    
65      MSG("...");      //MSG("...");
66    
67      /* metadata */      /* metadata */
68      P->name = E->name;      P->name = E->name;
# Line 71  PureFluid *ideal_prepare(const EosData * Line 71  PureFluid *ideal_prepare(const EosData *
71    
72      switch(E->type){      switch(E->type){
73      case FPROPS_CUBIC:      case FPROPS_CUBIC:
74          MSG("Cubic");          //MSG("Cubic");
75          D->M = E->data.cubic->M;          D->M = E->data.cubic->M;
76          D->R = R_UNIVERSAL / D->M;          D->R = R_UNIVERSAL / D->M;
77          D->T_t = 0; /* TODO how will we flag this object so that sat.c doesn't try to solve? */          D->T_t = 0; /* TODO how will we flag this object so that sat.c doesn't try to solve? */
# Line 84  PureFluid *ideal_prepare(const EosData * Line 84  PureFluid *ideal_prepare(const EosData *
84          D->cp0 = cp0_prepare(E->data.cubic->ideal, D->R, D->Tstar);          D->cp0 = cp0_prepare(E->data.cubic->ideal, D->R, D->Tstar);
85          D->corr.helm = NULL;          D->corr.helm = NULL;
86    
87          MSG("ref0 type = %d", E->data.cubic->ref0.type);          //MSG("ref0 type = %d", E->data.cubic->ref0.type);
88          D->ref0 = E->data.cubic->ref0;          D->ref0 = E->data.cubic->ref0;
89          if(ref == NULL){          if(ref == NULL){
90              ref = &(E->data.cubic->ref);              ref = &(E->data.cubic->ref);
# Line 127  PureFluid *ideal_prepare(const EosData * Line 127  PureFluid *ideal_prepare(const EosData *
127  #undef FN  #undef FN
128  #undef D  #undef D
129    
130      MSG("Setting reference state...");      //MSG("Setting reference state...");
131      // set the reference point      // set the reference point
132      switch(ref->type){      switch(ref->type){
133      case FPROPS_REF_PHI0:      case FPROPS_REF_PHI0:
# Line 136  PureFluid *ideal_prepare(const EosData * Line 136  PureFluid *ideal_prepare(const EosData *
136          P->data->cp0->m = ref->data.phi0.m;          P->data->cp0->m = ref->data.phi0.m;
137          break;          break;
138      case FPROPS_REF_REF0:      case FPROPS_REF_REF0:
139          MSG("Applying ref0 reference state");          //MSG("Applying ref0 reference state");
140          switch(P->data->ref0.type){          switch(P->data->ref0.type){
141          case FPROPS_REF_TPHG:          case FPROPS_REF_TPHG:
142              {              {
143                  //MSG("TPHG");                  //MSG("TPHG");
144                  ReferenceState *ref0 = &(P->data->ref0);                  ReferenceState *ref0 = &(P->data->ref0);
145                  MSG("T0 = %f, p0 = %f, h0 = %f, g0 = %f",ref0->data.tphg.T0,ref0->data.tphg.p0,ref0->data.tphg.h0,ref0->data.tphg.g0);                  //MSG("T0 = %f, p0 = %f, h0 = %f, g0 = %f",ref0->data.tphg.T0,ref0->data.tphg.p0,ref0->data.tphg.h0,ref0->data.tphg.g0);
146                  FpropsError res = FPROPS_NO_ERROR;                  FpropsError res = FPROPS_NO_ERROR;
147                  double rho0 = ref0->data.tphg.p0 / P->data->R / ref0->data.tphg.T0;                  double rho0 = ref0->data.tphg.p0 / P->data->R / ref0->data.tphg.T0;
148                  double T0 = ref0->data.tphg.T0;                  double T0 = ref0->data.tphg.T0;
# Line 163  PureFluid *ideal_prepare(const EosData * Line 163  PureFluid *ideal_prepare(const EosData *
163    
164                  h0 = ideal_h(T0,rho0, P->data, &res);                  h0 = ideal_h(T0,rho0, P->data, &res);
165                  if(res)ERRMSG("error %d",res);                  if(res)ERRMSG("error %d",res);
166                  MSG("new h0(T0,rho0) = %f", h0);                  //MSG("new h0(T0,rho0) = %f", h0);
167                  double g0 = ideal_g(T0,rho0, P->data, &res);                  double g0 = ideal_g(T0,rho0, P->data, &res);
168                  if(res)ERRMSG("error %d",res);                  if(res)ERRMSG("error %d",res);
169                  MSG("new g0(T0,rho0) = %f", g0);                  //MSG("new g0(T0,rho0) = %f", g0);
170                  //MSG("DONE");                  //MSG("DONE");
171              }              }
172              break;              break;

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

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