CLASSpp Manual
Cosmology reference and developer manual
Loading...
Searching...
No Matches
background_module.h
1#ifndef BACKGROUND_MODULE_H
2#define BACKGROUND_MODULE_H
3
4#include <optional>
5#include <string>
6#include <vector>
7
8#include "base_module.h"
9#include "input_module.h"
10
11class ModifiedGravity;
13
14class BackgroundModule : public BaseModule {
15 public:
20 double GetOmega0Species(const std::string& key) const;
21 BackgroundModule(InputModulePtr input_module);
22 ~BackgroundModule();
24 void background_output_titles(std::string& titles) const;
26 std::vector<std::string> background_output_notes() const;
27 void background_output_data(int number_of_titles, double* data) const;
28 void background_at_tau(
29 double tau, short return_format, short inter_mode, int* last_index, double* pvecback) const;
30 void background_tau_of_z(double z, double* tau) const;
31 void background_w_fld(double a,
32 double* w_fld,
33 double* dw_over_da_fld,
34 double* integral_fld) const;
35
38 double GetOmega0NcdmTot() const;
39
43 bool HasSpecies(const std::string& key) const;
44
50 double GetSpeciesParam(const std::string& key, const std::string& param) const;
51
56 bool HasSpeciesParam(const std::string& key, const std::string& param) const;
57
61
62 int index_bg_a_ = -1;
63 int index_bg_H_ = -1;
64 int index_bg_H_prime_ = -1;
66 /* end of vector in short format, now quantities in normal format */
67
68 int index_bg_rho_tot_ = -1;
69 int index_bg_p_tot_ = -1;
70 int index_bg_p_tot_prime_ = -1;
72 int index_bg_Omega_r_ =
73 -1;
75 /* end of vector in normal format, now quantities in long format */
76
77 int index_bg_rho_crit_ = -1;
78 int index_bg_Omega_m_ =
79 -1;
80 int index_bg_Omega_de_ = -1;
82 int index_bg_w_de_ = -1;
84 int index_bg_conf_distance_ = -1;
85 int index_bg_ang_distance_ = -1;
86 int index_bg_lum_distance_ = -1;
87 int index_bg_time_ = -1;
88 int index_bg_rs_ = -1;
90 int index_bg_D_ = -1;
91 int index_bg_f_ = -1;
93 int bg_size_short_ = 0;
94 int bg_size_normal_ = 0;
95 int bg_size_ = 0;
98 int bt_size_ = 0;
99 std::vector<double>
100 tau_table_;
101 std::vector<double>
102 background_table_;
104 double conformal_age_ = 0.0;
105 double Neff_ =
106 0.0;
107 double a_eq_ = 0.0;
108 double H_eq_ = 0.0;
109 double Omega0_m_ = 0.0;
110 double Omega0_de_ =
111 0.0;
113 double age_ = 0.0;
114 double Omega0_r_ = 0.0;
115 double z_eq_ = 0.0;
116 double tau_eq_ = 0.0;
117 double Omega0_dcdm_ = 0.0;
118 double Omega0_dr_ = 0.0;
120 double Omega0_idr_drmd_ = 0.0;
121 double Omega0_idm_drmd_ = 0.0;
122 double Omega0_idm_ = 0.0;
123
124 // DRMD diagnostics exposed to the Python wrapper. The data now lives on
125 // IDM_DRMD_IDR_DRMD_Species (#319); these delegate to it (neutral values if
126 // no DRMD species is present).
127 double f_idr_drmd() const;
128 double z_dec_drmd() const;
129
145 bool StoringBackgroundTable() const {
146 return storing_background_table_;
147 }
148
149 private:
158 std::optional<double> PeakEnergyFraction(const BaseSpecies& species,
159 const std::string& param) const;
160
161 void background_functions(double* pvecback_B, short return_format, double* pvecback);
162 bool storing_background_table_ = false;
163
166 const ModifiedGravity* gravity_ = nullptr;
167
168 void background_init();
169 void background_indices();
170 void background_solve_evolver();
171 void background_initial_conditions(double* pvecback, double* pvecback_integration);
172 void background_find_equality();
173 void background_derivs(double tau,
174 double* y,
175 double* dy,
177 void background_derivs_loga(double loga,
178 double* y,
179 double* dy,
183 void background_derivs_diagonal_loga(double loga,
184 double* y,
185 double* diag,
187 void background_add_line_to_bg_table(double loga, double* y, double* dy, int index_loga);
188 void background_output_budget();
189 void background_print_variables(double loga,
190 double* y,
191 double* dy,
193
206
207 int index_bi_a_ = -1;
209 int index_bi_time_ = -1;
210 int index_bi_rs_ = -1;
211 int index_bi_tau_ = -1;
212 int index_bi_D_ = -1;
213 int index_bi_D_prime_ =
214 -1;
216 int bi_B_size_ = 0;
217 int bi_size_ = 0;
220
224
225 std::vector<double>
226 z_table_;
229
233
234 std::vector<double>
235 d2tau_dz2_table_;
236 std::vector<double>
237 d2background_dtau2_table_;
240};
241
247 double* pvecback = nullptr;
248};
249
250#endif //BACKGROUND_MODULE_H
Definition base_species.h:90
Definition modified_gravity.h:23
Definition background_module.h:246