diff --git a/src/hydro/Default/hydro.h b/src/hydro/Default/hydro.h index aefd85cf6eb566e84efbec95de3bc4cc93b140d8..a7e7e18512631b9bfe133bf89a5599373e372758 100644 --- a/src/hydro/Default/hydro.h +++ b/src/hydro/Default/hydro.h @@ -194,14 +194,15 @@ __attribute__((always_inline)) INLINE static void hydro_predict_extra( __attribute__((always_inline)) INLINE static void hydro_end_force(struct part* p) {} + + /** * @brief Kick the additional variables * * @param p The particle to act upon - * @param dt The time-step for this kick */ __attribute__((always_inline)) - INLINE static void hydro_kick_extra(struct part* p, float dt) {} + INLINE static void hydro_kick_extra(struct part* p, float dt) {} /** * @brief Converts hydro quantity of a particle diff --git a/src/hydro/Gadget2/hydro.h b/src/hydro/Gadget2/hydro.h index 7a8518a010e342dfbc87165810178a0c2433ece8..b1f83be3b34def075ec590ccfe8648cd5b16de61 100644 --- a/src/hydro/Gadget2/hydro.h +++ b/src/hydro/Gadget2/hydro.h @@ -190,13 +190,18 @@ __attribute__((always_inline)) (const_hydro_gamma - 1.f) * powf(p->rho, -(const_hydro_gamma - 1.f)); } + /** * @brief Kick the additional variables * * @param p The particle to act upon + * @param xp The particle extended data to act upon + * @param dt The time-step for this kick + * @param half_dt The half time-step for this kick */ __attribute__((always_inline)) - INLINE static void hydro_kick_extra(struct part* p, float dt) { + INLINE static void hydro_kick_extra(struct part* p, struct xpart* xp, + float dt, float half_dt) { /* Do not decrease the entropy (temperature) by more than a factor of 2*/ const float entropy_change = p->entropy_dt * dt; diff --git a/src/hydro/Minimal/hydro.h b/src/hydro/Minimal/hydro.h index 4543b18aabfa7762f98d79937f8f08ddbfe93538..464a03a7ed12139109411c7f111dc632229f3ab9 100644 --- a/src/hydro/Minimal/hydro.h +++ b/src/hydro/Minimal/hydro.h @@ -156,10 +156,20 @@ __attribute__((always_inline)) * @brief Kick the additional variables * * @param p The particle to act upon + * @param xp The particle extended data to act upon * @param dt The time-step for this kick + * @param half_dt The half time-step for this kick */ __attribute__((always_inline)) - INLINE static void hydro_kick_extra(struct part* p, float dt) {} + INLINE static void hydro_kick_extra(struct part* p, struct xpart* xp, + float dt, float half_dt) { + + /* Kick in momentum space */ + xp->u_full += p->u_dt * dt; + + /* Get the predicted internal energy */ + p->u = xp->u_full - half_dt * p->u_dt; +} /** * @brief Converts hydro quantity of a particle diff --git a/src/runner.c b/src/runner.c index 84bb73debc1d58337f72ca53c169c433e6d70b18..fc17e7d3d9c860da7b262c7ebaace8950492d911 100644 --- a/src/runner.c +++ b/src/runner.c @@ -930,7 +930,7 @@ void runner_dokick(struct runner *r, struct cell *c, int timer) { /* p->v[2]); */ /* Extra kick work */ - hydro_kick_extra(p, dt); + hydro_kick_extra(p, xp, dt, half_dt); } /* Now collect quantities for statistics */