Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
core_power.h
Go to the documentation of this file.
1 
9 #pragma once
10 #include "precision.hpp"
11 #include <gsl/gsl_spline.h>
12 
13 /*******************/
17 class Cosmo_Param;
18 class Sim_Param;
19 template <typename T, size_t N> class Data_Vec;
20 
27 
34 FTYPE_t norm_growth_factor(const Cosmo_Param& cosmo);
35 
43 FTYPE_t growth_factor(FTYPE_t a, const Cosmo_Param& cosmo);
44 
52 FTYPE_t growth_rate(FTYPE_t a, const Cosmo_Param& cosmo);
53 
61 FTYPE_t growth_change(FTYPE_t a, const Cosmo_Param& cosmo);
62 
70 FTYPE_t Omega_lambda(FTYPE_t a, const Cosmo_Param& cosmo);
71 
80 FTYPE_t lin_pow_spec(FTYPE_t a, FTYPE_t k, const Cosmo_Param& cosmo);
81 
90 FTYPE_t non_lin_pow_spec(FTYPE_t a, FTYPE_t k, const Cosmo_Param& cosmo);
91 
97 {
98 public:
99  Interp_obj(): is_init(false) {}
100  ~Interp_obj();
101  double operator()(double x) const;
102  template <typename T, size_t N>
103  void init(const Data_Vec<T, N>& data);
104  double x_min, x_max;
105 
106 private:
107  bool is_init;
108  gsl_spline* spline;
109  gsl_interp_accel* acc;
110 };
111 
121 template <typename T, size_t N>
122 class Extrap_Pk : public Interp_obj
123 {
124 public:
125  Extrap_Pk(const Data_Vec<T, N>& data, const Sim_Param& sim);
126  Extrap_Pk(const Data_Vec<T, N>& data, const Sim_Param& sim, const size_t m_l, const size_t n_u);
127  Extrap_Pk(const Data_Vec<T, N>& data, const Sim_Param& sim, const size_t m_l, const size_t n_l,
128  const size_t m_u, const size_t n_u);
129  double operator()(double k) const;
130 
131  void fit_lin(const Data_Vec<T, N>& data, const size_t m, const size_t n, double& A);
132  void fit_power_law(const Data_Vec<T, N>& data, const size_t m, const size_t n, double& A, double& n_s);
133 
134  double A_low;
136  double A_up, n_s;
137  T k_min, k_max;
138 };
139 
145 template <typename T, size_t N>
146 class Extrap_Pk_Nl : public Extrap_Pk<T, N>
147 {
148 public:
149  Extrap_Pk_Nl(const Data_Vec<T, N>& data, const Sim_Param &sim, T A_nl, T a_eff);
150  const T A_nl, a_eff, k_split;
151  double operator()(double k) const;
152 };
153 
162 template<class P>
163 void gen_corr_func_binned_gsl_qawf(const Sim_Param &sim, const P& P_k, Data_Vec<FTYPE_t, 2>& corr_func_binned);
164 
172 void gen_corr_func_binned_gsl_qawf_lin(const Sim_Param &sim, FTYPE_t a, Data_Vec<FTYPE_t, 2>& corr_func_binned);
173 
181 void gen_corr_func_binned_gsl_qawf_nl(const Sim_Param &sim, FTYPE_t a, Data_Vec<FTYPE_t, 2>& corr_func_binned);
182 
191 template<class P>
192 void gen_sigma_binned_gsl_qawf(const Sim_Param &sim, const P& P_k, Data_Vec<FTYPE_t, 2>& sigma_binned);
193 
201 void gen_sigma_func_binned_gsl_qawf_lin(const Sim_Param &sim, FTYPE_t a, Data_Vec<FTYPE_t, 2>& sigma_binned);
202 
210 void gen_sigma_func_binned_gsl_qawf_nl(const Sim_Param &sim, FTYPE_t a, Data_Vec<FTYPE_t, 2>& sigma_binned);
double growth_factor(double a, const Cosmo_Param &cosmo)
Definition: core_power.cpp:414
double non_lin_pow_spec(double a, double k, const Cosmo_Param &cosmo)
Definition: core_power.cpp:486
double lin_pow_spec(double a, double k, const Cosmo_Param &cosmo)
Definition: core_power.cpp:474
const T k_split
Definition: core_power.h:150
void gen_sigma_binned_gsl_qawf(const Sim_Param &sim, const P &P_k, Data_Vec< double, 2 > &sigma_binned)
compute amplitude of density fluctuation and store results
Definition: core_power.cpp:686
double growth_change(double a, const Cosmo_Param &cosmo)
Definition: core_power.cpp:447
: linear interpolation (Steffen) of data [x, y]
Definition: core_power.h:96
void gen_corr_func_binned_gsl_qawf(const Sim_Param &sim, const P &P_k, Data_Vec< double, 2 > &corr_func_binned)
compute correlation function and store results
Definition: core_power.cpp:665
gsl_spline * spline
Definition: core_power.h:108
: class storing simulation parameters
Definition: params.hpp:193
void norm_pwr(Cosmo_Param &cosmo)
declaration in class_data_vec.hpp
Definition: core_power.cpp:400
void gen_corr_func_binned_gsl_qawf_nl(const Sim_Param &sim, double a, Data_Vec< double, 2 > &corr_func_binned)
compute non-linear correlation function and store results
Definition: core_power.cpp:679
void gen_sigma_func_binned_gsl_qawf_nl(const Sim_Param &sim, double a, Data_Vec< double, 2 > &sigma_binned)
compute non-linear amplitude of density fluctuation and store results
Definition: core_power.cpp:700
double x_min
Definition: core_power.h:104
gsl_interp_accel * acc
Definition: core_power.h:109
void init(const Data_Vec< T, N > &data)
Definition: core_power.cpp:496
double A_low
amplitude of linear power in lower range
Definition: core_power.h:134
declaration in params.hpp
Definition: core_power.h:19
cosmological & CCL parameters
Definition: params.hpp:22
double Omega_lambda(double a, const Cosmo_Param &cosmo)
Definition: core_power.cpp:462
static CCL_BEGIN_DECLS double x[111][8]
: creates Extrapolate object (linear power spectrum) from data and store non-linear parameters call &#39;...
Definition: core_power.h:146
double growth_rate(double a, const Cosmo_Param &cosmo)
Definition: core_power.cpp:429
void gen_corr_func_binned_gsl_qawf_lin(const Sim_Param &sim, double a, Data_Vec< double, 2 > &corr_func_binned)
compute linear correlation function and store results
Definition: core_power.cpp:673
double norm_growth_factor(const Cosmo_Param &cosmo)
when computing growth factor outside CCL range we need to normalize the growth factor; ...
Definition: core_power.cpp:408
single / double / long double definitions
: linear interpolation of data [k, P(k)] within &#39;useful&#39; range fit to primordial P_i(k) below the &#39;us...
Definition: core_power.h:122
const Cosmo_Param & cosmo
Definition: core_power.h:135
double n_s
scale-free power spectrum in upper range
Definition: core_power.h:136
double operator()(double x) const
Definition: core_power.cpp:520
static int m[2]
Definition: ccl_emu17.c:25
double x_max
Definition: core_power.h:104
bool is_init
Definition: core_power.h:107
void gen_sigma_func_binned_gsl_qawf_lin(const Sim_Param &sim, double a, Data_Vec< double, 2 > &sigma_binned)
compute linear amplitude of density fluctuation and store results
Definition: core_power.cpp:694