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

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

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

revision 2773 by jpye, Thu Mar 27 09:21:24 2014 UTC revision 2774 by jpye, Thu Mar 27 11:42:30 2014 UTC
# Line 40  Line 40 
40    
41  void thcond_prepare(PureFluid *P, const ThermalConductivityData *K, FpropsError *err){  void thcond_prepare(PureFluid *P, const ThermalConductivityData *K, FpropsError *err){
42      MSG("Preparing thermal conductivity: currently we are just reusing the FileData pointer; no changes");      MSG("Preparing thermal conductivity: currently we are just reusing the FileData pointer; no changes");
43      P->thcond = K;      MSG("K.type: %d",K->type);
44            MSG("K.source: %s",K->source);
45        switch(K->type){
46        case FPROPS_THCOND_1:
47            MSG("K.data.k1.nc: %d",K->data.k1.nc);
48            P->thcond = K;
49            MSG("P.thcond.type = %d",P->thcond->type);
50            return;
51        case FPROPS_THCOND_NONE:
52            *err = FPROPS_NOT_IMPLEMENTED;
53            return;
54        }
55  }  }
56    
57  /*-----------------------------IDEAL PART ------------------------------------*/  /*-----------------------------IDEAL PART ------------------------------------*/
# Line 49  void thcond_prepare(PureFluid *P, const Line 59  void thcond_prepare(PureFluid *P, const
59  static double thcond1_cs(const ThermalConductivityData1 *K, double Tstar){  static double thcond1_cs(const ThermalConductivityData1 *K, double Tstar){
60      double res = 0;      double res = 0;
61      int i;      int i;
62      //MSG("Tstar = %f (1/Tstar = %f)",Tstar,1/Tstar);      MSG("K: %p",K);
63        MSG("Tstar = %f (1/Tstar = %f)",Tstar,1/Tstar);
64        MSG("nc = %d",K->nc);
65      for(i=0; i < K->nc; ++i){      for(i=0; i < K->nc; ++i){
66          //MSG("b[%d] = %e, i = %d, term = %f",i,K->ct[i].b, K->ct[i].i, K->ct[i].b * pow(Tstar, K->ct[i].i));          //MSG("b[%d] = %e, i = %d, term = %f",i,K->ct[i].b, K->ct[i].i, K->ct[i].b * pow(Tstar, K->ct[i].i));
67          res += K->ct[i].b * pow(Tstar, K->ct[i].i);          res += K->ct[i].b * pow(Tstar, K->ct[i].i);
68      }      }
69      //MSG("res = %f",res);      MSG("res = %f",res);
70      return res;      return res;
71  }  }
72    
# Line 63  double thcond1_lam0(FluidState state, Fp Line 75  double thcond1_lam0(FluidState state, Fp
75      const ThermalConductivityData1 *k1 = &(state.fluid->thcond->data.k1);      const ThermalConductivityData1 *k1 = &(state.fluid->thcond->data.k1);
76      double lam0 = 0;      double lam0 = 0;
77    
78        MSG("k1: %p",k1);
79    
80      // TODO FIXME need to re-factor this to be standardised and only use data from filedata.h structures.      // TODO FIXME need to re-factor this to be standardised and only use data from filedata.h structures.
81    
82      if(0==strcmp(state.fluid->name,"carbondioxide")){      if(0==strcmp(state.fluid->name,"carbondioxide")){
83          //MSG("lam0 for carbondioxide");          MSG("lam0 for carbondioxide");
84    
85  //#define USE_CP0_FOR_LAM0  //#define USE_CP0_FOR_LAM0
86  #ifdef USE_CP0_FOR_LAM0  #ifdef USE_CP0_FOR_LAM0
# Line 178  double thcond1_lamc(FluidState state, Fp Line 192  double thcond1_lamc(FluidState state, Fp
192          *err = FPROPS_INVALID_REQUEST;          *err = FPROPS_INVALID_REQUEST;
193          return NAN;          return NAN;
194      }      }
195      const ThermalConductivityData1 *k1 = &(state.fluid->thcond->data.k1);      //const ThermalConductivityData1 *k1 = &(state.fluid->thcond->data.k1);
196    
197      /* parameters specific to CO2 */      /* parameters specific to CO2 */
198      double qt_D = 4.0e-10; // [m]      double qt_D = 4.0e-10; // [m]
# Line 250  double thcond1_lamc(FluidState state, Fp Line 264  double thcond1_lamc(FluidState state, Fp
264    
265  /*----------------------------------OVERALL RESULT----------------------------*/  /*----------------------------------OVERALL RESULT----------------------------*/
266    
267  double thcond1_k(FluidState state, FpropsError *err){  double thcond1_lam(FluidState state, FpropsError *err){
268      // if we are here, we should be able to assume that state, should be able to remove following test (convert to assert)      // if we are here, we should be able to assume that state, should be able to remove following test (convert to assert)
269      if(state.fluid->thcond->type != FPROPS_THCOND_1){      if(state.fluid->thcond->type != FPROPS_THCOND_1){
270          *err = FPROPS_INVALID_REQUEST;          *err = FPROPS_INVALID_REQUEST;

Legend:
Removed from v.2773  
changed lines
  Added in v.2774

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