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

Also update the prediction set interface fot Gizmo.

parent a0cc3bf9
...@@ -271,8 +271,6 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities( ...@@ -271,8 +271,6 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
/** /**
* @brief Extra operations to be done during the drift * @brief Extra operations to be done during the drift
* *
* Not used for GIZMO.
*
* @param p Particle to act upon. * @param p Particle to act upon.
* @param xp The extended particle data to act upon. * @param xp The extended particle data to act upon.
* @param dt The drift time-step. * @param dt The drift time-step.
...@@ -281,11 +279,10 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities( ...@@ -281,11 +279,10 @@ __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
* @param timeBase Conversion factor between integer and physical time. * @param timeBase Conversion factor between integer and physical time.
*/ */
__attribute__((always_inline)) INLINE static void hydro_predict_extra( __attribute__((always_inline)) INLINE static void hydro_predict_extra(
struct part* p, struct xpart* xp, int t0, int t1, double timeBase) { struct part* p, struct xpart* xp, float dt, int t0, int t1,
double timeBase) {
const float dt = (t1 - t0) * timeBase;
const float h_inv = 1.0f / p->h; const float h_inv = 1.0f / p->h;
const float w = -hydro_dimension * p->force.h_dt * h_inv * dt;
/* Predict smoothing length */ /* Predict smoothing length */
const float w1 = p->force.h_dt * h_inv * dt; const float w1 = p->force.h_dt * h_inv * dt;
...@@ -294,15 +291,17 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra( ...@@ -294,15 +291,17 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra(
else else
p->h *= expf(w1); p->h *= expf(w1);
if (fabsf(w) < 0.2f) { const float w2 = -hydro_dimension * w1;
p->primitives.rho *= approx_expf(w); if (fabsf(w2) < 0.2f) {
p->primitives.rho *= approx_expf(w2);
} else { } else {
p->primitives.rho *= expf(w); p->primitives.rho *= expf(w2);
} }
p->primitives.v[0] += (p->a_hydro[0] + p->gravity.old_a[0]) * dt; p->primitives.v[0] += (p->a_hydro[0] + p->gravity.old_a[0]) * dt;
p->primitives.v[1] += (p->a_hydro[1] + p->gravity.old_a[1]) * dt; p->primitives.v[1] += (p->a_hydro[1] + p->gravity.old_a[1]) * dt;
p->primitives.v[2] += (p->a_hydro[2] + p->gravity.old_a[2]) * dt; p->primitives.v[2] += (p->a_hydro[2] + p->gravity.old_a[2]) * dt;
float u = p->conserved.energy + p->du_dt * dt; const float u = p->conserved.energy + p->du_dt * dt;
p->primitives.P = p->primitives.P =
hydro_gamma_minus_one * u * p->primitives.rho / p->conserved.mass; hydro_gamma_minus_one * u * p->primitives.rho / p->conserved.mass;
} }
......
Supports Markdown
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