/[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 2770 by jpye, Thu Mar 27 08:36:59 2014 UTC revision 2771 by jpye, Thu Mar 27 09:17:10 2014 UTC
# Line 162  double thcond1_chitilde(FluidState state Line 162  double thcond1_chitilde(FluidState state
162      double p_c = state.fluid->data->p_c;      double p_c = state.fluid->data->p_c;
163      double rho_c = state.fluid->data->rho_c;      double rho_c = state.fluid->data->rho_c;
164      double T_c = state.fluid->data->T_c;      double T_c = state.fluid->data->T_c;
165        MSG("p_c = %e, rho_c = %f",p_c, rho_c);
166      /* FIXME we use dpdrho_T directly; assume that we have checked if we're in two-phase region or not */      /* FIXME we use dpdrho_T directly; assume that we have checked if we're in two-phase region or not */
167      double dpdrho_T = (*(state.fluid->dpdrho_T_fn))(state.T, state.rho, state.fluid->data, err);      double dpdrho_T = (*(state.fluid->dpdrho_T_fn))(state.T, state.rho, state.fluid->data, err);
168      //MSG("drhodp_T = %e",1/dpdrho_T);      MSG("dpdrho_T = %f",dpdrho_T);
169    
170      double chitilde = p_c * state.rho / SQ(rho_c) / dpdrho_T;      double chitilde = p_c * state.rho / SQ(rho_c) / dpdrho_T;
171      //MSG("chitilde = %f",chitilde);      MSG("chitilde(T=%f,rho=%f) = %f",state.T,state.rho,chitilde);
172      return chitilde;      return chitilde;
173  }  }
174    
# Line 195  double thcond1_lamc(FluidState state, Fp Line 196  double thcond1_lamc(FluidState state, Fp
196    
197      /* use the cp/cv functions directly, to avoid bothering with saturation boundary checks (ie assume we're outside saturation region?) */      /* use the cp/cv functions directly, to avoid bothering with saturation boundary checks (ie assume we're outside saturation region?) */
198      double cp = (*(state.fluid->cp_fn))(state.T, state.rho, state.fluid->data, err);      double cp = (*(state.fluid->cp_fn))(state.T, state.rho, state.fluid->data, err);
199      double cv = (*(state.fluid->cp_fn))(state.T, state.rho, state.fluid->data, err);      double cv = (*(state.fluid->cv_fn))(state.T, state.rho, state.fluid->data, err);
200            
201        MSG("cp = %f",cp);
202        MSG("cv = %f",cv);
203    
204  #if 0  #if 0
205      double T_orig = state.T;      double T_orig = state.T;
206      if(T_orig >= 445.){      if(T_orig >= 445.){
# Line 204  double thcond1_lamc(FluidState state, Fp Line 208  double thcond1_lamc(FluidState state, Fp
208      }      }
209  #endif  #endif
210      FluidState state_r = state;      FluidState state_r = state;
211      state_r.T = 445.;      state_r.T = T_ref;
212      MSG("state_r: T=%f, rho=%f",state_r.T, state_r.rho);      MSG("state_r: T=%f, rho=%f",state_r.T, state_r.rho);
213      MSG("chitilde(state) = %e", thcond1_chitilde(state,err));      //MSG("chitilde(state) = %e", thcond1_chitilde(state,err));
214      MSG("chitilde(state_r) = %e", thcond1_chitilde(state_r,err));      //MSG("chitilde(state_r) = %e", thcond1_chitilde(state_r,err));
215      //MSG("chitilde(state_r)*T_ref/T = %e", thcond1_chitilde(state_r,err)*T_ref/state.T);      //MSG("chitilde(state_r)*T_ref/T = %e", thcond1_chitilde(state_r,err)*T_ref/state.T);
216            
217      double brackterm = (thcond1_chitilde(state,err) - thcond1_chitilde(state_r,err) * T_ref / state.T) / Gamma;      double brackterm = (thcond1_chitilde(state,err) - thcond1_chitilde(state_r,err) * T_ref / state.T) / Gamma;
# Line 218  double thcond1_lamc(FluidState state, Fp Line 222  double thcond1_lamc(FluidState state, Fp
222          MSG("brackterm<=0 -> lamc = 0");          MSG("brackterm<=0 -> lamc = 0");
223      }else{      }else{
224          double xi = xi0 * pow(brackterm, nu/gamma); /* m */          double xi = xi0 * pow(brackterm, nu/gamma); /* m */
225            MSG("xi = %e",xi)
226          ASSERT(!isnan(xi));          ASSERT(!isnan(xi));
227  #if 0  #if 0
228          if(T_orig >= 445.){          if(T_orig >= 445.){
# Line 226  double thcond1_lamc(FluidState state, Fp Line 231  double thcond1_lamc(FluidState state, Fp
231          MSG("xi = %f",xi);          MSG("xi = %f",xi);
232  #endif  #endif
233    
234          double xioq; /* = xi / qt_D */          double xioq = xi / qt_D;
235            MSG("xioq = %f",xioq);
236    
237          //double xi = thcond1_xi(state, err);          //double xi = thcond1_xi(state, err);
238          double rho_c = state.fluid->data->rho_c;          double rho_c = state.fluid->data->rho_c;
239          double Omegatilde = 2/PI * ( (cp-cv)/cp * atan(xioq) + cv/cp*xioq);          double Omegatilde = 2/PI *( ((cp-cv)/cp) * atan(xioq) + (cv/cp)*xioq);
240          double Omegatilde_0 = 2/PI * (1 - exp(-1/(1./xioq + 1./3*SQ(xioq)*SQ(rho_c/state.rho))));          double Omegatilde_0 = 2/PI * (1 - exp(-1/(1./xioq + 1./3*SQ(xioq)*SQ(rho_c/state.rho))));
241            MSG("Omegatilde = %e",Omegatilde);
242            MSG("Omegatilde_0 = %e",Omegatilde_0);
243    
244          double mu = visc1_mu(state, err); /* TODO ensure visc1_mu excludes crit enhancement! */          double mu = visc1_mu(state, err); /* TODO ensure visc1_mu excludes crit enhancement! */
245    
246          lamc = k1->k_star * state.rho * cp * R_0 * K_BOLTZMANN *state.T/(6.*PI*xi*mu)* (Omegatilde - Omegatilde_0);          lamc = state.rho * cp * R_0 * K_BOLTZMANN *state.T/(6.*PI*xi*mu)* (Omegatilde - Omegatilde_0);
247      }      }
248      return lamc;      return lamc;
249  }  }
# Line 256  double thcond1_k(FluidState state, Fprop Line 264  double thcond1_k(FluidState state, Fprop
264    
265      double lamr = thcond1_lamr(state,err);      double lamr = thcond1_lamr(state,err);
266    
267      double lamc = 0;      // FIXME need to check if k1->crit is used, etc etc
268      if(!(k1->crit)){      double lamc = thcond1_lamc(state,err);
         MSG("No critical enhancement function provided");  
     }else{  
         MSG("Critical enhancement function not yet implemented");  
     }  
269      MSG("lamc = %e",lamc);      MSG("lamc = %e",lamc);
270    
271      return lam0 + lamr + k1->k_star * (lamc);      return lam0 + lamr + lamc;
272  }  }
273    
274    

Legend:
Removed from v.2770  
changed lines
  Added in v.2771

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