57 assert(K.
nrows() == 4 );
58 assert(K.
ncols() == 4 );
61 S2T = sin(theta)*sin(theta),
70 K(0,0) = 0; K(0,1) = 0; K(0,2) = 0; K(0,3) = 0;
71 K(1,0) = 0; K(1,1) = 0; K(1,2) = 2 * CT; K(1,3) = S2T * SE2;
72 K(2,0) = 0; K(2,1) = - 2 * CT; K(2,2) = 0; K(2,3) = - S2T * CE2;
73 K(3,0) = 0; K(3,1) = - S2T * SE2; K(3,2) = S2T * CE2; K(3,3) = 0;
76 K(0,0) = 0; K(0,1) = 0; K(0,2) = 0; K(0,3) = 0;
77 K(1,0) = 0; K(1,1) = 0; K(1,2) = - 2 * CT; K(1,3) = S2T * SE2;
78 K(2,0) = 0; K(2,1) = 2 * CT; K(2,2) = 0; K(2,3) = - S2T * CE2;
79 K(3,0) = 0; K(3,1) = - S2T * SE2; K(3,2) = S2T * CE2; K(3,3) = 0;
82 K(0,0) = 0; K(0,1) = 0; K(0,2) = 0; K(0,3) = 0;
83 K(1,0) = 0; K(1,1) = 0; K(1,2) = 0; K(1,3) = - S2T * SE2;
84 K(2,0) = 0; K(2,1) = 0; K(2,2) = 0; K(2,3) = S2T * CE2;
85 K(3,0) = 0; K(3,1) = S2T * SE2; K(3,2) = - S2T * CE2; K(3,3) = 0;
110 assert(K.
nrows() == 4 );
111 assert(K.
ncols() == 4 );
115 S2T = sin(theta)*sin(theta),
116 C2T = cos(theta)*cos(theta),
124 K(0,0) = 1 + C2T; K(0,1) = S2T * CE2; K(0,2) = S2T * SE2; K(0,3) = 2 * CT;
125 K(1,0) = S2T * CE2; K(1,1) = 1 + C2T; K(1,2) = 0; K(1,3) = 0;
126 K(2,0) = S2T * SE2; K(2,1) = 0; K(2,2) = 1 + C2T; K(2,3) = 0;
127 K(3,0) = 2 * CT; K(3,1) = 0; K(3,2) = 0; K(3,3) = 1 + C2T;
130 K(0,0) = 1 + C2T; K(0,1) = S2T * CE2; K(0,2) = S2T * SE2; K(0,3) = - 2 * CT;
131 K(1,0) = S2T * CE2; K(1,1) = 1 + C2T; K(1,2) = 0; K(1,3) = 0;
132 K(2,0) = S2T * SE2; K(2,1) = 0; K(2,2) = 1 + C2T; K(2,3) = 0;
133 K(3,0) = - 2 * CT; K(3,1) = 0; K(3,2) = 0; K(3,3) = 1 + C2T;
136 K(0,0) = S2T; K(0,1) = - S2T * CE2; K(0,2) = - S2T * SE2; K(0,3) = 0;
137 K(1,0) = - S2T * CE2; K(1,1) = S2T; K(1,2) = 0; K(1,3) = 0;
138 K(2,0) = - S2T * SE2; K(2,1) = 0; K(2,2) = S2T; K(2,3) = 0;
139 K(3,0) = 0; K(3,1) = 0; K(3,2) = 0; K(3,3) = S2T;
142 K(0,0) = 1; K(0,1) = 0; K(0,2) = 0; K(0,3) = 0;
143 K(1,0) = 0; K(1,1) = 1; K(1,2) = 0; K(1,3) = 0;
144 K(2,0) = 0; K(2,1) = 0; K(2,2) = 1; K(2,3) = 0;
145 K(3,0) = 0; K(3,1) = 0; K(3,2) = 0; K(3,3) = 1;
172 const Numeric J = (j-dj).toNumeric(),
M = (m).toNumeric();
183 ret_val = (0.75)*(J+
M)*(J-1+
M)/(2.*J*(2.*J-1)*(2.*J+1));
186 ret_val = (1.50)*(J*J-
M*
M)/(J*(2.*J-1.)*(2.*J+1.));
189 ret_val = (0.75)*(J-
M)*(J-1.-
M)/(2.*J*(2.*J-1.)*(2.*J+1.));
192 throw std::runtime_error(
"Something is extremely wrong.");
200 ret_val = (0.75)*(J+
M)*(J+1.-
M)/(2.*J*(J+1.)*(2.*J+1.));
203 ret_val = (1.50)*
M*
M/(J*(J+1.)*(2.*J+1.));
206 ret_val = (0.75)*(J-
M)*(J+1.+
M)/(2.*J*(J+1.)*(2.*J+1.));
209 throw std::runtime_error(
"Something is extremely wrong.");
217 ret_val = (0.75)*(J+1.-
M)*(J+2.-
M)/(2.*(J+1.)*(2.*J+1.)*(2.*J+3.));
220 ret_val = (1.5)*((J+1.)*(J+1.)-
M*
M)/((J+1.)*(2.*J+1.)*(2.*J+3.));
223 ret_val = (0.75)*(J+1.+
M)*(J+2.+
M)/(2.*(J+1.)*(2.*J+1.)*(2.*J+3.));
226 throw std::runtime_error(
"Something is extremely wrong.");
231 throw std::runtime_error(
"Something is extremely wrong.");
261 Numeric
frequency_change_caseb(
const Rational& n,
const Rational& m,
const Rational& j,
const Numeric& S,
const Index& DJ,
const Index& DM,
const Index& DN,
const Numeric& H_mag,
const Numeric& GS)
264 const Numeric N_lo = N_up - (
Numeric)DN;
266 const Numeric M_up = M_lo + (
Numeric)DM;
268 const Numeric J_lo = J_up - (
Numeric)DJ;
271 return (!(j == 0 && DJ == -1)) ?
297 Numeric
frequency_change_casea(
const Rational& omega,
const Rational& m,
const Rational& j,
const Numeric& Sigma,
const Index& DJ,
const Index& DM,
const Index& Domega,
const Numeric& H_mag,
const Numeric& GS)
299 const Numeric Omega_up = omega.
toNumeric();
300 const Numeric Omega_lo = Omega_up - (
Numeric)Domega;
302 const Numeric M_up = M_lo + (
Numeric)DM;
304 const Numeric J_lo = J_up - (
Numeric)DJ;
318 const Vector& abs_t,
const Vector& f_grid,
const Numeric& theta,
const Numeric& eta,
const Index& DM,
const Index& this_species,
324 assert( part_abs_mat.
npages() == f_grid.
nelem() && part_abs_mat.
ncols() == 4 && part_abs_mat.
nrows() == 4 );
331 for ( Index i=0; i<abs_species[this_species].
nelem(); ++i )
333 { temp_lut[this_species] = temp_species_lut;
break;}
335 for ( Index i=0; i<abs_species[this_species].
nelem(); ++i )
340 f_grid, abs_p, abs_t, abs_vmrs, abs_species, this_species, lr,
341 abs_lineshape[i].Ind_ls(), abs_lineshape[i].Ind_lsn(), abs_lineshape[i].Cutoff(),
342 isotopologue_ratios, verbosity );
344 attenuation *= abs_vmrs(this_species, 0) *
number_density( abs_p[0],abs_t[0]);
345 phase *= abs_vmrs(this_species, 0) *
number_density( abs_p[0],abs_t[0]);
351 Matrix K_a(4,4), K_b(4,4);
355 Tensor3 temp_part_abs_mat=part_abs_mat;
359 part_abs_mat+=temp_part_abs_mat;
372 const Numeric& rtp_pressure,
373 const Numeric& rtp_temperature,
377 const Index& atmosphere_dim,
380 const Index& manual_zeeman_tag,
381 const Numeric& manual_zeeman_magnetic_field_strength,
382 const Numeric& manual_zeeman_theta,
383 const Numeric& manual_zeeman_eta,
388 const Numeric margin = 1e-4;
389 bool do_zeeman =
false;
396 if (abs_species.
nelem() != abs_lines_per_species.
nelem())
397 throw std::runtime_error(
"Dimension of *abs_species* and *abs_lines_per_species* don't match.");
398 for(Index II = 0; II<abs_species.
nelem(); II++)
399 if(
is_zeeman(abs_species[II])) { do_zeeman =
true;
break; }
400 if( propmat_clearsky.
ncols() != 4 )
401 throw std::runtime_error(
"Zeeman Effect is only implemented for Stokes dimension 4.");
402 if( propmat_clearsky.
nrows() != 4 )
403 throw std::runtime_error(
"Zeeman Effect is only implemented for Stokes dimension 4.");
405 throw std::runtime_error(
"Frequency dimension of *propmat_clearsky* not equal to length of *f_grid*.");
406 if( propmat_clearsky.
nbooks() != abs_species.
nelem() )
407 throw std::runtime_error(
"Species dimension of *propmat_clearsky* not equal to length of *abs_species*.");
408 if( rtp_mag.
nelem() != 3 )
409 throw std::runtime_error(
"*rtp_mag* must have length 3.");
410 if( atmosphere_dim != 3 )
411 throw std::runtime_error(
"*atmosphere_dim* must be 3.");
412 if( ppath_los.
nelem() != 2 )
413 throw std::runtime_error(
"*ppath_los* is not set correctly.");
417 mirror_los(R_path_los, ppath_los, atmosphere_dim);
422 rtp_pressure, rtp_temperature, rtp_vmr,
424 if( do_zeeman && (( rtp_mag[0]!=0 || rtp_mag[1]!=0 || rtp_mag[2]!=0 ) || manual_zeeman_tag != 0 ))
427 const Numeric H_mag = manual_zeeman_tag != 0?manual_zeeman_magnetic_field_strength:sqrt( rtp_mag * rtp_mag );
430 if(manual_zeeman_tag!=0)
432 eta = manual_zeeman_eta;
433 theta = manual_zeeman_theta;
442 zaaa2cart(dx,dy,dz,R_path_los[0],R_path_los[1]);
450 e_v[0] = cos(R_path_los[0] *
DEG2RAD) * cos(R_path_los[1] * DEG2RAD);
451 e_v[1] = cos(R_path_los[0] * DEG2RAD) * sin(R_path_los[1] * DEG2RAD);
452 e_v[2] = -sin(R_path_los[0] * DEG2RAD);
455 e_h[0] = -sin(R_path_los[1] * DEG2RAD);
456 e_h[1] = cos(R_path_los[1] * DEG2RAD);
460 proj(tmp, R_path, H);
464 R11 *= sqrt(R11*R11);
479 for(Index II = 0; II<abs_species.
nelem(); II++)
487 if(!
is_zeeman(abs_species[II]))
continue;
490 for (Index ii = 0; ii< abs_lines_per_species[II].
nelem(); ii++)
493 LineRecord temp_LR = abs_lines_per_species[II][ii];
500 Index number_M_sm = 0, number_M_sp=0, number_M_pi=0;
524 os <<
"There are undefined Hund cases: " << abs_lines_per_species[II][ii] <<
"\nThe case is: "<<hund<<
", allowed are (a): "<<0<<
" and (b): " << 1<<
"\n";
525 throw std::runtime_error(os.str());
531 for ( Rational
M = -J+DJ;
M<=J-DJ;
M++ )
544 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
545 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
546 temp_abs_lines_sm.push_back(temp_LR);
553 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
554 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
555 temp_abs_lines_pi.push_back(temp_LR);
562 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
563 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
564 temp_abs_lines_sp.push_back(temp_LR);
573 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
574 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
575 temp_abs_lines_sm.push_back(temp_LR);
583 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
584 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
585 temp_abs_lines_pi.push_back(temp_LR);
593 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
594 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
595 temp_abs_lines_sp.push_back(temp_LR);
601 if (
M == -J + DJ &&
M!=0 )
606 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
607 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
608 temp_abs_lines_sp.push_back(temp_LR);
613 else if (
M == -J + DJ + 1 &&
M!=0 )
618 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
619 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
620 temp_abs_lines_sp.push_back(temp_LR);
627 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
628 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
629 temp_abs_lines_pi.push_back(temp_LR);
633 else if (
M == J - DJ - 1 &&
M!=0 )
638 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
639 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
640 temp_abs_lines_pi.push_back(temp_LR);
647 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
648 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
649 temp_abs_lines_sm.push_back(temp_LR);
653 else if (
M == J - DJ &&
M!=0 )
658 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
659 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
660 temp_abs_lines_sm.push_back(temp_LR);
664 else if( (-J + DJ + 1) == (J - DJ - 1) &&
M == 0)
669 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
670 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
671 temp_abs_lines_pi.push_back(temp_LR);
680 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
681 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
682 temp_abs_lines_sp.push_back(temp_LR);
689 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
690 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
691 temp_abs_lines_pi.push_back(temp_LR);
698 temp_LR.
setF( abs_lines_per_species[II][ii].F() + DF );
699 temp_LR.
setI0( abs_lines_per_species[II][ii].I0() * RS );
700 temp_abs_lines_sm.push_back(temp_LR);
708 os <<
"There seems to be something wrong with the quantum numbers of at least one line in your *abs_lines*. " <<
709 "Make sure this is a Zeeman line.\nThe upper quantum numbers are: " <<
710 abs_lines_per_species[II][ii].QuantumNumbers().Upper() <<
711 "\nThe lower quantum numbers are: " <<
712 abs_lines_per_species[II][ii].QuantumNumbers().Lower() <<
713 "\nThe entire line information: " << abs_lines_per_species[II][ii];
714 throw std::runtime_error(os.str());
718 if (
abs(RS_sum-1.)>margin)
721 os <<
"The sum of relative strengths is not close to one. This is severly problematic and " 722 "you should look into why this happens.\nIt is currently " << RS_sum <<
" with DJ: "<<DJ<<
", DMain: "<<DMain<<
" for line: "<<
723 abs_lines_per_species[II][ii] <<
"\n";
724 throw std::runtime_error(os.str());
729 for(Index n=0;n<number_M_sm;n++)
730 temp_lut_sm.push_back(line_mixing_data_lut[II][ii]);
731 for(Index n=0;n<number_M_pi;n++)
732 temp_lut_pi.push_back(line_mixing_data_lut[II][ii]);
733 for(Index n=0;n<number_M_sp;n++)
734 temp_lut_sp.push_back(line_mixing_data_lut[II][ii]);
741 os <<
"There are undefined quantum numbers in the line: " << abs_lines_per_species[II][ii] <<
"\nJ is "<<J<<
" and Main is "<<Main<<std::endl;
742 throw std::runtime_error(os.str());
749 temp_abs_lines_pi, isotopologue_ratios,
750 abs_vmrs, abs_p, abs_t, f_grid,
753 line_mixing_data_lut,
760 temp_abs_lines_sm, isotopologue_ratios,
761 abs_vmrs, abs_p, abs_t, f_grid,
764 line_mixing_data_lut,
771 temp_abs_lines_sp, isotopologue_ratios,
772 abs_vmrs, abs_p, abs_t, f_grid,
775 line_mixing_data_lut,
784 for(Index II = 0; II<abs_species.
nelem(); II++)
787 if(!
is_zeeman(abs_species[II]))
continue;
794 abs_lines_per_species[II], isotopologue_ratios,
795 abs_vmrs, abs_p, abs_t, f_grid,
798 line_mixing_data_lut,
804 abs_lines_per_species[II], isotopologue_ratios,
805 abs_vmrs, abs_p, abs_t, f_grid,
808 line_mixing_data_lut,
809 line_mixing_data_lut[II],
INDEX Index
The type to use for all integer numbers and indices.
const Numeric PLANCK_CONST
void cross3(VectorView c, const ConstVectorView &a, const ConstVectorView &b)
cross3
Index nelem() const
Number of elements.
Declarations having to do with the four output streams.
Numeric frequency_change_caseb(const Rational &n, const Rational &m, const Rational &j, const Numeric &S, const Index &DJ, const Index &DM, const Index &DN, const Numeric &H_mag, const Numeric &GS)
void zaaa2cart(Numeric &dx, Numeric &dy, Numeric &dz, const Numeric &za, const Numeric &aa)
zaaa2cart
void xsec_species_line_mixing_wrapper(MatrixView xsec_attenuation, MatrixView xsec_phase, const ArrayOfArrayOfLineMixingRecord &line_mixing_data, const ArrayOfArrayOfIndex &line_mixing_data_lut, ConstVectorView f_grid, ConstVectorView abs_p, ConstVectorView abs_t, ConstMatrixView all_vmrs, const ArrayOfArrayOfSpeciesTag &abs_species, const Index this_species, const ArrayOfLineRecord &abs_lines, const Index ind_ls, const Index ind_lsn, const Numeric cutoff, const SpeciesAuxData &isotopologue_ratios, const Verbosity &verbosity)
This will work as a wrapper for linemixing when abs_species contain relevant data.
Index npages() const
Returns the number of pages.
Numeric gs_caseb(const Numeric &N, const Numeric &J, const Numeric &S, const Numeric &GS)
void phase_matrix(MatrixView K, const Numeric &theta, const Numeric &eta, const Index &DM)
Index nrows() const
Returns the number of rows.
const QuantumNumberRecord & QuantumNumbers() const
Quantum numbers.
Index nrows() const
Returns the number of rows.
Numeric number_density(const Numeric &p, const Numeric &t)
number_density
Index nelem() const
Returns the number of elements.
void mult(VectorView y, const ConstMatrixView &M, const ConstVectorView &x)
Matrix Vector multiplication.
Rational Lower(Index i) const
Get lower quantum number.
Index ncols() const
Returns the number of columns.
Numeric toNumeric() const
void proj(Vector &c, ConstVectorView a, ConstVectorView b)
void AbsInputFromRteScalars(Vector &abs_p, Vector &abs_t, Matrix &abs_vmrs, const Numeric &rtp_pressure, const Numeric &rtp_temperature, const Vector &rtp_vmr, const Verbosity &)
WORKSPACE METHOD: AbsInputFromRteScalars.
Index ncols() const
Returns the number of columns.
Numeric(* frequency_change)(const Rational &, const Rational &, const Rational &, const Numeric &, const Index &, const Index &, const Index &, const Numeric &, const Numeric &)
Index Isotopologue() const
The index of the isotopologue species that this line belongs to.
void xsec_species_line_mixing_wrapper_with_zeeman(Tensor3View part_abs_mat, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfLineshapeSpec &abs_lineshape, const ArrayOfLineRecord &lr, const SpeciesAuxData &isotopologue_ratios, const Matrix &abs_vmrs, const Vector &abs_p, const Vector &abs_t, const Vector &f_grid, const Numeric &theta, const Numeric &eta, const Index &DM, const Index &this_species, const ArrayOfArrayOfLineMixingRecord &line_mixing_data, const ArrayOfArrayOfIndex &line_mixing_data_lut, const ArrayOfIndex &temp_species_lut, const Verbosity &verbosity)
NUMERIC Numeric
The type to use for all floating point numbers.
Declarations required for the calculation of absorption coefficients.
Propagation path structure and functions.
Index npages() const
Returns the number of pages.
const Numeric BOHR_MAGNETON
void checkIsotopologueRatios(const ArrayOfArrayOfSpeciesTag &abs_species, const SpeciesAuxData &isoratios)
Check that isotopologue ratios for the given species are correctly defined.
Numeric frequency_change_casea(const Rational &omega, const Rational &m, const Rational &j, const Numeric &Sigma, const Index &DJ, const Index &DM, const Index &Domega, const Numeric &H_mag, const Numeric &GS)
void propmat_clearskyAddZeeman(Tensor4 &propmat_clearsky, const Vector &f_grid, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfArrayOfLineRecord &abs_lines_per_species, const ArrayOfLineshapeSpec &abs_lineshape, const SpeciesAuxData &isotopologue_ratios, const SpeciesAuxData &isotopologue_quantum, const Numeric &rtp_pressure, const Numeric &rtp_temperature, const Vector &rtp_vmr, const Vector &rtp_mag, const Vector &ppath_los, const Index &atmosphere_dim, const ArrayOfArrayOfLineMixingRecord &line_mixing_data, const ArrayOfArrayOfIndex &line_mixing_data_lut, const Index &manual_zeeman_tag, const Numeric &manual_zeeman_magnetic_field_strength, const Numeric &manual_zeeman_theta, const Numeric &manual_zeeman_eta, const Verbosity &verbosity)
WORKSPACE METHOD: propmat_clearskyAddZeeman.
Numeric vector_angle(ConstVectorView a, ConstVectorView b)
Contains the rational class definition.
Index nbooks() const
Returns the number of books.
Numeric getParam(Index species, Index isotopologue, Index col) const
Get single parameter value.
void mirror_los(Vector &los_mirrored, ConstVectorView los, const Index &atmosphere_dim)
mirror_los
void attenuation_matrix(MatrixView K, const Numeric &theta, const Numeric &eta, const Index &DM)
void setF(Numeric new_mf)
Set the line center frequency in Hz.
Rational Upper(Index i) const
Get upper quantum number.
Auxiliary data for isotopologues.
Numeric gs_casea(const Numeric &Omega, const Numeric &J, const Numeric &Sigma, const Numeric &GS)
Index Species() const
The index of the molecular species that this line belongs to.
Index ncols() const
Returns the number of columns.
void setI0(Numeric new_mi0)
Set Intensity.
Numeric relative_strength(const Rational &m, const Rational &j, const Index &dj, const Index &dm)
Index nrows() const
Returns the number of rows.
Spectral line catalog data.
Declaration of functions in rte.cc.