|
MP-Gadget
5.0.1.dev1-76bc7d4726-dirty
|
#include <math.h>#include <string.h>#include <bigfile-mpi.h>#include <gsl/gsl_integration.h>#include <gsl/gsl_errno.h>#include <gsl/gsl_interp.h>#include <gsl/gsl_sf_bessel.h>#include "neutrinos_lra.h"#include "utils/endrun.h"#include "utils/mymalloc.h"#include "petaio.h"#include "cosmology.h"#include "powerspectrum.h"#include "physconst.h"Go to the source code of this file.
Classes | |
| struct | _transfer_init_table |
| struct | _delta_nu_int_params |
Macros | |
| #define | FLOAT_ACC 1e-6 |
| #define | GSL_VAL 200 |
Typedefs | |
| typedef struct _transfer_init_table | _transfer_init_table |
| typedef struct _delta_nu_int_params | delta_nu_int_params |
Functions | |
| void | update_delta_tot (_delta_tot_table *const d_tot, const double a, const double delta_cdm_curr[], const double delta_nu_curr[], const int overwrite) |
| void | get_delta_nu (Cosmology *CP, const _delta_tot_table *const d_tot, const double a, double delta_nu_curr[], const double mnu) |
| void | get_delta_nu_combined (Cosmology *CP, const _delta_tot_table *const d_tot, const double a, double delta_nu_curr[]) |
| double | specialJ (const double x, const double vcmnubylight, const double nufrac_low) |
| double | fslength (Cosmology *CP, const double logai, const double logaf, const double light) |
| static double | get_delta_tot (const double delta_nu_curr, const double delta_cdm_curr, const double OmegaNua3, const double Omeganonu, const double Omeganu1, const double particle_nu_fraction) |
| static void | delta_tot_first_init (_delta_tot_table *const d_tot, const int nk_in, const double wavenum[], const double delta_cdm_curr[], const double TimeIC) |
| void | delta_nu_from_power (struct _powerspectrum *PowerSpectrum, Cosmology *CP, const double Time, const double TimeIC) |
| void | powerspectrum_nu_save (struct _powerspectrum *PowerSpectrum, const char *OutputDir, const char *filename, const double Time) |
| void | petaio_save_neutrinos (BigFile *bf, int ThisTask) |
| void | petaio_read_icnutransfer (BigFile *bf, int ThisTask) |
| void | petaio_read_neutrinos (BigFile *bf, int ThisTask) |
| void | init_neutrinos_lra (const int nk_in, const double TimeTransfer, const double TimeMax, const double Omega0, const _omega_nu *const omnu, const double UnitTime_in_s, const double UnitLength_in_cm) |
| double | fslength_int (const double loga, void *params) |
| static double | specialJ_fit (const double x) |
| static double | II (const double x, const double qc, const int n) |
| static double | Jfrac_high (const double x, const double qc, const double nufrac_low) |
| double | get_delta_nu_int (double logai, void *params) |
Variables | |
| _delta_tot_table | delta_tot_table |
| static _transfer_init_table | t_init_data |
| static _transfer_init_table * | t_init = &t_init_data |
Contains calculations for the Fourier-space semi-linear neutrino method described in Ali-Haimoud and Bird 2012. delta_tot_table stores the state of the integrator, which includes the matter power spectrum over all past time. This file contains routines for manipulating this structure; updating it by computing a new neutrino power spectrum, from the non-linear CDM power.
Definition in file neutrinos_lra.c.
| #define FLOAT_ACC 1e-6 |
Floating point accuracy
Definition at line 28 of file neutrinos_lra.c.
| #define GSL_VAL 200 |
Number of bins in integrations
Definition at line 30 of file neutrinos_lra.c.
| typedef struct _transfer_init_table _transfer_init_table |
Definition at line 75 of file neutrinos_lra.c.
| typedef struct _delta_nu_int_params delta_nu_int_params |
Definition at line 616 of file neutrinos_lra.c.
| void delta_nu_from_power | ( | struct _powerspectrum * | PowerSpectrum, |
| Cosmology * | CP, | ||
| const double | Time, | ||
| const double | TimeIC | ||
| ) |
Definition at line 134 of file neutrinos_lra.c.
References CP, _delta_tot_table::delta_nu_last, _powerspectrum::delta_nu_ratio, _delta_tot_table::delta_tot, delta_tot_first_init(), _delta_tot_table::delta_tot_init_done, delta_tot_table, endrun(), FLOAT_ACC, get_delta_nu_combined(), get_omega_nu(), get_omega_nu_nopart(), _omega_nu::hybnu, _delta_tot_table::ia, _powerspectrum::kk, _transfer_init_table::logk, _powerspectrum::logknu, message(), myfree, mymalloc, mymalloc2, _delta_tot_table::nk, _powerspectrum::nonzero, _powerspectrum::nu_prefac, _delta_tot_table::Omeganonu, Cosmology::ONu, particle_nu_fraction(), _powerspectrum::Power, _delta_tot_table::scalefact, update_delta_tot(), and _delta_tot_table::wavenum.
Referenced by compute_neutrino_power().
|
static |
Definition at line 97 of file neutrinos_lra.c.
References _delta_tot_table::delta_nu_init, _delta_tot_table::delta_tot, endrun(), get_delta_tot(), get_omega_nu(), get_omega_nu_nopart(), _omega_nu::hybnu, _delta_tot_table::ia, _transfer_init_table::logk, _delta_tot_table::nk, _transfer_init_table::NPowerTable, _delta_tot_table::Omeganonu, _delta_tot_table::omnu, particle_nu_fraction(), _delta_tot_table::scalefact, t_init, _transfer_init_table::T_nu, _delta_tot_table::TimeTransfer, and _delta_tot_table::wavenum.
Referenced by delta_nu_from_power().
| double fslength | ( | Cosmology * | CP, |
| const double | logai, | ||
| const double | logaf, | ||
| const double | light | ||
| ) |
Free-streaming length (times Mnu/k_BT_nu, which is dimensionless) for a non-relativistic particle of momentum q = T0, from scale factor ai to af. Arguments:
| logai | log of initial scale factor |
| logaf | log of final scale factor |
| mnu | Neutrino mass in eV |
| light | speed of light in internal length units. |
Definition at line 553 of file neutrinos_lra.c.
References CP, fslength_int(), and GSL_VAL.
Referenced by get_delta_nu(), and test_fslength().
| double fslength_int | ( | const double | loga, |
| void * | params | ||
| ) |
Definition at line 536 of file neutrinos_lra.c.
References CP, and hubble_function().
Referenced by fslength().
| void get_delta_nu | ( | Cosmology * | CP, |
| const _delta_tot_table *const | d_tot, | ||
| const double | a, | ||
| double | delta_nu_curr[], | ||
| const double | mnu | ||
| ) |
Main function: given tables of wavenumbers, total delta at Na earlier times (< = a), and initial conditions for neutrinos, computes the current delta_nu.
| d_tot | Initialised structure for storing total matter density. |
| a | Current scale factor. |
| delta_nu_curr | Pointer to array to store square root of neutrino power spectrum. Main output. |
| mnu | Neutrino mass in eV. |
Definition at line 667 of file neutrinos_lra.c.
References _delta_nu_int_params::acc, _delta_nu_int_params::CP, CP, _delta_tot_table::delta_nu_init, _delta_tot_table::delta_nu_prefac, _delta_nu_int_params::delta_tot, _delta_tot_table::delta_tot, endrun(), _delta_nu_int_params::fs_acc, _delta_nu_int_params::fs_spline, fslength(), _delta_nu_int_params::fslengths, _delta_nu_int_params::fsscales, get_delta_nu_int(), GSL_VAL, hubble_function(), _omega_nu::hybnu, _delta_tot_table::ia, _delta_nu_int_params::k, _omega_nu::kBtnu, _delta_tot_table::light, _delta_nu_int_params::mnubykT, myfree, mymalloc, _delta_tot_table::nk, _delta_nu_int_params::nufrac_low, _hybrid_nu::nufrac_low, _delta_tot_table::omnu, particle_nu_fraction(), _delta_nu_int_params::qc, _delta_nu_int_params::scale, _delta_tot_table::scalefact, specialJ(), _delta_nu_int_params::spline, _delta_tot_table::TimeTransfer, _hybrid_nu::vcrit, and _delta_tot_table::wavenum.
Referenced by get_delta_nu_combined().
| void get_delta_nu_combined | ( | Cosmology * | CP, |
| const _delta_tot_table *const | d_tot, | ||
| const double | a, | ||
| double | delta_nu_curr[] | ||
| ) |
Function which wraps three get_delta_nu calls to get delta_nu three times, so that the final value is for all neutrino species
Definition at line 494 of file neutrinos_lra.c.
References CP, get_delta_nu(), get_omega_nu_nopart(), _rho_nu_single::mnu, myfree, mymalloc, _delta_tot_table::nk, _omega_nu::nu_degeneracies, NUSPECIES, omega_nu_single(), _delta_tot_table::omnu, and _omega_nu::RhoNuTab.
Referenced by delta_nu_from_power().
| double get_delta_nu_int | ( | double | logai, |
| void * | params | ||
| ) |
GSL integration kernel for get_delta_nu
Definition at line 652 of file neutrinos_lra.c.
References _delta_nu_int_params::acc, _delta_nu_int_params::CP, _delta_nu_int_params::delta_tot, _delta_nu_int_params::fs_acc, _delta_nu_int_params::fs_spline, _delta_nu_int_params::fslengths, _delta_nu_int_params::fsscales, hubble_function(), _delta_nu_int_params::k, _delta_nu_int_params::mnubykT, _delta_nu_int_params::nufrac_low, _delta_nu_int_params::qc, _delta_nu_int_params::scale, specialJ(), and _delta_nu_int_params::spline.
Referenced by get_delta_nu().
|
inlinestatic |
Combine the CDM and neutrino power spectra together to get the total power. OmegaNua3 = OmegaNu(a) * a^3 Omeganonu = Omega0 - OmegaNu(1) Omeganu1 = OmegaNu(1)
Definition at line 67 of file neutrinos_lra.c.
References particle_nu_fraction().
Referenced by delta_tot_first_init(), and update_delta_tot().
|
inlinestatic |
Definition at line 590 of file neutrinos_lra.c.
Referenced by Jfrac_high().
| void init_neutrinos_lra | ( | const int | nk_in, |
| const double | TimeTransfer, | ||
| const double | TimeMax, | ||
| const double | Omega0, | ||
| const _omega_nu *const | omnu, | ||
| const double | UnitTime_in_s, | ||
| const double | UnitLength_in_cm | ||
| ) |
Allocates memory for delta_tot_table.
| nk_in | Number of bins stored in each power spectrum. |
| TimeTransfer | Scale factor of the transfer functions. |
| TimeMax | Final scale factor up to which we will need memory. |
| Omega0 | Matter density at z=0. |
| omnu | Pointer to structure containing pre-computed tables for evaluating neutrino matter densities. |
| UnitTime_in_s | Time unit of the simulation in s. |
| UnitLength_in_cm | Length unit of the simulation in cm |
Definition at line 450 of file neutrinos_lra.c.
References _delta_tot_table::delta_nu_init, _delta_tot_table::delta_nu_last, _delta_tot_table::delta_nu_prefac, _delta_tot_table::delta_tot, delta_tot_table, get_omega_nu(), HUBBLE, _delta_tot_table::ia, _delta_tot_table::light, LIGHTCGS, mymalloc, _delta_tot_table::namax, _delta_tot_table::nk, _delta_tot_table::nk_allocated, _delta_tot_table::Omeganonu, _delta_tot_table::omnu, _delta_tot_table::scalefact, _delta_tot_table::TimeTransfer, UnitLength_in_cm, and _delta_tot_table::wavenum.
Referenced by begrun(), and test_allocate_delta_tot_table().
|
inlinestatic |
Definition at line 601 of file neutrinos_lra.c.
References II(), and nufrac_low().
| void petaio_read_icnutransfer | ( | BigFile * | bf, |
| int | ThisTask | ||
| ) |
Definition at line 317 of file neutrinos_lra.c.
References endrun(), _transfer_init_table::logk, message(), myfree, mymalloc, mymalloc2, _transfer_init_table::NPowerTable, petaio_read_block(), t_init, _transfer_init_table::T_nu, and ThisTask.
Referenced by petaio_read_snapshot().
| void petaio_read_neutrinos | ( | BigFile * | bf, |
| int | ThisTask | ||
| ) |
Definition at line 376 of file neutrinos_lra.c.
References _delta_tot_table::delta_nu_init, _delta_tot_table::delta_tot, delta_tot_table, endrun(), _delta_tot_table::ia, myfree, mymalloc, _delta_tot_table::namax, _delta_tot_table::nk, _delta_tot_table::nk_allocated, petaio_read_block(), _delta_tot_table::scalefact, ThisTask, and _delta_tot_table::wavenum.
Referenced by petaio_read_snapshot().
| void petaio_save_neutrinos | ( | BigFile * | bf, |
| int | ThisTask | ||
| ) |
Definition at line 265 of file neutrinos_lra.c.
References _delta_tot_table::delta_nu_init, _delta_tot_table::delta_tot, delta_tot_table, endrun(), _delta_tot_table::ia, myfree, mymalloc, _delta_tot_table::nk, petaio_save_block(), _delta_tot_table::scalefact, ThisTask, and _delta_tot_table::wavenum.
Referenced by petaio_save_snapshot().
| void powerspectrum_nu_save | ( | struct _powerspectrum * | PowerSpectrum, |
| const char * | OutputDir, | ||
| const char * | filename, | ||
| const double | Time | ||
| ) |
Definition at line 240 of file neutrinos_lra.c.
References _delta_tot_table::delta_nu_last, delta_tot_table, fastpm_strdup_printf(), _powerspectrum::kk, myfree, _powerspectrum::Nmodes, _powerspectrum::nonzero, _powerspectrum::nu_acc, _powerspectrum::nu_spline, and ThisTask.
Referenced by gravpm_force().
| double specialJ | ( | const double | x, |
| const double | vcmnubylight, | ||
| const double | nufrac_low | ||
| ) |
Fit to the special function J(x) that is accurate to better than 3% relative and 0.07% absolute
Definition at line 616 of file neutrinos_lra.c.
Referenced by get_delta_nu(), get_delta_nu_int(), and test_specialJ().
|
inlinestatic |
Definition at line 576 of file neutrinos_lra.c.
| void update_delta_tot | ( | _delta_tot_table *const | d_tot, |
| const double | a, | ||
| const double | delta_cdm_curr[], | ||
| const double | delta_nu_curr[], | ||
| const int | overwrite | ||
| ) |
Update the last value of delta_tot in the table with a new value computed from the given delta_cdm_curr and delta_nu_curr. If overwrite is true, overwrite the existing final entry.
Definition at line 519 of file neutrinos_lra.c.
References _delta_tot_table::delta_tot, get_delta_tot(), get_omega_nu(), get_omega_nu_nopart(), _omega_nu::hybnu, _delta_tot_table::ia, _delta_tot_table::nk, _delta_tot_table::Omeganonu, _delta_tot_table::omnu, particle_nu_fraction(), and _delta_tot_table::scalefact.
Referenced by delta_nu_from_power().
| _delta_tot_table delta_tot_table |
Definition at line 75 of file neutrinos_lra.c.
Referenced by delta_nu_from_power(), init_neutrinos_lra(), petaio_read_neutrinos(), petaio_save_neutrinos(), powerspectrum_nu_save(), and test_allocate_delta_tot_table().
|
static |
Definition at line 91 of file neutrinos_lra.c.
Referenced by delta_tot_first_init(), and petaio_read_icnutransfer().
|
static |
Definition at line 90 of file neutrinos_lra.c.