Commit 8bf391d4 by Matthieu Schaller

### P_over_rho --> P_over_rho2

parent 579822fc
 ... ... @@ -135,22 +135,28 @@ __attribute__((always_inline)) INLINE static void hydro_prepare_force( p->density.rot_v[1] * p->density.rot_v[1] + p->density.rot_v[2] * p->density.rot_v[2]); /* Compute the norm of div v */ const float abs_div_v = fabsf(p->density.div_v); /* Compute the pressure */ const float dt = (ti_current - (p->ti_begin + p->ti_end) * 0.5f) * timeBase; const float pressure = (p->entropy + p->force.entropy_dt * dt) * pow_gamma(p->rho); const float dt = (ti_current - (p->ti_begin + p->ti_end) / 2) * timeBase; const float pressure = (p->entropy + p->force.entropy_dt * dt) * pow_gamma(p->rho); const float irho = 1.f / p->rho; /* Divide the pressure by the density and density gradient */ const float P_over_rho = pressure / (p->rho * p->rho) * p->rho_dh; const float P_over_rho2 = pressure * irho * irho * p->rho_dh; /* Compute the sound speed */ const float soundspeed = sqrtf(hydro_gamma * pressure / p->rho); const float soundspeed = sqrtf(hydro_gamma * pressure * irho); /* Compute the Balsara switch */ float balsara = fabsf(p->density.div_v) / (fabsf(p->density.div_v) + curl_v + 0.0001f * p->force.soundspeed / fac_mu / p->h); const float balsara = abs_div_v / (abs_div_v + curl_v + 0.0001f * soundspeed / fac_mu / p->h); /* Update variables. */ p->force.P_over_rho = P_over_rho; p->force.P_over_rho2 = P_over_rho2; p->force.soundspeed = soundspeed; p->force.balsara = balsara; } ... ... @@ -196,16 +202,18 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra( /* Drift the pressure */ const float dt_entr = (t1 - (p->ti_begin + p->ti_end) / 2) * timeBase; const float pressure = (p->entropy + p->force.entropy_dt * dt_entr) * pow_gamma(p->rho); (p->entropy + p->force.entropy_dt * dt_entr) * pow_gamma(p->rho); /* Divide the pressure by the density and density gradient */ const float P_over_rho = pressure / (p->rho * p->rho) * p->rho_dh; const float irho = 1.f / p->rho; /* Divide the pressure by the density and density gradient */ const float P_over_rho2 = pressure * irho * irho * p->rho_dh; /* Compute the new sound speed */ const float soundspeed = sqrtf(hydro_gamma * pressure / p->rho); const float soundspeed = sqrtf(hydro_gamma * pressure * irho); /* Update variables */ p->force.P_over_rho = P_over_rho; p->force.P_over_rho2 = P_over_rho2; p->force.soundspeed = soundspeed; } ... ... @@ -219,7 +227,8 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra( __attribute__((always_inline)) INLINE static void hydro_end_force( struct part *restrict p) { p->force.entropy_dt *= hydro_gamma_minus_one * pow_minus_gamma_minus_one(p->rho); p->force.entropy_dt *= hydro_gamma_minus_one * pow_minus_gamma_minus_one(p->rho); } /** ... ...
 ... ... @@ -23,7 +23,8 @@ __attribute__((always_inline)) INLINE static void hydro_debug_particle( "x=[%.3e,%.3e,%.3e], " "v=[%.3e,%.3e,%.3e],v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n " "h=%.3e, " "wcount=%d, wcount_dh=%.3e, m=%.3e, dh_drho=%.3e, rho=%.3e, P_over_rho=%.3e, " "wcount=%d, wcount_dh=%.3e, m=%.3e, dh_drho=%.3e, rho=%.3e, " "P_over_rho2=%.3e, " "S=%.3e, " "dS/dt=%.3e, c=%.3e\n" "divV=%.3e, rotV=[%.3e,%.3e,%.3e], balsara=%.3e \n " ... ... @@ -31,7 +32,8 @@ __attribute__((always_inline)) INLINE static void hydro_debug_particle( p->x[0], p->x[1], p->x[2], p->v[0], p->v[1], p->v[2], xp->v_full[0], xp->v_full[1], xp->v_full[2], p->a_hydro[0], p->a_hydro[1], p->a_hydro[2], p->h, (int)p->density.wcount, p->density.wcount_dh, p->mass, p->rho_dh, p->rho, p->force.P_over_rho, p->entropy, p->force.entropy_dt, p->force.soundspeed, p->density.div_v, p->density.rot_v[0], p->density.rot_v[1], p->density.rot_v[2], p->force.balsara, p->force.v_sig, p->h_dt, p->ti_begin, p->ti_end); p->rho, p->force.P_over_rho2, p->entropy, p->force.entropy_dt, p->force.soundspeed, p->density.div_v, p->density.rot_v[0], p->density.rot_v[1], p->density.rot_v[2], p->force.balsara, p->force.v_sig, p->h_dt, p->ti_begin, p->ti_end); }
 ... ... @@ -25,8 +25,6 @@ struct xpart { /* Velocity at the last full step. */ float v_full[3]; } __attribute__((aligned(xpart_align))); ... ... @@ -90,15 +88,15 @@ struct part { /* Balsara switch */ float balsara; /* Signal velocity. */ float v_sig; /* Pressure over density*/ float P_over_rho; float P_over_rho2; /* Particle sound speed. */ float soundspeed; /* Signal velocity. */ float v_sig; /* Entropy time derivative */ float entropy_dt; ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!