Re: Help with cluster.param snapshot timing calcs

From: Hector Aceves <>
Date: Fri, 15 Jul 2011 16:36:13 -0700

Hi Timothy

The numbers you quote as also somewhat strange to me, so I will better go to
the Gadget's guide. As you may have noticed already, there are two options to
set the time outputs of snapshots in Gadget. (1) By specifying the timesteps
between them, or (2) by writing explicitly the output times in a file that
Gadget reads. For option (1) one has to be rather careful in setting the
output time variables (see below) in cosmological simulations
(ComovingIntegrationOn= 1). For (2) you have to define the
"OutputListFilename" variable with the name of the file that contains the
output times values, say, "outputs_lcdm_gas.txt", and set the flag
"OutputListOn" to "1". Recall that for a cosmological simulation the time
variable is the scale factor a, and notice that the "cluster.param" file in
the demo section has OutputListOn turned on!, so Gadget is only outputting
files at the a's indicated at the "outputs..txt" file, and ignoring the other
related parameters in such parameter file.

When using option (2) I usually use the following little (fortran) program to
generate the "outputs.txt" file, that you may perhaps find helpful:

Program Out_as

  write(*,*)'Outputfile times (a`s) for Gadget cosmo'
  write(*,*)'...log10-equally spaced a`s !'
  write(*,*)'z_initial, z_final & number of a`s = ?'



  write(*,*)' i z a '

     do i=1,ndat

2 format (i3,1x,f12.2,1x,f12.3)
3 format(f8.5)

End Program Out_as

Regarding option (1), the "TimeOfFirstSnapshot 0.047619048" is rather
clear since z_init=20 and a_init=1/(1+z_init)=0.0476.

The "TimeBetSnapshot" is a multiplying factor (f) of the TimeOfFirstSnapshot
(a1=a_init), hence the second snapshot is at: a2=f*a1

For N equally logarithmically spaced steps, as in the above program:
a2 = 10**( log a1 + da ) = a1 * 10**da = a1*f

Now, da=(log a_final - log a_init ) / N (N to give the number in the param
file of Gadget). Since usually a_final = 1 and for z_init=20 ==> a_init=0.0476
==> log a_init = -1.3222 and with N=50 we have: da = 0.0264.

The factor to multiply the first step, and subsequent ones, is then f=10**da
= 1.0627, that is the number that appears in "TimeBetSnapshot" in the Gadget's
guide. As you mention "TimeOfFirstSnapshot 1.8384163" is strange since
a=[0-->1], but has no effect whatsoever in the simulation for "OutputListOn
1". The "lcdm_gas.param" in the examples of Gadget is more consistent. I hope
this helps in claryfing a bit your questions.



Héctor Aceves Campos
Instituto de Astronomía-UNAM
Apdo. Postal 106
Ensenada B.C. 22800 México

---------- Original Message -----------
From: Timothy Dwight Dunn <Timothy.Dunn_at_Colorado.EDU>
To: gadget-list_at_MPA-Garching.MPG.DE
Sent: Thu, 14 Jul 2011 11:36:11 -0600 (MDT)
Subject: [gadget-list] Help with cluster.param snapshot timing calcs

> I'm trying to setup my first Cosmological model with Gadget and was
> trying to figure out how to set up the time intervals for a quick
> test run and then a longer real run. So I popped into the demo
> models and looked at the cluster.param file and am confused on its
> settings. I was hoping someone could clarify how the settings were
> determined for it.
> TimeBegin 0.041666666 % Begin of the simulation (z=23)
> TimeMax 1.0
> TimeBetSnapshot 0.047619048 % z=20
> TimeOfFirstSnapshot 1.8384163 % 5 constant steps in log(a)
> What I'm confused about is how do I have a Snapshot starting at a
> time almost twice the max time and how does the TImeBetSnapshots
> actually add up to 5 equally spaced intervals? I agree the math is
> simple but sadly I must be using the wrong numbers when I calc it as
> I don't get values anywhere near that is used.
> Sorry for my ignorance I normally work with galactic collision and
> various collapsar/black hole models, this is my first cosmological
> galaxy cluster setup I have attempted.
> Thanks
> Tim
> -----------------------------------------------------------
> 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:
------- End of Original Message -------
Received on 2011-07-16 01:56:52

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