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.");
271 return (!(j == 0 && DJ == -1)) ?
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;
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,
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;
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());
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],