ARTS  2.4.0(git:4fb77825)
psd.h
Go to the documentation of this file.
1 /* Copyright (C) 2017
2 
3  Jana Mendrok <jana.mendrok@gmail.com>
4  Patrick Eriksson <patrick.eriksson@chalmers.se>
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the
8  Free Software Foundation; either version 2, or (at your option) any
9  later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19  USA.
20 */
21 
30 #ifndef psd_h
31 #define psd_h
32 
33 #include "array.h"
34 #include "gridded_fields.h"
35 #include "interpolation.h"
36 #include "matpackVII.h"
37 #include "messages.h"
38 #include "optproperties.h"
39 #include "ppath.h"
40 
41 // ------------------------------------------------------
42 // Macros to avoid duplication of code
43 // ------------------------------------------------------
44 
45 #define START_OF_PSD_METHODS() \
46  const Index nin = pnd_agenda_input_names.nelem(); \
47  const Index ndx = dpnd_data_dx_names.nelem(); \
48  const Index np = pnd_agenda_input.nrows(); \
49  const Index nsi = psd_size_grid.nelem(); \
50  ArrayOfIndex dx2in(ndx); \
51  \
52  if (pnd_agenda_input.ncols() != nin) \
53  throw runtime_error( \
54  "Length of *pnd_agenda_input_names* and number of " \
55  "columns in *pnd_agenda_input* must be equal."); \
56  if (ndx) { \
57  if (ndx > nin) \
58  throw runtime_error( \
59  "The length of *dpnd_data_dx_names* can not " \
60  "exceed the one of *pnd_agenda_input_names*."); \
61  for (Index i = 0; i < ndx; i++) { \
62  dx2in[i] = find_first(pnd_agenda_input_names, dpnd_data_dx_names[i]); \
63  if (dx2in[i] < 0) { \
64  ostringstream os; \
65  os << "dpnd_data_dx_names[" << i << "] is " << dpnd_data_dx_names[i] \
66  << "\nThis string could not be found in *pnd_agenda_input_names*."; \
67  throw std::runtime_error(os.str()); \
68  } \
69  } \
70  } \
71  \
72  psd_data.resize(np, nsi); \
73  psd_data = 0.0; \
74  if (ndx) { \
75  dpsd_data_dx.resize(ndx, np, nsi); \
76  dpsd_data_dx = 0.0; \
77  } else { \
78  dpsd_data_dx.resize(0, 0, 0); \
79  }
80 
98 void psd_cloudice_MH97(Vector& psd,
99  const Vector& diameter,
100  const Numeric& iwc,
101  const Numeric& t,
102  const bool noisy);
103 
132  const String& something,
133  const Vector& psd_size_grid,
134  const Vector& pnd_agenda_input_t,
135  const Matrix& pnd_agenda_input,
138  const Numeric& scat_species_a,
139  const Numeric& scat_species_b,
140  const Numeric& n0,
141  const Numeric& mu,
142  const Numeric& la,
143  const Numeric& ga,
144  const Numeric& t_min,
145  const Numeric& t_max,
146  const Index& picky,
147  const Verbosity&);
148 
168  const String& type,
169  const Vector& pnd_agenda_input_t,
170  const Matrix& pnd_agenda_input,
174  const Index& species_index,
175  const Numeric& t_min,
176  const Numeric& t_max,
177  const Index& picky,
178  const Verbosity&);
179 
199 void psd_rain_W16(Vector& psd, const Vector& diameter, const Numeric& rwc);
200 
227  const String& psd_name,
228  const Vector& psd_size_grid,
229  const Vector& pnd_agenda_input_t,
230  const Matrix& pnd_agenda_input,
233  const Numeric& scat_species_a,
234  const Numeric& scat_species_b,
235  const Numeric& n_alpha_in,
236  const Numeric& n_b_in,
237  const Numeric& mu_in,
238  const Numeric& gamma_in,
239  const Numeric& t_min,
240  const Numeric& t_max,
241  const Index& picky,
242  const Verbosity&);
243 
266 void psd_snow_F07(Vector& psd,
267  const Vector& diameter,
268  const Numeric& swc,
269  const Numeric& t,
270  const Numeric alpha,
271  const Numeric beta,
272  const String& regime);
273 
289 void psd_SB06(Vector& psd,
290  Matrix& dpsd,
291  const Vector& mass,
292  const Numeric& N_tot,
293  const Numeric& WC,
294  const String& hydrometeor_type);
295 
311 void psd_MY05(Vector& psd,
312  Matrix& dpsd,
313  const Vector& diameter_max,
314  const Numeric N_tot,
315  const Numeric WC,
316  const String psd_type);
317 
332 
347 
364 
365 
366 #endif //psd_h
Matrix
The Matrix class.
Definition: matpackI.h:1193
n0_from_t
Numeric n0_from_t(Numeric t)
Sets N0star based on temperature.
Definition: psd.cc:1257
gridded_fields.h
Implementation of gridded fields.
psd_cloudice_MH97
void psd_cloudice_MH97(Vector &psd, const Vector &diameter, const Numeric &iwc, const Numeric &t, const bool noisy)
The MH97 cloud ice PSD.
Definition: psd.cc:58
ARTS::Var::scat_meta
ArrayOfArrayOfScatteringMetaData scat_meta(Workspace &ws) noexcept
Definition: autoarts.h:5983
ARTS::Var::scat_species_a
Numeric scat_species_a(Workspace &ws) noexcept
Definition: autoarts.h:6103
Tensor3
The Tensor3 class.
Definition: matpackIII.h:339
psd_SB06
void psd_SB06(Vector &psd, Matrix &dpsd, const Vector &mass, const Numeric &N_tot, const Numeric &WC, const String &hydrometeor_type)
Definition: psd.cc:977
interpolation.h
Header file for interpolation.cc.
ARTS::Var::psd_size_grid
Vector psd_size_grid(Workspace &ws) noexcept
Definition: autoarts.h:5460
n0_from_iwc_dm
Numeric n0_from_iwc_dm(Numeric iwc, Numeric dm, Numeric rho)
Derives N0star from IWC and Dm.
Definition: psd.cc:1249
psd_rain_W16
void psd_rain_W16(Vector &psd, const Vector &diameter, const Numeric &rwc)
The Wang16 rain DSD DEPRECATED BY NEW MGD_SMM_COMMON Only included for compatibility with "old" pnd_f...
Definition: psd.cc:699
array.h
This file contains the definition of Array.
ARTS::Var::dpnd_data_dx_names
ArrayOfString dpnd_data_dx_names(Workspace &ws) noexcept
Definition: autoarts.h:3235
psd_snow_F07
void psd_snow_F07(Vector &psd, const Vector &diameter, const Numeric &swc, const Numeric &t, const Numeric alpha, const Numeric beta, const String &regime)
The F07 snow PSD.
Definition: psd.cc:886
Array< String >
ARTS::Var::dpsd_data_dx
Tensor3 dpsd_data_dx(Workspace &ws) noexcept
Definition: autoarts.h:3281
messages.h
Declarations having to do with the four output streams.
my_basic_string< char >
optproperties.h
Scattering database structure and functions.
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
Verbosity
Definition: messages.h:49
dm_from_iwc_n0
Numeric dm_from_iwc_n0(Numeric iwc, Numeric n0, Numeric rho)
Derives Dm from IWC and N0star.
Definition: psd.cc:1241
psd_mgd_smm_common
void psd_mgd_smm_common(Matrix &psd_data, Tensor3 &dpsd_data_dx, const String &psd_name, const Vector &psd_size_grid, const Vector &pnd_agenda_input_t, const Matrix &pnd_agenda_input, const ArrayOfString &pnd_agenda_input_names, const ArrayOfString &dpnd_data_dx_names, const Numeric &scat_species_a, const Numeric &scat_species_b, const Numeric &n_alpha_in, const Numeric &n_b_in, const Numeric &mu_in, const Numeric &gamma_in, const Numeric &t_min, const Numeric &t_max, const Index &picky, const Verbosity &)
Code common to a number of modified gamma PSDs used with single-moment mass schemes.
Definition: psd.cc:727
ARTS::Var::scat_species_b
Numeric scat_species_b(Workspace &ws) noexcept
Definition: autoarts.h:6112
psd_mono_common
void psd_mono_common(Matrix &psd_data, Tensor3 &dpsd_data_dx, const String &type, const Vector &pnd_agenda_input_t, const Matrix &pnd_agenda_input, const ArrayOfString &pnd_agenda_input_names, const ArrayOfString &dpnd_data_dx_names, const ArrayOfArrayOfScatteringMetaData &scat_meta, const Index &species_index, const Numeric &t_min, const Numeric &t_max, const Index &picky, const Verbosity &)
Code common to PSDs of mono type.
Definition: psd.cc:606
ppath.h
Propagation path structure and functions.
ARTS::Var::pnd_agenda_input_t
Vector pnd_agenda_input_t(Workspace &ws) noexcept
Definition: autoarts.h:5038
ARTS::Var::pnd_agenda_input_names
ArrayOfString pnd_agenda_input_names(Workspace &ws) noexcept
Definition: autoarts.h:5023
psd_mgd_mass_and_something
void psd_mgd_mass_and_something(Matrix &psd_data, Tensor3 &dpsd_data_dx, const String &something, const Vector &psd_size_grid, const Vector &pnd_agenda_input_t, const Matrix &pnd_agenda_input, const ArrayOfString &pnd_agenda_input_names, const ArrayOfString &dpnd_data_dx_names, const Numeric &scat_species_a, const Numeric &scat_species_b, const Numeric &n0, const Numeric &mu, const Numeric &la, const Numeric &ga, const Numeric &t_min, const Numeric &t_max, const Index &picky, const Verbosity &)
Code common to MGD PSD involving the integrated mass.
Definition: psd.cc:195
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
Vector
The Vector class.
Definition: matpackI.h:860
beta
#define beta
Definition: legacy_continua.cc:21435
ARTS::Var::pnd_agenda_input
Matrix pnd_agenda_input(Workspace &ws) noexcept
Definition: autoarts.h:5011
ARTS::Var::psd_data
Matrix psd_data(Workspace &ws) noexcept
Definition: autoarts.h:5446
matpackVII.h
psd_MY05
void psd_MY05(Vector &psd, Matrix &dpsd, const Vector &diameter_max, const Numeric N_tot, const Numeric WC, const String psd_type)
Definition: psd.cc:1118