# Re: Time Integration of Entropy

From: Volker Springel <volker_at_MPA-Garching.MPG.DE>
Date: Wed, 2 Oct 2013 12:04:09 +0800

On Sep 3, 2013, at 10:48 PM, Ali wrote:

> Hello,
>
> I am having difficulty understanding the usage of "dt_entr" in advance_and_find_timesteps() in timestep.c.
>

Hi Ali,

> As I understand it, the scale factor is used as the 'time' integration variable by using the appropriate conversion factor from da/dt. The time integration discretized and broken up onto an integer timeline from [0, TIMEBASE] which directly maps to [log(a_i), log(a_f)].

Yes, exactly.

>
> So when integrating the equations of motion (per equations 27 and 28 in the Gadget2 paper), the gravity integration make sense. The integer time (in log(a)) is passed to get_gravkick_factor() which looks up the appropriate integration values from GravKickTable[]. As I understand it, the values stored in GravKickTable[] are the integrals of da from [a_i, a], but the array values are spaced in steps of d(log(a)).
>
> So the actual value returned from get_gravkick_factor() is the integral of da with the appropriate factors of H(a) and a. This makes sense.
>
> My confusion comes from the line (when All.ComovingIntegrationOn is true) in timestep.c where
> dt_entr = (tend - tstart) * All.Timebase_interval;
>
> tend and tstart are on the integer timeline and map to [log(a_end), log(a_start)]. If we are integrating the entropy w/r/t to da, I would expect that line to instead be
> dt_entr = All.TimeBegin * exp(tend*All.Timebase_interval) - All.TimeBegin * exp(tstart*All.Timebase_interval);
>
> This usage would be similar to the line in find_next_sync_point_and_drift() where All.Time is updated.
> So what have I missed here? Thank you for your time.
>

For the entropy, the code stores directly the rate of entropy increase per log of the scale-factor, and here dt_entr simply corresponds to the interval of the timestep in terms of log(a). In other words, this means dt_entr gives the interval of the timestep in log(a) and not a. One could compute the change of the entropy across a timesteps either as

Delta_A = (dA/dloga) * Delta_loga
or
Delta_A = (dA/da) * Delta_a

Gadget calculates DtEntropy as dA/dloga, and dt_entr as Delta_loga, and then uses the first form for the update of the entropy. I hope this clarifies this point.

Volker

> Sincerely,
> Ali
>
> -----------------------------------------------------------
>
> If you wish to unsubscribe from this mailing, send mail to
> minimalist_at_MPA-Garching.MPG.de with a subject of: unsubscribe gadget-list
> A web-archive of this mailing list is available here: