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 <vector>
5
6#include "base_module.h"
7#include "input_module.h"
8
9class ThermodynamicsModule : public BaseModule {
10 public:
11 ThermodynamicsModule(InputModulePtr input_module, BackgroundModulePtr background_module);
12 ~ThermodynamicsModule();
13 void thermodynamics_output_titles(std::string& titles) const;
14 void thermodynamics_output_data(int number_of_titles, double* data) const;
15 void thermodynamics_at_z(
16 double z, short inter_mode, int* last_index, double* pvecback, double* pvecthermo) const;
17
18 const thermo* GetThermodynamics() const {
19 return pth;
20 }
21
22 double
23 tau_ini_;
24 double YHe_;
29 short
30 inter_normal_;
31 short
32 inter_closeby_;
34
35 int tt_size_;
36 double z_rec_;
37 int th_size_;
38 double
39 tau_rec_;
40 double
41 angular_rescaling_;
42 double
43 tau_free_streaming_;
44 double
45 tau_idr_free_streaming_;
46 double
47 tau_cut_;
49 double tau_reionization_;
50 double z_reionization_;
51 double n_e_;
56
57 double ds_rec_;
58 double da_rec_;
59 double rd_rec_;
60 double rs_rec_;
61 double ra_rec_;
63 double rs_star_;
64 double ra_star_;
65 double z_star_;
66 double tau_star_;
67 double ds_star_;
68 double da_star_;
69 double rd_star_;
71 double z_d_;
72 double tau_d_;
73 double rs_d_;
74 double ds_d_;
77
81
82 int index_th_xe_;
83 int index_th_rate_;
84 int index_th_tau_d_;
85 int index_th_dkappa_;
86 int index_th_ddkappa_;
87 int index_th_dddkappa_;
88 int index_th_exp_m_kappa_;
89 int index_th_g_;
90 int index_th_dg_;
91 int index_th_ddg_;
92 int index_th_dmu_idm_dr_;
93 int index_th_ddmu_idm_dr_;
94 int index_th_dddmu_idm_dr_;
95 int index_th_dmu_idr_;
96 int index_th_tau_idm_dr_;
97 int index_th_tau_idr_;
98 int index_th_g_idm_dr_;
99 int index_th_cidm_dr2_;
100 int index_th_Tidm_dr_;
101 int index_th_Tb_;
102 int index_th_wb_;
103 int index_th_cb2_;
104 int index_th_dcb2_;
105 int index_th_ddcb2_;
106 int index_th_r_d_;
109
110 private:
111 void thermodynamics_init();
112 void thermodynamics_indices(recombination* preco, reionization* preio);
113 void thermodynamics_helium_from_bbn();
114 void thermodynamics_onthespot_energy_injection(recombination* preco,
115 double z,
116 double* energy_rate);
117 void thermodynamics_energy_injection(recombination* preco, double z, double* energy_rate);
118 void thermodynamics_reionization_function(double z, reionization* preio, double* xe);
119 void thermodynamics_reionization(recombination* preco, reionization* preio, double* pvecback);
120 void thermodynamics_reionization_sample(recombination* preco,
121 reionization* preio,
122 double* pvecback);
123 void thermodynamics_get_xe_before_reionization(recombination* preco, double z, double* xe);
124 void thermodynamics_recombination(recombination* preco, double* pvecback);
125 void thermodynamics_recombination_with_hyrec(recombination* prec, double* pvecback);
126 void thermodynamics_recombination_with_recfast(recombination* prec, double* pvecback);
127 double thermodynamics_recfast_hydrogen_saha_xH(const recombination* preco, double z) const;
128 double thermodynamics_recfast_helium_first_saha_xe(const recombination* preco, double z) const;
129 double thermodynamics_recfast_helium_second_saha_xe(const recombination* preco, double z) const;
130 void thermodynamics_recfast_store_row(
131 recombination* preco, int sample_index, double z, double xe, double Tb, double dTbdz) const;
132 double thermodynamics_recfast_xe_after_helium_ode(const recombination* preco,
133 double z,
134 const double* y) const;
135 double thermodynamics_recfast_xe_after_full_ode(const recombination* preco,
136 double z,
137 const double* y) const;
138 void thermodynamics_derivs_with_recfast_member(double z,
139 double* y,
140 double* dy,
141 void* fixed_parameters);
142 static void thermodynamics_derivs_with_recfast(double z,
143 double* y,
144 double* dy,
145 void* fixed_parameters);
146 static void thermodynamics_recfast_derivs(double minus_z,
147 double* y,
148 double* dy,
149 void* fixed_parameters);
150 static void thermodynamics_recfast_output(
151 double minus_z, double y[], double dy[], int index_x, void* parameters_and_workspace);
152 static void thermodynamics_recfast_output_none(
153 double minus_z, double y[], double dy[], int index_x, void* parameters_and_workspace);
154 static void thermodynamics_recfast_timescale(double minus_z,
155 void* parameters_and_workspace,
156 double* timescale);
157 void thermodynamics_merge_reco_and_reio(recombination* preco, reionization* preio);
158 void thermodynamics_tanh(
159 double x, double center, double before, double after, double width, double* result);
160
161 BackgroundModulePtr background_module_;
162
166 std::vector<double>
167 z_table_;
168 std::vector<double>
169 thermodynamics_table_;
170 std::vector<double>
171 d2thermodynamics_dz2_table_;
173};
174
175enum class RecfastPhase { analytic, helium, full };
176
182 thermodynamics_parameters_and_workspace(ThermodynamicsModule* p_m) : thermodynamics_module(p_m) {}
183 ThermodynamicsModule* const thermodynamics_module;
184 /* structures containing fixed input parameters (indices, ...) */
185 recombination* preco;
186
187 /* workspace */
188 double* pvecback;
189 int recfast_output_index_offset = 0;
190 RecfastPhase recfast_phase = RecfastPhase::full;
191};
192
193#endif //THERMODYNAMICS_MODULE_H
Definition thermodynamics_module.h:181
Definition thermodynamics.h:181
Definition thermodynamics.h:276
Definition thermodynamics.h:59