ARTS 2.5.0 (git: 9ee3ac6c)
linemixing.h
Go to the documentation of this file.
1#ifndef linemixing_h
2#define linemixing_h
3
4#include <functional>
5
6#include "absorption.h"
7#include "matpack_complex.h"
8#include "constants.h"
9#include "gridded_fields.h"
10#include "linescaling.h"
11#include "zeemandata.h"
12
13namespace Absorption::LineMixing {
14
19
24 explicit EquivalentLines(Index n=0) noexcept : val(n, 0), str(n, 0) {}
25
34 EquivalentLines(const ComplexMatrix& W, const Vector& pop, const Vector& dip) noexcept;
35
38
41
44
47
48 void sort_by_frequency(Vector& f, const ArrayOfIndex& sorting);
49
50 friend std::ostream& operator<<(std::ostream& os, const EquivalentLines& eqv);
51}; // EquivalentLines
52
57
64 const AbsorptionLines& band) noexcept;
65
71 ArrayOfIndex sort(const AbsorptionLines& band) noexcept;
72
77 void sort(const ArrayOfIndex& presorting) noexcept;
78}; // PopulationAndDipole
79
80using EnergyFunction = std::function<Numeric (const Rational)>;
81
83 Species::Species spec{Species::Species::Bath};
89
90 constexpr SpeciesErrorCorrectedSuddenData() noexcept :
91 scaling(LineShapeTemperatureModel::T0, 0, 0, 0, 0),
92 beta(LineShapeTemperatureModel::T0, 0, 0, 0, 0),
93 lambda(LineShapeTemperatureModel::T0, 0, 0, 0, 0),
95
96 constexpr SpeciesErrorCorrectedSuddenData(Species::Species inspec) noexcept :
97 spec(inspec), scaling(LineShapeTemperatureModel::T0, 0, 0, 0, 0),
98 beta(LineShapeTemperatureModel::T0, 0, 0, 0, 0),
99 lambda(LineShapeTemperatureModel::T0, 0, 0, 0, 0),
100 collisional_distance(LineShapeTemperatureModel::T0, 0, 0, 0, 0) {}
101
102 [[nodiscard]] Numeric Q(const Rational J,
103 const Numeric T,
104 const Numeric T0,
105 const Numeric energy) const noexcept;
106
107 [[nodiscard]] Numeric Omega(const Numeric T,
108 const Numeric T0,
109 const Numeric other_mass,
110 const Numeric energy_x,
111 const Numeric energy_xm2) const noexcept;
112
113 friend std::ostream& operator<<(std::ostream& os, const SpeciesErrorCorrectedSuddenData& srbd);
114
115 friend std::istream& operator>>(std::istream& is, SpeciesErrorCorrectedSuddenData& srbd);
116
117 constexpr bool operator==(Species::Species species) const noexcept {
118 return species == spec;
119 }
120}; // SpeciesErrorCorrectedSuddenData
121
133 Quantum::Identifier id;
134
139
140 explicit ErrorCorrectedSuddenData(const Quantum::Identifier& qid={}) noexcept :
142
143 friend std::ostream& operator<<(std::ostream& os, const ErrorCorrectedSuddenData& rbd) {
144 for (Index i=0; i<rbd.data.nelem(); i++) {
145 if (i) os << '\n';
146 os << rbd.data[i];
147 }
148 return os;
149 }
150
151 friend std::istream& operator>>(std::istream& is, ErrorCorrectedSuddenData& rbd) {
152 for (auto& x: rbd.data) is >> x;
153 return is;
154 }
155
156 bool operator==(const Quantum::Identifier& band_id) const noexcept {
157 return id == band_id;
158 }
159
160 const SpeciesErrorCorrectedSuddenData& operator[](Species::Species spec) const noexcept {
161 if(auto ptr = std::find(data.cbegin(), data.cend(), spec); ptr not_eq data.cend())
162 return *ptr;
163 return *std::find(data.cbegin(), data.cend(), Species::Species::Bath);
164 }
165
166 SpeciesErrorCorrectedSuddenData& operator[](Species::Species spec) noexcept {
167 if(auto ptr = std::find(data.begin(), data.end(), spec); ptr not_eq data.end())
168 return *ptr;
169 return data.emplace_back(spec);
170 }
171}; // ErrorCorrectedSuddenData
172
173struct MapOfErrorCorrectedSuddenData : public Array<ErrorCorrectedSuddenData> {
174 ErrorCorrectedSuddenData& operator[](const Quantum::Identifier& id) noexcept {
175 if(auto ptr = std::find(begin(), end(), id); ptr not_eq end())
176 return *ptr;
177 return emplace_back(id);
178
179 }
180
181 const ErrorCorrectedSuddenData& operator[](const Quantum::Identifier& id) const {
182 if(auto ptr = std::find(cbegin(), cend(), id); ptr not_eq cend()) {
183 return *ptr;
184 }
185 ARTS_USER_ERROR("Cannot find data for QuantumIdentifier:\n", id, '\n',
186 "Available data:\n", *this);
187 return front(); // To get rid of potential warnings...
188 }
189
191 ARTS_ASSERT(i >= 0 and i < nelem())
192 return * (begin() + i);
193 }
194
196 ARTS_ASSERT(i >= 0 and i < nelem())
197 return * (begin() + i);
198 }
199
200 friend std::ostream& operator<<(std::ostream& os, const MapOfErrorCorrectedSuddenData& m) {
201 std::for_each(m.cbegin(), m.cend(), [&](auto& x){os << x << '\n';});
202 return os;
203 }
204}; // MapOfErrorCorrectedSuddenData
205
218std::pair<ComplexVector, ArrayOfComplexVector> ecs_absorption(const Numeric T,
219 const Numeric P,
220 const Numeric this_vmr,
221 const Vector& vmrs,
222 const ErrorCorrectedSuddenData& ecs_data,
223 const Vector& f_grid,
224 const AbsorptionLines& band,
225 const ArrayOfRetrievalQuantity& jacobian_quantities={});
226
227
242std::pair<ComplexVector, ArrayOfComplexVector> ecs_absorption_zeeman(const Numeric T,
243 const Numeric H,
244 const Numeric P,
245 const Numeric this_vmr,
246 const Vector& vmrs,
247 const ErrorCorrectedSuddenData& ecs_data,
248 const Vector& f_grid,
249 const Zeeman::Polarization zeeman_polarization,
250 const AbsorptionLines& band,
251 const ArrayOfRetrievalQuantity& jacobian_quantities={});
252
259 const Tensor4& tempdata,
260 const Vector& temperatures,
261 const Numeric P0,
262 const Index ord);
263
264
285EquivalentLines eigenvalue_adaptation_of_relmat(const ComplexMatrix& W,
286 const Vector& pop,
287 const Vector& dip,
288 const AbsorptionLines& band,
289 const Numeric frenorm,
290 const Numeric T,
291 const Numeric P,
292 const Numeric QT,
293 const Numeric QT0,
294 const Index broadener);
295
296
319 const Vector& temperatures,
320 const ErrorCorrectedSuddenData& ecs_data,
321 const Numeric P0,
322 const Index ord);
323
336 const Vector& temperatures,
337 const ErrorCorrectedSuddenData& ecs_data,
338 const Vector& pressures);
339} // namespace Absorption::LineMixing
340
344
345#endif // linemixing_h
Declarations required for the calculation of absorption coefficients.
Index nelem() const ARTS_NOEXCEPT
Number of elements.
Definition: array.h:195
The ComplexMatrix class.
The ComplexVector class.
Implements rational numbers to work with other ARTS types.
Definition: rational.h:52
The Tensor4 class.
Definition: matpackIV.h:421
The Tensor5 class.
Definition: matpackV.h:506
The Vector class.
Definition: matpackI.h:876
Constants of physical expressions as constexpr.
#define ARTS_NOEXCEPT
Definition: debug.h:80
#define ARTS_ASSERT(condition,...)
Definition: debug.h:83
#define ARTS_USER_ERROR(...)
Definition: debug.h:150
Implementation of gridded fields.
Absorption::LineMixing::ErrorCorrectedSuddenData ErrorCorrectedSuddenData
Definition: linemixing.h:341
Absorption::LineMixing::MapOfErrorCorrectedSuddenData MapOfErrorCorrectedSuddenData
Definition: linemixing.h:342
Absorption::LineMixing::SpeciesErrorCorrectedSuddenData SpeciesErrorCorrectedSuddenData
Definition: linemixing.h:343
Constains various line scaling functions.
LineShape::TemperatureModel LineShapeTemperatureModel
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
EquivalentLines eigenvalue_adaptation_of_relmat(const ComplexMatrix &W, const Vector &pop, const Vector &dip, const AbsorptionLines &band, const Numeric frenorm, const Numeric T, const Numeric P, const Numeric QT, const Numeric QT0, const Index broadener)
Adapts the relaxation matrix eigenvalues to a form where they represent additions towards the three R...
Definition: linemixing.cc:1331
Index band_eigenvalue_adaptation(AbsorptionLines &band, const Tensor4 &tempdata, const Vector &temperatures, const Numeric P0, const Index ord)
Adapts the band to the temperature data.
Definition: linemixing.cc:1159
std::pair< ComplexVector, ArrayOfComplexVector > ecs_absorption_zeeman(const Numeric T, const Numeric H, const Numeric P, const Numeric this_vmr, const Vector &vmrs, const ErrorCorrectedSuddenData &ecs_data, const Vector &f_grid, const Zeeman::Polarization zeeman_polarization, const AbsorptionLines &band, const ArrayOfRetrievalQuantity &jacobian_quantities)
Definition: linemixing.cc:932
Tensor5 ecs_eigenvalue_adaptation_test(const AbsorptionLines &band, const Vector &temperatures, const ErrorCorrectedSuddenData &ecs_data, const Vector &pressures)
Definition: linemixing.cc:1469
std::function< Numeric(const Rational)> EnergyFunction
Definition: linemixing.h:80
std::pair< ComplexVector, ArrayOfComplexVector > ecs_absorption(const Numeric T, const Numeric P, const Numeric this_vmr, const Vector &vmrs, const ErrorCorrectedSuddenData &ecs_data, const Vector &f_grid, const AbsorptionLines &band, const ArrayOfRetrievalQuantity &jacobian_quantities)
Definition: linemixing.cc:654
void ecs_eigenvalue_adaptation(AbsorptionLines &band, const Vector &temperatures, const ErrorCorrectedSuddenData &ecs_data, const Numeric P0, const Index ord)
Definition: linemixing.cc:1445
Vector vmrs(const ConstVectorView &atmospheric_vmrs, const ArrayOfArrayOfSpeciesTag &atmospheric_species, const ArrayOfSpecies &lineshape_species) ARTS_NOEXCEPT
Returns a VMR vector for this model's main calculations.
Polarization
Zeeman polarization selection.
Definition: zeemandata.h:44
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
Definition: zeemandata.h:109
Contains recomputed equivalent lines (sorting is unknown)
Definition: linemixing.h:16
EquivalentLines & operator=(const EquivalentLines &)=delete
Explicitly deleted.
void sort_by_frequency(Vector &f, const ArrayOfIndex &sorting)
Definition: linemixing.cc:65
EquivalentLines & operator=(EquivalentLines &&)=default
Explicitly defaulted.
EquivalentLines(EquivalentLines &&)=default
Explicitly defaulted.
friend std::ostream & operator<<(std::ostream &os, const EquivalentLines &eqv)
Definition: linemixing.cc:89
EquivalentLines(const EquivalentLines &)=delete
Explicitly deleted.
Rovibrational line mixing data following the ideas of Collisional Effects On Molecular Spectra by J.
Definition: linemixing.h:132
friend std::istream & operator>>(std::istream &is, ErrorCorrectedSuddenData &rbd)
Definition: linemixing.h:151
SpeciesErrorCorrectedSuddenData & operator[](Species::Species spec) noexcept
Definition: linemixing.h:166
friend std::ostream & operator<<(std::ostream &os, const ErrorCorrectedSuddenData &rbd)
Definition: linemixing.h:143
ErrorCorrectedSuddenData(const Quantum::Identifier &qid={}) noexcept
Definition: linemixing.h:140
Array< SpeciesErrorCorrectedSuddenData > data
Data of species data The program is considered ill-formed if data does not contain a Bath-species,...
Definition: linemixing.h:138
bool operator==(const Quantum::Identifier &band_id) const noexcept
Definition: linemixing.h:156
const SpeciesErrorCorrectedSuddenData & operator[](Species::Species spec) const noexcept
Definition: linemixing.h:160
friend std::ostream & operator<<(std::ostream &os, const MapOfErrorCorrectedSuddenData &m)
Definition: linemixing.h:200
ErrorCorrectedSuddenData & operator[](Index i) ARTS_NOEXCEPT
Definition: linemixing.h:195
const ErrorCorrectedSuddenData & operator[](const Quantum::Identifier &id) const
Definition: linemixing.h:181
const ErrorCorrectedSuddenData & operator[](Index i) const ARTS_NOEXCEPT
Definition: linemixing.h:190
ErrorCorrectedSuddenData & operator[](const Quantum::Identifier &id) noexcept
Definition: linemixing.h:174
Contains the population distribution and dipole.
Definition: linemixing.h:54
ArrayOfIndex sort(const AbsorptionLines &band) noexcept
Definition: linemixing.cc:161
PopulationAndDipole(const Numeric T, const AbsorptionLines &band) noexcept
Definition: linemixing.cc:135
friend std::istream & operator>>(std::istream &is, SpeciesErrorCorrectedSuddenData &srbd)
Definition: linemixing.cc:108
Numeric Q(const Rational J, const Numeric T, const Numeric T0, const Numeric energy) const noexcept
Definition: linemixing.cc:228
constexpr SpeciesErrorCorrectedSuddenData(Species::Species inspec) noexcept
Definition: linemixing.h:96
constexpr bool operator==(Species::Species species) const noexcept
Definition: linemixing.h:117
friend std::ostream & operator<<(std::ostream &os, const SpeciesErrorCorrectedSuddenData &srbd)
Definition: linemixing.cc:98
Numeric Omega(const Numeric T, const Numeric T0, const Numeric other_mass, const Numeric energy_x, const Numeric energy_xm2) const noexcept
Definition: linemixing.cc:235
Coefficients and temperature model for SingleSpeciesModel.
Headers and class definition of Zeeman modeling.