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

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

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

revision 1839 by jpye, Thu Aug 28 09:20:11 2008 UTC revision 1840 by jpye, Fri Aug 29 03:52:04 2008 UTC
# Line 64  double helmholtz_p(double T, double rho, Line 64  double helmholtz_p(double T, double rho,
64      assert(!isnan(delta));      assert(!isnan(delta));
65      assert(!isnan(data->R));      assert(!isnan(data->R));
66    
67      fprintf(stderr,"p calc: T = %f\n",T);      //fprintf(stderr,"p calc: T = %f\n",T);
68      fprintf(stderr,"p calc: tau = %f\n",tau);      //fprintf(stderr,"p calc: tau = %f\n",tau);
69      fprintf(stderr,"p calc: rho = %f\n",rho);      //fprintf(stderr,"p calc: rho = %f\n",rho);
70      fprintf(stderr,"p calc: delta = %f\n",delta);      //fprintf(stderr,"p calc: delta = %f\n",delta);
71      fprintf(stderr,"p calc: R*T*rho = %f\n",data->R * T * rho);      //fprintf(stderr,"p calc: R*T*rho = %f\n",data->R * T * rho);
72  #endif  #endif
73            
74      return data->R * T * rho * (1. + delta * helm_resid_del(tau,delta,data));      return data->R * T * rho * (1. + delta * helm_resid_del(tau,delta,data));
# Line 311  double helm_resid_del(double tau,double Line 311  double helm_resid_del(double tau,double
311      sum = 0;      sum = 0;
312      XdelX = 0;      XdelX = 0;
313      for(i=0; i<n; ++i){      for(i=0; i<n; ++i){
314          fprintf(stderr,"i = %d, a = %e, t = %f, d = %d, l = %d\n",i+1, pt->a, pt->t, pt->d, pt->l);          //fprintf(stderr,"i = %d, a = %e, t = %f, d = %d, l = %d\n",i+1, pt->a, pt->t, pt->d, pt->l);
315          sum += pt->a * pow(tau, pt->t) * ipow(delta, pt->d - 1) * (pt->d - XdelX);          sum += pt->a * pow(tau, pt->t) * pow(delta, pt->d - 1) * (pt->d - XdelX);
316          ++pt;          ++pt;
317          //fprintf(stderr,"l = %d\n",l);          //fprintf(stderr,"l = %d\n",l);
318          if(i+1==n || l != pt->l){          if(i+1==n || l != pt->l){
319              if(l==0){              if(l==0){
320                  //fprintf(stderr,"Adding non-exp term\n");                  //fprintf(stderr,"Adding non-exp term\n");
321                  fprintf(stderr,"sum = %f\n",sum);                  //fprintf(stderr,"sum = %f\n",sum);
322                  res += sum;                  res += sum;
323              }else{              }else{
324                  //fprintf(stderr,"Adding exp term with l = %d, delX = %e\n",l,delX);                  //fprintf(stderr,"Adding exp term with l = %d, delX = %e\n",l,delX);
325                  fprintf(stderr,"sum = %f\n",sum);                  //fprintf(stderr,"sum = %f\n",sum);
326                  res += sum * exp(-delX);                  res += sum * exp(-delX);
327              }              }
328              /* set l to new value */              /* set l to new value */
# Line 336  double helm_resid_del(double tau,double Line 336  double helm_resid_del(double tau,double
336          }          }
337      }      }
338    
339    #if 0
340      /* now the exponential terms */      /* now the exponential terms */
341      n = data->ne;      n = data->ne;
342      et = &(data->et[0]);      et = &(data->et[0]);
# Line 358  double helm_resid_del(double tau,double Line 359  double helm_resid_del(double tau,double
359          res += sum;          res += sum;
360          ++et;          ++et;
361      }      }
362    #endif
363    
364      return res;      return res;
365  }  }

Legend:
Removed from v.1839  
changed lines
  Added in v.1840

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