ARTS  2.4.0(git:4fb77825)
m_microphysics.cc File Reference

Workspace functions related to particle micophysics (e.g. size distributions). More...

#include <cmath>
#include <cstdlib>
#include <stdexcept>
#include "array.h"
#include "arts.h"
#include "auto_md.h"
#include "check_input.h"
#include "cloudbox.h"
#include "file.h"
#include "interpolation.h"
#include "lin_alg.h"
#include "logic.h"
#include "math_funcs.h"
#include "messages.h"
#include "microphysics.h"
#include "optproperties.h"
#include "parameters.h"
#include "physics_funcs.h"
#include "psd.h"
#include "rte.h"
#include "sorting.h"
#include "special_interp.h"
#include "xml_io.h"

Go to the source code of this file.

Functions

void particle_massesFromMetaDataSingleCategory (Matrix &particle_masses, const ArrayOfArrayOfScatteringMetaData &scat_meta, const Verbosity &)
 WORKSPACE METHOD: particle_massesFromMetaDataSingleCategory. More...
 
void particle_massesFromMetaData (Matrix &particle_masses, const ArrayOfArrayOfScatteringMetaData &scat_meta, const Verbosity &)
 WORKSPACE METHOD: particle_massesFromMetaData. More...
 
void pndFromPsdBasic (Matrix &pnd_data, Tensor3 &dpnd_data_dx, const Vector &pnd_size_grid, const Matrix &psd_data, const Vector &psd_size_grid, const Tensor3 &dpsd_data_dx, const Index &quad_order, const Verbosity &)
 WORKSPACE METHOD: pndFromPsdBasic. More...
 
void pndFromPsd (Matrix &pnd_data, Tensor3 &dpnd_data_dx, const Vector &pnd_size_grid, const Matrix &psd_data, const Vector &psd_size_grid, const Tensor3 &dpsd_data_dx, const ArrayOfArrayOfSingleScatteringData &scat_data, const Vector &f_grid, const Index &scat_data_checked, const Index &quad_order, const Index &scat_index, const Numeric &threshold_rsec, const Numeric &threshold_bext, const Numeric &threshold_rpnd, const Verbosity &)
 WORKSPACE METHOD: pndFromPsd. More...
 
void pnd_fieldCalcFromParticleBulkProps (Workspace &ws, Tensor4 &pnd_field, ArrayOfTensor4 &dpnd_field_dx, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &t_field, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const ArrayOfString &scat_species, const ArrayOfArrayOfSingleScatteringData &scat_data, const ArrayOfArrayOfScatteringMetaData &scat_meta, const Tensor4 &particle_bulkprop_field, const ArrayOfString &particle_bulkprop_names, const ArrayOfAgenda &pnd_agenda_array, const ArrayOfArrayOfString &pnd_agenda_array_input_names, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Verbosity &)
 WORKSPACE METHOD: pnd_fieldCalcFromParticleBulkProps. More...
 
void ScatSpeciesSizeMassInfo (Vector &scat_species_x, Numeric &scat_species_a, Numeric &scat_species_b, const ArrayOfArrayOfScatteringMetaData &scat_meta, const Index &species_index, const String &x_unit, const Numeric &x_fit_start, const Numeric &x_fit_end, const Index &do_only_x, const Verbosity &)
 WORKSPACE METHOD: ScatSpeciesSizeMassInfo. More...
 

Variables

const String SCATSPECIES_MAINTAG
 

Detailed Description

Workspace functions related to particle micophysics (e.g. size distributions).

Author
Jana Mendrok, Daniel Kreyling, Manfred Brath, Patrick Eriksson
Date
2017-07-10

These functions are listed in the doxygen documentation as entries of the file auto_md.h.

Definition in file m_microphysics.cc.

Function Documentation

◆ particle_massesFromMetaData()

void particle_massesFromMetaData ( Matrix particle_masses,
const ArrayOfArrayOfScatteringMetaData scat_meta,
const Verbosity verbosity 
)

WORKSPACE METHOD: particle_massesFromMetaData.

Derives particle_masses from scat_meta.

This method is supposed to be used to derive particle_masses when pnd_field is internally calculated using pnd_fieldCalcFromParticleBulkProps* (in contrast to reading it from external sources using ScatElementsPndAndScatAdd and pnd_fieldCalcFrompnd_field_raw*). It extracts the mass information of the scattering elements from scat_meta*. Each scattering species is taken as a separate category of particle_masses, i.e., the resulting particle_masses* matrix will contain as many columns as scattering species are present in scat_meta.

Author
Jana Mendrok
Parameters
[out]particle_massesWS Output
[in]scat_metaWS Input

Definition at line 109 of file m_microphysics.cc.

References ARTS::Var::particle_masses(), ARTS::Var::scat_meta(), and TotalNumberOfElements().

Referenced by particle_massesFromMetaData_g().

◆ particle_massesFromMetaDataSingleCategory()

void particle_massesFromMetaDataSingleCategory ( Matrix particle_masses,
const ArrayOfArrayOfScatteringMetaData scat_meta,
const Verbosity verbosity 
)

WORKSPACE METHOD: particle_massesFromMetaDataSingleCategory.

Sets particle_masses based on scat_meta assuming all particles are of the same mass category.

This method derives the particle masses from the mass entry of each scattering element. It is assumed that all scattering elements represent particles of the same (bulk) matter (e.g. water or ice). With other words, a single mass category is assumed (see particle_masses for a definition of "mass category").

To be clear, the above are assumptions of the method, the user is free to work with any scattering element. For Earth and just having cloud and particles, the resulting mass category can be seen as the total cloud water content, with possible contribution from both ice and liquid phase.

Author
Jana Mendrok
Patrick Eriksson
Parameters
[out]particle_massesWS Output
[in]scat_metaWS Input

Definition at line 72 of file m_microphysics.cc.

References ARTS::Var::particle_masses(), ARTS::Var::scat_meta(), and TotalNumberOfElements().

Referenced by particle_massesFromMetaDataSingleCategory_g().

◆ pnd_fieldCalcFromParticleBulkProps()

void pnd_fieldCalcFromParticleBulkProps ( Workspace ws,
Tensor4 pnd_field,
ArrayOfTensor4 dpnd_field_dx,
const Index atmosphere_dim,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const Tensor3 t_field,
const Index cloudbox_on,
const ArrayOfIndex cloudbox_limits,
const ArrayOfString scat_species,
const ArrayOfArrayOfSingleScatteringData scat_data,
const ArrayOfArrayOfScatteringMetaData scat_meta,
const Tensor4 particle_bulkprop_field,
const ArrayOfString particle_bulkprop_names,
const ArrayOfAgenda pnd_agenda_array,
const ArrayOfArrayOfString pnd_agenda_array_input_names,
const Index jacobian_do,
const ArrayOfRetrievalQuantity jacobian_quantities,
const Verbosity verbosity 
)

WORKSPACE METHOD: pnd_fieldCalcFromParticleBulkProps.

Converts particle bulk property data to pnd_field.

In short, the method combines scat_species, pnd_agenda_array, particle_bulkprop_field* and their associated variables to derive pnd_field*.

The method does nothing if cloudbox is inactive.

Otherwise, cloudbox limits must be set before calling the method, and particle_bulkprop_field is checked to have non-zero elements just inside the cloudbox.

Author
Patrick Eriksson, Jana Mendrok
Parameters
[in,out]wsWorkspace
[out]pnd_fieldWS Output
[out]dpnd_field_dxWS Output
[in]atmosphere_dimWS Input
[in]p_gridWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]t_fieldWS Input
[in]cloudbox_onWS Input
[in]cloudbox_limitsWS Input
[in]scat_speciesWS Input
[in]scat_dataWS Input
[in]scat_metaWS Input
[in]particle_bulkprop_fieldWS Input
[in]particle_bulkprop_namesWS Input
[in]pnd_agenda_arrayWS Input
[in]pnd_agenda_array_input_namesWS Input
[in]jacobian_doWS Input
[in]jacobian_quantitiesWS Input

Definition at line 499 of file m_microphysics.cc.

