Example #1
0
/* ***************************************************************** */
double InternalEnergyFunc(double *v, double T)
/*!
 *  Compute the gas internal energy as a function of temperature
 *  and fractions (or density):
 *  - <tt> rhoe = rhoe(T,rho) </tt> in LTE or CIE;
 *  - <tt> rhoe = rhoe(T,X) </tt> in non-equilibrium chemistry.
 *
 *  \param [in]   v   1D Array of primitive variables containing
 *                    density and species. Other variables are
 *                    ignored.
 *  \param [in]   T   Gas temperature
 *
 *  \return The gas internal energy (\c rhoe) in code units.
 ******************************************************************* */
{
  double x, rho, e, mu, kT;
  double rhoe, chi = 13.6*CONST_eV;
  double p0 = UNIT_DENSITY*UNIT_VELOCITY*UNIT_VELOCITY;

  kT   = CONST_kB*T;
  x    = SahaXFrac(T, v[RHO]);
  GetMu(T,v[RHO],&mu); 
  rho  = v[RHO]*UNIT_DENSITY;
  e    = 1.5*kT/(mu*CONST_amu) + chi*x/CONST_mH;

/*
FILE *fp;
double p, lnT;
fp = fopen("gamma.dat","w");
v[RHO] = 1.0;
for (lnT = 2; lnT < 6; lnT += 0.01){
  T = pow(10.0, lnT);
  kT   = CONST_kB*T;
  x    = SahaXFrac(T, v[RHO]);
  GetMu(T,v[RHO],&mu); 
  rho  = v[RHO]*UNIT_DENSITY;
  e    = 1.5*kT/(mu*CONST_amu) + chi*x/CONST_mH;
p = kT/(mu*CONST_amu)*rho;
fprintf (fp,"%12.6e   %12.6e   %12.6e\n",T,p/(rho*e) + 1.0, x);
}
fclose(fp);
exit(1);
*/

  return rho*e/p0; /* Convert to code units */ 
}
Example #2
0
inline void MCTSNode::ComputeUCBStats() {
	if (valid_ucb) return;
	ucb_weight = static_cast<float>(uct_stats.played) /
				(Params::beta + static_cast<float>(uct_stats.played));
	ucb = GetMu() + (Params::alpha * InverseSqrt(uct_stats.played));
}