CLASSpp Manual
Cosmology reference and developer manual
Loading...
Searching...
No Matches
thermodynamics_module.h
1#ifndef THERMODYNAMICS_MODULE_H
2#define THERMODYNAMICS_MODULE_H
3
4#include <array>
5#include <vector>
6
7#include "base_module.h"
8#include "input_module.h"
10
13 double f_V;
14 double Delta;
15};
16
22std::array<BaryonClumpingZone, 3> BaryonClumpingZones(double b,
23 double f_V_2,
24 double Delta_1,
25 double Delta_2);
26
28
29class ThermodynamicsModule : public BaseModule {
30 public:
31 ThermodynamicsModule(InputModulePtr input_module, BackgroundModulePtr background_module);
32 ~ThermodynamicsModule();
33 void thermodynamics_output_titles(std::string& titles) const;
34 void thermodynamics_output_data(int number_of_titles, double* data) const;
35 void thermodynamics_at_z(double z,
36 short inter_mode,
37 int* last_index,
38 const double* pvecback,
39 double* pvecthermo) const;
40
41 double tau_ini_ =
42 0.0;
43 double YHe_ = 0.0;
46 double Omega0_dm_ = 0.0;
47
56 double DoverH_ = 0.;
57 double He3overH_ = 0.;
58 double Li7overH_ = 0.;
59 double Li6overH_ = 0.;
60 double bbn_eta10_ = 0.;
61 bool bbn_network_ran_ = false;
66 short inter_normal_ =
67 0;
68 short inter_closeby_ =
69 0;
71
72 int tt_size_ = 0;
73 double z_rec_ =
74 0.0;
75 int th_size_ = 0;
76 double tau_rec_ =
77 0.0;
78 double angular_rescaling_ =
79 0.0;
80 double tau_free_streaming_ =
81 0.0;
82 double tau_idr_free_streaming_ =
83 0.0;
84 double tau_cut_ =
85 0.0;
87 double tau_reionization_ = 0.0;
88 double z_reionization_ = 0.0;
89 double n_e_ = 0.0;
94
95 double ds_rec_ = 0.0;
96 double da_rec_ = 0.0;
97 double rd_rec_ = 0.0;
98 double rs_rec_ = 0.0;
99 double ra_rec_ = 0.0;
101 double rs_star_ = 0.0;
102 double ra_star_ = 0.0;
103 double z_star_ = 0.0;
104 double tau_star_ = 0.0;
105 double ds_star_ = 0.0;
106 double da_star_ = 0.0;
107 double rd_star_ = 0.0;
109 double z_d_ = 0.0;
110 double tau_d_ = 0.0;
111 double rs_d_ = 0.0;
112 double ds_d_ = 0.0;
115
119
120 int index_th_xe_ = -1;
121 int index_th_rate_ =
122 -1;
123 int index_th_tau_d_ = -1;
124 int index_th_dkappa_ = -1;
125 int index_th_ddkappa_ = -1;
126 int index_th_dddkappa_ =
127 -1;
128 int index_th_exp_m_kappa_ = -1;
129 int index_th_g_ = -1;
130 int index_th_dg_ = -1;
131 int index_th_ddg_ = -1;
132 int index_th_dmu_idm_dr_ =
133 -1;
134 int index_th_ddmu_idm_dr_ = -1;
135 int index_th_dddmu_idm_dr_ = -1;
136 int index_th_dmu_idr_ = -1;
137 int index_th_tau_idm_dr_ = -1;
138 int index_th_tau_idr_ = -1;
139 int index_th_g_idm_dr_ = -1;
140 int index_th_cidm_dr2_ = -1;
141 int index_th_Tidm_dr_ = -1;
142 int index_th_Tb_ = -1;
143 int index_th_wb_ = -1;
144 int index_th_cb2_ = -1;
145 int index_th_dcb2_ =
146 -1;
147 int index_th_ddcb2_ =
148 -1;
149 int index_th_r_d_ = -1;
152
153 private:
154 void thermodynamics_init();
155 void thermodynamics_indices(recombination* preco, reionization* preio);
156 double thermodynamics_delta_neff_at_bbn();
157 void thermodynamics_helium_from_bbn();
158 void thermodynamics_helium_from_bbn_network();
159 void thermodynamics_onthespot_energy_injection(recombination* preco,
160 double z,
161 double* energy_rate);
162 void thermodynamics_energy_injection(recombination* preco, double z, double* energy_rate);
163 void thermodynamics_reionization_function(double z, reionization* preio, double* xe);
164 void thermodynamics_reionization(recombination* preco, reionization* preio, double* pvecback);
165 void thermodynamics_reionization_sample(recombination* preco,
166 reionization* preio,
167 double* pvecback);
168 void thermodynamics_get_xe_before_reionization(recombination* preco, double z, double* xe);
169 void thermodynamics_recombination(recombination* preco, double* pvecback);
170 void thermodynamics_recombination_clumpy(recombination* preco, double* pvecback);
172 void thermodynamics_recombination_integrate(recombination* prec,
173 double* pvecback,
174 double density_factor);
175 double thermodynamics_recfast_hydrogen_saha_xH(const recombination* preco, double z) const;
176 double thermodynamics_recfast_helium_first_saha_xe(const recombination* preco, double z) const;
177 double thermodynamics_recfast_helium_second_saha_xe(const recombination* preco, double z) const;
179 FundamentalConstants FundamentalConstantsAt(double z) const;
180 double RedshiftOfBbn() const;
181 double SahaRhs(const recombination* preco, double z, double CB) const;
182 void thermodynamics_recfast_store_row(
183 recombination* preco, int sample_index, double z, double xe, double Tb, double dTbdz) const;
184 void thermodynamics_recombination_derivs(double z,
185 const double* y,
186 double* dy,
188 void thermodynamics_recfast_derivs(double minus_z,
189 double* y,
190 double* dy,
192 void thermodynamics_recfast_output(double minus_z,
193 const double* y,
194 const double* dy,
195 int index_x,
197 void thermodynamics_merge_reco_and_reio(recombination* preco, reionization* preio);
198 void thermodynamics_tanh(
199 double x, double center, double before, double after, double width, double* result);
200
201 BackgroundModulePtr background_module_;
202
206 std::vector<double>
207 z_table_;
208 std::vector<double>
209 thermodynamics_table_;
210 std::vector<double>
211 d2thermodynamics_dz2_table_;
213};
214
215enum class RecombinationPhase { analytic, helium, full };
216
222 /* structures containing fixed input parameters (indices, ...) */
223 recombination* preco = nullptr;
224
225 /* which atomic physics supplies dx_H/dz and dx_He/dz */
226 const RecombinationModel* recombination_model = nullptr;
227
228 /* workspace */
229 double* pvecback = nullptr;
230 int recfast_output_index_offset = 0;
231 RecombinationPhase recombination_phase = RecombinationPhase::full;
232};
233
234#endif //THERMODYNAMICS_MODULE_H
Definition recombination_model.h:75
Definition thermodynamics_module.h:12
double f_V
Definition thermodynamics_module.h:13
double Delta
Definition thermodynamics_module.h:14
Definition recombination_model.h:12
Definition thermodynamics_module.h:221
Definition thermodynamics.h:218
Definition thermodynamics.h:316
std::array< BaryonClumpingZone, 3 > BaryonClumpingZones(double b, double f_V_2, double Delta_1, double Delta_2)
Definition thermodynamics_module.cpp:2998