ARTS  2.3.1285(git:92a29ea9-dirty)
linemixing.h
Go to the documentation of this file.
1 /* Copyright 2018, Richard Larsson
2  *
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the
5  * Free Software Foundation; either version 2, or (at your option) any
6  * later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software Foundation,
15  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 */
17 
29 #ifndef linemixing_h
30 #define linemixing_h
31 
32 #include "absorption.h"
33 #include "complex.h"
34 #include "constants.h"
35 #include "rational.h"
36 
53 template <class T>
55  T N,
56  T J2,
57  Numeric B,
58  Numeric D,
59  Numeric H,
60  Numeric gamma,
65  Numeric lambda_H) {
66  if (N == J and N == J2) {
67  const Numeric JJ1 = J * (J + 1);
68  const Numeric JJ2 = JJ1 * JJ1;
69  const Numeric JJ3 = JJ1 * JJ1 * JJ1;
70  return +(B * JJ1 - D * JJ2 + H * JJ3) -
71  (gamma + gamma_D * JJ1 + gamma_H * JJ2) +
72  2 / 3 * (lambda + lambda_D * JJ1 + lambda_H * JJ2);
73  } else if (N == (J - 1) and N == (J2 - 1)) {
74  const Numeric JJ1 = J * (J - 1);
75  const Numeric JJ2 = JJ1 * JJ1;
76  const Numeric JJ3 = JJ1 * JJ1 * JJ1;
77  return +(B * JJ1 - D * JJ2 + H * JJ3) +
78  (gamma + gamma_D * JJ1 + gamma_H * JJ2) * (J - 1) +
79  (lambda + lambda_D * JJ1 + lambda_H * JJ2) *
80  (2 / 3 - 2 * J / (2 * J + 1));
81  } else if (N == (J + 1) and N == (J2 + 1)) {
82  const Numeric JJ1 = (J + 2) * (J + 1);
83  const Numeric JJ2 = JJ1 * JJ1;
84  const Numeric JJ3 = JJ1 * JJ1 * JJ1;
85  return +(B * JJ1 - D * JJ2 + H * JJ3) -
86  (gamma + gamma_D * JJ1 + gamma_H * JJ2) * (J + 2) +
87  (lambda + lambda_D * JJ1 + lambda_H * JJ2) *
88  (2 / 3 - 2 * (J + 1) / (2 * J + 1));
89 
90  } else if ((N == (J + 1) and N == (J2 - 1)) or
91  (N == (J - 1) and N == (J2 + 1))) {
92  const Numeric JJ1 = J * J + J + 1;
93  const Numeric JJ2 = JJ1 * JJ1;
94  return (lambda + lambda_D * JJ1 + lambda_H * JJ2) * 2 *
95  std::sqrt(J * J + J) / (2 * J + 1);
96  } else {
97  return 0;
98  }
99 }
100 
102 namespace Molecule {
103 
105 enum class Name { O2_66, CO2_626 };
106 
108 namespace O2_66 {
109 constexpr Numeric g_S = 2.002084;
110 constexpr Numeric ge_l = 2.77e-3;
111 constexpr Numeric g_r = -1.16e-4;
112 
113 constexpr Numeric B = 43100.44276e6;
114 constexpr Numeric D = 145.1271e3;
115 constexpr Numeric H = 49e-3;
116 
117 constexpr Numeric lambda = 59501.3438e6;
118 constexpr Numeric lambda_D = 58.3680e3;
119 constexpr Numeric lambda_H = 290.8e-3;
120 
121 constexpr Numeric gamma = -252.58634e6;
122 constexpr Numeric gamma_D = -243.42;
123 constexpr Numeric gamma_H = -1.46e-3;
124 
125 constexpr Numeric mass = 31.989830;
126 
134 template <class T>
135 Numeric hamiltonian_freq(T J, int dcol = 0, int drow = 0) {
136  /*
137  Matrix:
138  (-1,-1), (0,-1), (1,-1)
139  (-1, 0), (0, 0), (1, 0)
140  (-1, 1), (0, 1), (1, 1)
141  */
142  return rotational_energy_hund_b_molecule(J + dcol,
143  J,
144  J + drow,
145  B,
146  D,
147  H,
148  gamma,
149  gamma_D,
150  gamma_H,
151  lambda,
152  lambda_D,
153  lambda_H);
154 }
155 }; // namespace O2_66
156 
158 namespace CO2_626 {
159 constexpr Numeric B = Conversion::kaycm2freq(0.39021);
160 template <class T>
161 
167 constexpr Numeric hamiltonian_freq(T J) {
168  return B * J * (J + 1);
169 }
170 } // namespace CO2_626
171 }; // namespace Molecule
172 
175  public:
176 
178  enum class Type { Hartmann };
179 
181  enum class HartmannPos : Index { dc, SIZE };
182 
190  AdiabaticFactor(const Vector& v, Type t) : mtype(t), mdata(v) {
191  bool error = false;
192  switch (mtype) {
193  case Type::Hartmann:
194  if (Index(HartmannPos::SIZE) not_eq mdata.nelem()) error = true;
195  break;
196  }
197 
198  if (error)
199  throw std::runtime_error(
200  "Bad initializaton of BasisRate, type and size disagree...");
201  }
202 
212  Numeric mol_X(const Numeric& L,
213  const Numeric& B0,
214  const Numeric& T,
215  const Numeric& main_mass,
216  const Numeric& collider_mass) const;
217 
227  Numeric get(const Numeric& L,
228  const Numeric& B0,
229  const Numeric& T,
230  const Numeric& main_mass,
231  const Numeric& collider_mass) const {
232  switch (mtype) {
233  case Type::Hartmann:
234  return mol_X(L, B0, T, main_mass, collider_mass);
235  }
236  return 0;
237  }
238 
239  private:
242 };
243 
245 class BasisRate {
246  public:
247 
249  enum class Type { Hartmann };
250 
252  enum class HartmannPos : Index { a1, a2, a3, SIZE };
253 
261  BasisRate(const Vector& v, Type t) : mtype(t), mdata(v) {
262  bool error = false;
263  switch (mtype) {
264  case Type::Hartmann:
265  if (Index(HartmannPos::SIZE) not_eq mdata.nelem()) error = true;
266  break;
267  }
268 
269  if (error)
270  throw std::runtime_error(
271  "Bad initializaton of BasisRate, type and size disagree...");
272  }
273 
281  Numeric mol_X(const Numeric& L, const Numeric& B0, const Numeric& T) const;
282 
290  Numeric get(const Numeric& L, const Numeric& B0, const Numeric& T) const {
291  switch (mtype) {
292  case Type::Hartmann:
293  return mol_X(L, B0, T);
294  }
295  return 0;
296  }
297 
298  private:
301 };
302 
305  Numeric ij, ji;
306 };
307 
310 
312 enum class Type { CO2_IR, O2_66_MW };
313 
335  const Rational& Jju,
336  const Rational& Jkl,
337  const Rational& Jjl,
338  const Rational& l2ku,
339  const Rational& l2ju,
340  const Rational& l2kl,
341  const Rational& l2jl,
342  const Numeric& j_rho,
343  const Numeric& k_rho,
344  const BasisRate& br,
345  const AdiabaticFactor& af,
346  const Numeric& T,
347  const Numeric& B0,
348  const Numeric& main_mass,
349  const Numeric& collider_mass);
350 
367 OffDiagonalElementOutput O2_66_MW(const Rational& J1u,
368  const Rational& N1u,
369  const Rational& J1l,
370  const Rational& N1l,
371  const Rational& J2u,
372  const Rational& N2u,
373  const Rational& J2l,
374  const Rational& N2l,
375  const Numeric& rho1,
376  const Numeric& rho2,
377  const Numeric& T,
378  const Numeric& collider_mass);
379 }; // namespace OffDiagonalElement
380 
392  const ArrayOfSpeciesTag& collider_species,
393  const Vector& collider_species_vmr,
394  const SpeciesAuxData& partition_functions,
395  const Numeric& T,
396  const Index& size);
397 
406  const SpeciesAuxData& partition_functions,
407  const Numeric& T);
408 
415 Vector dipole_vector(const AbsorptionLines& abs_lines,
416  const SpeciesAuxData& partition_functions);
417 
420 
428  const RedPoleType type);
429 
438  const Matrix& W,
439  const Vector& d0);
440 
448  const Matrix& W);
449 
458  const Matrix& W,
459  const Vector& d0);
460 
463  Numeric y0, y1;
464 };
465 
478  ConstVectorView x,
479  const Numeric exp,
480  const Numeric x0);
481 
490  const Vector& population,
491  const Vector& dipole,
492  const Eigen::ComplexEigenSolver<Eigen::MatrixXcd>& M);
493 
500 Numeric total_linestrengths(const Vector& population, const Vector& dipole);
501 
516  const ArrayOfRational& Jf,
517  const ArrayOfRational& l2i,
518  const ArrayOfRational& l2f,
519  const Vector& F0,
520  const Vector& d,
521  const Vector& rho,
522  const Vector& gamma,
523  const Numeric& T);
524 
533 void relmatInAir(Matrix& relmat,
534  const AbsorptionLines& abs_lines,
535  const SpeciesAuxData& partition_functions,
536  const Index& wigner_initialized,
537  const Numeric& temperature);
538 
539 #ifdef ENABLE_RELMAT
540 extern "C" {
541 // This is the interfaces between the Fortran code that calculates W and ARTS
542 extern void arts_relmat_interface__hartmann_and_niro_type(
543  long* nlines,
544  double* fmin,
545  double* fmax,
546  long* M,
547  long* I,
548  double* v,
549  double* S,
550  double* gamma_air,
551  double* E_double_prime,
552  double* n_air,
553  long* upper,
554  long* lower,
555  long* g_prime,
556  long* g_double_prime,
557  double* temperature,
558  double* pressure,
559  double* partition_function_t,
560  double* partition_function_t0,
561  double* isotopologue_mass,
562  long* number_of_perturbers,
563  long* molecule_code_perturber,
564  long* iso_code_perturber,
565  double* perturber_mass,
566  double* vmr,
567  //output+input
568  long* debug_in__error_out,
569  long* ordered,
570  double* tolerance_in_rule_nr2,
571  bool* use_adiabatic_factor,
572  //outputs
573  double* W,
574  double* dipole,
575  double* rhoT,
576  double* Y,
577  double* G,
578  double* DV);
579 
580 extern void arts_relmat_interface__linear_type(long* nlines,
581  double* fmin,
582  double* fmax,
583  long* M,
584  long* I,
585  double* v,
586  double* S,
587  double* gamma_air,
588  double* E_double_prime,
589  double* n_air,
590  long* upper,
591  long* lower,
592  long* g_prime,
593  long* g_double_prime,
594  double* temperature,
595  double* pressure,
596  double* partition_function_t,
597  double* partition_function_t0,
598  double* isotopologue_mass,
599  long* number_of_perturbers,
600  long* molecule_code_perturber,
601  long* iso_code_perturber,
602  double* perturber_mass,
603  double* vmr,
604  //output+input
605  long* debug_in__error_out,
606  long* ordered,
607  double* tolerance_in_rule_nr2,
608  bool* use_adiabatic_factor,
609  //outputs
610  double* W,
611  double* dipole,
612  double* rhoT,
613  double* Y,
614  double* G,
615  double* DV);
616 
617 extern double* wigner3j_(double*, double*, double*, double*, double*, double*);
618 extern double* wigner6j_(double*, double*, double*, double*, double*, double*);
619 }
620 #endif //ENABLE_RELMAT
621 
622 #endif // linemixing_h
Vector rosenkranz_first_order(const AbsorptionLines &abs_lines, const Matrix &W, const Vector &d0)
Computes Y for Rosenkranz&#39;s line mixing coefficients.
Definition: linemixing.cc:431
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
constexpr Numeric lambda_H
Definition: linemixing.h:119
Struct to help keep position of the two matched outputs clear.
Definition: linemixing.h:304
constexpr Numeric gamma
Definition: linemixing.h:121
Methods to compute off diagonal elements.
Definition: linemixing.h:309
A class implementing complex numbers for ARTS.
ComplexVector equivalent_linestrengths(const Vector &population, const Vector &dipole, const Eigen::ComplexEigenSolver< Eigen::MatrixXcd > &M)
Equivalent line strengths.
Definition: linemixing.cc:884
#define x0
Numeric total_linestrengths(const Vector &population, const Vector &dipole)
Sum of line strengths.
Definition: linemixing.cc:906
The Vector class.
Definition: matpackI.h:782
Constants of physical expressions as constexpr.
Name
Name of molecules.
Definition: linemixing.h:105
constexpr Numeric gamma_H
Definition: linemixing.h:123
constexpr Numeric lambda_D
Definition: linemixing.h:118
BasisRate(const Vector &v, Type t)
Construct a new Basis Rate object.
Definition: linemixing.h:261
HartmannPos
Description of data in Hartmann Type.
Definition: linemixing.h:181
constexpr Numeric hamiltonian_freq(T J)
Hamiltonian frequency.
Definition: linemixing.h:167
constexpr Numeric lambda
Definition: linemixing.h:117
Vector rosenkranz_scaling_second_order(const AbsorptionLines &abs_lines, const Matrix &W, const Vector &d0)
Computes G for Rosenkranz&#39;s line mixing coefficients.
Definition: linemixing.cc:466
Vector mdata
Definition: linemixing.h:300
Vector reduced_dipole_vector(const AbsorptionLines &abs_lines, const RedPoleType type)
Reduced dipole vector.
Definition: linemixing.cc:401
Type
Type of off diagonal element computations.
Definition: linemixing.h:312
void relmatInAir(Matrix &relmat, const AbsorptionLines &abs_lines, const SpeciesAuxData &partition_functions, const Index &wigner_initialized, const Numeric &temperature)
Compute the relaxation matrix in air mixture.
Definition: linemixing.cc:915
#define d0
Matrix CO2_ir_training(const ArrayOfRational &Ji, const ArrayOfRational &Jf, const ArrayOfRational &l2i, const ArrayOfRational &l2f, const Vector &F0, const Vector &d, const Vector &rho, const Vector &gamma, const Numeric &T)
CO2 IR training algorithm for linearization.
Definition: linemixing.cc:665
RedPoleType
Type of reduced dipole.
Definition: linemixing.h:419
OffDiagonalElementOutput O2_66_MW(const Rational &J1u, const Rational &N1u, const Rational &J1l, const Rational &N1l, const Rational &J2u, const Rational &N2u, const Rational &J2l, const Rational &N2l, const Numeric &rho1, const Numeric &rho2, const Numeric &T, const Numeric &collider_mass)
O2-66 MW off diagonal element computer.
Definition: linemixing.cc:741
Basis rate of transitions.
Definition: linemixing.h:245
Molecular constant.
Definition: linemixing.h:102
Type mtype
Definition: linemixing.h:299
Implements rational numbers to work with other ARTS types.
Definition: rational.h:54
constexpr Numeric kaycm2freq(T x)
Definition: constants.h:383
#define a1
Definition: complex.h:55
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
The Matrix class.
Definition: matpackI.h:1113
Declarations required for the calculation of absorption coefficients.
To keep track of (y0 + y1 * (T0 / T - 1.)) * pow(T0 / T, n)
Definition: linemixing.h:462
Vector rosenkranz_shifting_second_order(const AbsorptionLines &abs_lines, const Matrix &W)
Computes DV for Rosenkranz&#39;s line mixing coefficients.
Definition: linemixing.cc:449
Matrix hartmann_ecs_interface(const AbsorptionLines &abs_lines, const ArrayOfSpeciesTag &collider_species, const Vector &collider_species_vmr, const SpeciesAuxData &partition_functions, const Numeric &T, const Index &size)
Energy corrected sudden relaxation matrix using Hartmann&#39;s method.
Definition: linemixing.cc:501
The ComplexVector class.
Definition: complex.h:572
Type
Methods to compute factor.
Definition: linemixing.h:178
constexpr Numeric g_S
Definition: linemixing.h:109
constexpr Numeric B
Definition: linemixing.h:159
Adiabatic factor computations.
Definition: linemixing.h:174
G0 G2 FVC Y DV F0
Vector dipole_vector(const AbsorptionLines &abs_lines, const SpeciesAuxData &partition_functions)
Dipole vector.
Definition: linemixing.cc:371
OffDiagonalElementOutput CO2_IR(const Rational &Jku, const Rational &Jju, const Rational &Jkl, const Rational &Jjl, const Rational &l2ku, const Rational &l2ju, const Rational &l2kl, const Rational &l2jl, const Numeric &j_rho, const Numeric &k_rho, const BasisRate &br, const AdiabaticFactor &af, const Numeric &T, const Numeric &B0, const Numeric &main_mass, const Numeric &collider_mass)
CO2 IR off diagonal element computer.
Definition: linemixing.cc:526
constexpr Numeric H
Definition: linemixing.h:115
A constant view of a Vector.
Definition: matpackI.h:400
#define nlines
#define a2
Definition: complex.h:57
Contains the rational class definition.
constexpr Numeric gamma_D
Definition: linemixing.h:122
constexpr Numeric mass
Definition: linemixing.h:125
HartmannPos
Type of basis rate.
Definition: linemixing.h:252
constexpr Numeric D
Definition: linemixing.h:114
AdiabaticFactor(const Vector &v, Type t)
Construct a new Adiabatic Factor object.
Definition: linemixing.h:190
Vector population_density_vector(const AbsorptionLines &abs_lines, const SpeciesAuxData &partition_functions, const Numeric &T)
Compute the population density.
Definition: linemixing.cc:342
Auxiliary data for isotopologues.
Definition: absorption.h:217
SecondOrderLineMixingCoeffs compute_2nd_order_lm_coeff(ConstVectorView y, ConstVectorView x, const Numeric exp, const Numeric x0)
Fit to a second order line mixing formula the input.
Definition: linemixing.cc:835
Numeric rotational_energy_hund_b_molecule(T J, T N, T J2, Numeric B, Numeric D, Numeric H, Numeric gamma, Numeric gamma_D, Numeric gamma_H, Numeric lambda, Numeric lambda_D, Numeric lambda_H)
Compute the rotational energy of a Hund b case molecule.
Definition: linemixing.h:54
Type
Type of basis rate.
Definition: linemixing.h:249
constexpr Numeric g_r
Definition: linemixing.h:111
constexpr Numeric ge_l
Definition: linemixing.h:110
Numeric sqrt(const Rational r)
Square root.
Definition: rational.h:620