ARTS 2.5.11 (git: 6827797f)
linescaling.cc
Go to the documentation of this file.
1#include "linescaling.h"
2#include "partfun.h"
3
4Numeric single_partition_function(const Numeric& T,
5 const Species::IsotopeRecord& ir) {
6 return PartitionFunctions::Q(T, ir);
7}
8
9Numeric dsingle_partition_function_dT(const Numeric& T,
10 const Species::IsotopeRecord& ir) {
11 return PartitionFunctions::dQdT(T, ir);
12}
13
14Numeric stimulated_emission(Numeric T, Numeric F0) {
15 using namespace Constant;
16 static constexpr Numeric c1 = -h / k;
17 return std::exp(c1 * F0 / T);
18}
19
20Numeric dstimulated_emissiondT(Numeric T, Numeric F0) {
21 using namespace Constant;
22 using namespace Math;
23 static constexpr Numeric c1 = -h / k;
24 return -F0 * c1 * std::exp(F0 * c1 / T) / pow2(T);
25}
26
27Numeric dstimulated_emissiondF0(Numeric T, Numeric F0) {
28 using namespace Constant;
29 static constexpr Numeric c1 = -h / k;
30 return c1 * std::exp(F0 * c1 / T) / T;
31}
32
33Numeric stimulated_relative_emission(const Numeric F0, const Numeric T0, const Numeric T) noexcept {
34 return std::expm1(-Conversion::hz2joule(F0) / Conversion::kelvin2joule(T)) / std::expm1(-Conversion::hz2joule(F0) / Conversion::kelvin2joule(T0));
35}
36
37Numeric dstimulated_relative_emission_dT(const Numeric F0, const Numeric T0, const Numeric T) noexcept {
40}
41
42Numeric dstimulated_relative_emission_dF0(const Numeric F0, const Numeric T0, const Numeric T) noexcept {
43 const Numeric exp0m1 = std::expm1(-Conversion::hz2joule(F0) / Conversion::kelvin2joule(T0));
44 const Numeric exptm1 = std::expm1(-Conversion::hz2joule(F0) / Conversion::kelvin2joule(T));
45 return Constant::h * (T * exptm1 * (1 + exp0m1) - T0 * exp0m1 * (1 + exptm1)) / (Constant::k * T * T0 * Math::pow2(exp0m1));
46}
47
48Numeric stimulated_relative_emission(const Numeric& gamma,
49 const Numeric& gamma_ref) {
50 return (1. - gamma) / (1. - gamma_ref);
51}
52
53Numeric dstimulated_relative_emission_dT(const Numeric& gamma,
54 const Numeric& gamma_ref,
55 const Numeric& F0,
56 const Numeric& T) {
57 static constexpr Numeric c = -Constant::h / Constant::k;
58
59 return c * F0 * gamma / (T * T * (1. - gamma_ref));
60}
61
62Numeric dstimulated_relative_emission_dF0(const Numeric& gamma,
63 const Numeric& gamma_ref,
64 const Numeric& T,
65 const Numeric& T0) {
66 static constexpr Numeric c = -Constant::h / Constant::k;
67
68 const Numeric g0 = 1 - gamma_ref;
69 const Numeric g = 1 - gamma;
70
71 return c * (g * gamma_ref / (T0 * g0 * g0) - gamma / (T * g0));
72}
73
74// Ratio of boltzman emission at T and T0
75Numeric boltzman_ratio(const Numeric& T, const Numeric& T0, const Numeric& E0) {
76 static constexpr Numeric c = 1 / Constant::k;
77
78 return exp(E0 * c * (T - T0) / (T * T0));
79}
80
81Numeric dboltzman_ratio_dT(const Numeric& boltzmann_ratio,
82 const Numeric& T,
83 const Numeric& E0) {
84 static constexpr Numeric c = 1 / Constant::k;
85
86 return E0 * c * boltzmann_ratio / (T * T);
87}
88
89// Boltzmann factor at T
90Numeric boltzman_factor(Numeric T, Numeric E0)
91{
92 return std::exp(- E0 / (Constant::k*T));
93}
94
95// Boltzmann factor at T
96Numeric dboltzman_factordT(Numeric T, Numeric E0) {
97 using namespace Constant;
98 using namespace Math;
99 static constexpr Numeric c1 = -1 / k;
100 return -E0 * c1 * std::exp(E0 * c1 / T) / pow2(T);
101}
102
103// Boltzmann factor at T
104Numeric dboltzman_factordE0(Numeric T, Numeric E0) {
105 using namespace Constant;
106 static constexpr Numeric c1 = -1 / k;
107 return c1 * std::exp(E0 * c1 / T) / T;
108}
109
110Numeric absorption_nlte_ratio(const Numeric& gamma,
111 const Numeric& r_upp,
112 const Numeric& r_low) noexcept {
113 return (r_low - r_upp * gamma) / (1 - gamma);
114}
115
116Numeric dabsorption_nlte_rate_dT(const Numeric& gamma,
117 const Numeric& T,
118 const Numeric& F0,
119 const Numeric& El,
120 const Numeric& Eu,
121 const Numeric& r_upp,
122 const Numeric& r_low) {
123 static constexpr Numeric c = 1 / Constant::k;
124
125 ARTS_USER_ERROR_IF (El < 0 or Eu < 0,
126 "It is considered undefined behavior to NLTE and "
127 "temperature Jacobian without defining all "
128 "vibrational energy states")
129
130 const Numeric x = 1 / (T * (gamma - 1));
131 const Numeric hf = F0 * Constant::h;
132
133 return x * x * c *
134 ((gamma - 1) * (El * r_low - Eu * gamma * r_upp) -
135 hf * gamma * (r_low - r_upp));
136}
137
138Numeric dabsorption_nlte_rate_dF0(const Numeric& gamma,
139 const Numeric& T,
140 const Numeric& r_upp,
141 const Numeric& r_low) {
142 static constexpr Numeric c = -Constant::h / Constant::k;
143
144 return c * gamma * (r_low - r_upp) / (T * Math::pow2(gamma - 1));
145}
146
147Numeric dabsorption_nlte_rate_dTl(const Numeric& gamma,
148 const Numeric& T,
149 const Numeric& Tl,
150 const Numeric& El,
151 const Numeric& r_low) {
152 const Numeric x = 1 / (Constant::k * T);
153 const Numeric y = 1 / Tl;
154
155 return El * x * y * y * T * r_low / (gamma - 1);
156}
157
158Numeric dabsorption_nlte_rate_dTu(const Numeric& gamma,
159 const Numeric& T,
160 const Numeric& Tu,
161 const Numeric& Eu,
162 const Numeric& r_upp) {
163 const Numeric x = 1 / (Constant::k * T);
164 const Numeric y = 1 / Tu;
165
166 return Eu * x * y * y * T * gamma * r_upp / (gamma - 1);
167}
#define ARTS_USER_ERROR_IF(condition,...)
Definition: debug.h:135
Numeric boltzman_factor(Numeric T, Numeric E0)
Computes exp(- E0/kT)
Definition: linescaling.cc:90
Numeric stimulated_emission(Numeric T, Numeric F0)
Computes exp(-hf/kT)
Definition: linescaling.cc:14
Numeric dboltzman_factordT(Numeric T, Numeric E0)
Computes temperature derivatives exp(- E0/kT)
Definition: linescaling.cc:96
Numeric dabsorption_nlte_rate_dT(const Numeric &gamma, const Numeric &T, const Numeric &F0, const Numeric &El, const Numeric &Eu, const Numeric &r_upp, const Numeric &r_low)
Computes temperature derivatives of (r_low - r_upp * gamma) / (1 - gamma)
Definition: linescaling.cc:116
Numeric dstimulated_emissiondF0(Numeric T, Numeric F0)
Computes frequency derivative of exp(-hf/kT)
Definition: linescaling.cc:27
Numeric dabsorption_nlte_rate_dF0(const Numeric &gamma, const Numeric &T, const Numeric &r_upp, const Numeric &r_low)
Computes frequency derivative of (r_low - r_upp * gamma) / (1 - gamma)
Definition: linescaling.cc:138
Numeric dsingle_partition_function_dT(const Numeric &T, const Species::IsotopeRecord &ir)
Computes the partition function temperature derivative.
Definition: linescaling.cc:9
Numeric dstimulated_relative_emission_dF0(const Numeric F0, const Numeric T0, const Numeric T) noexcept
Computes.
Definition: linescaling.cc:42
Numeric boltzman_ratio(const Numeric &T, const Numeric &T0, const Numeric &E0)
Computes exp(E0/c (T - T0) / (T * T0))
Definition: linescaling.cc:75
Numeric dabsorption_nlte_rate_dTl(const Numeric &gamma, const Numeric &T, const Numeric &Tl, const Numeric &El, const Numeric &r_low)
Computes lower state temperature derivative of (r_low - r_upp * gamma) / (1 - gamma)
Definition: linescaling.cc:147
Numeric single_partition_function(const Numeric &T, const Species::IsotopeRecord &ir)
Computes the partition function at one temperature.
Definition: linescaling.cc:4
Numeric dboltzman_ratio_dT(const Numeric &boltzmann_ratio, const Numeric &T, const Numeric &E0)
Computes temperature derivatives exp(E0/k (T - T0) / (T * T0))
Definition: linescaling.cc:81
Numeric stimulated_relative_emission(const Numeric F0, const Numeric T0, const Numeric T) noexcept
Computes.
Definition: linescaling.cc:33
Numeric absorption_nlte_ratio(const Numeric &gamma, const Numeric &r_upp, const Numeric &r_low) noexcept
Computes (r_low - r_upp * gamma) / (1 - gamma)
Definition: linescaling.cc:110
Numeric dstimulated_emissiondT(Numeric T, Numeric F0)
Computes temperature derivative of exp(-hf/kT)
Definition: linescaling.cc:20
Numeric dabsorption_nlte_rate_dTu(const Numeric &gamma, const Numeric &T, const Numeric &Tu, const Numeric &Eu, const Numeric &r_upp)
Computes upper state temperature derivative of (r_low - r_upp * gamma) / (1 - gamma)
Definition: linescaling.cc:158
Numeric dboltzman_factordE0(Numeric T, Numeric E0)
Computes lower state energy derivatives exp(- E0/kT)
Definition: linescaling.cc:104
Numeric dstimulated_relative_emission_dT(const Numeric F0, const Numeric T0, const Numeric T) noexcept
Computes.
Definition: linescaling.cc:37
Constains various line scaling functions.
Namespace containing several constants, physical and mathematical.
constexpr Numeric k
Boltzmann constant convenience name [J/K].
constexpr Numeric h
Planck constant convenience name [J s].
constexpr auto kelvin2joule(auto x) noexcept
Conversion from Kelvin to Joule.
constexpr auto hz2joule(auto x) noexcept
Conversion from MHz to Joule.
Namespace containing several constants, physical and mathematical.
constexpr auto pow2(auto x) noexcept
power of two
Numeric dQdT(Numeric T, const Species::IsotopeRecord &ir)
Definition: partfun.cc:18
Numeric Q(Numeric T, const Species::IsotopeRecord &ir)
Definition: partfun.cc:14
Struct containing all information needed about one isotope.
Definition: isotopologues.h:16
#define c