ARTS 2.5.4 (git: 31ce4f0e)
linescaling.cc
Go to the documentation of this file.
1/* Copyright (C) 2015
2 Richard Larsson <ric.larsson@gmail.com>
3
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 2, or (at your option) any
7 later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 USA. */
18
19#include "linescaling.h"
21#include "partfun.h"
22
24 const Species::IsotopeRecord& ir) {
25 return PartitionFunctions::Q(T, ir);
26}
27
29 const Species::IsotopeRecord& ir) {
30 return PartitionFunctions::dQdT(T, ir);
31}
32
34 using namespace Constant;
35 static constexpr Numeric c1 = -h / k;
36 return std::exp(c1 * F0 / T);
37}
38
40 using namespace Constant;
41 using namespace Math;
42 static constexpr Numeric c1 = -h / k;
43 return -F0 * c1 * std::exp(F0 * c1 / T) / pow2(T);
44}
45
47 using namespace Constant;
48 static constexpr Numeric c1 = -h / k;
49 return c1 * std::exp(F0 * c1 / T) / T;
50}
51
52Numeric stimulated_relative_emission(const Numeric F0, const Numeric T0, const Numeric T) noexcept {
53 return std::expm1(-Conversion::hz2joule(F0) / Conversion::kelvin2joule(T)) / std::expm1(-Conversion::hz2joule(F0) / Conversion::kelvin2joule(T0));
54}
55
56Numeric dstimulated_relative_emission_dT(const Numeric F0, const Numeric T0, const Numeric T) noexcept {
59}
60
61Numeric dstimulated_relative_emission_dF0(const Numeric F0, const Numeric T0, const Numeric T) noexcept {
62 const Numeric exp0m1 = std::expm1(-Conversion::hz2joule(F0) / Conversion::kelvin2joule(T0));
63 const Numeric exptm1 = std::expm1(-Conversion::hz2joule(F0) / Conversion::kelvin2joule(T));
64 return Constant::h * (T * exptm1 * (1 + exp0m1) - T0 * exp0m1 * (1 + exptm1)) / (Constant::k * T * T0 * Math::pow2(exp0m1));
65}
66
68 const Numeric& gamma_ref) {
69 return (1. - gamma) / (1. - gamma_ref);
70}
71
73 const Numeric& gamma_ref,
74 const Numeric& F0,
75 const Numeric& T) {
76 static constexpr Numeric c = -Constant::h / Constant::k;
77
78 return c * F0 * gamma / (T * T * (1. - gamma_ref));
79}
80
82 const Numeric& gamma_ref,
83 const Numeric& T,
84 const Numeric& T0) {
85 static constexpr Numeric c = -Constant::h / Constant::k;
86
87 const Numeric g0 = 1 - gamma_ref;
88 const Numeric g = 1 - gamma;
89
90 return c * (g * gamma_ref / (T0 * g0 * g0) - gamma / (T * g0));
91}
92
93// Ratio of boltzman emission at T and T0
94Numeric boltzman_ratio(const Numeric& T, const Numeric& T0, const Numeric& E0) {
95 static constexpr Numeric c = 1 / Constant::k;
96
97 return exp(E0 * c * (T - T0) / (T * T0));
98}
99
100Numeric dboltzman_ratio_dT(const Numeric& boltzmann_ratio,
101 const Numeric& T,
102 const Numeric& E0) {
103 static constexpr Numeric c = 1 / Constant::k;
104
105 return E0 * c * boltzmann_ratio / (T * T);
106}
107
108// Boltzmann factor at T
110{
111 return std::exp(- E0 / (Constant::k*T));
112}
113
114// Boltzmann factor at T
116 using namespace Constant;
117 using namespace Math;
118 static constexpr Numeric c1 = -1 / k;
119 return -E0 * c1 * std::exp(E0 * c1 / T) / pow2(T);
120}
121
122// Boltzmann factor at T
124 using namespace Constant;
125 static constexpr Numeric c1 = -1 / k;
126 return c1 * std::exp(E0 * c1 / T) / T;
127}
128
130 const Numeric& r_upp,
131 const Numeric& r_low) noexcept {
132 return (r_low - r_upp * gamma) / (1 - gamma);
133}
134
136 const Numeric& T,
137 const Numeric& F0,
138 const Numeric& El,
139 const Numeric& Eu,
140 const Numeric& r_upp,
141 const Numeric& r_low) {
142 static constexpr Numeric c = 1 / Constant::k;
143
144 ARTS_USER_ERROR_IF (El < 0 or Eu < 0,
145 "It is considered undefined behavior to NLTE and "
146 "temperature Jacobian without defining all "
147 "vibrational energy states")
148
149 const Numeric x = 1 / (T * (gamma - 1));
150 const Numeric hf = F0 * Constant::h;
151
152 return x * x * c *
153 ((gamma - 1) * (El * r_low - Eu * gamma * r_upp) -
154 hf * gamma * (r_low - r_upp));
155}
156
158 const Numeric& T,
159 const Numeric& r_upp,
160 const Numeric& r_low) {
161 static constexpr Numeric c = -Constant::h / Constant::k;
162
163 return c * gamma * (r_low - r_upp) / (T * Math::pow2(gamma - 1));
164}
165
167 const Numeric& T,
168 const Numeric& Tl,
169 const Numeric& El,
170 const Numeric& r_low) {
171 const Numeric x = 1 / (Constant::k * T);
172 const Numeric y = 1 / Tl;
173
174 return El * x * y * y * T * r_low / (gamma - 1);
175}
176
178 const Numeric& T,
179 const Numeric& Tu,
180 const Numeric& Eu,
181 const Numeric& r_upp) {
182 const Numeric x = 1 / (Constant::k * T);
183 const Numeric y = 1 / Tu;
184
185 return Eu * x * y * y * T * gamma * r_upp / (gamma - 1);
186}
#define ARTS_USER_ERROR_IF(condition,...)
Definition: debug.h:134
Numeric boltzman_factor(Numeric T, Numeric E0)
Computes exp(- E0/kT)
Definition: linescaling.cc:109
Numeric stimulated_emission(Numeric T, Numeric F0)
Computes exp(-hf/kT)
Definition: linescaling.cc:33
Numeric dboltzman_factordT(Numeric T, Numeric E0)
Computes temperature derivatives exp(- E0/kT)
Definition: linescaling.cc:115
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:135
Numeric dstimulated_emissiondF0(Numeric T, Numeric F0)
Computes frequency derivative of exp(-hf/kT)
Definition: linescaling.cc:46
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:157
Numeric dsingle_partition_function_dT(const Numeric &T, const Species::IsotopeRecord &ir)
Computes the partition function temperature derivative.
Definition: linescaling.cc:28
Numeric dstimulated_relative_emission_dF0(const Numeric F0, const Numeric T0, const Numeric T) noexcept
Computes.
Definition: linescaling.cc:61
Numeric boltzman_ratio(const Numeric &T, const Numeric &T0, const Numeric &E0)
Computes exp(E0/c (T - T0) / (T * T0))
Definition: linescaling.cc:94
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:166
Numeric single_partition_function(const Numeric &T, const Species::IsotopeRecord &ir)
Computes the partition function at one temperature.
Definition: linescaling.cc:23
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:100
Numeric stimulated_relative_emission(const Numeric F0, const Numeric T0, const Numeric T) noexcept
Computes.
Definition: linescaling.cc:52
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:129
Numeric dstimulated_emissiondT(Numeric T, Numeric F0)
Computes temperature derivative of exp(-hf/kT)
Definition: linescaling.cc:39
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:177
Numeric dboltzman_factordE0(Numeric T, Numeric E0)
Computes lower state energy derivatives exp(- E0/kT)
Definition: linescaling.cc:123
Numeric dstimulated_relative_emission_dT(const Numeric F0, const Numeric T0, const Numeric T) noexcept
Computes.
Definition: linescaling.cc:56
Constains various line scaling functions.
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
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