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

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

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

revision 2738 by jpye, Thu Dec 12 08:21:07 2013 UTC revision 2739 by jpye, Thu Dec 12 12:33:26 2013 UTC
# Line 34  Line 34 
34  #define CP0_DEBUG  #define CP0_DEBUG
35  #ifdef CP0_DEBUG  #ifdef CP0_DEBUG
36  # include "color.h"  # include "color.h"
37  # define MSG(FMT, ...) \  # define MSG FPROPS_MSG
     color_on(stderr,ASC_FG_BRIGHTRED);\  
     fprintf(stderr,"%s:%d: ",__FILE__,__LINE__);\  
     color_on(stderr,ASC_FG_BRIGHTBLUE);\  
     fprintf(stderr,"%s: ",__func__);\  
     color_off(stderr);\  
     fprintf(stderr,FMT "\n",##__VA_ARGS__)  
38  #else  #else
39  # define MSG(ARGS...) ((void)0)  # define MSG(ARGS...) ((void)0)
40  #endif  #endif
# Line 49  Line 43 
43    PREPARATION OF IDEAL RUNDATA from FILEDATA    PREPARATION OF IDEAL RUNDATA from FILEDATA
44  */  */
45    
46  /*  /**
47        This function prepares the ideal part of the helmholtz function, phi (\$f \phi = \frac{a}{R T}\f$).
48        If we have IdealData of type IDEAL_PHI0, then we just copy the data directly.
49        We assume that we don't need to normalise for Tstar or R in that case (it's
50        not even checked).
51    
52        If we have IdealData of type IDEAL_CP0, then we have to do some conversions
53        in order to be able to obtain the required internal $\f\ \phi(\tau,\delta) \$f
54        function required here. The complication is that in general, cp0 can be
55        expressed with different normalising parameter cp0star and Tstar than those
56        used for the residual part function. So in that case, we normalise to R and
57        Tstar which are provided as parameters to this function. Except it doesn't \
58        work correctly for Peng-Robinson or Ideal EOS yet.
59    
60      FIXME      FIXME
61    
62      we have changed the definition of the cp0 expression to cp/R = sum( c *T/T*)^t )      we have changed the definition of the cp0 expression to cp/R = sum( c *T/T*)^t )
# Line 62  Line 69 
69      TODO check if ^^^ is still true      TODO check if ^^^ is still true
70  */  */
71  Phi0RunData *cp0_prepare(const IdealData *I, double R, double Tstar){  Phi0RunData *cp0_prepare(const IdealData *I, double R, double Tstar){
72        MSG("Tstar = %f",Tstar);
73  #ifdef CP0_DEBUG  #ifdef CP0_DEBUG
74      if(I->type==IDEAL_CP0){      if(I->type==IDEAL_CP0){
75          MSG("R=%f,Tstar=%f (cp0 data: cp0star=%f, Tstar=%f)",R,Tstar,I->data.cp0.cp0star, I->data.cp0.Tstar);          MSG("R=%f,Tstar=%f (cp0 data: cp0star=%f, Tstar=%f)",R,Tstar,I->data.cp0.cp0star, I->data.cp0.Tstar);
# Line 81  Phi0RunData *cp0_prepare(const IdealData Line 89  Phi0RunData *cp0_prepare(const IdealData
89          N->ne = I->data.cp0.ne;          N->ne = I->data.cp0.ne;
90          Tred = I->data.cp0.Tstar;          Tred = I->data.cp0.Tstar;
91          cp0red = I->data.cp0.cp0star;          cp0red = I->data.cp0.cp0star;
92          //MSG("Preparing PHI0 data for ideal fluid (np = %d, ne = %d)",N->np, N->ne);          MSG("Preparing PHI0 data for ideal fluid (np = %d, ne = %d)",N->np, N->ne);
93          //MSG("Tred = %f, Tstar = %f", Tred, Tstar);          MSG("Tred = %f, Tstar = %f", Tred, Tstar);
94          //MSG("cp0red = %f, R = %f", cp0red, R);          MSG("cp0red = %f, R = %f", cp0red, R);
95    
96          for(i=0; i < N->np; ++i)if(I->data.cp0.pt[i].t == 0)add_const_term = 0;          for(i=0; i < N->np; ++i)if(I->data.cp0.pt[i].t == 0)add_const_term = 0;
97          //MSG("add_const_term = %d",add_const_term);          //MSG("add_const_term = %d",add_const_term);

Legend:
Removed from v.2738  
changed lines
  Added in v.2739

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