ARTS  2.2.66
montecarlo.h File Reference
#include <stdexcept>
#include <cmath>
#include "messages.h"
#include "arts.h"
#include "ppath.h"
#include "matpackI.h"
#include "special_interp.h"
#include "check_input.h"
#include "rte.h"
#include "lin_alg.h"
#include "logic.h"
#include "optproperties.h"
#include "physics_funcs.h"
#include "xml_io.h"
#include "rng.h"
#include "cloudbox.h"

Go to the source code of this file.

Functions

void clear_rt_vars_at_gp (Workspace &ws, MatrixView ext_mat_mono, VectorView abs_vec_mono, Numeric &temperature, const Agenda &propmat_clearsky_agenda, const Numeric &f_mono, const GridPos &gp_p, const GridPos &gp_lat, const GridPos &gp_lon, ConstVectorView p_grid, ConstTensor3View t_field, ConstTensor4View vmr_field)
 clear_rt_vars_at_gp More...
 
void cloudy_rt_vars_at_gp (Workspace &ws, MatrixView ext_mat_mono, VectorView abs_vec_mono, VectorView pnd_vec, Numeric &temperature, const Agenda &propmat_clearsky_agenda, const Index stokes_dim, const Numeric &f_mono, const GridPos &gp_p, const GridPos &gp_lat, const GridPos &gp_lon, ConstVectorView p_grid_cloud, ConstTensor3View t_field_cloud, ConstTensor4View vmr_field_cloud, const Tensor4 &pnd_field, const ArrayOfSingleScatteringData &scat_data_array_mono, const ArrayOfIndex &cloudbox_limits, const Vector &rte_los, const Verbosity &verbosity)
 cloudy_rt_vars_at_gp More...
 
void cloud_atm_vars_by_gp (VectorView pressure, VectorView temperature, MatrixView vmr, MatrixView pnd, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, const ArrayOfIndex &cloudbox_limits, ConstVectorView p_grid_cloud, ConstTensor3View t_field_cloud, ConstTensor4View vmr_field_cloud, ConstTensor4View pnd_field)
 cloud_atm_vars_by_gp More...
 
void findZ11max (Vector &Z11maxvector, const ArrayOfSingleScatteringData &scat_data_array_mono)
 findZ11max More...
 
bool is_anyptype30 (const ArrayOfSingleScatteringData &scat_data_array_mono)
 is_anyptype30 More...
 
void mcPathTraceGeneral (Workspace &ws, MatrixView evol_op, Vector &abs_vec_mono, Numeric &temperature, MatrixView ext_mat_mono, Rng &rng, Vector &rte_pos, Vector &rte_los, Vector &pnd_vec, Numeric &g, Ppath &ppath_step, Index &termination_flag, bool &inside_cloud, const Agenda &ppath_step_agenda, const Numeric &ppath_lraytrace, const Agenda &propmat_clearsky_agenda, const Index stokes_dim, const Numeric &f_mono, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Vector &refellipsoid, const Matrix &z_surface, const Tensor3 &t_field, const Tensor4 &vmr_field, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const ArrayOfSingleScatteringData &scat_data_array_mono, const Verbosity &verbosity)
 mcPathTraceGeneral More...
 
void opt_propCalc (MatrixView K, VectorView K_abs, const Numeric za, const Numeric aa, const ArrayOfSingleScatteringData &scat_data_array_mono, const Index stokes_dim, ConstVectorView pnd_vec, const Numeric rtp_temperature, const Verbosity &verbosity)
 opt_propCalc More...
 
void opt_propExtract (MatrixView K_spt, VectorView K_abs_spt, const SingleScatteringData &scat_data, const Numeric za, const Numeric aa, const Numeric rtp_temperature, const Index stokes_dim, const Verbosity &verbosity)
 
void pha_mat_singleCalc (MatrixView Z, const Numeric za_sca, const Numeric aa_sca, const Numeric za_inc, const Numeric aa_inc, const ArrayOfSingleScatteringData &scat_data_array_mono, const Index stokes_dim, ConstVectorView pnd_vec, const Numeric rtp_temperature, const Verbosity &verbosity)
 pha_mat_singleCalc More...
 
void pha_mat_singleExtract (MatrixView Z_spt, const SingleScatteringData &scat_data, const Numeric za_sca, const Numeric aa_sca, const Numeric za_inc, const Numeric aa_inc, const Numeric rtp_temperature, const Index stokes_dim, const Verbosity &verbosity)
 Extract the phase matrix from a monochromatic SingleScatteringData object. More...
 
void Sample_los (VectorView new_rte_los, Numeric &g_los_csc_theta, MatrixView Z, Rng &rng, ConstVectorView rte_los, const ArrayOfSingleScatteringData &scat_data_array_mono, const Index stokes_dim, ConstVectorView pnd_vec, const bool anyptype30, ConstVectorView Z11maxvector, const Numeric Csca, const Numeric rtp_temperature, const Verbosity &verbosity)
 Sample_los. More...
 

Variables

const Numeric DEG2RAD
 
const Numeric RAD2DEG
 
const Numeric PI
 

Function Documentation

◆ clear_rt_vars_at_gp()

void clear_rt_vars_at_gp ( Workspace ws,
MatrixView  ext_mat_mono,
VectorView  abs_vec_mono,
Numeric temperature,
const Agenda propmat_clearsky_agenda,
const Numeric f_mono,
const GridPos gp_p,
const GridPos gp_lat,
const GridPos gp_lon,
ConstVectorView  p_grid,
ConstTensor3View  t_field,
ConstTensor4View  vmr_field 
)

clear_rt_vars_at_gp

Calculates a bunch of atmospheric variables at the end of a ppath.

Author
Cory Davis
Date
2005-02-19?

Definition at line 56 of file montecarlo.cc.

References interp_atmfield_by_itw(), interp_atmfield_gp2itw(), interpweights(), itw2p(), joker, ConstTensor4View::nbooks(), ns, opt_prop_sum_propmat_clearsky(), and propmat_clearsky_agendaExecute().

Referenced by mcPathTraceGeneral(), and mcPathTraceIPA().

◆ cloud_atm_vars_by_gp()

void cloud_atm_vars_by_gp ( VectorView  pressure,
VectorView  temperature,
MatrixView  vmr,
MatrixView  pnd,
const ArrayOfGridPos gp_p,
const ArrayOfGridPos gp_lat,
const ArrayOfGridPos gp_lon,
const ArrayOfIndex cloudbox_limits,
ConstVectorView  p_grid_cloud,
ConstTensor3View  t_field_cloud,
ConstTensor4View  vmr_field_cloud,
ConstTensor4View  pnd_field 
)

cloud_atm_vars_by_gp

Returns pressure, temperature, VMRs and PNDs, at points corresponding to arrays of gridpositions gp_p, gp_lat, and gp_lon. The field and grid input variables all span only the cloudbox

Parameters
pressureOutput: a vector of pressures
temperatureOutput: a vector of temperatures
vmrOutput: a n_species by n matrix of VMRs
pndOutput: a n_ptypes by n matrix of VMRs
gp_pan array of pressre gridpoints
gp_latan array of latitude gridpoints
gp_lonan array of longitude gridpoints
cloudbox_limitsthe WSV
p_grid_cloudthe subset of the p_grid corresponding to the cloudbox
t_field_cloudthe t_field within the cloudbox
vmr_field_cloudthe t_field within the cloudbox
pnd_fieldThe WSV
Author
Cory Davis
Date
2005-06-07

Definition at line 243 of file montecarlo.cc.

References gridpos_upperend_check(), interp_atmfield_by_itw(), interp_atmfield_gp2itw(), interpweights(), itw2p(), joker, ConstTensor4View::nbooks(), Array< base >::nelem(), ConstVectorView::nelem(), and ns.

Referenced by cloudy_rt_vars_at_gp(), and iwp_cloud_opt_pathCalc().

◆ cloudy_rt_vars_at_gp()

void cloudy_rt_vars_at_gp ( Workspace ws,
MatrixView  ext_mat_mono,
VectorView  abs_vec_mono,
VectorView  pnd_vec,
Numeric temperature,
const Agenda propmat_clearsky_agenda,
const Index  stokes_dim,
const Numeric f_mono,
const GridPos gp_p,
const GridPos gp_lat,
const GridPos gp_lon,
ConstVectorView  p_grid_cloud,
ConstTensor3View  t_field_cloud,
ConstTensor4View  vmr_field_cloud,
const Tensor4 pnd_field,
const ArrayOfSingleScatteringData scat_data_array_mono,
const ArrayOfIndex cloudbox_limits,
const Vector rte_los,
const Verbosity verbosity 
)

cloudy_rt_vars_at_gp

Calculates a bunch of atmospheric variables at the end of a ppath.

Author
Cory Davis
Date
2005-02-19?

Definition at line 135 of file montecarlo.cc.

References cloud_atm_vars_by_gp(), joker, ConstTensor4View::nbooks(), ns, opt_prop_sum_propmat_clearsky(), opt_propCalc(), and propmat_clearsky_agendaExecute().

Referenced by mcPathTraceGeneral(), and mcPathTraceIPA().

◆ findZ11max()

void findZ11max ( Vector Z11maxvector,
const ArrayOfSingleScatteringData scat_data_array_mono 
)

findZ11max

The direction sampling method requires a bounding value for Z11. This returns a vector with the maximum value of Z11 for each particle type.

Parameters
[out]Z11maxvectorMaximum value of Z11 for each particle type
[in]scat_data_array_mono
Author
Cory Davis
Date
2004-31-1

Definition at line 337 of file montecarlo.cc.

References joker, max, Array< base >::nelem(), PARTICLE_TYPE_HORIZ_AL, PARTICLE_TYPE_MACROS_ISO, and Vector::resize().

Referenced by MCGeneral(), and MCIPA().

◆ is_anyptype30()

bool is_anyptype30 ( const ArrayOfSingleScatteringData scat_data_array_mono)

is_anyptype30

Some operations in Monte Carlo simulations are different depending on the particle type of the scattering particles. This function searches scat_data_array_mono to determine if any of the particle types have particle_type=30

Author
Cory Davis
Date
2004-1-31

Definition at line 373 of file montecarlo.cc.

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

Referenced by MCGeneral(), and MCIPA().

◆ mcPathTraceGeneral()

void mcPathTraceGeneral ( Workspace ws,
MatrixView  evol_op,
Vector abs_vec_mono,
Numeric temperature,
MatrixView  ext_mat_mono,
Rng rng,
Vector rte_pos,
Vector rte_los,
Vector pnd_vec,
Numeric g,
Ppath ppath_step,
Index termination_flag,
bool &  inside_cloud,
const Agenda ppath_step_agenda,
const Numeric ppath_lraytrace,
const Agenda propmat_clearsky_agenda,
const Index  stokes_dim,
const Numeric f_mono,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const Tensor3 z_field,
const Vector refellipsoid,
const Matrix z_surface,
const Tensor3 t_field,
const Tensor4 vmr_field,
const ArrayOfIndex cloudbox_limits,
const Tensor4 pnd_field,
const ArrayOfSingleScatteringData scat_data_array_mono,
const Verbosity verbosity 
)

mcPathTraceGeneral

Performs the tasks of pathlength sampling.

Ray tracing done (but now only as far as determined by pathlength sampling) and calculation of the evolution operator and several atmospheric variables at the new point.

The end point of the ray tracing is returned by ppath_step, where the point of concern has index ppath_step.np-1. However, a somehwat dirty trick is used here to avoid copying of data. Only ppath.np is adjusted, and ppath_step can contain additional points (that should not be used).

2012-11-15 Patrick Eriksson Revised. Added handling of ppath_step_agenda. Correct handling of ppath steps having more than two points.

Author
Cory Davis
Date
2005-2-21

Definition at line 1402 of file mc_NotUsed.cc.

References abs, clear_rt_vars_at_gp(), cloudy_rt_vars_at_gp(), CREATE_OUT0, Rng::draw(), ext2trans(), fractional_gp(), Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, gridpos(), id_mat(), interp(), interpweights(), is_diagonal(), is_gp_inside_cloudbox(), joker, Ppath::los, Ppath::lstep, matrix_exp_p30(), mult(), ConstVectorView::nelem(), Ppath::np, Ppath::pos, ppath_start_stepping(), ppath_step_agendaExecute(), and ppath_what_background().

◆ opt_propCalc()

void opt_propCalc ( MatrixView  ext_mat_mono,
VectorView  abs_vec_mono,
const Numeric  za,
const Numeric  aa,
const ArrayOfSingleScatteringData scat_data_array_mono,
const Index  stokes_dim,
ConstVectorView  pnd_vec,
const Numeric  rtp_temperature,
const Verbosity verbosity 
)

opt_propCalc

Returns the extinction matrix and absorption vector due to scattering particles from scat_data_array_mono

Parameters
ext_mat_monoOutput: extinction matrix
abs_vec_monoOutput: absorption coefficient vector
zazenith angle of propagation direction
aaazimuthal angle of propagation
scat_data_array_monoworkspace variable
stokes_dimworkspace variable
pnd_vecvector pf particle number densities (one element per particle type)
rtp_temperatureloacl temperature (workspace variable)
Author
Cory Davis
Date
2004-7-16

Definition at line 684 of file montecarlo.cc.

References ConstMatrixView::ncols(), Array< base >::nelem(), ConstVectorView::nelem(), ConstMatrixView::nrows(), and opt_propExtract().

Referenced by cloudy_rt_vars_at_gp(), get_ppath_ext(), and iwp_cloud_opt_pathCalc().

◆ opt_propExtract()

◆ pha_mat_singleCalc()

void pha_mat_singleCalc ( MatrixView  Z,
const Numeric  za_sca,
const Numeric  aa_sca,
const Numeric  za_inc,
const Numeric  aa_inc,
const ArrayOfSingleScatteringData scat_data_array_mono,
const Index  stokes_dim,
ConstVectorView  pnd_vec,
const Numeric  rtp_temperature,
const Verbosity verbosity 
)

pha_mat_singleCalc

Returns the total phase matrix for given incident and scattered directions . It requires a vector of particle number densities to be precalculated

Parameters
[out]ZOutput: phase matrix
[in]za_scascattered
[in]aa_scaand
[in]za_incincident
[in]aa_incdirections
[in]scat_data_array_monoworkspace variable
[in]stokes_dimworkspace variable
[in]pnd_vecvector of particle number densities at the point in question
[in]rtp_temperatureworkspace variable
Author
Cory Davis
Date
2003-11-27

Definition at line 928 of file montecarlo.cc.

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

Referenced by fos(), iyCloudRadar(), pha_matExtractManually(), and Sample_los().

◆ pha_mat_singleExtract()

void pha_mat_singleExtract ( MatrixView  Z_spt,
const SingleScatteringData scat_data,
const Numeric  za_sca,
const Numeric  aa_sca,
const Numeric  za_inc,
const Numeric  aa_inc,
const Numeric  rtp_temperature,
const Index  stokes_dim,
const Verbosity verbosity 
)

Extract the phase matrix from a monochromatic SingleScatteringData object.

Given a monochromatic SingleScatteringData object, incident and scattered directions, and the temperature, this function returns the phase matrix in the laboratory frame

Parameters
[out]Z_sptthe phase matrix
[in]scat_dataa monochromatic SingleScatteringData object
[in]za_sca
[in]aa_sca
[in]za_inc
[in]aa_inc
[in]rtp_temperature
[in]stokes_dim
Author
Cory Davis
Date
2004-07-16

Definition at line 981 of file montecarlo.cc.

References SingleScatteringData::aa_grid, abs, CREATE_OUT0, gridpos(), interp(), interp_scat_angle_temperature(), interpweights(), joker, ConstTensor7View::ncols(), ConstVectorView::nelem(), SingleScatteringData::particle_type, PARTICLE_TYPE_GENERAL, PARTICLE_TYPE_HORIZ_AL, PARTICLE_TYPE_MACROS_ISO, SingleScatteringData::pha_mat_data, pha_mat_labCalc(), SingleScatteringData::T_grid, and SingleScatteringData::za_grid.

Referenced by pha_mat_singleCalc().

◆ Sample_los()

void Sample_los ( VectorView  new_rte_los,
Numeric g_los_csc_theta,
MatrixView  Z,
Rng rng,
ConstVectorView  rte_los,
const ArrayOfSingleScatteringData scat_data_array_mono,
const Index  stokes_dim,
ConstVectorView  pnd_vec,
const bool  anyptype30,
ConstVectorView  Z11maxvector,
const Numeric  Csca,
const Numeric  rtp_temperature,
const Verbosity verbosity 
)

Sample_los.

FIXME: 2011-06-17 Documentation removed by Gerrit (severely out of date)

Parameters
[out]new_rte_losincident line of sight for subsequent
[out]g_los_csc_thetaprobability density for the chosen direction multiplied by sin(za)
[out]Z
[in,out]rngRng random number generator instance
[in]rte_losincident line of sight for subsequent ray-tracing.
[in]scat_data_array_mono
[in]stokes_dim
[in]pnd_vec
[in]anyptype30
[in]Z11maxvector
[in]Csca
[in]rtp_temperature
Author
Cory Davis
Date
2003-06-19

Definition at line 1187 of file montecarlo.cc.

References Rng::draw(), Array< base >::nelem(), ConstVectorView::nelem(), pha_mat_singleCalc(), and RAD2DEG.

Referenced by MCGeneral(), and MCIPA().

Variable Documentation

◆ DEG2RAD

const Numeric DEG2RAD
extern

◆ PI

const Numeric PI
extern

◆ RAD2DEG

const Numeric RAD2DEG
extern