ARTS 2.5.9 (git: 825fa5f2)
linemixing.h
Go to the documentation of this file.
1#ifndef linemixing_h
2#define linemixing_h
3
4#include <functional>
5#include <utility>
6
7#include "absorption.h"
8#include "arts_conversions.h"
9#include "gridded_fields.h"
10#include "linescaling.h"
11#include "matpack_complex.h"
12#include "species.h"
13#include "zeemandata.h"
14
15namespace Absorption::LineMixing {
16
21
26 explicit EquivalentLines(Index n=0) noexcept : val(n, 0), str(n, 0) {}
27
36 EquivalentLines(const ComplexMatrix& W, const Vector& pop, const Vector& dip) noexcept;
37
38 void sort_by_frequency(Vector& f, const ArrayOfIndex& sorting);
39
40 friend std::ostream& operator<<(std::ostream& os, const EquivalentLines& eqv);
41}; // EquivalentLines
42
47
54 const AbsorptionLines& band);
55
61 ArrayOfIndex sort(const AbsorptionLines& band) noexcept;
62
67 void sort(const ArrayOfIndex& presorting) noexcept;
68}; // PopulationAndDipole
69
70using EnergyFunction = std::function<Numeric (const Rational)>;
71
73 Species::Species spec{Species::Species::Bath};
79
80 constexpr SpeciesErrorCorrectedSuddenData(Species::Species inspec=Species::Species::Bath) noexcept :
81 spec(inspec), scaling(LineShapeTemperatureModel::T0, 0, 0, 0, 0),
82 beta(LineShapeTemperatureModel::T0, 0, 0, 0, 0),
83 lambda(LineShapeTemperatureModel::T0, 0, 0, 0, 0),
84 collisional_distance(LineShapeTemperatureModel::T0, 0, 0, 0, 0) {}
85
86 [[nodiscard]] Numeric Q(const Rational J,
87 const Numeric T,
88 const Numeric T0,
89 const Numeric energy) const;
90
91 [[nodiscard]] Numeric Omega(const Numeric T,
92 const Numeric T0,
93 const Numeric other_mass,
94 const Numeric energy_x,
95 const Numeric energy_xm2) const;
96
97 friend std::ostream& operator<<(std::ostream& os, const SpeciesErrorCorrectedSuddenData& srbd);
98
99 friend std::istream& operator>>(std::istream& is, SpeciesErrorCorrectedSuddenData& srbd);
100
101 constexpr bool operator==(Species::Species species) const noexcept {
102 return species == spec;
103 }
104}; // SpeciesErrorCorrectedSuddenData
105
107
120
125
126 explicit ErrorCorrectedSuddenData(QuantumIdentifier qid={}) noexcept :
127 id(std::move(qid)), data({SpeciesErrorCorrectedSuddenData()}) {}
128
129 friend std::ostream& operator<<(std::ostream& os, const ErrorCorrectedSuddenData& rbd);
130
131 friend std::istream& operator>>(std::istream& is, ErrorCorrectedSuddenData& rbd);
132
133 bool operator==(const QuantumIdentifier& band_id) const noexcept {
134 return band_id.part_of(id);
135 }
136
137 [[nodiscard]] Index pos(Species::Species spec) const;
138
139 [[nodiscard]] Index size() const noexcept { return data.size(); }
140
141 const SpeciesErrorCorrectedSuddenData& operator[](Species::Species spec) const;
142
143 SpeciesErrorCorrectedSuddenData& operator[](Species::Species spec);
144}; // ErrorCorrectedSuddenData
145
146struct MapOfErrorCorrectedSuddenData : public Array<ErrorCorrectedSuddenData> {
148
150
152 ARTS_ASSERT(i >= 0 and i < nelem())
153 return * (begin() + i);
154 }
155
157 ARTS_ASSERT(i >= 0 and i < nelem())
158 return * (begin() + i);
159 }
160
161 friend std::ostream& operator<<(std::ostream& os, const MapOfErrorCorrectedSuddenData& m);
162}; // MapOfErrorCorrectedSuddenData
163
164// Return struct from calculations
165struct EcsReturn {
168 bool error;
169 EcsReturn(EcsReturn&&) noexcept = default;
170 EcsReturn(ComplexVector&& abs_, ArrayOfComplexVector&& dabs_, bool error_) noexcept :
171 abs(std::move(abs_)), dabs(std::move(dabs_)), error(error_) {}
172};
173
174
190EcsReturn ecs_absorption(const Numeric T,
191 const Numeric H,
192 const Numeric P,
193 const Numeric this_vmr,
194 const Vector& vmrs,
195 const ErrorCorrectedSuddenData& ecs_data,
196 const Vector& f_grid,
197 const Zeeman::Polarization zeeman_polarization,
198 const AbsorptionLines& band,
199 const ArrayOfRetrievalQuantity& jacobian_quantities={});
200
207 const Tensor4& tempdata,
208 const Vector& temperatures,
209 const Numeric P0,
210 const Index ord);
211
212
233EquivalentLines eigenvalue_adaptation_of_relmat(const ComplexMatrix& W,
234 const Vector& pop,
235 const Vector& dip,
236 const AbsorptionLines& band,
237 const Numeric frenorm,
238 const Numeric T,
239 const Numeric P,
240 const Numeric QT,
241 const Numeric QT0,
242 const Index broadener);
243
244
270 const Vector& temperatures,
271 const ErrorCorrectedSuddenData& ecs_data,
272 const Numeric P0,
273 const Index ord,
274 const bool robust,
275 const bool rosenkranz_adaptation,
276 const Verbosity& verbosity);
277
290 const Vector& temperatures,
291 const ErrorCorrectedSuddenData& ecs_data,
292 const Vector& pressures);
293} // namespace Absorption::LineMixing
294
299
300#endif // linemixing_h
Declarations required for the calculation of absorption coefficients.
Common ARTS conversions.
Index nelem() const ARTS_NOEXCEPT
Definition: array.h:92
The ComplexMatrix class.
The ComplexVector class.
The Tensor4 class.
Definition: matpackIV.h:435
The Tensor5 class.
Definition: matpackV.h:524
The Vector class.
Definition: matpackI.h:910
#define ARTS_NOEXCEPT
Definition: debug.h:79
#define ARTS_ASSERT(condition,...)
Definition: debug.h:82
Implementation of gridded fields.
Constains various line scaling functions.
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
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:1282
void ecs_eigenvalue_adaptation(AbsorptionLines &band, const Vector &temperatures, const ErrorCorrectedSuddenData &ecs_data, const Numeric P0, const Index ord, const bool robust, const bool rosenkranz_adaptation, const Verbosity &verbosity)
Definition: linemixing.cc:1452
EcsReturn ecs_absorption(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:763
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:1110
Tensor5 ecs_eigenvalue_adaptation_test(const AbsorptionLines &band, const Vector &temperatures, const ErrorCorrectedSuddenData &ecs_data, const Vector &pressures)
Definition: linemixing.cc:1500
std::function< Numeric(const Rational)> EnergyFunction
Definition: linemixing.h:70
Polarization
Zeeman polarization selection.
Definition: zeemandata.h:44
ArrayOfComplexVector dabs
Definition: linemixing.h:167
EcsReturn(EcsReturn &&) noexcept=default
Contains recomputed equivalent lines (sorting is unknown)
Definition: linemixing.h:18
void sort_by_frequency(Vector &f, const ArrayOfIndex &sorting)
Definition: linemixing.cc:104
friend std::ostream & operator<<(std::ostream &os, const EquivalentLines &eqv)
Definition: linemixing.cc:128
Rovibrational line mixing data following the ideas of Collisional Effects On Molecular Spectra by J.
Definition: linemixing.h:118
friend std::istream & operator>>(std::istream &is, ErrorCorrectedSuddenData &rbd)
Definition: linemixing.cc:1525
bool operator==(const QuantumIdentifier &band_id) const noexcept
Definition: linemixing.h:133
friend std::ostream & operator<<(std::ostream &os, const ErrorCorrectedSuddenData &rbd)
Definition: linemixing.cc:1516
ArrayOfSpeciesErrorCorrectedSuddenData data
Data of species data The program is considered ill-formed if data does not contain a Bath-species,...
Definition: linemixing.h:124
Index pos(Species::Species spec) const
Definition: linemixing.cc:1530
const SpeciesErrorCorrectedSuddenData & operator[](Species::Species spec) const
Definition: linemixing.cc:1535
ErrorCorrectedSuddenData(QuantumIdentifier qid={}) noexcept
Definition: linemixing.h:126
friend std::ostream & operator<<(std::ostream &os, const MapOfErrorCorrectedSuddenData &m)
Definition: linemixing.cc:1570
ErrorCorrectedSuddenData & operator[](Index i) ARTS_NOEXCEPT
Definition: linemixing.h:156
const ErrorCorrectedSuddenData & operator[](Index i) const ARTS_NOEXCEPT
Definition: linemixing.h:151
ErrorCorrectedSuddenData & operator[](const QuantumIdentifier &id)
Definition: linemixing.cc:1551
Contains the population distribution and dipole.
Definition: linemixing.h:44
ArrayOfIndex sort(const AbsorptionLines &band) noexcept
Definition: linemixing.cc:200
friend std::istream & operator>>(std::istream &is, SpeciesErrorCorrectedSuddenData &srbd)
Definition: linemixing.cc:147
constexpr SpeciesErrorCorrectedSuddenData(Species::Species inspec=Species::Species::Bath) noexcept
Definition: linemixing.h:80
Numeric Omega(const Numeric T, const Numeric T0, const Numeric other_mass, const Numeric energy_x, const Numeric energy_xm2) const
Definition: linemixing.cc:274
constexpr bool operator==(Species::Species species) const noexcept
Definition: linemixing.h:101
Numeric Q(const Rational J, const Numeric T, const Numeric T0, const Numeric energy) const
Definition: linemixing.cc:267
friend std::ostream & operator<<(std::ostream &os, const SpeciesErrorCorrectedSuddenData &srbd)
Definition: linemixing.cc:137
Coefficients and temperature model for SingleSpeciesModel.
A logical struct for global quantum numbers with species identifiers.
Implements rational numbers to work with other ARTS types.
Definition: rational.h:43
Headers and class definition of Zeeman modeling.