References ARTS::Var::atmosphere_dim(), chk_atm_field(), chk_atm_grids(), chk_if_in_range(), ARTS::Var::cloudbox_limits(), ARTS::Var::cloudbox_on(), ARTS::Var::dpnd_data_dx(), ARTS::Var::dpnd_data_dx_names(), ARTS::Var::dpnd_field_dx(), find_first(), ARTS::Var::jacobian_do(), ARTS::Var::jacobian_quantities(), joker, ARTS::Var::lat_grid(), ARTS::Var::lon_grid(), max, min, Array< base >::nelem(), Absorption::nelem(), ARTS::Var::p_grid(), ARTS::Var::particle_bulkprop_field(), ARTS::Var::particle_bulkprop_names(), ARTS::Var::pnd_agenda_array(), ARTS::Var::pnd_agenda_array_input_names(), pnd_agenda_arrayExecute(), ARTS::Var::pnd_agenda_input(), ARTS::Var::pnd_agenda_input_t(), ARTS::Var::pnd_data(), ARTS::Var::pnd_field(), ARTS::Var::scat_data(), ARTS::Var::scat_meta(), ARTS::Var::scat_species(), SCATSPECIES_MAINTAG, and ARTS::Var::t_field().

Referenced by pnd_fieldCalcFromParticleBulkProps_g().

◆ pndFromPsd()

void pndFromPsd ( Matrix pnd_data,
Tensor3 dpnd_data_dx,
const Vector pnd_size_grid,
const Matrix psd_data,
const Vector psd_size_grid,
const Tensor3 dpsd_data_dx,
const ArrayOfArrayOfSingleScatteringData scat_data,
const Vector f_grid,
const Index scat_data_checked,
const Index quad_order,
const Index scat_index,
const Numeric threshold_se_ext,
const Numeric threshold_ss_ext,
const Numeric threshold_se_pnd,
const Verbosity verbosity 
)

WORKSPACE METHOD: pndFromPsd.

Calculates pnd_data from given psd_data for one scattering species.

Performs integration of the size distribution over the size grid bin deriving pnd (units #/m3) from psd (units #/m3/m). Some checks on the sufficiency of the size grid range and coverage are applied.

quad_order* can be 0 for rectangular or 1 for trapezoidal integration. The only difference is the treatment of the start and end nodes. For trapezoidal their corresponding bins end exactly at the nodes, while for rectangular they extend further out by the half distance to the neighbor node (but not beyond 0).

Attempts to check that the size grids and scat_data represent the bulk extinction sufficiently. Specifically, it is tested that <br> (a) psd*ext is decreasing at the small and large particle size <br> ends of the size grid - but only if scattering species bulk <br> extinction exceeds 1% of threshold_ss_ext. <br> (b) removing the smallest and largest particles changes the <br> resulting bulk extinction by less then a fraction of <br> threshold_se_ext - but only if scattering species bulk <br> extinction exceeds threshold_ss_ext and number density (pnd) <br> of the edge size point at this atmospheric level is larger <br> than threshold_se_pnd times the maximum pnd of this <br> scattering element over all atmospheric levels. Skipping tests in case of low extinction is done in order to minimize issues arising from very low mass densities, particularly at single atmospheric levels, and very low bulk extinctions, i.e. in cases where the effects on the radiance fields are estimated to be low. NOTE: The tests are only approximate and do not guarantee the validity of the resulting bulk properties (and increasing the thresholds will decrease the reliability of the bulk properties).

Author
Jana Mendrok, Patrick Eriksson
Parameters
[out]pnd_dataWS Output
[out]dpnd_data_dxWS Output
[in]pnd_size_gridWS Input
[in]psd_dataWS Input
[in]psd_size_gridWS Input
[in]dpsd_data_dxWS Input
[in]scat_dataWS Input
[in]f_gridWS Input
[in]scat_data_checkedWS Input
[in]quad_orderGeneric Input (Default: "1")
[in]scat_indexGeneric Input
[in]threshold_se_extGeneric Input (Default: "0.02")
[in]threshold_ss_extGeneric Input (Default: "1e-8")
[in]threshold_se_pndGeneric Input (Default: "0.02")

Definition at line 209 of file m_microphysics.cc.

References abs, bin_quadweights(), ARTS::Var::dpnd_data_dx(), ARTS::Var::dpsd_data_dx(), ARTS::Var::f_grid(), get_sorted_indexes(), is_increasing(), joker, max, Absorption::nelem(), ARTS::Var::pnd_data(), ARTS::Var::pnd_size_grid(), ARTS::Var::psd_data(), ARTS::Var::psd_size_grid(), ARTS::Var::scat_data(), and ARTS::Var::scat_data_checked().

Referenced by pndFromPsd_g().

◆ pndFromPsdBasic()

void pndFromPsdBasic ( Matrix pnd_data,
Tensor3 dpnd_data_dx,
const Vector pnd_size_grid,
const Matrix psd_data,
const Vector psd_size_grid,
const Tensor3 dpsd_data_dx,
const Index quad_order,
const Verbosity verbosity 
)

WORKSPACE METHOD: pndFromPsdBasic.

Calculates pnd_data from given psd_data.

As pndFromPsdBasic, but without bulk extinction representation checks.

Author
Jana Mendrok, Patrick Eriksson
Parameters
[out]pnd_dataWS Output
[out]dpnd_data_dxWS Output
[in]pnd_size_gridWS Input
[in]psd_dataWS Input
[in]psd_size_gridWS Input
[in]dpsd_data_dxWS Input
[in]quad_orderGeneric Input (Default: "1")

Definition at line 130 of file m_microphysics.cc.

References bin_quadweights(), ARTS::Var::dpnd_data_dx(), ARTS::Var::dpsd_data_dx(), get_sorted_indexes(), is_increasing(), ARTS::Var::pnd_data(), ARTS::Var::pnd_size_grid(), ARTS::Var::psd_data(), and ARTS::Var::psd_size_grid().

Referenced by pndFromPsdBasic_g().

◆ ScatSpeciesSizeMassInfo()

void ScatSpeciesSizeMassInfo ( Vector scat_species_x,
Numeric scat_species_a,
Numeric scat_species_b,
const ArrayOfArrayOfScatteringMetaData scat_meta,
const Index species_index,
const String x_unit,
const Numeric x_fit_start,
const Numeric x_fit_end,
const Index do_only_x,
const Verbosity verbosity 
)

WORKSPACE METHOD: ScatSpeciesSizeMassInfo.

Derives size and mass information for a scattering species. This method assumes that the mass-size relationship can described by scat_species_a and scat_species_b. See documentation of scat_species_a* for details.

The quantity to be used as size descriptor is here denoted as x, and is selected by setting x_unit. The options are: <br> "dveq" : The size grid is set to scat_meta.diameter_volume_equ <br> "dmax" : The size grid is set to scat_meta.diameter_max <br> "area" : The size grid is set to scat_meta.diameter_area_equ_aerodynamical <br> "mass" : The size grid is set to scat_meta.mass This selection determines scat_species_x.

The parameters scat_species_a and scat_species_b are determined by a numeric fit between scat_species_x and corresponding masses in scat_meta*. This fit is performed over sizes inside the range [x_fit_start,x_fit_end]. This range is allowed to be broader than the coverage of scat_species_x. There must be at least two sizes inside [x_fit_start,x_fit_end].

Author
Manfred Brath
Jana Mendrok
Patrick Eriksson
Parameters
[out]scat_species_xWS Output
[out]scat_species_aWS Output
[out]scat_species_bWS Output
[in]scat_metaWS Input
[in]species_indexGeneric Input
[in]x_unitGeneric Input
[in]x_fit_startGeneric Input (Default: "0")
[in]x_fit_endGeneric Input (Default: "1e9")
[in]do_only_xGeneric Input (Default: "0")

Definition at line 779 of file m_microphysics.cc.

References derive_scat_species_a_and_b(), ARTS::Var::scat_meta(), ARTS::Var::scat_species_a(), ARTS::Var::scat_species_b(), and ARTS::Var::scat_species_x().

Referenced by ScatSpeciesSizeMassInfo_g().

Variable Documentation

◆ SCATSPECIES_MAINTAG

const String SCATSPECIES_MAINTAG
extern