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

New interface for kick_extra

parent cefdb664
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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 */
......
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