# Re: Tabulated Power Spectrum and Initial Conditions

From: Antonio Bibiano <antbbn_at_gmail.com>
Date: Fri, 28 Jun 2013 16:18:23 +0200

> You cannot really use the fitting functions for P(k) together with "ReNormalizeInputSpectrum=0" because the fitting functions are not normalized, they just give the shape of the linear power spectrum. In fact, ReNormalizeInputSpectrum=0 is ignored in this case and the spectrum at z=0 is always normalized to the specified sigma8.
>
> For a tabulated spectrum, it is also highly recommended to *not* use "ReNormalizeInputSpectrum=0", but rather let the code do the normalization through "ReNormalizeInputSpectrum=1". The former should only be useful in very special circumstances.

Ok, i understand this, but I was wondering why the normalization
calculated by NGenIC was so different (calculated a sigma8 ~ 15) from
the one given by CAMB or CLASS or in general for the usual value of
sigma8 ~ 0.8.
So i tried to understand how it is calculated by looking at the code
and it boils down to the integral of
4 * Pi * k^2 * w^2 k^(Primordialndex-1) P(k)
whereas the usual formula (the one used by CAMB and CLASS i believe) is
1/(2 Pi^2) k^2 w^2 P(k)
So i was wondering why it is calculated in this way, i suppose this is
for some internal workings of the program?
Maybe now i am just getting too technical and i am worring to bother
you all with this discussion but i just wanted to understand and i got
tangled in this thing. Hope this helps someone at some point.

2013/6/28 Volker Springel <volker_at_mpa-garching.mpg.de>
>
>
>
> On Jun 27, 2013, at 12:28 PM, Antonio Bibiano wrote:
>
> > So to understand how to correctly tabulate the initial power spectrum i looked at the code and understood that the table should be in the format:
> > log10(k [your units]) log10(4 Pi k^3 P(k) [no units])
> >
>
> Right.
>
>
> > Am I right? this might be useful to someone since the usual CAMB and CLASS output is:
> > k [h/Mpc] P(k) [Mpc/h)^3]
> >
> >
> > I also looked at the inputspec_ics.txt file that N-geniIC creates and looked at the code that generates it to understand what is it's format (only the first two columns),
> > i understood that the format this time is
> > k [internal units] 4 Pi k^3 k^(PrimordialIndex-1) P(k) [internal units]
> > am i right?
> >
>
> Right. (And note that the code will use P'(k) = k^(PrimordialIndex-1) * P(k) as actual power spectrum for the ICs, and this is also what's appearing then in inputspec_ics.txt)
>
>
> > So looking at this file when using one of the fitting functions it contains the power spectrum at the starting redshift and the second column is generated using those two lines of code in main.c:
> > 575: po = PowerSpec(k);
> > 576: dl = 4.0 * PI * k * k * k * po;
> > So i argue that PowerSpec(k) should give the power spectrum at the starting redshift, not redshift 0, right?
> > If this is the case then i cannot understand the comment in this snippet of code (main.c):
> > 214: p_of_k = PowerSpec(kmag);
> > 216: p_of_k *= -log(ampl);
> > 218: delta = fac * sqrt(p_of_k) / Dplus; /* scale back to starting redshift */
> > which contains the only occurrence of Dplus (the variable holding the growt factor which is 1.0 if I use a tabulated power spectrum properly normalized for the starting redshift and ReNormalizeInputSpectrum = 0).
> > So is the comment somehow misleading or that's the right behavior? Because it seems like this line espects a powerspectrum a z=0 and scales back to the starting redshift (z=Redshift from the input file).
> >
>
> You cannot really use the fitting functions for P(k) together with "ReNormalizeInputSpectrum=0" because the fitting functions are not normalized, they just give the shape of the linear power spectrum. In fact, ReNormalizeInputSpectrum=0 is ignored in this case and the spectrum at z=0 is always normalized to the specified sigma8.
>
> For a tabulated spectrum, it is also highly recommended to *not* use "ReNormalizeInputSpectrum=0", but rather let the code do the normalization through "ReNormalizeInputSpectrum=1". The former should only be useful in very special circumstances.
>
> Volker
>
>
>
>
>
> > I hope i was clear about my doubt.
> > Thanks for your help!
> >
> > Antonio Bibiano
> >
> >
> >
> > 2013/6/23 Volker Springel <volker_at_mpa-garching.mpg.de>
> >
> >
> > On Jun 9, 2013, at 9:53 AM, Volker Springel wrote:
> >
> > >
> > >
> > > On Jun 6, 2013, at 12:01 PM, Antonio Bibiano wrote:
> > >
> > >> Hello Everyone,
> > >> I was trying to generate some initial conditions for a cosmological simulation using
> > >> N-genIC and i wanted to use a tabulated power spectrum.
> > >> This is my first experience with simulations so I apologize if my questions are obvious or even stupid!
> > >>
> > >> My question is, should the redshift of the tabulated power spectrum be the same as the starting
> > >> Redshift in the N-genIC parameter file?
> > >
> > > Dear Antonio,
> > >
> > > No, this is not really necessary, provided you use ReNormalizeInputSpectrum = 1. The IC code will then only use the shape of the (linear) input spectrum and scale it up or down as needed (by the same factor for all k) to reproduce the specified normalization at z=0 (given by sigma8).
> > >
> > >>
> > >> I got my power spectra from CAMB and CLASS, as far as i understand those powerspectra a normalized to the sigma_8 that the programs give in their output, so ReNormalizeInputSpectrum = 0 should be the right setting, is this right?
> > >
> > > I think so, but this question is really one about CAMB and/or CLASS, not about N-GenIC.
> > >
> > >
> > >> And so the Sigma8 parameter should be initialized as the one given by those ouputs?
> > >>
> > >
> > > If you use ReNormalizeInputSpectrum = 0, the N-GenIC code will ignore the value specified for sigma8 in its parameterfile and assume that the input spectrum is correctly normalized for z=0. It will then scale it back to the starting redshift with the linear growth factor for the specified cosmology.
> > >
> >
> > Sorry, the last statement I made here in my previous mail is not quite correct (had remembered this differently... thanks to Hector Campos for pointing this out).
> >
> > When you use ReNormalizeInputSpectrum = 0 together with a tabulated power spectrum, the code will assume that the input power spectrum is already properly normalized for the starting redshift, i.e. it is not scaled at all in this case.
> >
> > Volker
> >
> >
> > > Regards,
> > > Volker
> > >
> > >>
> > >> Antonio Bibiano.
> > >>
> > >>
> > >> -----------------------------------------------------------
> > >>
> > >> 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:
> > >
> > >
> > >
> > >
> > > -----------------------------------------------------------
> > >
> > > 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:
> >
> >
> >
> >
> > -----------------------------------------------------------
> >
> > 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:
> >
> >
> > -----------------------------------------------------------
> >
> > 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: