diff --git a/src/gravity/Default/gravity_io.h b/src/gravity/Default/gravity_io.h index 06d8099a88b7c7753c4eabbf7345ad0a59ebb792..2508f69a636b93c218cdcb0770cf00ef969389c2 100644 --- a/src/gravity/Default/gravity_io.h +++ b/src/gravity/Default/gravity_io.h @@ -56,9 +56,15 @@ void convert_gpart_vel(const struct engine* e, const struct gpart* gp, dt_kick_grav = (ti_current - ((ti_beg + ti_end) / 2)) * time_base; } + /* Extrapolate the velocites to the current time */ ret[0] = gp->v_full[0] + gp->a_grav[0] * dt_kick_grav; ret[1] = gp->v_full[1] + gp->a_grav[1] * dt_kick_grav; ret[2] = gp->v_full[2] + gp->a_grav[2] * dt_kick_grav; + + /* Conversion from internal units to peculiar velocities */ + ret[0] *= cosmo->a2_inv; + ret[1] *= cosmo->a2_inv; + ret[2] *= cosmo->a2_inv; } /** diff --git a/src/hydro/Gadget2/hydro_io.h b/src/hydro/Gadget2/hydro_io.h index ef1402a32a876212d76a67632bcd694a6685c09d..3592b0bde9213465790939d8a0521b2ffd8c16b7 100644 --- a/src/hydro/Gadget2/hydro_io.h +++ b/src/hydro/Gadget2/hydro_io.h @@ -106,7 +106,13 @@ void convert_part_vel(const struct engine* e, const struct part* p, dt_kick_hydro = (ti_current - ((ti_beg + ti_end) / 2)) * time_base; } + /* Extrapolate the velocites to the current time */ hydro_get_drifted_velocities(p, xp, dt_kick_hydro, dt_kick_grav, ret); + + /* Conversion from internal units to peculiar velocities */ + ret[0] *= cosmo->a2_inv; + ret[1] *= cosmo->a2_inv; + ret[2] *= cosmo->a2_inv; } /**