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

Add cosmological conversion from internal velocity units to peculiar velocities.

parent 7a8a0fc9
No related branches found
No related tags found
1 merge request!516More cosmology work
...@@ -56,9 +56,15 @@ void convert_gpart_vel(const struct engine* e, const struct gpart* gp, ...@@ -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; 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[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[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; 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;
} }
/** /**
......
...@@ -106,7 +106,13 @@ void convert_part_vel(const struct engine* e, const struct part* p, ...@@ -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; 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); 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;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment