ARTS 2.5.11 (git: 725533f0)
m_gas_scattering.cc
Go to the documentation of this file.
1/*===========================================================================
2 === File description
3 ===========================================================================*/
4
5#include "agenda_class.h"
6#include "physics_funcs.h"
7#include "arts_conversions.h"
8#include "gas_scattering.h"
9#include "optproperties.h"
10#include "rte.h"
11#include "transmissionmatrix.h"
12#include <cmath>
13
14using Constant::pi;
16
17
30/*===========================================================================
31 === The functions
32 ===========================================================================*/
33
34/* Workspace method: Doxygen documentation will be auto-generated */
36 Index& gas_scattering_do,
37 Agenda& gas_scattering_agenda,
38 const Verbosity&) {
39 // set flag to False (default)
40 gas_scattering_do = 0;
41
42 gas_scattering_agenda = Agenda(ws);
43 gas_scattering_agenda.set_name("gas_scattering_agenda");
44}
45
46/* Workspace method: Doxygen documentation will be auto-generated */
47void gas_scattering_coefXsecConst(PropagationMatrix& gas_scattering_coef,
48 const Vector& f_grid,
49 const Numeric& rtp_pressure,
50 const Numeric& rtp_temperature,
51 const Index& stokes_dim,
52 const Numeric& ConstXsec,
53 const Verbosity&) {
54 gas_scattering_coef = PropagationMatrix(f_grid.nelem(), stokes_dim, 1, 1, ConstXsec * number_density(rtp_pressure, rtp_temperature));
55}
56
57/* Workspace method: Doxygen documentation will be auto-generated */
58void gas_scattering_coefAirSimple(PropagationMatrix& gas_scattering_coef,
59 const Vector& f_grid,
60 const Numeric& rtp_pressure,
61 const Numeric& rtp_temperature,
62 const Index& stokes_dim,
63 const Verbosity&) {
64 static constexpr std::array coefficients{
65 3.9729066, 4.6547659e-2, 4.5055995e-4, 2.3229848e-5};
66
67 gas_scattering_coef = PropagationMatrix(f_grid.nelem(), stokes_dim);
68
69 for (Index f = 0; f < f_grid.nelem(); f++) {
70 const Numeric wavelen = Conversion::freq2wavelen(f_grid[f]) * 1e6;
71 Numeric sum = 0;
72 Numeric pows = 1;
73 for (auto& coef: coefficients) {
74 sum += coef * pows;
75 pows /= Math::pow2(wavelen);
76 }
77 gas_scattering_coef.Kjj()[f] = 1e-32 * sum / Math::pow4(wavelen);
78 }
79
80 gas_scattering_coef.Kjj() *= number_density(rtp_pressure, rtp_temperature);
81}
82
83/* Workspace method: Doxygen documentation will be auto-generated */
85 Vector& gas_scattering_fct_legendre,
86 const Vector& gas_scattering_los_in,
87 const Vector& gas_scattering_los_out,
88 const Index& stokes_dim,
89 const Index& gas_scattering_output_type,
90 const Verbosity&) {
91 //out
92 if (gas_scattering_output_type) {
93 gas_scattering_fct_legendre.resize(1);
94 gas_scattering_fct_legendre = 1.;
95
96 } else {
97 if (gas_scattering_los_in.nelem() > 0 && gas_scattering_los_out.nelem() > 0) {
98 TransmissionMatrix sca_mat_temp(1, stokes_dim);
99 sca_mat_temp.setIdentity();
100 gas_scattering_mat = sca_mat_temp;
101 } else {
102 // set the scattering matrics empty in case the in and out los are empty
103 gas_scattering_mat = TransmissionMatrix();
104 }
105 }
106}
107
108/* Workspace method: Doxygen documentation will be auto-generated */
110 Vector& gas_scattering_fct_legendre,
111 const Vector& gas_scattering_los_in,
112 const Vector& gas_scattering_los_out,
113 const Index& stokes_dim,
114 const Index& gas_scattering_output_type,
115 const Numeric& depolarization_factor,
116 const Verbosity&) {
117
118 ARTS_USER_ERROR_IF(gas_scattering_los_in.nelem() != gas_scattering_los_out.nelem(),
119 "The length of the vectors of incoming and outgoing direction must be the same.")
120
121
122
123 if (gas_scattering_output_type) {
124 gas_scattering_fct_legendre.resize(3);
125 gas_scattering_fct_legendre = {1, 0, 0.1};
126
127 } else {
128
129 //if gas_scattering_los_in or gas_scattering_los_out is empty then gas_scattering_mat is empty.
130 if (gas_scattering_los_in.nelem()>0 && gas_scattering_los_out.nelem()>0){
131
132 Index atmosphere_dim = 1;
133 if (gas_scattering_los_in.nelem()==2){
134 atmosphere_dim=3;
135 }
136
137 //For the scattering calculation we need the propagation direction of incoming
138 //and outgoing radiation. Therefore we have to convert the line of sights to
139 //propagation directions.
140 Vector in_prop;
141 Vector out_prop;
142
143 mirror_los(in_prop, gas_scattering_los_in,atmosphere_dim);
144 mirror_los(out_prop, gas_scattering_los_out,atmosphere_dim);
145
146 // calc_scatteringAngle() between gas_scattering_los_in and gas_scattering_los_out
147 Numeric za_inc = in_prop[0];
148 Numeric za_sca = out_prop[0];
149
150 Numeric aa_inc = 0;
151 Numeric aa_sca = 0;
152 if (atmosphere_dim==3){
153 aa_inc = in_prop[1];
154 aa_sca = out_prop[1];
155 }
156
157 Numeric theta_rad = scat_angle(za_sca, aa_sca, za_inc, aa_inc);
158
159 // Rayleigh phase matrix in scattering system
160 Vector pha_mat_int = calc_rayleighPhaMat(theta_rad, stokes_dim);
161
162 // transform the phase matrix
163 Matrix pha_mat(stokes_dim, stokes_dim, 0.0);
164
165 // account for depolarization factor
166 Numeric delta =
167 (1 - depolarization_factor) / (1 + 0.5 * depolarization_factor);
168 Numeric delta_prime =
169 (1 - 2 * depolarization_factor) / (1 - depolarization_factor);
170 Vector depol(6, 0.0);
171
172 switch (stokes_dim) {
173 case 4:
174 depol[5] = 1;
175 pha_mat_int[5] *= delta_prime;
176 [[fallthrough]];
177 case 1:
178 depol[0] = 1;
179 depol *= 1 - delta;
180 pha_mat_int += depol;
181 }
182
183 pha_mat_labCalc(pha_mat,
184 pha_mat_int,
185 gas_scattering_los_out[0],
186 gas_scattering_los_out[1],
187 gas_scattering_los_in[0],
188 gas_scattering_los_in[1],
189 theta_rad);
190
191 TransmissionMatrix sca_mat_temp(pha_mat);
192
193 gas_scattering_mat = sca_mat_temp;
194 } else {
195 // set the scattering matrics empty in case the in and out los are empty
196 gas_scattering_mat = TransmissionMatrix();
197 }
198 }
199}
Declarations for agendas.
Common ARTS conversions.
The Agenda class.
void set_name(const String &nname)
Set agenda name.
Workspace class.
#define ARTS_USER_ERROR_IF(condition,...)
Definition debug.h:137
Vector calc_rayleighPhaMat(const Numeric &theta_rad, const Index &stokes_dim)
Header file for functions related to gas scattering.
void gas_scatteringOff(Workspace &ws, Index &gas_scattering_do, Agenda &gas_scattering_agenda, const Verbosity &)
WORKSPACE METHOD: gas_scatteringOff.
void gas_scattering_coefXsecConst(PropagationMatrix &gas_scattering_coef, const Vector &f_grid, const Numeric &rtp_pressure, const Numeric &rtp_temperature, const Index &stokes_dim, const Numeric &ConstXsec, const Verbosity &)
WORKSPACE METHOD: gas_scattering_coefXsecConst.
void gas_scattering_matIsotropic(TransmissionMatrix &gas_scattering_mat, Vector &gas_scattering_fct_legendre, const Vector &gas_scattering_los_in, const Vector &gas_scattering_los_out, const Index &stokes_dim, const Index &gas_scattering_output_type, const Verbosity &)
WORKSPACE METHOD: gas_scattering_matIsotropic.
void gas_scattering_matRayleigh(TransmissionMatrix &gas_scattering_mat, Vector &gas_scattering_fct_legendre, const Vector &gas_scattering_los_in, const Vector &gas_scattering_los_out, const Index &stokes_dim, const Index &gas_scattering_output_type, const Numeric &depolarization_factor, const Verbosity &)
WORKSPACE METHOD: gas_scattering_matRayleigh.
void gas_scattering_coefAirSimple(PropagationMatrix &gas_scattering_coef, const Vector &f_grid, const Numeric &rtp_pressure, const Numeric &rtp_temperature, const Index &stokes_dim, const Verbosity &)
WORKSPACE METHOD: gas_scattering_coefAirSimple.
constexpr Numeric boltzmann_constant
Boltzmann constant [J/K] From: https://en.wikipedia.org/wiki/2019_redefinition_of_SI_base_units Date:...
constexpr Numeric pi
The following mathematical constants are generated in python Decimal package by the code:
constexpr auto freq2wavelen(auto x) noexcept
Conversion from Hz to wavelength.
constexpr auto pow4(auto x) noexcept
power of four
constexpr auto pow2(auto x) noexcept
power of two
Numeric scat_angle(const Numeric &za_sca, const Numeric &aa_sca, const Numeric &za_inc, const Numeric &aa_inc)
Calculates the scattering angle.
void pha_mat_labCalc(MatrixView pha_mat_lab, ConstVectorView pha_mat_int, const Numeric &za_sca, const Numeric &aa_sca, const Numeric &za_inc, const Numeric &aa_inc, const Numeric &theta_rad)
Calculate phase matrix in laboratory coordinate system.
Scattering database structure and functions.
This file contains declerations of functions of physical character.
constexpr Numeric number_density(Numeric p, Numeric t) noexcept
number_density
void mirror_los(Vector &los_mirrored, const ConstVectorView &los, const Index &atmosphere_dim)
Determines the backward direction for a given line-of-sight.
Definition rte.cc:1792
Declaration of functions in rte.cc.
Class to keep track of Transmission Matrices for Stokes Dim 1-4.
void setIdentity()
Set to identity matrix.
Stuff related to the transmission matrix.