Re: Do thermodynamic quantities scale correctly in cosmological simulations?

From: Volker Springel <vspringel_at_MPA-Garching.MPG.DE>
Date: Sat, 15 May 2021 15:35:12 +0200

Hi Leonard,

Note that it is fairly arbitrary what power of "a" one assigns for code quantities in relation to the corresponding physical variable. But one obviously needs to be consistent. Gadget defines

rho_code = a^3 * rho_physical
A_code = A_physical
P_code = A_code * rho_code^gamma = a^(3*gamma) P_physical
c_code = sqrt(gamma * P_code/rho_code) = a^(3*(gamma-1)/2) * c_physical

Note that c_code is not added directly to velocities for this reason, there are conversion factors like fac_mu or cf_afac3 to correct for the a^(3*(gamma-1)/2) where needed. So your assumption of cs_code = a^-1 cs_physical is not really true for gadget, and there (hopefully) shouldn't be an inconsistency.


> On 15. May 2021, at 14:40, Leonard Romano <> wrote:
> Dear gadget-list,
> I keep wondering, whether or not there is an inconsistency with how certain thermodynamic quantities like pressure, entropy and the sound speed scale in cosmological simulations with the scale factor. In particular, expressions where sound speed and velocity both contribute as a sum, like artificial viscosity it seems obvious that the sound speed has to scale like a velocity, i.e. "cs_code = a^-1 cs_physical". In order for this to be the case, the pressure would need to scale as P_code = a P_physical since cs² ~ P / rho. However since entropy seems to be set not to scale at all, pressure scales as P_code = a^(3*GAMMA) P_physical, potentially causing an inconsistency.
> Is this a misunderstanding on my side, or is there indeed an inconsistency?
> Best regards,
> Leonard
> --
> ===================================================
> Leonard Romano, B.Sc.(レオナルド・ロマノ)
> Physics Department
> Technical University of Munich (TUM), Germany
> Theoretical Astrophysics Group
> Department of Earth and Space Science
> Graduate School of Science, Osaka University, Japan
> he / him / his
> ===================================================
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> with a subject of: unsubscribe gadget-list
> A web-archive of this mailing list is available here:
Received on 2021-05-15 15:35:13

This archive was generated by hypermail 2.3.0 : 2022-09-01 14:03:43 CEST