Skip to content
Snippets Groups Projects
Commit d0e9c6f5 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'corrected_drift_operation' into 'master'

Fix a drift integration mistake in the coupling of hydro and gravity

See merge request !1237
parents a7df77f7 421afab0
No related branches found
No related tags found
1 merge request!1237Fix a drift integration mistake in the coupling of hydro and gravity
......@@ -151,9 +151,9 @@ __attribute__((always_inline)) INLINE static void drift_part(
/* Predict velocities (for gravity terms) */
if (p->gpart != NULL) {
p->v[0] += (p->gpart->a_grav[0] + p->gpart->a_grav_mesh[0]) * dt_kick_grav;
p->v[1] += (p->gpart->a_grav[1] + p->gpart->a_grav_mesh[1]) * dt_kick_grav;
p->v[2] += (p->gpart->a_grav[2] + p->gpart->a_grav_mesh[2]) * dt_kick_grav;
p->v[0] += xp->a_grav[0] * dt_kick_grav;
p->v[1] += xp->a_grav[1] * dt_kick_grav;
p->v[2] += xp->a_grav[2] * dt_kick_grav;
}
/* Predict the values of the extra fields */
......
......@@ -55,6 +55,9 @@ struct xpart {
/*! Velocity at the last full step. */
float v_full[3];
/*! Gravitational acceleration at the end of the last step */
float a_grav[3];
/*! Internal energy at the last full step. */
float u_full;
......
......@@ -54,6 +54,9 @@ struct xpart {
/* Velocity at the last full step. */
float v_full[3];
/*! Gravitational acceleration at the end of the last step */
float a_grav[3];
/* Entropy at the last full step. */
float entropy_full;
......
......@@ -39,6 +39,9 @@ struct xpart {
/* Velocity at the last full step. */
float v_full[3];
/*! Gravitational acceleration at the end of the last step */
float a_grav[3];
/* Additional data used to record cooling information */
struct cooling_xpart_data cooling_data;
......
......@@ -58,6 +58,9 @@ struct xpart {
/*! Velocity at the last full step. */
float v_full[3];
/*! Gravitational acceleration at the end of the last step */
float a_grav[3];
/*! Internal energy at the last full step. */
float u_full;
......
......@@ -56,6 +56,9 @@ struct xpart {
/*! Velocity at the last full step. */
float v_full[3];
/*! Gravitational acceleration at the end of the last step */
float a_grav[3];
/*! Internal energy at the last full step. */
float u_full;
......
......@@ -61,6 +61,9 @@ struct xpart {
/*! Velocity at the last full step. */
float v_full[3];
/*! Gravitational acceleration at the end of the last step */
float a_grav[3];
/*! Internal energy at the last full step. */
float u_full;
......
......@@ -58,6 +58,9 @@ struct xpart {
/*! Velocity at the last full step. */
float v_full[3];
/*! Gravitational acceleration at the end of the last step */
float a_grav[3];
/*! Internal energy at the last full step. */
float u_full;
......
......@@ -58,6 +58,9 @@ struct xpart {
/*! Velocity at the last full step. */
float v_full[3];
/*! Gravitational acceleration at the end of the last step */
float a_grav[3];
/*! Internal energy at the last full step. */
float u_full;
......
......@@ -50,6 +50,9 @@ struct xpart {
/*! Velocity at the last full step. */
float v_full[3];
/*! Gravitational acceleration at the end of the last step */
float a_grav[3];
/*! Entropy at the last full step. */
float entropy_full;
......
......@@ -53,6 +53,9 @@ struct xpart {
/*! Velocity at the last full step. */
float v_full[3];
/*! Gravitational acceleration at the end of the last step */
float a_grav[3];
/*! Internal energy at the last full step. */
float u_full;
......
......@@ -41,6 +41,9 @@ struct xpart {
/* Velocity at the last full step. */
float v_full[3];
/*! Gravitational acceleration at the end of the last step */
float a_grav[3];
/* Additional data used to record cooling information */
struct cooling_xpart_data cooling_data;
......
......@@ -177,6 +177,14 @@ void runner_do_kick1(struct runner *r, struct cell *c, const int timer) {
kick_part(p, xp, dt_kick_hydro, dt_kick_grav, dt_kick_mesh_grav,
dt_kick_therm, dt_kick_corr, cosmo, hydro_props,
entropy_floor, ti_begin, ti_end, ti_begin_mesh, ti_end_mesh);
/* Update the accelerations to be used in the drift for hydro */
if (p->gpart != NULL) {
xp->a_grav[0] = p->gpart->a_grav[0] + p->gpart->a_grav_mesh[0];
xp->a_grav[1] = p->gpart->a_grav[1] + p->gpart->a_grav_mesh[1];
xp->a_grav[2] = p->gpart->a_grav[2] + p->gpart->a_grav_mesh[2];
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment