41 Numeric& diameter_aspect_area_max,
43 const Numeric& diameter_volume_equ,
46 const Numeric volume = (
PI *
pow(diameter_volume_equ, 3)) / 6.;
48 if (shape ==
"spheroidal") {
53 pow((3. * volume) / (4. *
PI *
pow(aspect_ratio, 2)), 1. / 3.);
54 diameter_max = 2. * b;
55 diameter_aspect_area_max = 2. * b;
59 const Numeric a =
pow((3. * volume * aspect_ratio) / (4 *
PI), 1. / 3.);
60 diameter_max = 2. * a;
61 diameter_aspect_area_max = 2. * a;
65 else if (shape ==
"cylindrical") {
67 const Numeric D =
pow((volume * 4 * aspect_ratio) /
PI, 1. / 3.);
68 const Numeric L = D / aspect_ratio;
69 diameter_max =
pow(
pow(D, 2) +
pow(L, 2), 1. / 2.);
70 diameter_aspect_area_max =
max(D,
pow(4 /
PI * D * L, 1. / 2.));
75 os <<
"Unknown particle shape: " << shape <<
"\n" 76 <<
"Must be spheroidal or cylindrical";
77 throw runtime_error(os.
str());
88 if (shape ==
"spheroidal") {
91 const Numeric b = diameter_max / 2.;
92 volume = (
pow(b, 3.) * 4. *
PI *
pow(aspect_ratio, 2.)) / 3.;
95 const Numeric a = diameter_max / 2.;
96 volume = (
pow(a, 3.) * 4. *
PI) / (3. * aspect_ratio);
100 else if (shape ==
"cylindrical") {
101 volume =
pow(diameter_max /
pow((
pow(aspect_ratio, 2.) + 1.), 1. / 2.), 3) *
102 pow(aspect_ratio, 2.) *
PI / 4.;
107 os <<
"Unknown particle shape: " << shape <<
"\n" 108 <<
"Must be spheroidal or cylindrical";
109 throw runtime_error(os.
str());
112 diameter_volume_equ =
pow((6. * volume) /
PI, 1. / 3.);
120 const Numeric& diameter_volume_equ,
124 const Vector& data_f_grid,
125 const Vector& data_t_grid,
126 const Vector& data_za_grid,
127 const Vector& data_aa_grid,
140 os <<
"T-matrix calculation for a " << shape <<
" particle, with " 141 <<
"diameter_volume_equ = " << 1e6 * diameter_volume_equ <<
"um and " 142 <<
"aspect ratio = " << aspect_ratio <<
".";
148 scat_data_single.
f_grid = data_f_grid;
149 scat_data_single.
T_grid = data_t_grid;
157 os <<
"Zenith angle (=scattering angle) grid needs to include\n" 158 <<
"0 deg and 180 deg as first and last grid points, respectively.\n" 159 <<
"At least one of them does not fit.";
160 throw runtime_error(os.
str());
164 for (
Index iza = 1; iza < nza; iza++) {
166 data_za_grid[iza], (
Numeric)iza * dza, 2 * DBL_EPSILON))) {
168 os <<
"Input zenith angle grid *data_za_grid* is required to be\n" 169 <<
"equidistant for randomly oriented particles, but it is not.";
170 throw runtime_error(os.
str());
174 scat_data_single.
za_grid = data_za_grid;
180 scat_data_single.
aa_grid = empty_grid;
185 data_aa_grid.
nelem() == 0) {
187 os <<
"For ptype = \"azimuthally_random\"" 188 <<
" the azimuth angle grid can not be empty.";
189 throw runtime_error(os.
str());
193 os <<
"For ptype = \"azimuthally_random\"" 194 <<
" the first value of the aa grid must be 0.";
195 throw runtime_error(os.
str());
199 last(data_aa_grid) != 180.) {
201 os <<
"For ptype = \"azimuthally_random\"" 202 <<
" the last value of the aa grid must be 180.";
203 throw runtime_error(os.
str());
206 scat_data_single.
aa_grid = data_aa_grid;
212 if (shape ==
"spheroidal") {
214 if (aspect_ratio == 1)
223 }
else if (shape ==
"cylindrical") {
227 os <<
"Unknown particle shape: " << shape <<
"\n" 228 <<
"Must be \"spheroidal\" or \"cylindrical\".";
229 throw runtime_error(os.
str());
241 "complex_refr_index",
249 0.5 * diameter_volume_equ,
259 "Meta data for associated file with single scattering data.";
261 "ARTS interface to T-matrix code by Mishchenko et al.";
264 Numeric diameter_max, area_max;
272 scat_meta_single.
mass = mass;
void tmatrix_tmd_test(const Verbosity &verbosity)
T-Matrix validation test.
Declarations for the T-Matrix interface.
void TMatrixTest(const Verbosity &verbosity)
WORKSPACE METHOD: TMatrixTest.
INDEX Index
The type to use for all integer numbers and indices.
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.
Declarations having to do with the four output streams.
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.
Numeric last(ConstVectorView x)
last
Index nelem() const
Returns the number of elements.
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.
bool is_same_within_epsilon(const Numeric &a, const Numeric &b, const Numeric &epsilon)
Check, if two numbers agree within a given epsilon.
_CS_string_type str() const
void calc_ssp_fixed_test(const Verbosity &verbosity)
Single scattering properties calculation for particles with fixed orientation.
PType PTypeFromString(const String &ptype_string)
Convert ptype name to enum value.
void calc_ssp_random_test(const Verbosity &verbosity)
Single scattering properties calculation for randomly oriented particles.
NUMERIC Numeric
The type to use for all floating point numbers.
Header file for special_interp.cc.
Numeric pow(const Rational base, Numeric exp)
Power of.
Header file for logic.cc.
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 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.
void tmatrix_ampld_test(const Verbosity &verbosity)
T-Matrix validation test.