Commit f4cd515f authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Better notation for some Gadget2-SPH variables.

parent b9229a0a
......@@ -231,18 +231,18 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
p->density.wcount *= kernel_norm;
p->density.wcount_dh *= h_inv * kernel_gamma * kernel_norm;
const float irho = 1.f / p->rho;
const float rho_inv = 1.f / p->rho;
/* Compute the derivative term */
p->rho_dh = 1.f / (1.f + hydro_dimension_inv * p->h * p->rho_dh * irho);
p->rho_dh = 1.f / (1.f + hydro_dimension_inv * p->h * p->rho_dh * rho_inv);
/* Finish calculation of the velocity curl components */
p->density.rot_v[0] *= h_inv_dim_plus_one * irho;
p->density.rot_v[1] *= h_inv_dim_plus_one * irho;
p->density.rot_v[2] *= h_inv_dim_plus_one * irho;
p->density.rot_v[0] *= h_inv_dim_plus_one * rho_inv;
p->density.rot_v[1] *= h_inv_dim_plus_one * rho_inv;
p->density.rot_v[2] *= h_inv_dim_plus_one * rho_inv;
/* Finish calculation of the velocity divergence */
p->density.div_v *= h_inv_dim_plus_one * irho;
p->density.div_v *= h_inv_dim_plus_one * rho_inv;
}
/**
......@@ -273,13 +273,13 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force(
const float half_dt = (ti_current - (p->ti_begin + p->ti_end) / 2) * timeBase;
const float pressure = hydro_get_pressure(p, half_dt);
const float irho = 1.f / p->rho;
const float rho_inv = 1.f / p->rho;
/* Divide the pressure by the density and density gradient */
const float P_over_rho2 = pressure * irho * irho * p->rho_dh;
const float P_over_rho2 = pressure * rho_inv * rho_inv * p->rho_dh;
/* Compute the sound speed */
const float soundspeed = sqrtf(hydro_gamma * pressure * irho);
const float soundspeed = sqrtf(hydro_gamma * pressure * rho_inv);
/* Compute the Balsara switch */
const float balsara =
......@@ -349,13 +349,13 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
const float dt_entr = (t1 - (p->ti_begin + p->ti_end) / 2) * timeBase;
const float pressure = hydro_get_pressure(p, dt_entr);
const float irho = 1.f / p->rho;
const float rho_inv = 1.f / p->rho;
/* Divide the pressure by the density and density gradient */
const float P_over_rho2 = pressure * irho * irho * p->rho_dh;
const float P_over_rho2 = pressure * rho_inv * rho_inv * p->rho_dh;
/* Compute the new sound speed */
const float soundspeed = sqrtf(hydro_gamma * pressure * irho);
const float soundspeed = sqrtf(hydro_gamma * pressure * rho_inv);
/* Update variables */
p->force.P_over_rho2 = P_over_rho2;
......
......@@ -248,17 +248,17 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
const float ri = 1.0f / r;
/* Compute the kernel function */
const float h_inv = 1.0f / hi;
const float u = r * h_inv;
kernel_deval(u, &wi, &wi_dx);
const float hi_inv = 1.0f / hi;
const float ui = r * hi_inv;
kernel_deval(ui, &wi, &wi_dx);
/* Compute contribution to the density */
pi->rho += mj * wi;
pi->rho_dh -= mj * (hydro_dimension * wi + u * wi_dx);
pi->rho_dh -= mj * (hydro_dimension * wi + ui * wi_dx);
/* Compute contribution to the number of neighbours */
pi->density.wcount += wi;
pi->density.wcount_dh -= u * wi_dx;
pi->density.wcount_dh -= ui * wi_dx;
const float fac = mj * wi_dx * ri;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment