ARTS  2.0.49
cloudbox.cc File Reference

Internal functions for scattering calculations. More...

#include "cloudbox.h"
#include <stdexcept>
#include <cmath>
#include "arts.h"
#include "messages.h"
#include "make_vector.h"
#include "logic.h"
#include "ppath.h"
#include "physics_funcs.h"
#include "math_funcs.h"
#include "check_input.h"

Go to the source code of this file.

Functions

void chk_massdensity_field (bool &empty_flag, const Index &dim, const Tensor3 &massdensity, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid)
 Check whether hydromet grid size is equal to atmospheric grid size and if hydromet profile is zero (no cloud) in each grid point. More...
 
void chk_if_pnd_zero_p (const Index &i_p, const GriddedField3 &pnd_field_raw, const String &pnd_field_file, const Verbosity &verbosity)
 Check whether particle number density is zero at a specified pressure level. More...
 
void chk_if_pnd_zero_lat (const Index &i_lat, const GriddedField3 &pnd_field_raw, const String &pnd_field_file, const Verbosity &verbosity)
 Check whether particle number density is zero at a specified latitude. More...
 
void chk_if_pnd_zero_lon (const Index &i_lon, const GriddedField3 &pnd_field_raw, const String &pnd_field_file, const Verbosity &verbosity)
 Check whether particle number density is zero at a specified longitude. More...
 
void chk_pnd_data (const GriddedField3 &pnd_field_raw, const String &pnd_field_file, const Index &atmosphere_dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, const ArrayOfIndex &cloudbox_limits, const Verbosity &verbosity)
 Check particle number density files. More...
 
void chk_pnd_raw_data (const ArrayOfGriddedField3 &pnd_field_raw, const String &pnd_field_file, const Index &atmosphere_dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, const ArrayOfIndex &cloudbox_limits, const Verbosity &verbosity)
 Check particle number density files (pnd_field_raw) More...
 
void chk_scattering_data (const ArrayOfSingleScatteringData &scat_data_raw, const ArrayOfScatteringMetaData &scat_data_meta_array, const Verbosity &)
 Check scattering data general. More...
 
void chk_scattering_meta_data (const ScatteringMetaData &scat_data_meta, const String &scat_data_meta_file, const Verbosity &verbosity)
 Check scattering data meta files. More...
 
void chk_single_scattering_data (const SingleScatteringData &scat_data_raw, const String &scat_data_file, ConstVectorView f_grid, const Verbosity &verbosity)
 Check single scattering data files. More...
 
bool is_gp_inside_cloudbox (const GridPos &gp_p, const GridPos &gp_lat, const GridPos &gp_lon, const ArrayOfIndex &cloudbox_limits, const bool include_boundaries)
 
bool is_inside_cloudbox (const Ppath &ppath_step, const ArrayOfIndex &cloudbox_limits, const bool include_boundaries)
 
Numeric barometric_heightformula (const Numeric &p, const Numeric &dh)
 
Numeric IWCtopnd_MH97 (const Numeric iwc, const Numeric dm, const Numeric t, const Numeric density)
 
Numeric psd_H11 (const Numeric xwc, const Numeric d, const Numeric t)
 
Numeric LWCtopnd (const Numeric lwc, const Numeric r)
 
Numeric LWCtopnd2 (const Numeric r)
 
void scale_pnd (Vector &w, const Vector &x, const Vector &y)
 
void chk_pndsum (Vector &pnd, const Numeric xwc, const Vector &vol, const Vector &density, const Index &p, const Index &lat, const Index &lon, const Verbosity &verbosity)
 
void scale_H11 (Vector &pnd, const Numeric xwc, const Vector &density, const Vector &vol)
 
void parse_part_type (String &part_type, const String &part_string)
 
void parse_psd_param (String &psd_param, const String &part_string)
 
void parse_part_size (Numeric &sizemin, Numeric &sizemax, const String &part_string)
 

Variables

const Index GFIELD3_P_GRID
 
const Index GFIELD3_LAT_GRID
 
const Index GFIELD3_LON_GRID
 
const Numeric PI
 

Detailed Description

Internal functions for scattering calculations.

Author
Claudia Emde claud.nosp@m.ia.e.nosp@m.mde@d.nosp@m.lr.d.nosp@m.e
Date
Thu May 23 10:59:55 2002

Definition in file cloudbox.cc.

Function Documentation

◆ barometric_heightformula()

Numeric barometric_heightformula ( const Numeric p,
const Numeric dh 
)

barometric heightformula for isothermal earth atmosphere

Returns
p1 pressure in displacement level [Pa]
Parameters
patmospheric pressure at starting level [Pa]
dhvertical displacement to starting pressure level [m]
Author
Daniel Kreyling
Date
2011-01-20

Definition at line 786 of file cloudbox.cc.

References M.

Referenced by cloudboxSetAutomatically().

◆ chk_if_pnd_zero_lat()

void chk_if_pnd_zero_lat ( const Index i_lat,
const GriddedField3 pnd_field_raw,
const String pnd_field_file,
const Verbosity verbosity 
)

Check whether particle number density is zero at a specified latitude.

Parameters
i_latLatitude index
pnd_field_rawParticle number density data
pnd_field_filepnd field filename
Author
Claudia Emde
Date
2005-05-09

Definition at line 181 of file cloudbox.cc.

References CREATE_OUT1, GriddedField3::data, GriddedField::get_numeric_grid(), GFIELD3_LAT_GRID, GFIELD3_LON_GRID, GFIELD3_P_GRID, and ConstVectorView::nelem().

Referenced by chk_pnd_data().

◆ chk_if_pnd_zero_lon()

void chk_if_pnd_zero_lon ( const Index i_lon,
const GriddedField3 pnd_field_raw,
const String pnd_field_file,
const Verbosity verbosity 
)

Check whether particle number density is zero at a specified longitude.

Parameters
i_lonLatitude index
pnd_field_rawParticle number density data
pnd_field_filepnd field filename
Author
Claudia Emde
Date
2005-05-09

Definition at line 227 of file cloudbox.cc.

References CREATE_OUT1, GriddedField3::data, GriddedField::get_numeric_grid(), GFIELD3_LAT_GRID, GFIELD3_LON_GRID, GFIELD3_P_GRID, and ConstVectorView::nelem().

Referenced by chk_pnd_data().

◆ chk_if_pnd_zero_p()

void chk_if_pnd_zero_p ( const Index i_p,
const GriddedField3 pnd_field_raw,
const String pnd_field_file,
const Verbosity verbosity 
)

Check whether particle number density is zero at a specified pressure level.

Parameters
i_pPressure index
pnd_field_rawParticle number density data
pnd_field_filepnd field filename
Author
Claudia Emde
Date
2005-05-09

Definition at line 135 of file cloudbox.cc.

References CREATE_OUT1, GriddedField3::data, GriddedField::get_numeric_grid(), GFIELD3_LAT_GRID, GFIELD3_LON_GRID, GFIELD3_P_GRID, and ConstVectorView::nelem().

Referenced by chk_pnd_data().

◆ chk_massdensity_field()

void chk_massdensity_field ( bool &  empty_flag,
const Index dim,
const Tensor3 massdensity,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid 
)

Check whether hydromet grid size is equal to atmospheric grid size and if hydromet profile is zero (no cloud) in each grid point.

Parameters
dimatmosphere dimension
hydromethydrometeor grid in p, lat or lon dimension
p_gridp grid of current atmosphere
lat_gridlat grid of current atmosphere
lon_gridlon grid of current atmosphere
Author
Daniel Kreyling
Date
2011-01-27

Definition at line 62 of file cloudbox.cc.

References ConstTensor3View::ncols(), ConstVectorView::nelem(), ConstTensor3View::npages(), and ConstTensor3View::nrows().

Referenced by cloudboxSetAutomatically().

◆ chk_pnd_data()

void chk_pnd_data ( const GriddedField3 pnd_field_raw,
const String pnd_field_file,
const Index atmosphere_dim,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
const ArrayOfIndex cloudbox_limits,
const Verbosity verbosity 
)

Check particle number density files.

This function checks, whether the particle number density file has the right atmospheric dimension and whether the cloudbox includes all points where the particle number density is non-zero.

Parameters
pnd_field_rawpnd field data
pnd_field_filepnd field filename
atmosphere_dimAtmospheric dimension
p_gridPressure grid
lat_gridLatitude grid
lon_gridLongitude grid
cloudbox_limitsCloudbox limits
Author
Claudia Emde
Date
2005-04-05

Definition at line 283 of file cloudbox.cc.

References chk_if_pnd_zero_lat(), chk_if_pnd_zero_lon(), chk_if_pnd_zero_p(), CREATE_OUT3, GriddedField::get_numeric_grid(), GFIELD3_LAT_GRID, GFIELD3_LON_GRID, GFIELD3_P_GRID, and ConstVectorView::nelem().

Referenced by chk_pnd_raw_data(), and ParticleTypeAdd().

◆ chk_pnd_raw_data()

void chk_pnd_raw_data ( const ArrayOfGriddedField3 pnd_field_raw,
const String pnd_field_file,
const Index atmosphere_dim,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
const ArrayOfIndex cloudbox_limits,
const Verbosity verbosity 
)

Check particle number density files (pnd_field_raw)

Parameters
pnd_field_rawpnd field raw data (array for all particle types)
pnd_field_filepnd field filename
atmosphere_dimAtmospheric dimension
p_gridPressure grid
lat_gridLatitude grid
lon_gridLongitude grid
cloudbox_limitsCloudbox limits
Author
Claudia Emde
Date
2005-04-05

Definition at line 394 of file cloudbox.cc.

References chk_pnd_data(), CREATE_OUT3, and Array< base >::nelem().

Referenced by ParticleTypeAddAll().

◆ chk_pndsum()

void chk_pndsum ( Vector pnd,
const Numeric  xwc,
const Vector vol,
const Vector density,
const Index p,
const Index lat,
const Index lon,
const Verbosity verbosity 
)

Check sum of pnd vector against total mass density value. Deviation is calculated and used to adjust the output of vector pnd.

\param pnd particle number density [g/m3]
\param xwc atmospheric massdensity [g/m3]
\param density scattering particle density [g/m3]
\param vol scattering particle volume [m3]
Author
Daniel Kreyling
Date
2010-12-15

Definition at line 1080 of file cloudbox.cc.

References CREATE_OUT1, CREATE_OUT2, and ConstVectorView::nelem().

Referenced by pnd_fieldSetup().

◆ chk_scattering_data()

void chk_scattering_data ( const ArrayOfSingleScatteringData scat_data_raw,
const ArrayOfScatteringMetaData scat_data_meta_array,
const Verbosity  
)

Check scattering data general.

FIXME

Parameters
scat_data_rawArray of single scattering data
scat_data_meta_arrayArray of scattering meta data
Author
Daniel Kreyling
Date
2010-12-02

Definition at line 427 of file cloudbox.cc.

References Array< base >::nelem().

Referenced by ScatteringParticleTypeAndMetaRead().

◆ chk_scattering_meta_data()

void chk_scattering_meta_data ( const ScatteringMetaData scat_data_meta,
const String scat_data_meta_file,
const Verbosity verbosity 
)

Check scattering data meta files.

FIXME

Parameters
scat_data_metascattering meta data
scat_data_meta_filefilename of the data to be checked
Author
Daniel Kreyling
Date
2010-12-02

Definition at line 454 of file cloudbox.cc.

References CREATE_OUT2, and ScatteringMetaData::type.

Referenced by ScatteringParticleTypeAndMetaRead().

◆ chk_single_scattering_data()

void chk_single_scattering_data ( const SingleScatteringData scat_data_raw,
const String scat_data_file,
ConstVectorView  f_grid,
const Verbosity verbosity 
)

Check single scattering data files.

This function checks, whether a datafile containing the single scattering properties of a particle type includes the required frequencies and temperatures and whether the angular grids are defined correctly. Furthermore it checks the self consistency of the data by checking the dimensions of pha_mat, ext_mat and abs_vec depening on the ptype case.

Parameters
scat_data_rawSingle scattering data
scat_data_fileFilename of the data to be checked.
f_gridFrequency grid
Author
Claudia Emde
Date
2005-04-04

Definition at line 486 of file cloudbox.cc.

References SingleScatteringData::aa_grid, SingleScatteringData::abs_vec_data, chk_interpolation_grids(), chk_size(), CREATE_OUT2, SingleScatteringData::ext_mat_data, SingleScatteringData::f_grid, last(), ConstVectorView::nelem(), PARTICLE_TYPE_GENERAL, PARTICLE_TYPE_HORIZ_AL, PARTICLE_TYPE_MACROS_ISO, PARTICLE_TYPE_SPHERICAL, SingleScatteringData::pha_mat_data, SingleScatteringData::ptype, SingleScatteringData::T_grid, and SingleScatteringData::za_grid.

Referenced by ParticleTypeAdd(), ParticleTypeAddAll(), and ScatteringParticleTypeAndMetaRead().

◆ is_gp_inside_cloudbox()

bool is_gp_inside_cloudbox ( const GridPos gp_p,
const GridPos gp_lat,
const GridPos gp_lon,
const ArrayOfIndex cloudbox_limits,
const bool  include_boundaries 
)

Checks, whether a gridpoint is inside the cloudbox.

Returns
true is returned if the point is inside the cloudbox.
Parameters
gp_ppressure GridPos
gp_latlatitude GridPos
gp_lonlongitude GridPos
cloudbox_limitsThe limits of the cloudbox.
include_boundariesboolean: determines whther or not points on the boundary are considered to be inside the cloudbox.
Author
Claudia Emde (rewritten by Cory Davis 2005-07-03)
Date
2003-06-06

Definition at line 689 of file cloudbox.cc.

References fractional_gp().

Referenced by is_inside_cloudbox(), and mcPathTraceIPA().

◆ is_inside_cloudbox()

bool is_inside_cloudbox ( const Ppath ppath_step,
const ArrayOfIndex cloudbox_limits,
const bool  include_boundaries 
)

Checks, whether the last point of a propagation path is inside the cloudbox.

Returns
true is returned if the point is inside the cloudbox.
Parameters
ppath_stepPropagation path step.
cloudbox_limitsThe limits of the cloudbox.
include_boundariesboolean: determines whther or not points on the boundary are considered to be inside the cloudbox.
Author
Claudia Emde (rewritten by Cory Davis 2005-07-03)
Date
2003-06-06

Definition at line 764 of file cloudbox.cc.

References Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, is_gp_inside_cloudbox(), and Ppath::np.

Referenced by cloud_ppath_update3D(), mcPathTraceGeneral(), and mcPathTraceIPA().

◆ IWCtopnd_MH97()

Numeric IWCtopnd_MH97 ( const Numeric  iwc,
const Numeric  dm,
const Numeric  t,
const Numeric  density 
)

Calculates particle size distribution using MH97 parametrization. Each diameter of the scattering particles is a node in the ditribution. One call of this function, calculates one particle number density.

Returns
dN particle number density per diameter interval [#/m3*m]
Parameters
iwcatmospheric ice water content [g/m3]
dmmelted diameter of scattering particle [m]
tatmospheric temperature [K]
densityof the scattering particle [g/m3]
Author
Daniel Kreyling
Date
2010-12-06

Definition at line 828 of file cloudbox.cc.

References gamma_func(), min, and PI.

Referenced by pnd_fieldSetup().

◆ LWCtopnd()

Numeric LWCtopnd ( const Numeric  lwc,
const Numeric  r 
)

Calculates particle size distribution for liquid particles using gamma parametrization. Each radius of the scattering particles is a node in the ditribution. One call of this function, calculates one particle number density.

\return n particle number density per radius interval [#/m3*m]

\param lwc atmospheric liquid water content [g/m3]
\param r radius of scattering particle [m]
Author
Daniel Kreyling
Date
2010-12-16

Definition at line 983 of file cloudbox.cc.

References gamma_func(), and PI.

Referenced by pnd_fieldSetup().

◆ LWCtopnd2()

Numeric LWCtopnd2 ( const Numeric  r)

Definition at line 1008 of file cloudbox.cc.

References gamma_func().

◆ parse_part_size()

void parse_part_size ( Numeric sizemin,
Numeric sizemax,
const String part_string 
)

Splitting part_species string and parse min and max particle radius

Parameters
sizeminmin scattering particle radius
sizemaxmax scattering particle radius
part_stringcontaining infos about scattering particle calculations
Author
Daniel Kreyling
Date
2011-02-21

Definition at line 1270 of file cloudbox.cc.

References Array< base >::nelem(), and my_basic_string< charT >::split().

Referenced by ScatteringParticlesSelect().

◆ parse_part_type()

void parse_part_type ( String part_type,
const String part_string 
)

Splitting part_species string and parse type of massdensity_field

\param  part_type type of atmospheric scattering particle profile 
\param  part_string containing infos about scattering particle calculations
Author
Daniel Kreyling
Date
2011-02-21

Definition at line 1205 of file cloudbox.cc.

References my_basic_string< charT >::split().

Referenced by cloudboxSetAutomatically(), pnd_fieldSetup(), and ScatteringParticlesSelect().

◆ parse_psd_param()

void parse_psd_param ( String psd_param,
const String part_string 
)

Splitting part_species string and parse psd_param

Parameters
psd_paramparticle size distribution parametrization
part_stringcontaining infos about scattering particle calculations
Author
Daniel Kreyling
Date
2011-02-21

Definition at line 1240 of file cloudbox.cc.

References my_basic_string< charT >::split().

Referenced by pnd_fieldSetup().

◆ psd_H11()

Numeric psd_H11 ( const Numeric  xwc,
const Numeric  d,
const Numeric  t 
)

Calculates particle size distribution using H11 parametrization. Each diameter of the scattering particles is a node in the ditribution. One call of this function, calculates one particle number density.

Returns
dN particle number density per diameter interval [#/m3*m]
Parameters
dmaximum diameter of scattering particle [m]
tatmospheric temperature [K]
Author
Daniel Kreyling
Date
2011-10-28

Definition at line 927 of file cloudbox.cc.

Referenced by pnd_fieldSetup().

◆ scale_H11()

void scale_H11 ( Vector pnd,
const Numeric  xwc,
const Vector density,
const Vector vol 
)

The H11 PSD is scaled to the initial 'ice' or 'snow' massdensity, after the distribution has been evaluated. This function applies the scaling.

  \param xwc atmospheric massdensity [g/m3]
\param density scattering particle density [g/m3]
\param vol scattering particle volume [m3]
Author
Daniel Kreyling
Date
2011-10-31

Definition at line 1158 of file cloudbox.cc.

References ConstVectorView::nelem(), and ConstVectorView::sum().

Referenced by pnd_fieldSetup().

◆ scale_pnd()

void scale_pnd ( Vector w,
const Vector x,
const Vector y 
)

Scaling pnd values by width of size bin. Bin width is detemined from preceding and following particle size. Vector y and x must be equal in size. Vector w holds the weights. Derived from trapezoid integration rule.

Parameters
wweights
xe.g. particle radius [m]
ye.g. particle number density per radies interval [#/m3*m]
Author
Daniel Kreyling
Date
2010-12-15

Definition at line 1040 of file cloudbox.cc.

References ConstVectorView::nelem().

Referenced by pnd_fieldSetup().

Variable Documentation

◆ GFIELD3_LAT_GRID

const Index GFIELD3_LAT_GRID
extern

◆ GFIELD3_LON_GRID

const Index GFIELD3_LON_GRID
extern

◆ GFIELD3_P_GRID

const Index GFIELD3_P_GRID
extern

◆ PI