RE: ICs with ZA+2LPT

From: Agarwal, Shankar <sagarwal_at_ku.edu>
Date: Thu, 30 Sep 2010 16:05:05 -0500

Hi Volker and Scott,

Thanks a lot for clearing how to get DM+gas ICs. Both the methods look promising and I am going to try both. I have four questions though regarding CDM-only simulations...

1. When running CDM-only simulations (with Omega_baryon=0.04 or any NON-zero value), should the mass_per_CDM_particle be equal to

    (a). total_CDM_mass_in_the_box / Number_CDM_particles
    (b). total_CDM+Baryon_mass_in_the_box / Number_CDM_particles ?


2. Volker's snippet below (to get gas ICs) requires that the CDM-only ICs be generated with (b). This made me think "If I wanted a CDM-only simulation, would I use a or b?"


3. To calculate P(k) normalization, 2LPT uses the CDM transfer function. Shouldn't it use the CDM+Baryon+neutrino_weighted Tf ?

  Tf_matter = f_cdm*T_cdm + f_b*T_b + f_nu*T_nu where f_nu=0.

 
4. To calculate the Amplitude and Phase of Displacement Field for CDM particles, 2LPT uses CDM Tf. Again, should it be Tf_matter?



Sorry, I should be asking this to the 2LPT team!
-Shankar


-----Original Message-----
From: Volker Springel [mailto:volker_at_MPA-Garching.MPG.DE]
Sent: Thu 9/30/2010 3:41 AM
To: Scott Wales
Cc: gadget-list_at_MPA-Garching.MPG.DE
Subject: Re: [gadget-list] ICs with ZA+2LPT
 


One possibility is also to modify the read-in routine of gadget such
that gas particles are automatically created for DM-only initial
conditions. This duplicates the set of dm particles, and shifts the
particle pairs such that the center-of-mass stays invariant, but at the
same time the two particle species form two interleaved grids/glasses.
This technique assumes that the displacement fields for gas and dark
matter are the same, which is ok unless you probe quite small scales.
Such an option already exists in gadget3. To do this in gadget2, one
would have to insert code modications in two places

before allocate_memory() is called, and before All.MaxPart ist set, one
would have to add something like

#ifdef GENERATE_GAS_IN_ICS
      if(RestartFlag == 0)
        {
          All.TotN_gas += header.npartTotal[1];
          All.TotNumPart += header.npartTotal[1];
        }
#endif


And towards the end of read_ic(), before the temperatures/entropies are
initialized, one could add something like


#ifdef GENERATE_GAS_IN_ICS
  int count;
  double fac, d, a, b, rho;

  if(RestartFlag == 0)
    {
      for(i = 0, count = 0; i < NumPart; i++)
        if(P[i].Type == 1)
          count++;

      memmove(P + count, P, sizeof(struct particle_data) * NumPart);

      NumPart += count;
      N_gas += count;
 

      fac = All.OmegaBaryon / All.Omega0;
      rho = All.Omega0 * 3 * All.Hubble * All.Hubble / (8 * M_PI *
All.G);

      int j;

      for(i = count, j = 0; i < NumPart; i++)
        if(P[i].Type == 1)
          {
            d = pow(P[i].Mass / rho, 1.0 / 3);
            a = 0.5 * All.OmegaBaryon / All.Omega0 * d;
            b = 0.5 * (All.Omega0 - All.OmegaBaryon) / All.Omega0 * d;
            P[j] = P[i];

            P[j].Mass *= fac;
            P[i].Mass *= (1 - fac);
            P[j].Type = 0;
            P[j].ID += 1000000000;

            P[i].Pos[0] += a;
            P[i].Pos[1] += a;
            P[i].Pos[2] += a;
            P[j].Pos[0] -= b;
            P[j].Pos[1] -= b;
            P[j].Pos[2] -= b;

            j++;
          }

      All.MassTable[0] = 0;
      All.MassTable[1] *= (1 - fac);
    }
#endif



Your milage with these changes may vary - debug yourself please.


Volker



On Thursday, September 30, 2010 09:47:28 am Scott Wales wrote:
> Hi Shankar,
>
> You'll probably want to generate the gas particles separately, using
> the baryon transfer function, so that you get two IC files, one for
> CDM and one for gas. You can then combine them into one manually.
>
> It looks like 2lpt takes a cmbfast transfer function file, which will
> probably have a column for each cosmological component (baryon, cdm,
> neutrino etc.). You should only have to change which column is used
> in 2lpt's source code. You'll probably get better results if you use
> the same random generator seed for both cdm and baryon particles.
>
> Combining the cdm and gas files should be fairly straightforward,
> you'll have to set the correct number of particles and masses in the
> header, then in each block put the gas particles before the cdm
> particles. Blocks consist of a size (32 bit unsigned integer), that
> many bytes and then the size again (check the gadget user's guide).
> Fill the SPH specific blocks with zeros and you should be good.
>
> You should be able to work out the particle mass from rho, the box
> size and the particle count, edit the initial conditions file header
> to correct it.
>
> Cheers,
> Scott Wales
>
> On 29/09/2010, at 11:37 PM, Agarwal, Shankar wrote:
> > Hi all,
> >
> > I intend to run large-scale CDM+gas cosmological simulations using
> > Gadget. I have generated the ICs using ZA+2LPT
> > (http://cosmo.nyu.edu/roman/2LPT/).
> >
> > I found that the way 2LPT is set up, it generated only CDM
> > realization and it sets the gas mass [Massarr(0)] and gas particles
> > [Npart(0)] equal to zero. Also, the mass_per_cdm_particle is not
> > correct (it is correct if Ngas=0).
> >
> >
> > Please let me know if I need to modify 2LPT to include gas. If yes,
> > I have identified the following modifications :
> >
> > 1. Npart(0)
> > 2. Massarr(0)
> > 3. temperature field - i can initialize it to zero.
> >
> >
> > I will appreciate any feedback. I have so far been using Enzo1.5
> > N-body code but have found that it does not resolve low mass halos
> > well.
> >
> >
> > Regards
> > Shankar Agarwal
> > Cosmology group
> > University of Kansas
> > USA
> >
> >
> > -----------------------------------------------------------
> >
> > 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:
> > http://www.mpa-garching.mpg.de/gadget/gadget-list
>




-----------------------------------------------------------

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:
http://www.mpa-garching.mpg.de/gadget/gadget-list





Received on 2010-09-30 23:05:46

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