-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmacroatom.h
More file actions
56 lines (41 loc) · 2.76 KB
/
macroatom.h
File metadata and controls
56 lines (41 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef MACROATOM_H
#define MACROATOM_H
#include <cmath>
#include "constants.h"
#include "packet.h"
void macroatom_open_file(int my_rank);
void macroatom_close_file();
DEVICE_FUNC void do_macroatom(Packet& pkt, const MacroAtomState& pktmastate);
[[gnu::pure]] [[nodiscard]] auto rad_excitation_ratecoeff(int nonemptymgi, double upper_statweight, double einstein_A,
double epsilon_trans, double nnlevel_lower,
double nnlevel_upper, double statweight_lower,
int alltransindex, double t_current) -> double;
[[gnu::pure]] [[nodiscard]] auto rad_recombination_ratecoeff(float T_e, float nne, int element, int upperion,
int upperionlevel, int lowerionlevel) -> double;
[[gnu::pure]] [[nodiscard]] auto col_recombination_ratecoeff(float T_e, float nne, int element, int upperion, int upper,
int lower, double epsilon_trans) -> double;
[[gnu::pure]] [[nodiscard]] auto col_ionisation_ratecoeff(float T_e, float nne, int element, int ion, int lower,
int phixstargetindex, double epsilon_trans) -> double;
[[gnu::pure]] [[nodiscard]] auto col_deexcitation_ratecoeff(float T_e, float nne, double epsilon_trans,
double upperstatweight, double lowerstatweight,
int alltransindex) -> double;
[[gnu::pure]] [[nodiscard]] auto col_excitation_ratecoeff(float T_e, float nne, double upperstatweight,
int alltransindex, double epsilon_trans,
double lowerstatweight) -> double;
// radiative deexcitation rate: paperII 3.5.2
// multiply by upper level population to get a rate per second
[[gnu::const]] [[nodiscard]] constexpr auto rad_deexcitation_ratecoeff(
const double epsilon_trans, const float A_ul, const double upperstatweight, const double lowerstatweight,
const double nnlevelupper, const double nnlevellower, const double t_current) -> double {
const double nu_trans = epsilon_trans / H;
const double B_ul = CLIGHTSQUAREDOVERTWOH / pow3(nu_trans) * A_ul;
const double B_lu = upperstatweight / lowerstatweight * B_ul;
const double tau_sobolev = ((B_lu * nnlevellower) - (B_ul * nnlevelupper)) * HCLIGHTOVERFOURPI * t_current;
if (tau_sobolev > 1e-100) {
const double beta = 1.0 / tau_sobolev * (-std::expm1(-tau_sobolev));
const auto R = A_ul * beta;
return R;
}
return 0.;
}
#endif // MACROATOM_H