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

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

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

revision 2666 by jpye, Mon Jan 21 06:23:14 2013 UTC revision 2667 by jpye, Mon Jan 21 06:54:33 2013 UTC
# Line 512  double pengrob_sat(double T,double *rhof Line 512  double pengrob_sat(double T,double *rhof
512      double Zg, Z1, Zf, vg, vf;      double Zg, Z1, Zf, vg, vf;
513      double oldfratio = 1e9;      double oldfratio = 1e9;
514    
515    #ifdef PR_DEBUG
516      FILE *F1 = fopen("pf.txt","w");      FILE *F1 = fopen("pf.txt","w");
517    #endif
518    
519      // FIXME test upper iteration limit required      // FIXME test upper iteration limit required
520      while(++i < 200){      while(++i < 200){
# Line 563  double pengrob_sat(double T,double *rhof Line 565  double pengrob_sat(double T,double *rhof
565                  *rhog_ret = 1 / vg;                  *rhog_ret = 1 / vg;
566                  p = pengrob_p(T, *rhog_ret, data, err);                  p = pengrob_p(T, *rhog_ret, data, err);
567                  MSG("Solved for T = %f: p = %f, rhof = %f, rhog = %f", T, p, *rhof_ret, *rhog_ret);                  MSG("Solved for T = %f: p = %f, rhof = %f, rhog = %f", T, p, *rhof_ret, *rhog_ret);
568    #ifdef PR_DEBUG
569                  fclose(F1);                  fclose(F1);
570    #endif
571                  return p;                  return p;
572              }              }
573    #ifdef PR_DEBUG
574              fprintf(F1,"%f\t%f\t%f\n",p,ff,fg);              fprintf(F1,"%f\t%f\t%f\n",p,ff,fg);
575    #endif
576              if(fratio > oldfratio){              if(fratio > oldfratio){
577                  MSG("fratio increased!");                  MSG("fratio increased!");
578                  //fratio = 0.5 + 0.5*fratio;                  //fratio = 0.5 + 0.5*fratio;
# Line 583  double pengrob_sat(double T,double *rhof Line 589  double pengrob_sat(double T,double *rhof
589              p = MidpointPressureCubic(T, data, err);              p = MidpointPressureCubic(T, data, err);
590              if(*err){              if(*err){
591                  ERRMSG("Failed to solve for a midpoint pressure");                  ERRMSG("Failed to solve for a midpoint pressure");
592    #ifdef PR_DEBUG
593                  fclose(F1);                  fclose(F1);
594    #endif
595                  return p;                  return p;
596              }              }
597              MSG("    single root: Z = %f. new pressure guess: %f", Zf, p);              MSG("    single root: Z = %f. new pressure guess: %f", Zf, p);
# Line 591  double pengrob_sat(double T,double *rhof Line 599  double pengrob_sat(double T,double *rhof
599      }      }
600      MSG("Did not converge");      MSG("Did not converge");
601      *err = FPROPS_SAT_CVGC_ERROR;      *err = FPROPS_SAT_CVGC_ERROR;
602    #ifdef PR_DEBUG
603      fclose(F1);      fclose(F1);
604    #endif
605      return 0;      return 0;
606  }  }
607    

Legend:
Removed from v.2666  
changed lines
  Added in v.2667

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