From 4517ef2be993ff3e9c800074804598d1b355c9cb Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Sun, 11 Mar 2018 17:38:18 +0900 Subject: [PATCH] When converting internal energy to entropy at startup, apply the correct cosmology factor. --- src/hydro/Gadget2/hydro.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/hydro/Gadget2/hydro.h b/src/hydro/Gadget2/hydro.h index 185a98b6d2..7196346021 100644 --- a/src/hydro/Gadget2/hydro.h +++ b/src/hydro/Gadget2/hydro.h @@ -545,13 +545,18 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra( * * Requires the density to be known * - * @param p The particle to act upon + * @param p The particle to act upon. + * @param xp The extended data. + * @param cosmo The cosmological model. */ __attribute__((always_inline)) INLINE static void hydro_convert_quantities( - struct part *restrict p, struct xpart *restrict xp) { + struct part *restrict p, struct xpart *restrict xp, + const struct cosmology *cosmo) { - /* We read u in the entropy field. We now get S from u */ - xp->entropy_full = gas_entropy_from_internal_energy(p->rho, p->entropy); + /* We read u in the entropy field. We now get (comoving) S from (physical) u + * and (physical) rho. Note that comoving S == physical S */ + xp->entropy_full = + gas_entropy_from_internal_energy(p->rho * cosmo->a3_inv, p->entropy); p->entropy = xp->entropy_full; /* Compute the pressure */ -- GitLab