|
Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
|
#include <stdio.h>#include <stdlib.h>#include <math.h>#include <string.h>#include <gsl/gsl_errno.h>#include <gsl/gsl_odeiv2.h>#include <gsl/gsl_spline.h>#include <gsl/gsl_integration.h>#include <gsl/gsl_roots.h>#include "ccl.h"#include "ccl_params.h"
Go to the source code of this file.
Classes | |
| struct | chipar |
| struct | Fpar |
|
static |
Definition at line 299 of file ccl_background.c.
References CCL_ERROR_COMPUTECHI, ccl_gsl, ccl_raise_gsl_warning(), Fpar::chi, cl_cmbl_bm::cosmo, Fpar::cosmo, dfzero(), fdfzero(), fzero(), p, ccl_gsl_params::ROOT_EPSREL, and Fpar::status.
Referenced by ccl_cosmology_compute_distances().
| double ccl_comoving_angular_distance | ( | ccl_cosmology * | cosmo, |
| double | a, | ||
| int * | status | ||
| ) |
Comoving angular distance in Mpc from today to scale factor a NOTE this quantity is otherwise known as the transverse comoving distance, and is NOT angular diameter distance or angular separation
| cosmo | Cosmological parameters |
| a | scale factor, normalized to 1 for today |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 813 of file ccl_background.c.
References ccl_data::accelerator, ccl_check_status(), ccl_cosmology_compute_distances(), ccl_cosmology_set_status_message(), CCL_ERROR_COMPUTECHI, ccl_raise_gsl_warning(), ccl_sinn(), ccl_data::chi, ccl_cosmology::computed_distances, and ccl_cosmology::data.
Referenced by ccl_comoving_angular_distances(), and ccl_luminosity_distance().
| void ccl_comoving_angular_distances | ( | ccl_cosmology * | cosmo, |
| int | na, | ||
| double | a[], | ||
| double | output[], | ||
| int * | status | ||
| ) |
Comoving angular distances in Mpc to scale factors as given in array a[0..na-1] NOTE this quantity is otherwise known as the transverse comoving distance, and is NOT angular diameter distance or angular separation
| cosmo | Cosmological parameters |
| na | Number of scale factors in a |
| a | array of scale factors |
| output | array of length na to store the results of the calculation. The entry at index i stores the distance for a[i]. |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 843 of file ccl_background.c.
References ccl_comoving_angular_distance().
| double ccl_comoving_radial_distance | ( | ccl_cosmology * | cosmo, |
| double | a, | ||
| int * | status | ||
| ) |
Comoving radial distance in Mpc from today to scale factor a
| cosmo | Cosmological parameters |
| a | scale factor, normalized to 1 for today |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 752 of file ccl_background.c.
References ccl_data::accelerator, ccl_check_status(), ccl_cosmology_compute_distances(), ccl_cosmology_set_status_message(), CCL_ERROR_COMPUTECHI, ccl_raise_gsl_warning(), ccl_data::chi, ccl_cosmology::computed_distances, and ccl_cosmology::data.
Referenced by ccl_comoving_radial_distances(), ccl_get_tracer_fa(), ccl_get_tracer_fas(), cl_tracer(), clt_init_nz(), clt_init_wL(), clt_init_wM(), compare_distances(), compare_distances_hiz(), compare_distances_hiz_mnu(), compare_distances_mnu(), and main().
| void ccl_comoving_radial_distances | ( | ccl_cosmology * | cosmo, |
| int | na, | ||
| double | a[], | ||
| double | output[], | ||
| int * | status | ||
| ) |
Comoving radial distances in Mpc to scale factors as given in list a[0..na-1]
| cosmo | Cosmological parameters |
| na | Number of scale factors in a |
| a | array of scale factors |
| output | array of length na to store the results of the calculation. The entry at index i stores the distance for a[i]. |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 781 of file ccl_background.c.
References ccl_comoving_radial_distance().
| void ccl_cosmology_compute_distances | ( | ccl_cosmology * | cosmo, |
| int * | status | ||
| ) |
Compute comoving distances and spline to be stored in the cosmology structure.
| cosmo | Cosmological parameters |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 346 of file ccl_background.c.
References a_of_chi(), ccl_spline_params::A_SPLINE_MAX, ccl_spline_params::A_SPLINE_MIN, ccl_spline_params::A_SPLINE_MINLOG, ccl_spline_params::A_SPLINE_NA, ccl_spline_params::A_SPLINE_NLOG, A_SPLINE_TYPE, ccl_data::accelerator, ccl_data::achi, ccl_cosmology_set_status_message(), CCL_ERROR_COMPUTECHI, CCL_ERROR_INTEG, CCL_ERROR_LINSPACE, CCL_ERROR_MEMORY, CCL_ERROR_ROOT, CCL_ERROR_SPLINE, ccl_linear_spacing(), ccl_linlog_spacing(), ccl_splines, ccl_data::chi, compute_chi(), ccl_cosmology::computed_distances, ccl_cosmology::data, ccl_data::E, h_over_h0(), and growth_allz::T.
Referenced by ccl_comoving_angular_distance(), ccl_comoving_radial_distance(), ccl_distance_modulus(), ccl_h_over_h0(), and ccl_scale_factor_of_chi().
| void ccl_cosmology_compute_growth | ( | ccl_cosmology * | cosmo, |
| int * | status | ||
| ) |
Compute the growth function and a spline to be stored in the cosmology structure.
| cosmo | Cosmological parameters |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 516 of file ccl_background.c.
References ccl_spline_params::A_SPLINE_MAX, ccl_spline_params::A_SPLINE_MIN, ccl_spline_params::A_SPLINE_MINLOG, ccl_spline_params::A_SPLINE_NA, ccl_spline_params::A_SPLINE_NLOG, A_SPLINE_TYPE, ccl_data::accelerator, ccl_cosmology_set_status_message(), CCL_ERROR_INTEG, CCL_ERROR_LINSPACE, CCL_ERROR_MEMORY, CCL_ERROR_NOT_IMPLEMENTED, CCL_ERROR_SPLINE, ccl_gsl, ccl_linlog_spacing(), ccl_raise_gsl_warning(), ccl_splines, ccl_cosmology::computed_growth, ccl_cosmology::data, df_integrand(), ccl_parameters::df_mgrowth, ccl_data::fgrowth, ccl_data::growth, ccl_data::growth0, growth_factor_and_growth_rate(), ccl_parameters::has_mgrowth, ccl_gsl_params::INTEGRATION_DISTANCE_EPSREL, ccl_gsl_params::N_ITERATION, ccl_parameters::N_nu_mass, ccl_parameters::nz_mgrowth, halomod_bm::params, ccl_cosmology::params, z, and ccl_parameters::z_mgrowth.
Referenced by ccl_growth_factor(), ccl_growth_factor_unnorm(), and ccl_growth_rate().
| void ccl_distance_moduli | ( | ccl_cosmology * | cosmo, |
| int | na, | ||
| double | a[], | ||
| double | output[], | ||
| int * | status | ||
| ) |
Distance moduli for objects at scale factors as given in list a[0..na-1]. Note the factor of 6 arises from the conversion from Mpc to pc.
| cosmo | Cosmological parameters |
| na | Number of scale factors in a |
| a | array of scale factors |
| output | array of length na to store the results of the calculation. The entry at index i stores the distance for a[i]. |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 898 of file ccl_background.c.
References ccl_distance_modulus().
| double ccl_distance_modulus | ( | ccl_cosmology * | cosmo, |
| double | a, | ||
| int * | status | ||
| ) |
Distance modulus for object at scale factor a. Note the factor of 6 arises from the conversion from Mpc to pc.
| cosmo | Cosmological parameters |
| a | scale factor, normalized to 1 today |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 871 of file ccl_background.c.
References ccl_check_status(), ccl_cosmology_compute_distances(), ccl_cosmology_set_status_message(), CCL_ERROR_COMPUTECHI, ccl_luminosity_distance(), and ccl_cosmology::computed_distances.
Referenced by ccl_distance_moduli(), compare_distances(), compare_distances_hiz_mnu(), compare_distances_mnu(), and main().
| double ccl_growth_factor | ( | ccl_cosmology * | cosmo, |
| double | a, | ||
| int * | status | ||
| ) |
Growth factor at scale factor a, where g(z=0) is normalized to 1
| cosmo | Cosmological parameters |
| a | scale factor, normalized to 1 for today |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 948 of file ccl_background.c.
References ccl_data::accelerator, ccl_check_status(), ccl_cosmology_compute_growth(), ccl_cosmology_set_status_message(), CCL_ERROR_COMPUTECHI, CCL_ERROR_NOT_IMPLEMENTED, ccl_raise_gsl_warning(), ccl_cosmology::computed_growth, ccl_cosmology::data, and ccl_data::growth.
Referenced by ccl_cosmology_compute_power_bbks(), ccl_cosmology_compute_power_eh(), ccl_growth_factor_unnorm(), ccl_growth_factors(), ccl_halo_concentration(), ccl_linear_matter_power(), ccl_nonlin_matter_power(), ccl_sigmaM(), ccl_sigmaR(), ccl_sigmaV(), check_mgrowth(), growth_factor(), and main().
| double ccl_growth_factor_unnorm | ( | ccl_cosmology * | cosmo, |
| double | a, | ||
| int * | status | ||
| ) |
Growth factor at scale factor a, where g(a) is normalized to a in matter domination
| cosmo | Cosmological parameters |
| a | scale factor, normalized to 1 for today |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 992 of file ccl_background.c.
References ccl_check_status(), ccl_cosmology_compute_growth(), CCL_ERROR_NOT_IMPLEMENTED, ccl_growth_factor(), ccl_cosmology::computed_growth, ccl_cosmology::data, and ccl_data::growth0.
Referenced by ccl_growth_factors_unnorm(), compare_growth(), and compare_growth_hiz().
| void ccl_growth_factors | ( | ccl_cosmology * | cosmo, |
| int | na, | ||
| double | a[], | ||
| double | output[], | ||
| int * | status | ||
| ) |
Growth factors at an array of scale factor given in a[0..na-1], where g(z=0) is normalized to 1
| cosmo | Cosmological parameters |
| na | Number of scale factors in a |
| a | array of scale factors |
| output | array of length na to store the results of the calculation. The entry at index i stores the distance for a[i]. |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 981 of file ccl_background.c.
References ccl_growth_factor().
| void ccl_growth_factors_unnorm | ( | ccl_cosmology * | cosmo, |
| int | na, | ||
| double | a[], | ||
| double | output[], | ||
| int * | status | ||
| ) |
Growth factors at a list of scale factor given in a[0..na-1], where g(a) is normalized to a in matter domination
| cosmo | Cosmological parameters |
| na | Number of scale factors in a |
| a | array of scale factors |
| output | array of length na to store the results of the calculation. The entry at index i stores the distance for a[i]. |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 1007 of file ccl_background.c.
References ccl_growth_factor_unnorm().
| double ccl_growth_rate | ( | ccl_cosmology * | cosmo, |
| double | a, | ||
| int * | status | ||
| ) |
Logarithmic rate of d ln(g)/d ln(a) at scale factor a
| cosmo | Cosmological parameters |
| a | scale factor, normalized to 1 for today |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 1018 of file ccl_background.c.
References ccl_data::accelerator, ccl_check_status(), ccl_cosmology_compute_growth(), ccl_cosmology_set_status_message(), CCL_ERROR_COMPUTECHI, CCL_ERROR_NOT_IMPLEMENTED, ccl_raise_gsl_warning(), ccl_cosmology::computed_growth, ccl_cosmology::data, and ccl_data::fgrowth.
Referenced by ccl_growth_rates(), check_mgrowth(), f_rsd(), growth_rate(), and main().
| void ccl_growth_rates | ( | ccl_cosmology * | cosmo, |
| int | na, | ||
| double | a[], | ||
| double | output[], | ||
| int * | status | ||
| ) |
Logarithmic rates of d ln(g)/d ln(a) at an array of scale factors a[0..na-1]
| cosmo | Cosmological parameters |
| na | Number of scale factors in a |
| a | array of scale factors |
| output | array of length na to store the results of the calculation. The entry at index i stores the distance for a[i]. |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 1046 of file ccl_background.c.
References ccl_growth_rate().
| double ccl_h_over_h0 | ( | ccl_cosmology * | cosmo, |
| double | a, | ||
| int * | status | ||
| ) |
Normalized expansion rate at scale factor a. Returns H(a)/H0 in a given cosmology.
| cosmo | Cosmological parameters |
| a | scale factor, normalized to 1 for today |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 719 of file ccl_background.c.
References ccl_data::accelerator, ccl_check_status(), ccl_cosmology_compute_distances(), ccl_cosmology_set_status_message(), ccl_raise_gsl_warning(), ccl_cosmology::computed_distances, ccl_cosmology::data, ccl_data::E, and h_over_h0().
Referenced by ccl_h_over_h0s(), cl_tracer(), f_dens(), f_IA_NLA(), f_rsd(), integrand_mag(), and integrand_wl().
| void ccl_h_over_h0s | ( | ccl_cosmology * | cosmo, |
| int | na, | ||
| double | a[], | ||
| double | output[], | ||
| int * | status | ||
| ) |
Normalized expansion rate at scale factors as given in list a[0..na-1] Returns H(a)/H0 for an array of scale factors a of length na.
| cosmo | Cosmological parameters |
| na | Number of scale factors in a |
| a | array of scale factors |
| output | array of length na to store the results of the calculation. The entry at index i stores H(a[i])/H0 |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 740 of file ccl_background.c.
References ccl_h_over_h0().
| double ccl_luminosity_distance | ( | ccl_cosmology * | cosmo, |
| double | a, | ||
| int * | status | ||
| ) |
Comoving luminosity distance in Mpc from today to scale factor a
| cosmo | Cosmological parameters |
| a | scale factor, normalized to 1 for today |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 855 of file ccl_background.c.
References ccl_comoving_angular_distance().
Referenced by ccl_distance_modulus(), ccl_luminosity_distances(), and main().
| void ccl_luminosity_distances | ( | ccl_cosmology * | cosmo, |
| int | na, | ||
| double | a[], | ||
| double | output[], | ||
| int * | status | ||
| ) |
Comoving luminosity distances in Mpc to scale factors as given in array a[0..na-1]
| cosmo | Cosmological parameters |
| na | Number of scale factors in a |
| a | array of scale factors |
| output | array of length na to store the results of the calculation. The entry at index i stores the distance for a[i]. |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 860 of file ccl_background.c.
References ccl_luminosity_distance().
| double ccl_omega_x | ( | ccl_cosmology * | cosmo, |
| double | a, | ||
| ccl_species_x_label | label, | ||
| int * | status | ||
| ) |
Density fraction of a given species at a redshift different than z=0.
| cosmo | Cosmological parameters |
| a | scale factor, normalized to 1 for today |
| label | species type. Available: 'matter'(1), 'dark_energy'(2), 'radiation'(3), 'curvature'(4), 'massless neutrinos'(5), 'massive neutrinos'(6). |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 63 of file ccl_background.c.
References ccl_data::accelerator, ccl_check_status(), ccl_cosmology_set_status_message(), CCL_ERROR_PARAMETERS, ccl_Omeganuh2(), ccl_species_crit_label, ccl_species_g_label, ccl_species_k_label, ccl_species_l_label, ccl_species_m_label, ccl_species_nu_label, ccl_species_ur_label, ccl_cosmology::data, ccl_parameters::h, h_over_h0(), ccl_parameters::mnu, ccl_parameters::N_nu_mass, ccl_parameters::Omega_g, ccl_parameters::Omega_k, ccl_parameters::Omega_l, ccl_parameters::Omega_m, ccl_parameters::Omega_n_rel, ccl_cosmology::params, pow(), ccl_parameters::T_CMB, ccl_parameters::w0, and ccl_parameters::wa.
Referenced by ccl_rho_x(), dc_NakamuraSuto(), Dv_BryanNorman(), growth_ode_system(), main(), massfunc_f(), and Omega_lambda().
| double ccl_rho_x | ( | ccl_cosmology * | cosmo, |
| double | a, | ||
| ccl_species_x_label | label, | ||
| int | is_comoving, | ||
| int * | status | ||
| ) |
Physical density (rho) as a function of scale factor. Critical density is defined as rho_critical = 3 H^2(a)/ (8 pi G). Density of a given species is then rho_x = Omega_x(a) rho_critical(a). For example, rho_matter(a) = Omega_m a^{-3} / (H^2/H0^2) 3H^2 / (8 pi G) = Omega_m a^{-3} 3H0^2 / (8 pi G) = Omega_m a^{-3} rho_critical_present. Units of M_sun/(Mpc)^3.
| cosmo | Cosmological parameters |
| a | scale factor, normalized to 1 for today |
| label | species type. Available: 'critical'(0), 'matter'(1), 'dark_energy'(2), 'radiation'(3), 'curvature'(4), 'massless neutrinos'(5), 'massive neutrinos'(6). |
| int | is_comoving. 0 for physical densities, and nonzero for comoving densities (via a^3 factor). |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error. |
Definition at line 118 of file ccl_background.c.
References ccl_omega_x(), ccl_parameters::h, h_over_h0(), ccl_cosmology::params, and RHO_CRITICAL.
Referenced by ccl_massfunc_m2r(), main(), r_delta(), and window_function().
| double ccl_scale_factor_of_chi | ( | ccl_cosmology * | cosmo, |
| double | chi, | ||
| int * | status | ||
| ) |
Scale factor for a given comoving distance (in Mpc)
| cosmo | Cosmological parameters |
| chi | Comoving distance in Mpc |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 910 of file ccl_background.c.
References ccl_data::accelerator_achi, ccl_data::achi, ccl_check_status(), ccl_cosmology_compute_distances(), ccl_cosmology_set_status_message(), CCL_ERROR_COMPUTECHI, ccl_raise_gsl_warning(), ccl_cosmology::computed_distances, and ccl_cosmology::data.
Referenced by ccl_scale_factor_of_chis(), cl_integrand(), f_IA_NLA(), integrand_mag(), integrand_wl(), main(), transfer_cmblens(), transfer_nc(), and transfer_wl().
| void ccl_scale_factor_of_chis | ( | ccl_cosmology * | cosmo, |
| int | nchi, | ||
| double | chi[], | ||
| double | output[], | ||
| int * | status | ||
| ) |
Scale factors for a given array of comoving distances chi[0..nchi-1]
| cosmo | Cosmological parameters |
| nchi | Number of chis in chi |
| chi | array of comoving distances |
| output | array of length na to store the results of the calculation. The entry at index i stores the scale factor for chi[i]. |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 937 of file ccl_background.c.
References ccl_scale_factor_of_chi().
| double ccl_sinn | ( | ccl_cosmology * | cosmo, |
| double | chi, | ||
| int * | status | ||
| ) |
Transforms between radial and transverse comoving distances Calculate the comoving radial distance of two objects with comoving radial distance chi via: { sin(x) , if k==1 sinn(x)={ x , if k==0 { sinh(x) , if k==-1
| cosmo | Cosmological parameters |
| chi | Comoving radial distance of two objects |
| status | Status flag. 0 if there are no errors, nonzero otherwise. For specific cases see documentation for ccl_error.c |
Definition at line 792 of file ccl_background.c.
References ccl_cosmology_set_status_message(), CCL_ERROR_PARAMETERS, ccl_parameters::k_sign, ccl_cosmology::params, and ccl_parameters::sqrtk.
Referenced by ccl_comoving_angular_distance(), integrand_mag(), and integrand_wl().
Definition at line 145 of file ccl_background.c.
References CLIGHT_HMPC, cl_cmbl_bm::cosmo, and h_over_h0().
Referenced by compute_chi(), and dfzero().
|
static |
Definition at line 230 of file ccl_background.c.
References CCL_ERROR_COMPUTECHI, ccl_gsl, ccl_raise_gsl_warning(), chi_integrand(), cl_cmbl_bm::cosmo, chipar::cosmo, ccl_parameters::h, ccl_gsl_params::INTEGRATION_DISTANCE_EPSREL, ccl_gsl_params::N_ITERATION, p, ccl_cosmology::params, and chipar::status.
Referenced by ccl_cosmology_compute_distances(), and fzero().
Definition at line 175 of file ccl_background.c.
Referenced by ccl_cosmology_compute_growth().
Definition at line 273 of file ccl_background.c.
References chi_integrand(), cl_cmbl_bm::cosmo, chipar::cosmo, ccl_parameters::h, p, ccl_cosmology::params, and chipar::status.
Referenced by a_of_chi(), and fdfzero().
Definition at line 285 of file ccl_background.c.
References dfzero(), and fzero().
Referenced by a_of_chi().
Definition at line 263 of file ccl_background.c.
References compute_chi(), and cl_cmbl_bm::cosmo.
Referenced by a_of_chi(), and fdfzero().
|
static |
Definition at line 191 of file ccl_background.c.
References ccl_gsl, ccl_raise_gsl_warning(), EPS_SCALEFAC_GROWTH, growth_ode_system(), h_over_h0(), and ccl_gsl_params::ODE_GROWTH_EPSREL.
Referenced by ccl_cosmology_compute_growth().
Definition at line 157 of file ccl_background.c.
References ccl_omega_x(), ccl_species_m_label, cl_cmbl_bm::cosmo, h_over_h0(), and halomod_bm::params.
Referenced by growth_factor_and_growth_rate().
|
static |
Definition at line 19 of file ccl_background.c.
References ccl_data::accelerator, ccl_check_status(), ccl_Omeganuh2(), ccl_cosmology::data, ccl_parameters::h, ccl_parameters::mnu, ccl_parameters::N_nu_mass, ccl_parameters::Omega_g, ccl_parameters::Omega_k, ccl_parameters::Omega_l, ccl_parameters::Omega_m, ccl_parameters::Omega_n_rel, ccl_cosmology::params, pow(), sqrt(), ccl_parameters::T_CMB, ccl_parameters::w0, and ccl_parameters::wa.
Referenced by ccl_cosmology_compute_distances(), ccl_h_over_h0(), ccl_omega_x(), ccl_rho_x(), chi_integrand(), growth_factor_and_growth_rate(), and growth_ode_system().