42 Numeric& diameter_aspect_area_max,
44 const Numeric& diameter_volume_equ,
47 const Numeric volume = (
PI *
pow(diameter_volume_equ, 3)) / 6.;
49 if (shape ==
"spheroidal") {
54 pow((3. * volume) / (4. *
PI *
pow(aspect_ratio, 2)), 1. / 3.);
55 diameter_max = 2. *
b;
56 diameter_aspect_area_max = 2. *
b;
60 const Numeric a =
pow((3. * volume * aspect_ratio) / (4 *
PI), 1. / 3.);
61 diameter_max = 2. *
a;
62 diameter_aspect_area_max = 2. *
a;
66 else if (shape ==
"cylindrical") {
68 const Numeric D =
pow((volume * 4 * aspect_ratio) /
PI, 1. / 3.);
69 const Numeric L = D / aspect_ratio;
70 diameter_max =
pow(
pow(D, 2) +
pow(L, 2), 1. / 2.);
71 diameter_aspect_area_max =
max(D,
pow(4 /
PI * D * L, 1. / 2.));
76 os <<
"Unknown particle shape: " << shape <<
"\n"
77 <<
"Must be spheroidal or cylindrical";
78 throw runtime_error(os.str());
89 if (shape ==
"spheroidal") {
93 volume = (
pow(
b, 3.) * 4. *
PI *
pow(aspect_ratio, 2.)) / 3.;
97 volume = (
pow(
a, 3.) * 4. *
PI) / (3. * aspect_ratio);
101 else if (shape ==
"cylindrical") {
102 volume =
pow(diameter_max /
pow((
pow(aspect_ratio, 2.) + 1.), 1. / 2.), 3) *
103 pow(aspect_ratio, 2.) *
PI / 4.;
108 os <<
"Unknown particle shape: " << shape <<
"\n"
109 <<
"Must be spheroidal or cylindrical";
110 throw runtime_error(os.str());
113 diameter_volume_equ =
pow((6. * volume) /
PI, 1. / 3.);
121 const Numeric& diameter_volume_equ,
125 const Vector& data_f_grid,
126 const Vector& data_t_grid,
127 const Vector& data_za_grid,
128 const Vector& data_aa_grid,
141 os <<
"T-matrix calculation for a " << shape <<
" particle, with "
142 <<
"diameter_volume_equ = " << 1e6 * diameter_volume_equ <<
"um and "
143 <<
"aspect ratio = " << aspect_ratio <<
".";
149 scat_data_single.
f_grid = data_f_grid;
150 scat_data_single.
T_grid = data_t_grid;
158 os <<
"Zenith angle (=scattering angle) grid needs to include\n"
159 <<
"0 deg and 180 deg as first and last grid points, respectively.\n"
160 <<
"At least one of them does not fit.";
161 throw runtime_error(os.str());
165 for (
Index iza = 1; iza < nza; iza++) {
167 data_za_grid[iza], (
Numeric)iza * dza, 2 * DBL_EPSILON))) {
169 os <<
"Input zenith angle grid *data_za_grid* is required to be\n"
170 <<
"equidistant for randomly oriented particles, but it is not.";
171 throw runtime_error(os.str());
175 scat_data_single.
za_grid = data_za_grid;
181 scat_data_single.
aa_grid = empty_grid;
186 data_aa_grid.
nelem() == 0) {
188 os <<
"For ptype = \"azimuthally_random\""
189 <<
" the azimuth angle grid can not be empty.";
190 throw runtime_error(os.str());
194 os <<
"For ptype = \"azimuthally_random\""
195 <<
" the first value of the aa grid must be 0.";
196 throw runtime_error(os.str());
200 last(data_aa_grid) != 180.) {
202 os <<
"For ptype = \"azimuthally_random\""
203 <<
" the last value of the aa grid must be 180.";
204 throw runtime_error(os.str());
207 scat_data_single.
aa_grid = data_aa_grid;
213 if (shape ==
"spheroidal") {
215 if (aspect_ratio == 1)
224 }
else if (shape ==
"cylindrical") {
228 os <<
"Unknown particle shape: " << shape <<
"\n"
229 <<
"Must be \"spheroidal\" or \"cylindrical\".";
230 throw runtime_error(os.str());
242 "complex_refr_index",
250 0.5 * diameter_volume_equ,
260 "Meta data for associated file with single scattering data.";
262 "ARTS interface to T-matrix code by Mishchenko et al.";
265 Numeric diameter_max, area_max;
273 scat_meta_single.
mass = mass;
base max(const Array< base > &x)
Max function.
Constants of physical expressions as constexpr.
Index nelem() const noexcept
Returns the number of elements.
bool is_same_within_epsilon(const Numeric &a, const Numeric &b, const Numeric &epsilon)
Check, if two numbers agree within a given epsilon.
Header file for logic.cc.
void diameter_maxFromDiameter_volume_equ(Numeric &diameter_max, Numeric &diameter_aspect_area_max, const String &shape, const Numeric &diameter_volume_equ, const Numeric &aspect_ratio, const Verbosity &)
WORKSPACE METHOD: diameter_maxFromDiameter_volume_equ.
void scat_data_singleTmatrix(SingleScatteringData &scat_data_single, ScatteringMetaData &scat_meta_single, const GriddedField3 &complex_refr_index, const String &shape, const Numeric &diameter_volume_equ, const Numeric &aspect_ratio, const Numeric &mass, const String &ptype, const Vector &data_f_grid, const Vector &data_t_grid, const Vector &data_za_grid, const Vector &data_aa_grid, const Numeric &precision, const String &cri_source, const Index &ndgs, const Index &robust, const Index &quiet, const Verbosity &verbosity)
WORKSPACE METHOD: scat_data_singleTmatrix.
void diameter_volume_equFromDiameter_max(Numeric &diameter_volume_equ, Numeric &volume, const String &shape, const Numeric &diameter_max, const Numeric &aspect_ratio, const Verbosity &)
WORKSPACE METHOD: diameter_volume_equFromDiameter_max.
void TMatrixTest(const Verbosity &verbosity)
WORKSPACE METHOD: TMatrixTest.
Numeric last(ConstVectorView x)
last
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
Declarations having to do with the four output streams.
constexpr Numeric pi
The following mathematical constants are generated in python Decimal package by the code:
PType PTypeFromString(const String &ptype_string)
Convert ptype name to enum value.
Numeric pow(const Rational base, Numeric exp)
Power of.
void complex_n_interp(MatrixView n_real, MatrixView n_imag, const GriddedField3 &complex_n, const String &varname, ConstVectorView f_grid, ConstVectorView t_grid)
General function for interpolating data of complex n type.
Header file for special_interp.cc.
void calc_ssp_fixed_test(const Verbosity &verbosity)
Single scattering properties calculation for particles with fixed orientation.
void calcSingleScatteringDataProperties(SingleScatteringData &ssd, ConstMatrixView ref_index_real, ConstMatrixView ref_index_imag, const Numeric equiv_radius, const Index np, const Numeric aspect_ratio, const Numeric precision, const Index ndgs, const Index robust, const Index quiet)
Calculate SingleScatteringData properties.
void tmatrix_tmd_test(const Verbosity &verbosity)
T-Matrix validation test.
void calc_ssp_random_test(const Verbosity &verbosity)
Single scattering properties calculation for randomly oriented particles.
void tmatrix_ampld_test(const Verbosity &verbosity)
T-Matrix validation test.
Declarations for the T-Matrix interface.