#include "messages.h"
#include "arts.h"
#include "ppath.h"
#include "matpackI.h"
#include "special_interp.h"
#include "check_input.h"
#include <stdexcept>
#include <cmath>
#include "rte.h"
#include "lin_alg.h"
#include "auto_md.h"
#include "logic.h"
#include "physics_funcs.h"
#include "xml_io.h"
#include "montecarlo.h"
#include "rng.h"
#include <ctime>
#include <fstream>
#include "mc_interp.h"
#include "math_funcs.h"
Go to the source code of this file.
Functions | |
void | mc_IWP_cloud_opt_pathCalc (Workspace &ws, Numeric &mc_IWP, Numeric &mc_cloud_opt_path, Numeric &mc_IWP_error, Numeric &mc_cloud_opt_path_error, Index &mc_iteration_count, const MCAntenna &mc_antenna, const Matrix &sensor_pos, const Matrix &sensor_los, const Agenda &ppath_step_agenda, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Matrix &r_geoid, const Matrix &z_surface, const Tensor3 &z_field, const Tensor3 &t_field, const Tensor4 &vmr_field, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const ArrayOfSingleScatteringData &scat_data_mono, const Vector &particle_masses, const Index &mc_seed, const Index &max_iter) |
WORKSPACE METHOD: mc_IWP_cloud_opt_pathCalc. | |
void | mc_antennaSetGaussian (MCAntenna &mc_antenna, const Numeric &za_sigma, const Numeric &aa_sigma) |
WORKSPACE METHOD: mc_antennaSetGaussian. | |
void | mc_antennaSetGaussianByFWHM (MCAntenna &mc_antenna, const Numeric &za_fwhm, const Numeric &aa_fwhm) |
WORKSPACE METHOD: mc_antennaSetGaussianByFWHM. | |
void | mc_antennaSetPencilBeam (MCAntenna &mc_antenna) |
WORKSPACE METHOD: mc_antennaSetPencilBeam. | |
void | MCGeneral (Workspace &ws, Vector &y, Index &mc_iteration_count, Vector &mc_error, Tensor3 &mc_points, const MCAntenna &mc_antenna, const Vector &f_grid, const Index &f_index, const Matrix &sensor_pos, const Matrix &sensor_los, const Index &stokes_dim, const Agenda &iy_space_agenda, const Agenda &surface_prop_agenda, const Agenda &opt_prop_gas_agenda, const Agenda &abs_scalar_gas_agenda, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Matrix &r_geoid, const Matrix &z_surface, const Tensor3 &t_field, const Tensor4 &vmr_field, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const ArrayOfSingleScatteringData &scat_data_mono, const Index &mc_seed, const String &y_unit, const Numeric &std_err, const Index &max_time, const Index &max_iter, const Index &z_field_is_1D) |
WORKSPACE METHOD: MCGeneral. | |
void | MCIPA (Workspace &ws, Vector &y, Index &mc_iteration_count, Vector &mc_error, Tensor3 &mc_points, const MCAntenna &mc_antenna, const Vector &f_grid, const Index &f_index, const Matrix &sensor_pos, const Matrix &sensor_los, const Index &stokes_dim, const Agenda &iy_space_agenda, const Agenda &surface_prop_agenda, const Agenda &opt_prop_gas_agenda, const Agenda &abs_scalar_gas_agenda, const Agenda &ppath_step_agenda, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Matrix &r_geoid, const Matrix &z_surface, const Tensor3 &t_field, const Tensor4 &vmr_field, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const ArrayOfSingleScatteringData &scat_data_mono, const Index &mc_seed, const String &y_unit, const Numeric &std_err, const Index &max_time, const Index &max_iter, const Index &z_field_is_1D) |
WORKSPACE METHOD: MCIPA. | |
void | MCSetIncomingEmpty (SLIData2 &mc_incoming) |
void | MCSetSeedFromTime (Index &mc_seed) |
WORKSPACE METHOD: MCSetSeedFromTime. | |
void | ScatteringMonteCarlo (Workspace &ws, Ppath &ppath, Ppath &ppath_step, Vector &mc_error, Index &mc_iteration_count, Vector &rte_pos, Vector &rte_los, Matrix &iy, Numeric &rte_pressure, Numeric &rte_temperature, Vector &rte_vmr_list, Tensor3 &ext_mat, Matrix &abs_vec, const Agenda &ppath_step_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Matrix &r_geoid, const Matrix &z_surface, const ArrayOfIndex &cloudbox_limits, const Index &stokes_dim, const Agenda &rte_agenda, const Agenda &iy_space_agenda, const Agenda &surface_prop_agenda, const Tensor3 &t_field, const Vector &f_grid, const Agenda &opt_prop_gas_agenda, const Agenda &abs_scalar_gas_agenda, const Tensor4 &vmr_field, const ArrayOfSingleScatteringData &scat_data_mono, const Tensor4 &pnd_field, const Index &mc_seed, const Index &f_index, const SLIData2 &mc_incoming, const Numeric &std_err, const Index &max_time, const Index &max_iter, const Index &incoming_lookup, const Index &z_field_is_1D) |
void | rte_posShift (Vector &rte_pos, Vector &rte_los, GridPos &rte_gp_p, GridPos &rte_gp_lat, GridPos &rte_gp_lon, const Ppath &ppath, const Index &atmosphere_dim) |
WORKSPACE METHOD: rte_posShift. | |
Variables | |
const Numeric | DEG2RAD |
const Numeric | RAD2DEG |
const Numeric | PI |
const Numeric | BOLTZMAN_CONST |
const Numeric | SPEED_OF_LIGHT |
Definition in file m_montecarlo.cc.
void mc_antennaSetGaussian | ( | MCAntenna & | mc_antenna, | |
const Numeric & | za_sigma, | |||
const Numeric & | aa_sigma | |||
) |
WORKSPACE METHOD: mc_antennaSetGaussian.
Makes mc_antenna (used by MCGeneral) a 2D Gaussian pattern.
The gaussian antenna pattern is determined by the keyword parameters za_sigma, and aa_sigma, which represent the standard deviations in the uncorrelated bivariate normal distribution
[out] | mc_antenna | WS Output |
[in] | za_sigma | Generic Input |
[in] | aa_sigma | Generic Input |
Definition at line 154 of file m_montecarlo.cc.
References MCAntenna::set_gaussian().
Referenced by mc_antennaSetGaussian_g().
void mc_antennaSetGaussianByFWHM | ( | MCAntenna & | mc_antenna, | |
const Numeric & | za_fwhm, | |||
const Numeric & | aa_fwhm | |||
) |
WORKSPACE METHOD: mc_antennaSetGaussianByFWHM.
Makes mc_antenna (used by MCGeneral) a 2D Gaussian pattern.
The gaussian antenna pattern is determined by the keyword parameters za_fwhm, and aa_fwhm, which represent the full width half maximum (FWHM) of the antenna response, in the zenith and azimuthal planes.
[out] | mc_antenna | WS Output |
[in] | za_fwhm | Generic Input |
[in] | aa_fwhm | Generic Input |
Definition at line 166 of file m_montecarlo.cc.
References MCAntenna::set_gaussian_fwhm().
Referenced by mc_antennaSetGaussianByFWHM_g().
void mc_antennaSetPencilBeam | ( | MCAntenna & | mc_antenna | ) |
WORKSPACE METHOD: mc_antennaSetPencilBeam.
Makes mc_antenna (used by MCGeneral) a pencil beam.
This WSM makes the subsequent MCGeneral WSM perform pencil beam RT calculations.
[out] | mc_antenna | WS Output |
Definition at line 178 of file m_montecarlo.cc.
References MCAntenna::set_pencil_beam().
Referenced by mc_antennaSetPencilBeam_g().
void mc_IWP_cloud_opt_pathCalc | ( | Workspace & | ws, | |
Numeric & | mc_IWP, | |||
Numeric & | mc_cloud_opt_path, | |||
Numeric & | mc_IWP_error, | |||
Numeric & | mc_cloud_opt_path_error, | |||
Index & | mc_iteration_count, | |||
const MCAntenna & | mc_antenna, | |||
const Matrix & | sensor_pos, | |||
const Matrix & | sensor_los, | |||
const Agenda & | ppath_step_agenda, | |||
const Vector & | p_grid, | |||
const Vector & | lat_grid, | |||
const Vector & | lon_grid, | |||
const Matrix & | r_geoid, | |||
const Matrix & | z_surface, | |||
const Tensor3 & | z_field, | |||
const Tensor3 & | t_field, | |||
const Tensor4 & | vmr_field, | |||
const ArrayOfIndex & | cloudbox_limits, | |||
const Tensor4 & | pnd_field, | |||
const ArrayOfSingleScatteringData & | scat_data_mono, | |||
const Vector & | particle_masses, | |||
const Index & | mc_seed, | |||
const Index & | max_iter | |||
) |
WORKSPACE METHOD: mc_IWP_cloud_opt_pathCalc.
Calculates the FOV averaged ice water path and cloud optical path for a given viewing direction
[in,out] | ws | Workspace |
[out] | mc_IWP | WS Output |
[out] | mc_cloud_opt_path | WS Output |
[out] | mc_IWP_error | WS Output |
[out] | mc_cloud_opt_path_error | WS Output |
[out] | mc_iteration_count | WS Output |
[in] | mc_antenna | WS Input |
[in] | sensor_pos | WS Input |
[in] | sensor_los | WS Input |
[in] | ppath_step_agenda | WS Input |
[in] | p_grid | WS Input |
[in] | lat_grid | WS Input |
[in] | lon_grid | WS Input |
[in] | r_geoid | WS Input |
[in] | z_surface | WS Input |
[in] | z_field | WS Input |
[in] | t_field | WS Input |
[in] | vmr_field | WS Input |
[in] | cloudbox_limits | WS Input |
[in] | pnd_field | WS Input |
[in] | scat_data_mono | WS Input |
[in] | particle_masses | WS Input |
[in] | mc_seed | WS Input |
[in] | max_iter | Generic Input |
Definition at line 73 of file m_montecarlo.cc.
References ATYPE_PENCIL_BEAM, MCAntenna::draw_los(), MCAntenna::get_type(), iwp_cloud_opt_pathCalc(), joker, and Rng::seed().
Referenced by mc_IWP_cloud_opt_pathCalc_g().
void MCGeneral | ( | Workspace & | ws, | |
Vector & | y, | |||
Index & | mc_iteration_count, | |||
Vector & | mc_error, | |||
Tensor3 & | mc_points, | |||
const MCAntenna & | mc_antenna, | |||
const Vector & | f_grid, | |||
const Index & | f_index, | |||
const Matrix & | sensor_pos, | |||
const Matrix & | sensor_los, | |||
const Index & | stokes_dim, | |||
const Agenda & | iy_space_agenda, | |||
const Agenda & | surface_prop_agenda, | |||
const Agenda & | opt_prop_gas_agenda, | |||
const Agenda & | abs_scalar_gas_agenda, | |||
const Vector & | p_grid, | |||
const Vector & | lat_grid, | |||
const Vector & | lon_grid, | |||
const Tensor3 & | z_field, | |||
const Matrix & | r_geoid, | |||
const Matrix & | z_surface, | |||
const Tensor3 & | t_field, | |||
const Tensor4 & | vmr_field, | |||
const ArrayOfIndex & | cloudbox_limits, | |||
const Tensor4 & | pnd_field, | |||
const ArrayOfSingleScatteringData & | scat_data_mono, | |||
const Index & | mc_seed, | |||
const String & | y_unit, | |||
const Numeric & | mc_std_err, | |||
const Index & | mc_max_time, | |||
const Index & | mc_max_iter, | |||
const Index & | mc_z_field_is_1D | |||
) |
WORKSPACE METHOD: MCGeneral.
A generalised 3D reversed Monte Carlo radiative algorithm, that allows for 2D antenna patterns, surface reflection and arbitrary sensor positions.
The main output variables *y* and *mc_error* represent the Stokes vector integrated over the antenna function, and the estimated error in this vector respectively.
The WSV *mc_max_iter* describes the number of `photons' used in the simulation (more photons means smaller *mc_error*). mc_std_err* is the desired value of mc_error, and *mc_max_time* is the maximum allowed number of seconds for MCGeneral. MCGeneral will terminate once any of the max_iter, std_err, max_time criteria are met. If negative values are given for these parameters then it is ignored.
Negative values of mc_seed seed the random number generator according to system time, positive rng_seed values are taken literally.
[in,out] | ws | Workspace |
[out] | y | WS Output |
[out] | mc_iteration_count | WS Output |
[out] | mc_error | WS Output |
[out] | mc_points | WS Output |
[in] | mc_antenna | WS Input |
[in] | f_grid | WS Input |
[in] | f_index | WS Input |
[in] | sensor_pos | WS Input |
[in] | sensor_los | WS Input |
[in] | stokes_dim | WS Input |
[in] | iy_space_agenda | WS Input |
[in] | surface_prop_agenda | WS Input |
[in] | opt_prop_gas_agenda | WS Input |
[in] | abs_scalar_gas_agenda | WS Input |
[in] | p_grid | WS Input |
[in] | lat_grid | WS Input |
[in] | lon_grid | WS Input |
[in] | z_field | WS Input |
[in] | r_geoid | WS Input |
[in] | z_surface | WS Input |
[in] | t_field | WS Input |
[in] | vmr_field | WS Input |
[in] | cloudbox_limits | WS Input |
[in] | pnd_field | WS Input |
[in] | scat_data_mono | WS Input |
[in] | mc_seed | WS Input |
[in] | y_unit | WS Input |
[in] | mc_std_err | WS Input |
[in] | mc_max_time | WS Input |
[in] | mc_max_iter | WS Input |
[in] | mc_z_field_is_1D | WS Input |
Definition at line 187 of file m_montecarlo.cc.
References BOLTZMAN_CONST, Rng::draw(), MCAntenna::draw_los(), findZ11max(), Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, id_mat(), invrayjean(), is_anyptype30(), iy_space_agendaExecute(), joker, mcPathTraceGeneral(), mult(), ConstTensor4View::nbooks(), ConstVectorView::nelem(), Ppath::np, ConstMatrixView::nrows(), planck(), q, Tensor3::resize(), Vector::resize(), Sample_los(), Rng::seed(), SPEED_OF_LIGHT, and surface_prop_agendaExecute().
Referenced by MCGeneral_g(), and RteCalcMC().
void MCIPA | ( | Workspace & | ws, | |
Vector & | y, | |||
Index & | mc_iteration_count, | |||
Vector & | mc_error, | |||
Tensor3 & | mc_points, | |||
const MCAntenna & | mc_antenna, | |||
const Vector & | f_grid, | |||
const Index & | f_index, | |||
const Matrix & | sensor_pos, | |||
const Matrix & | sensor_los, | |||
const Index & | stokes_dim, | |||
const Agenda & | iy_space_agenda, | |||
const Agenda & | surface_prop_agenda, | |||
const Agenda & | opt_prop_gas_agenda, | |||
const Agenda & | abs_scalar_gas_agenda, | |||
const Agenda & | ppath_step_agenda, | |||
const Vector & | p_grid, | |||
const Vector & | lat_grid, | |||
const Vector & | lon_grid, | |||
const Tensor3 & | z_field, | |||
const Matrix & | r_geoid, | |||
const Matrix & | z_surface, | |||
const Tensor3 & | t_field, | |||
const Tensor4 & | vmr_field, | |||
const ArrayOfIndex & | cloudbox_limits, | |||
const Tensor4 & | pnd_field, | |||
const ArrayOfSingleScatteringData & | scat_data_mono, | |||
const Index & | mc_seed, | |||
const String & | y_unit, | |||
const Numeric & | mc_std_err, | |||
const Index & | mc_max_time, | |||
const Index & | mc_max_iter, | |||
const Index & | mc_z_field_is_1D | |||
) |
WORKSPACE METHOD: MCIPA.
A specialised 3D reversed Monte Carlo radiative algorithm, that mimics independent pixel appoximation simulations. Probably temporary.
[in,out] | ws | Workspace |
[out] | y | WS Output |
[out] | mc_iteration_count | WS Output |
[out] | mc_error | WS Output |
[out] | mc_points | WS Output |
[in] | mc_antenna | WS Input |
[in] | f_grid | WS Input |
[in] | f_index | WS Input |
[in] | sensor_pos | WS Input |
[in] | sensor_los | WS Input |
[in] | stokes_dim | WS Input |
[in] | iy_space_agenda | WS Input |
[in] | surface_prop_agenda | WS Input |
[in] | opt_prop_gas_agenda | WS Input |
[in] | abs_scalar_gas_agenda | WS Input |
[in] | ppath_step_agenda | WS Input |
[in] | p_grid | WS Input |
[in] | lat_grid | WS Input |
[in] | lon_grid | WS Input |
[in] | z_field | WS Input |
[in] | r_geoid | WS Input |
[in] | z_surface | WS Input |
[in] | t_field | WS Input |
[in] | vmr_field | WS Input |
[in] | cloudbox_limits | WS Input |
[in] | pnd_field | WS Input |
[in] | scat_data_mono | WS Input |
[in] | mc_seed | WS Input |
[in] | y_unit | WS Input |
[in] | mc_std_err | WS Input |
[in] | mc_max_time | WS Input |
[in] | mc_max_iter | WS Input |
[in] | mc_z_field_is_1D | WS Input |
Definition at line 445 of file m_montecarlo.cc.
References Ppath::background, BOLTZMAN_CONST, Rng::draw(), MCAntenna::draw_los(), findZ11max(), Ppath::geom_tan_pos, Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, gridpos(), id_mat(), invrayjean(), is_anyptype30(), iy_space_agendaExecute(), joker, mcPathTraceIPA(), mult(), ConstTensor4View::nbooks(), ConstVectorView::nelem(), Ppath::np, ConstMatrixView::nrows(), planck(), ppath_calc(), q, Tensor3::resize(), Vector::resize(), Sample_los(), Rng::seed(), SPEED_OF_LIGHT, and surface_prop_agendaExecute().
Referenced by MCIPA_g().
void MCSetIncomingEmpty | ( | SLIData2 & | mc_incoming | ) |
Definition at line 725 of file m_montecarlo.cc.
References Vector::resize(), SLIData2::x1a, SLIData2::x2a, and SLIData2::ya.
void MCSetSeedFromTime | ( | Index & | mc_seed | ) |
WORKSPACE METHOD: MCSetSeedFromTime.
Sets the value of mc_seed from system time
[out] | mc_seed | WS Output |
Definition at line 737 of file m_montecarlo.cc.
Referenced by MCSetSeedFromTime_g(), and RteCalcMC().
void rte_posShift | ( | Vector & | rte_pos, | |
Vector & | rte_los, | |||
GridPos & | rte_gp_p, | |||
GridPos & | rte_gp_lat, | |||
GridPos & | rte_gp_lon, | |||
const Ppath & | ppath, | |||
const Index & | atmosphere_dim | |||
) |
WORKSPACE METHOD: rte_posShift.
Shifts rte_pos and rte_los, and rte_gp_XXX to the end of ppath.
[out] | rte_pos | WS Output |
[out] | rte_los | WS Output |
[out] | rte_gp_p | WS Output |
[out] | rte_gp_lat | WS Output |
[out] | rte_gp_lon | WS Output |
[in] | ppath | WS Input |
[in] | atmosphere_dim | WS Input |
Definition at line 1068 of file m_montecarlo.cc.
References Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, gridpos_copy(), joker, Ppath::los, ConstMatrixView::ncols(), Ppath::np, Ppath::pos, and Vector::resize().
Referenced by rte_posShift_g().
void ScatteringMonteCarlo | ( | Workspace & | ws, | |
Ppath & | ppath, | |||
Ppath & | ppath_step, | |||
Vector & | mc_error, | |||
Index & | mc_iteration_count, | |||
Vector & | rte_pos, | |||
Vector & | rte_los, | |||
Matrix & | iy, | |||
Numeric & | rte_pressure, | |||
Numeric & | rte_temperature, | |||
Vector & | rte_vmr_list, | |||
Tensor3 & | ext_mat, | |||
Matrix & | abs_vec, | |||
const Agenda & | ppath_step_agenda, | |||
const Index & | atmosphere_dim, | |||
const Vector & | p_grid, | |||
const Vector & | lat_grid, | |||
const Vector & | lon_grid, | |||
const Tensor3 & | z_field, | |||
const Matrix & | r_geoid, | |||
const Matrix & | z_surface, | |||
const ArrayOfIndex & | cloudbox_limits, | |||
const Index & | stokes_dim, | |||
const Agenda & | rte_agenda, | |||
const Agenda & | iy_space_agenda, | |||
const Agenda & | surface_prop_agenda, | |||
const Tensor3 & | t_field, | |||
const Vector & | f_grid, | |||
const Agenda & | opt_prop_gas_agenda, | |||
const Agenda & | abs_scalar_gas_agenda, | |||
const Tensor4 & | vmr_field, | |||
const ArrayOfSingleScatteringData & | scat_data_mono, | |||
const Tensor4 & | pnd_field, | |||
const Index & | mc_seed, | |||
const Index & | f_index, | |||
const SLIData2 & | mc_incoming, | |||
const Numeric & | std_err, | |||
const Index & | max_time, | |||
const Index & | max_iter, | |||
const Index & | incoming_lookup, | |||
const Index & | z_field_is_1D | |||
) |
Definition at line 746 of file m_montecarlo.cc.
References BOLTZMAN_CONST, Cloudbox_ppath_rteCalc(), Rng::draw(), findZ11max(), SLIData2::interpolate(), interpTArray(), is_anyptype30(), joker, mcPathTrace(), montecarloGetIncoming(), mult(), ConstTensor4View::nbooks(), ConstVectorView::nelem(), Array< base >::nelem(), Ppath::np, opt_depth_calc(), planck(), q, Vector::resize(), Sample_los(), Sample_ppathlengthLOS(), Rng::seed(), and SPEED_OF_LIGHT.
const Numeric BOLTZMAN_CONST |
const Numeric SPEED_OF_LIGHT |