MP-Gadget  5.0.1.dev1-76bc7d4726-dirty
power.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <string.h>
3 #include <math.h>
4 #include <stddef.h>
5 #include <mpi.h>
6 #include <gsl/gsl_integration.h>
7 #include <gsl/gsl_interp.h>
8 #include <bigfile-mpi.h>
9 
10 #include <libgadget/cosmology.h>
11 #include <libgadget/utils.h>
12 
13 #include <libgadget/physconst.h>
14 #include "power.h"
15 #include "proto.h"
16 static double Delta_EH(double k);
17 static double Delta_Tabulated(double k, enum TransferType Type);
18 static double sigma2_int(double k, void * params);
19 static double TopHatSigma2(double R);
20 static double tk_eh(double k);
21 
22 static double Norm;
23 static int WhichSpectrum;
24 /*Only used for tk_eh, WhichSpectrum == 0*/
25 static double PrimordialIndex;
26 static double UnitLength_in_cm;
27 static Cosmology * CP;
28 
29 /* Small factor so a zero in the power spectrum is not
30  * a log(0) = -INF*/
31 #define NUGGET 1e-30
32 #define MAXCOLS 9
33 
34 struct table
35 {
36  int Nentry;
37  double * logk;
38  double * logD[MAXCOLS];
39  gsl_interp * mat_intp[MAXCOLS];
40 };
41 
42 /*Typedef for a function that parses the table from text*/
43 typedef void (*_parse_fn)(int i, double k, char * line, struct table *, int *InputInLog10, const double InitTime, int NumCol);
44 
45 
46 static struct table power_table;
47 /*Columns: 0 == baryon, 1 == CDM, 2 == neutrino, 3 == baryon velocity, 4 == CDM velocity, 5 = neutrino velocity*/
48 static struct table transfer_table;
49 
50 static const char * tnames[MAXCOLS] = {"DELTA_BAR", "DELTA_CDM", "DELTA_NU", "DELTA_CB", "VEL_BAR", "VEL_CDM", "VEL_NU", "VEL_CB", "VEL_TOT"};
51 
52 double DeltaSpec(double k, enum TransferType Type)
53 {
54  double power;
55 
56  if(WhichSpectrum == 2)
57  power = Delta_Tabulated(k, Type);
58  else
59  power = Delta_EH(k);
60 
61  /*Normalise the power spectrum*/
62  power *= Norm;
63 
64  return power;
65 }
66 
67 /* Internal helper function that performs interpolation for a row of the
68  * tabulated transfer/mater power table*/
69 static double get_Tabulated(double k, enum TransferType Type, double oobval)
70 {
71  /*Convert k to Mpc/h*/
72  const double scale = (CM_PER_MPC / UnitLength_in_cm);
73  const double logk = log10(k*scale);
74 
76  return oobval;
77 
78  double logD = gsl_interp_eval(power_table.mat_intp[0], power_table.logk, power_table.logD[0], logk, NULL);
79  double trans = 1;
80  /*Transfer table stores (T_type(k) / T_tot(k))*/
81  if(transfer_table.Nentry > 0)
82  if(Type >= DELTA_BAR && Type < DELTA_TOT)
83  trans = gsl_interp_eval(transfer_table.mat_intp[Type], transfer_table.logk, transfer_table.logD[Type], logk, NULL);
84 
85  /*Convert delta from (Mpc/h)^3/2 to kpc/h^3/2*/
86  logD += 1.5 * log10(scale);
87  double delta = (pow(10.0, logD)-NUGGET) * trans;
88  if(!isfinite(delta))
89  endrun(1,"infinite delta or growth: %g for k = %g, Type = %d (tk = %g, logD = %g)\n",delta, k, Type, trans, logD);
90  return delta;
91 }
92 
93 double Delta_Tabulated(double k, enum TransferType Type)
94 {
95  if(Type >= VEL_BAR && Type <= VEL_TOT)
96  endrun(1, "Velocity Type %d passed to Delta_Tabulated\n", Type);
97 
98  return get_Tabulated(k, Type, 0);
99 }
100 
101 double dlogGrowth(double kmag, enum TransferType Type)
102 {
103  /*Default to total growth: type 3 is cdm + baryons.*/
104  if(Type < DELTA_BAR || Type > DELTA_CB)
105  Type = VEL_TOT;
106  else
107  /*Type should be an offset from the first velocity*/
108  Type = (enum TransferType) ((int) VEL_BAR + ((int) Type - (int) DELTA_BAR));
109  return get_Tabulated(kmag, Type, 1);
110 }
111 
112 /*Save a transfer function table to the IC file*/
113 static void save_transfer(BigFile * bf, int ncol, struct table * ttable, const char * bname, int ThisTask, const char * colnames[])
114 {
115  BigBlock btransfer;
116  int i;
117  if(0 != big_file_mpi_create_block(bf, &btransfer, bname, NULL, 0, 0, 0, MPI_COMM_WORLD)) {
118  endrun(0, "failed to create block %s:%s", bname,
119  big_file_get_error_message());
120  }
121 
122  if ( (0 != big_block_set_attr(&btransfer, "Nentry", &(ttable->Nentry), "u8", 1)) ) {
123  endrun(0, "Failed to write table size %s\n",
124  big_file_get_error_message());
125  }
126  if(0 != big_block_mpi_close(&btransfer, MPI_COMM_WORLD)) {
127  endrun(0, "Failed to close block %s\n",
128  big_file_get_error_message());
129  }
130  size_t dims[2] = {0 , 1};
131  /*The transfer state is shared between all processors,
132  *so only write on master task*/
133  if(ThisTask == 0) {
134  dims[0] = ttable->Nentry;
135  }
136 
137  char buf[100];
138  snprintf(buf, 100, "%s/logk", bname);
139 
140  _bigfile_utils_create_block_from_c_array(bf, ttable->logk, buf, "f8", dims, sizeof(double), 1, 1, MPI_COMM_WORLD);
141 
142  for(i = 0; i < ncol; i++)
143  {
144  snprintf(buf, 100, "%s/%s", bname, colnames[i]);
145  _bigfile_utils_create_block_from_c_array(bf, ttable->logD[i], buf, "f8", dims, sizeof(double), 1, 1, MPI_COMM_WORLD);
146  }
147 }
148 
149 /*Save both transfer function tables to the IC file*/
150 void save_all_transfer_tables(BigFile * bf, int ThisTask)
151 {
152  const char * pname = "DELTA_MAT";
153  save_transfer(bf, 1, &power_table, "ICPower", ThisTask, &pname);
154  save_transfer(bf, MAXCOLS, &transfer_table, "ICTransfers", ThisTask, tnames);
155 }
156 
157 
158 void parse_power(int i, double k, char * line, struct table *out_tab, int * InputInLog10, const double InitTime, int NumCol)
159 {
160  char * retval;
161  if((*InputInLog10) == 0) {
162  if(k < 0) {
163  message(1, "some input k is negative, guessing the file is in log10 units\n");
164  *InputInLog10 = 1;
165  }
166  else
167  k = log10(k);
168  }
169  out_tab->logk[i] = k;
170  retval = strtok(NULL, " \t");
171  if(!retval)
172  endrun(1,"Incomplete line in power spectrum: %s\n",line);
173  double p = atof(retval);
174  if ((*InputInLog10) == 0)
175  p = log10(p+NUGGET);
176  /*Store delta, square root of power*/
177  out_tab->logD[0][i] = p/2;
178 }
179 
180 void parse_transfer(int i, double k, char * line, struct table *out_tab, int * InputInLog10, const double InitTime, int NumCol)
181 {
182  int j;
183  int ncols = NumCol - 1; /* The first column k is already read in read_power_table. */
184  int nnu = round((ncols - 15)/2);
185  double * transfers = (double *) mymalloc("transfers", sizeof(double) * ncols);
186  k = log10(k);
187  out_tab->logk[i] = k;
188  /* Note: the ncdm entries change depending on the number of neutrino species. The first row, k,
189  * is read in read_power_table and passed as a parameter.
190  * but only the first is used for particles.
191  * 1:k (h/Mpc) 2:d_g 3:d_b 4:d_cdm 5:d_ur
192  * 6:d_ncdm[0] 7:d_ncdm[1] 8:d_ncdm[2] 9:d_tot 10:phi
193  * 11:psi 12:h 13:h_prime 14:eta 15:eta_prime
194  * 16:t_g 17:t_b 18:t_ur
195  * 19:t_ncdm[0] 20:t_ncdm[1] 21:t_ncdm[2] 22:t_tot*/
196  for(j = 0; j< ncols; j++) {
197  char * retval = strtok(NULL, " \t");
198  /*This happens if we do not have as many neutrino species as we expect, or we don't find h_prime.*/
199  if(!retval)
200  endrun(1,"Incomplete line in power spectrum: only %d columns, expecting %d. Did you remember to set extra metric transfer functions=y?\n",j, ncols);
201  transfers[j] = atof(retval);
202  }
203  /*Order of the transfer table matches the particle types:
204  * 0 is baryons, 1 is CDM, 2 is massive neutrinos (we use the most massive neutrino species).
205  * 3 is growth function for baryons, 4 is growth function for CDM, 5 is growth function for massive neutrinos.
206  * We use the formulae for velocities from fastpm in synchronous gauge:
207  * https://github.com/rainwoodman/fastpm-python/blob/02ce2ff87897f713c7b9204630f4e0257d703784/fastpm/multi.py#L185
208  * CDM = - h_prime / 2 / d_cdm
209  * bar = - (h_prime / 2 + t_b) / d_b
210  * nu = - (h_prime / 2 + t_ncdm) / d_ncdm
211  * and there is a normalisation factor of (1+z)/ hubble applied later on.
212  *
213  * See http://adsabs.harvard.edu/abs/1995ApJ...455....7M
214  * Eq. 42 (cdm), not using 49(ur), eq. 66 (baryons, and ncdm, truncation at the same order as baryon).
215  * These are in CLASS units: they are converted to Gadget units in init_transfer_table().
216  * */
217  out_tab->logD[DELTA_BAR][i] = -1*transfers[1];
218  out_tab->logD[DELTA_CDM][i] = -1*transfers[2];
219  /*This should be the weighted average sum of the three neutrino species*/
220  const _omega_nu * Onu = &CP->ONu;
221  out_tab->logD[DELTA_NU][i] = 0;
222  for(j=0; j < nnu; j++)
223  out_tab->logD[DELTA_NU][i] = -1*transfers[4+j] * omega_nu_single(Onu, InitTime, j);
224  const double onu = get_omega_nu(&CP->ONu, InitTime);
225  /*Should be weighted by omega_nu*/
226  out_tab->logD[DELTA_NU][i] /= onu;
227  /*h_prime is entry 8 + nnu. t_b is 12 + nnu, t_ncdm[2] is 13 + nnu * 2.*/
228  out_tab->logD[VEL_BAR][i] = transfers[12+nnu];
229  out_tab->logD[VEL_CDM][i] = transfers[8+nnu] * 0.5;
230  out_tab->logD[VEL_NU][i] = 0;
231  for(j=0; j < nnu; j++)
232  out_tab->logD[VEL_NU][i] = transfers[13 + nnu + j] * omega_nu_single(Onu, InitTime, j);
233  /*Should be weighted by omega_nu*/
234  out_tab->logD[VEL_NU][i] /= onu;
235  myfree(transfers);
236 }
237 
238 void read_power_table(int ThisTask, const char * inputfile, const int ncols, struct table * out_tab, const double InitTime, _parse_fn parse_line)
239 {
240  FILE *fd = NULL;
241  int j;
242  int InputInLog10 = 0;
243 
244  if(ThisTask == 0) {
245  if(!(fd = fopen(inputfile, "r")))
246  endrun(1, "can't read input spectrum in file '%s' on task %d\n", inputfile, ThisTask);
247 
248  out_tab->Nentry = 0;
249  do
250  {
251  char buffer[1024];
252  char * retval = fgets(buffer, 1024, fd);
253  /*Happens on end of file*/
254  if(!retval)
255  break;
256  retval = strtok(buffer, " \t");
257  if(!retval || retval[0] == '#')
258  continue;
259  out_tab->Nentry++;
260  }
261  while(1);
262  rewind(fd);
263  }
264  MPI_Bcast(&(out_tab->Nentry), 1, MPI_INT, 0, MPI_COMM_WORLD);
265 
266  if(out_tab->Nentry < 2)
267  endrun(1, "Input spectrum too short\n");
268  out_tab->logk = (double *) mymalloc("Powertable", (ncols+1)*out_tab->Nentry * sizeof(double));
269  for(j=0; j<ncols; j++)
270  out_tab->logD[j] = out_tab->logk + (j+1)*out_tab->Nentry;
271 
272  if(ThisTask == 0)
273  {
274  /* detect the columns of the input file */
275  char line1[1024];
276 
277  while(fgets(line1,1024,fd))
278  {
279  char * content = strtok(line1, " \t");
280  if(content[0] != '#') /*Find the first line*/
281  break;
282  }
283  int Ncolumns = 0;
284  char *c;
285  do
286  {
287  Ncolumns++;
288  c = strtok(NULL," \t");
289  }
290  while(c != NULL);
291 
292  rewind(fd);
293  message(0, "Detected %d columns in file '%s'. \n", Ncolumns, inputfile);
294 
295  int i = 0;
296  do
297  {
298  char buffer[1024];
299  char * line = fgets(buffer, 1024, fd);
300  /*Happens on end of file*/
301  if(!line)
302  break;
303  char * retval = strtok(line, " \t");
304  if(!retval || retval[0] == '#')
305  continue;
306  double k = atof(retval);
307  parse_line(i, k, line, out_tab, &InputInLog10, InitTime, Ncolumns);
308  i++;
309  }
310  while(1);
311 
312  fclose(fd);
313  }
314 
315  MPI_Bcast(out_tab->logk, (ncols+1)*out_tab->Nentry, MPI_DOUBLE, 0, MPI_COMM_WORLD);
316  for(j=0; j<ncols; j++) {
317  out_tab->mat_intp[j] = gsl_interp_alloc(gsl_interp_cspline,out_tab->Nentry);
318  }
319 }
320 
321 int
322 init_transfer_table(int ThisTask, double InitTime, const struct power_params * const ppar)
323 {
324  int i, t;
325  const int nnu = (CP->MNu[0] > 0) + (CP->MNu[1] > 0) + (CP->MNu[2] > 0);
326  if(strlen(ppar->FileWithTransferFunction) > 0) {
328  }
329  if(transfer_table.Nentry == 0) {
330  endrun(1, "Could not read transfer table at: '%s'\n",ppar->FileWithTransferFunction);
331  }
332  /*Normalise the transfer functions.*/
333 
334  /*Now normalise the velocity transfer functions: divide by a * hubble, where hubble is the hubble function in Mpc^-1, so H0/c*/
335  const double fac = InitTime * hubble_function(CP, InitTime)/CP->Hubble * 100 * CP->HubbleParam/(LIGHTCGS / 1e5);
336  const double onu = get_omega_nu(&CP->ONu, InitTime)*pow(InitTime,3);
337  double meangrowth[VEL_TOT-VEL_BAR+1] = {0};
338  /* At this point the transfer table contains: (3,4,5) t_b, 0.5 * h_prime, t_ncdm.
339  * After, if t_cdm = 0.5 h_prime / (a H(a) / H0 /c) we need:
340  * (t_b + t_cdm) / d_b, t_cdm/d_cdm, (t_ncdm + t_cdm) / d_ncdm*/
341  for(i=0; i< transfer_table.Nentry; i++) {
342  /* Now row 4 is t_cdm*/
343  transfer_table.logD[VEL_CDM][i] /= fac;
346 
347  /*Set up the CDM + baryon rows*/
350  /*total growth and delta: start as CDM + baryon and then add nu if needed.*/
352  double T_tot = transfer_table.logD[DELTA_CB][i];
353  /*Normalise the cb rows*/
354  double Omega0a3 = CP->OmegaBaryon + CP->OmegaCDM;
355  transfer_table.logD[DELTA_CB][i] /= Omega0a3;
356  transfer_table.logD[VEL_CB][i] /= Omega0a3;
357  /*Total matter density in T_tot. Neutrinos may be slightly relativistic, so
358  * Omega0a3 >= CP->Omega0 if neutrinos are massive.*/
359  if(nnu > 0) {
360  /*Add neutrino growth to total growth*/
362  T_tot += onu * transfer_table.logD[DELTA_NU][i];
363  Omega0a3 += onu;
364  }
365  /*Normalise the totals now we have neutrinos*/
366  transfer_table.logD[VEL_TOT][i] /= Omega0a3;
367  T_tot /= Omega0a3;
368  /*Normalize growth_i and delta_i by delta_tot */
369  for(t = DELTA_BAR; t <= VEL_TOT; t++) {
370  transfer_table.logD[t][i] /= T_tot;
371  }
372  }
373 
374  /*Now compute mean growths*/
375  for(t = VEL_BAR; t <= VEL_TOT; t++) {
376  int nmean=0;
377  for(i=0; i< transfer_table.Nentry; i++)
378  if(transfer_table.logk[i] > power_table.logk[0]) {
379  meangrowth[t-VEL_BAR] += transfer_table.logD[t][i];
380  nmean++;
381  }
382  if(nmean > 0)
383  meangrowth[t-VEL_BAR]/= nmean;
384  }
385  /*Initialise the interpolation*/
386  for(t = 0; t < MAXCOLS; t++)
388 
389  message(0,"Scale-dependent growth calculated. Mean = %g %g %g %g %g\n",meangrowth[0], meangrowth[1], meangrowth[2], meangrowth[3], meangrowth[4]);
390  message(0, "Power spectrum rows: %d, Transfer: %d (%g -> %g)\n", power_table.Nentry, transfer_table.Nentry, transfer_table.logD[DELTA_BAR][0],transfer_table.logD[DELTA_BAR][transfer_table.Nentry-1]);
391  return transfer_table.Nentry;
392 }
393 
394 int init_powerspectrum(int ThisTask, double InitTime, double UnitLength_in_cm_in, Cosmology * CPin, struct power_params * ppar)
395 {
397  /*Used only for tk_eh*/
399  UnitLength_in_cm = UnitLength_in_cm_in;
400  CP = CPin;
401 
402  if(ppar->WhichSpectrum == 2) {
404  /*Initialise the interpolation*/
407  if(ppar->DifferentTransferFunctions || ppar->ScaleDepVelocity) {
408  init_transfer_table(ThisTask, InitTime, ppar);
409  }
410  }
411 
412  Norm = 1.0;
413  if(ppar->InputPowerRedshift >= 0 || ppar->Sigma8 > 0) {
414  const double R8 = 8 * (CM_PER_MPC / UnitLength_in_cm); /* 8 Mpc/h */
415  if(ppar->Sigma8 > 0) {
416  double res = TopHatSigma2(R8);
417  if(isfinite(res) && res > 0)
418  Norm = ppar->Sigma8 / sqrt(res);
419  else
420  endrun(1, "Could not normalize P(k) to Sigma8=%g! Measured Sigma8^2 is %g\n", ppar->Sigma8, res);
421  }
422  double Dplus = GrowthFactor(CP, InitTime, 1/(1+ppar->InputPowerRedshift));
423  if(ppar->InputPowerRedshift >= 0) {
424  Norm *= Dplus;
425  message(0,"Growth factor from z=%g (InputPowerRedshift) to z=%g (Init): %g \n", ppar->InputPowerRedshift, 1. / InitTime - 1, Dplus);
426  }
427  message(0, "Normalization adjusted to Sigma8=%g (at z=0) (Normfac=%g). \n", sqrt(TopHatSigma2(R8))/Dplus, Norm);
428  }
429  return power_table.Nentry;
430 }
431 
432 double Delta_EH(double k) /* Eisenstein & Hu */
433 {
434  return sqrt(k * pow(tk_eh(k), 2)* pow(k, PrimordialIndex - 1.0));
435 }
436 
437 
438 double tk_eh(double k) /* from Martin White */
439 {
440  double q, theta, ommh2, a, s, gamma, L0, C0;
441  double tmp;
442  double omegam, ombh2, hubble;
443 
444  /* other input parameters */
445  hubble = CP->HubbleParam;
446 
447  omegam = CP->Omega0;
448  ombh2 = CP->OmegaBaryon * CP->HubbleParam * CP->HubbleParam;
449 
450  if(CP->OmegaBaryon == 0)
451  ombh2 = 0.044 * CP->HubbleParam * CP->HubbleParam;
452 
453  k *= (CM_PER_MPC / UnitLength_in_cm); /* convert to h/Mpc */
454 
455  theta = 2.728 / 2.7;
456  ommh2 = omegam * hubble * hubble;
457  s = 44.5 * log(9.83 / ommh2) / sqrt(1. + 10. * exp(0.75 * log(ombh2))) * hubble;
458  a = 1. - 0.328 * log(431. * ommh2) * ombh2 / ommh2
459  + 0.380 * log(22.3 * ommh2) * (ombh2 / ommh2) * (ombh2 / ommh2);
460  gamma = a + (1. - a) / (1. + exp(4 * log(0.43 * k * s)));
461  gamma *= omegam * hubble;
462  q = k * theta * theta / gamma;
463  L0 = log(2. * exp(1.) + 1.8 * q);
464  C0 = 14.2 + 731. / (1. + 62.5 * q);
465  tmp = L0 / (L0 + C0 * q * q);
466  return (tmp);
467 }
468 
469 
470 double TopHatSigma2(double R)
471 {
472  gsl_integration_workspace * w = gsl_integration_workspace_alloc (1000);
473  double result,abserr;
474  gsl_function F;
475  F.function = &sigma2_int;
476  F.params = &R;
477 
478  /* note: 500/R is here chosen as integration boundary (infinity) */
479  gsl_integration_qags (&F, 0, 500. / R, 0, 1e-4,1000,w,&result, &abserr);
480 /* printf("gsl_integration_qng in TopHatSigma2. Result %g, error: %g, intervals: %lu\n",result, abserr,w->size); */
481  gsl_integration_workspace_free (w);
482  return result;
483 }
484 
485 
486 double sigma2_int(double k, void * params)
487 {
488  double w, x;
489 
490  double r_tophat = *(double *) params;
491  const double kr = r_tophat * k;
492  const double kr2 = kr * kr;
493 
494  /*Series expansion; actually good until kr~1*/
495  if(kr < 1e-3)
496  w = 1./3. - kr2/30. +kr2*kr2/840.;
497  else
498  w = 3 * (sin(kr) / kr - cos(kr)) / kr2;
499  x = 4 * M_PI / (2 * M_PI * 2 * M_PI * 2 * M_PI) * k * k * w * w * pow(DeltaSpec(k, DELTA_TOT),2);
500 
501  return x;
502 
503 }
double GrowthFactor(Cosmology *CP, double astart, double aend)
Definition: cosmology.c:82
double hubble_function(const Cosmology *CP, double a)
Definition: cosmology.c:58
void message(int where, const char *fmt,...)
Definition: endrun.c:175
void endrun(int where, const char *fmt,...)
Definition: endrun.c:147
#define mymalloc(name, size)
Definition: mymalloc.h:15
#define myfree(x)
Definition: mymalloc.h:19
double omega_nu_single(const _omega_nu *const omnu, const double a, int i)
double get_omega_nu(const _omega_nu *const omnu, const double a)
#define CM_PER_MPC
Definition: physconst.h:20
#define LIGHTCGS
Definition: physconst.h:18
static int WhichSpectrum
Definition: power.c:23
double DeltaSpec(double k, enum TransferType Type)
Definition: power.c:52
static double sigma2_int(double k, void *params)
Definition: power.c:486
int init_powerspectrum(int ThisTask, double InitTime, double UnitLength_in_cm_in, Cosmology *CPin, struct power_params *ppar)
Definition: power.c:394
int init_transfer_table(int ThisTask, double InitTime, const struct power_params *const ppar)
Definition: power.c:322
static double get_Tabulated(double k, enum TransferType Type, double oobval)
Definition: power.c:69
double dlogGrowth(double kmag, enum TransferType Type)
Definition: power.c:101
static double PrimordialIndex
Definition: power.c:25
static double Delta_Tabulated(double k, enum TransferType Type)
Definition: power.c:93
#define MAXCOLS
Definition: power.c:32
void save_all_transfer_tables(BigFile *bf, int ThisTask)
Definition: power.c:150
void(* _parse_fn)(int i, double k, char *line, struct table *, int *InputInLog10, const double InitTime, int NumCol)
Definition: power.c:43
static struct table power_table
Definition: power.c:46
static const char * tnames[MAXCOLS]
Definition: power.c:50
static struct table transfer_table
Definition: power.c:48
void read_power_table(int ThisTask, const char *inputfile, const int ncols, struct table *out_tab, const double InitTime, _parse_fn parse_line)
Definition: power.c:238
static double tk_eh(double k)
Definition: power.c:438
#define NUGGET
Definition: power.c:31
static Cosmology * CP
Definition: power.c:27
void parse_transfer(int i, double k, char *line, struct table *out_tab, int *InputInLog10, const double InitTime, int NumCol)
Definition: power.c:180
void parse_power(int i, double k, char *line, struct table *out_tab, int *InputInLog10, const double InitTime, int NumCol)
Definition: power.c:158
static double Delta_EH(double k)
Definition: power.c:432
static void save_transfer(BigFile *bf, int ncol, struct table *ttable, const char *bname, int ThisTask, const char *colnames[])
Definition: power.c:113
static double UnitLength_in_cm
Definition: power.c:26
static double TopHatSigma2(double R)
Definition: power.c:470
static double Norm
Definition: power.c:22
TransferType
Definition: power.h:41
@ DELTA_CB
Definition: power.h:45
@ DELTA_BAR
Definition: power.h:42
@ DELTA_TOT
Definition: power.h:52
@ VEL_TOT
Definition: power.h:50
@ VEL_BAR
Definition: power.h:46
@ VEL_CB
Definition: power.h:49
@ DELTA_CDM
Definition: power.h:43
@ VEL_CDM
Definition: power.h:47
@ DELTA_NU
Definition: power.h:44
@ VEL_NU
Definition: power.h:48
void _bigfile_utils_create_block_from_c_array(BigFile *bf, void *baseptr, const char *name, const char *dtype, size_t dims[], ptrdiff_t elsize, int NumFiles, int NumWriters, MPI_Comm comm)
Definition: save.c:18
double Omega0
Definition: cosmology.h:10
double HubbleParam
Definition: cosmology.h:20
double OmegaCDM
Definition: cosmology.h:11
double OmegaBaryon
Definition: cosmology.h:19
double MNu[3]
Definition: cosmology.h:25
_omega_nu ONu
Definition: cosmology.h:24
double Hubble
Definition: cosmology.h:21
int ScaleDepVelocity
Definition: power.h:11
char * FileWithTransferFunction
Definition: power.h:12
int DifferentTransferFunctions
Definition: power.h:10
double PrimordialIndex
Definition: power.h:16
int WhichSpectrum
Definition: power.h:9
double Sigma8
Definition: power.h:14
char * FileWithInputSpectrum
Definition: power.h:13
double InputPowerRedshift
Definition: power.h:15
Definition: power.c:35
int Nentry
Definition: power.c:36
double * logD[MAXCOLS]
Definition: power.c:38
double * logk
Definition: power.c:37
gsl_interp * mat_intp[MAXCOLS]
Definition: power.c:39
int ThisTask
Definition: test_exchange.c:23