Re: EntropyToInvGammaPred not integrated in Hydrokick

From: Volker Springel <vspringel_at_MPA-Garching.MPG.DE>
Date: Fri, 23 Apr 2021 13:15:09 +0200

Hi Leonard,

I think you are right that there has been a small inconsistency when PRESSURE_ENTROPY_SPH is used, and REUSE_HYDRO_ACCELERATIONS_FROM_PREVIOUS_STEP is not used (note that the latter is faster and typically just as good in practice). Let me explain this a bit more.

When REUSE_HYDRO_ACCELERATIONS_FROM_PREVIOUS_STEP is not activated, the hydro forces and entropy changes are computed twice per timestep, something like this

   [ Ka(dt/2) D(dt) Kb(dt/2) ] [ Ka(dt/2) D(dt) Kb(dt/2) ]

When in sim::hydro_force() (line 559 in src/time_integration/ the variable EntropyPred is set to the new value of Entropy at the end of a timestep (corresponding to the time in between the two steps above), which then forms the new basis for forward predictions in time, then EntropyToInvGammaPred should also be updated - this is what you presumably mean, and I agree with this. Otherwise the next Ka(dt/2) operator still uses the old pressures which were used for the preceeding Kb. The pressure entering Kb is however always correct, as EntropyToInvGammaPred is updated in the drift operator. Neglecting this update corresponds to what the REUSE_HYDRO_ACCELERATIONS_FROM_PREVIOUS_STEP option does, as here Ka and Kb are effectively rolled into one kick operator.

I have made a corresponding change in the code fixing this for the PRESSURE_ENTROPY_SPH option.


> On 19. Apr 2021, at 12:55, Leonard Romano <> wrote:
> Dear Gadget list members,
> I noticed that when one uses PRESSURE_ENTROPY_SPH the variables Entropy and EntropyPred
> are integrated during the Hydrokick in the function sim::hydro_force(...) but never used.
> Instead the pressure is computed from EntropyToInvGammaPred. This alone wouldn't be confusing,
> but at the same time in the function simparticles::drift_particle(...) these two variables
> are integrated too, and then EntropyToInvGammaPred is updated in order to be consistent with them,
> so I am wondering if either I don't understand this formulation of SPH well enough or instead
> there is an update of EntropyToInvGammaPred missing in sim::hydro_force(...).
> Thank you very much,
> 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-04-23 13:15:09

This archive was generated by hypermail 2.3.0 : 2023-01-10 10:01:32 CET