ARTS
2.4.0(git:4fb77825)
|
This file contains functions related to the DISORT interface. More...
#include "disort.h"
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <stdexcept>
#include "agenda_class.h"
#include "array.h"
#include "auto_md.h"
#include "check_input.h"
#include "cdisort.h"
#include "interpolation.h"
#include "logic.h"
#include "math_funcs.h"
#include "messages.h"
#include "rte.h"
#include "xml_io.h"
Go to the source code of this file.
Macros | |
#define | MAX_WARNINGS 100 |
Functions | |
void | check_disort_input (const Index &cloudbox_on, const Index &atmfields_checked, const Index &atmgeom_checked, const Index &cloudbox_checked, const Index &scat_data_checked, const Index &atmosphere_dim, const Index &stokes_dim, const ArrayOfIndex &cloudbox_limits, const ArrayOfArrayOfSingleScatteringData &scat_data, ConstVectorView za_grid, const Index &nstreams, const String &pfct_method) |
check_disort_input. More... | |
void | init_ifield (Tensor7 &cloudbox_field, const Vector &f_grid, const ArrayOfIndex &cloudbox_limits, const Index &nang, const Index &stokes_dim) |
init_ifield. More... | |
void | get_disortsurf_props (Vector &albedo, Numeric &btemp, ConstVectorView f_grid, const Numeric &surface_skin_t, ConstVectorView surface_scalar_reflectivity) |
get_disortsurf_props. More... | |
void | get_gasoptprop (Workspace &ws, MatrixView ext_bulk_gas, const Agenda &propmat_clearsky_agenda, ConstVectorView t_profile, ConstMatrixView vmr_profiles, ConstVectorView p_grid, ConstVectorView f_grid) |
get_gasoptprop. More... | |
void | get_paroptprop (MatrixView ext_bulk_par, MatrixView abs_bulk_par, const ArrayOfArrayOfSingleScatteringData &scat_data, ConstMatrixView pnd_profiles, ConstVectorView t_profile, ConstVectorView DEBUG_ONLY(p_grid), const ArrayOfIndex &cloudbox_limits, ConstVectorView f_grid) |
void | get_dtauc_ssalb (MatrixView dtauc, MatrixView ssalb, ConstMatrixView ext_bulk_gas, ConstMatrixView ext_bulk_par, ConstMatrixView abs_bulk_par, ConstVectorView z_profile) |
get_dtauc_ssalb More... | |
void | get_angs (Vector &pfct_angs, const ArrayOfArrayOfSingleScatteringData &scat_data, const Index &Npfct) |
get_angs. More... | |
void | get_parZ (Tensor3 &pha_bulk_par, const ArrayOfArrayOfSingleScatteringData &scat_data, ConstMatrixView pnd_profiles, ConstVectorView t_profile, ConstVectorView pfct_angs, const ArrayOfIndex &cloudbox_limits) |
get_parZ. More... | |
void | get_pfct (Tensor3 &pfct_bulk_par, ConstTensor3View &pha_bulk_par, ConstMatrixView ext_bulk_par, ConstMatrixView abs_bulk_par, const ArrayOfIndex &cloudbox_limits) |
get_pfct. More... | |
void | get_pmom (Tensor3View pmom, ConstTensor3View pfct_bulk_par, ConstVectorView pfct_angs, const Index &Nlegendre) |
get_pmom More... | |
void | c_errmsg (const char *messag, int type) |
Verbosity enabled replacement for the original cdisort function. More... | |
int | c_write_bad_var (int quiet, const char *varnam) |
Verbosity enabled replacement for the original cdisort function. More... | |
int | c_write_too_small_dim (int quiet, const char *dimnam, int minval) |
Verbosity enabled replacement for the original cdisort function. More... | |
void | reduced_1datm (Vector &p, Vector &z, Vector &t, Matrix &vmr, Matrix &pnd, ArrayOfIndex &cboxlims, Index &ncboxremoved, ConstVectorView p_grid, ConstVectorView z_profile, const Numeric &z_surface, ConstVectorView t_profile, ConstMatrixView vmr_profiles, ConstMatrixView pnd_profiles, const ArrayOfIndex &cloudbox_limits) |
reduced_1datm More... | |
void | run_cdisort (Workspace &ws, Tensor7 &cloudbox_field, ConstVectorView f_grid, ConstVectorView p_grid, ConstVectorView z_profile, const Numeric &z_surface, ConstVectorView t_profile, ConstMatrixView vmr_profiles, ConstMatrixView pnd_profiles, const ArrayOfArrayOfSingleScatteringData &scat_data, const Agenda &propmat_clearsky_agenda, const ArrayOfIndex &cloudbox_limits, const Numeric &surface_skin_t, const Vector &surface_scalar_reflectivity, ConstVectorView za_grid, const Index &nstreams, const Index &Npfct, const Index &quiet, const Verbosity &verbosity) |
Calculate doit_i_feild with Disort. More... | |
void | surf_albedoCalc (Workspace &ws, VectorView albedo, Numeric &btemp, const Agenda &surface_rtprop_agenda, ConstVectorView f_grid, ConstVectorView scat_za_grid, const Numeric &surf_alt, const Verbosity &verbosity) |
Surface albed. More... | |
Variables | |
const Numeric | PI |
const Numeric | DEG2RAD |
const Numeric | PLANCK_CONST |
const Numeric | SPEED_OF_LIGHT |
const Numeric | COSMIC_BG_TEMP |
thread_local Verbosity | disort_verbosity |
This file contains functions related to the DISORT interface.
Definition in file disort.cc.
void c_errmsg | ( | const char * | messag, |
int | type | ||
) |
Verbosity enabled replacement for the original cdisort function.
Definition at line 636 of file disort.cc.
References arts_exit(), CREATE_OUT0, CREATE_OUT1, disort_verbosity, MAX_WARNINGS, and ARTS::Var::verbosity().
Referenced by c_write_bad_var().
int c_write_bad_var | ( | int | quiet, |
const char * | varnam | ||
) |
Verbosity enabled replacement for the original cdisort function.
Definition at line 664 of file disort.cc.
References c_errmsg(), CREATE_OUT1, disort_verbosity, and ARTS::Var::verbosity().
int c_write_too_small_dim | ( | int | quiet, |
const char * | dimnam, | ||
int | minval | ||
) |
Verbosity enabled replacement for the original cdisort function.
Definition at line 682 of file disort.cc.
References CREATE_OUT1, disort_verbosity, and ARTS::Var::verbosity().
void check_disort_input | ( | const Index & | cloudbox_on, |
const Index & | atmfields_checked, | ||
const Index & | atmgeom_checked, | ||
const Index & | cloudbox_checked, | ||
const Index & | scat_data_checked, | ||
const Index & | atmosphere_dim, | ||
const Index & | stokes_dim, | ||
const ArrayOfIndex & | cloudbox_limits, | ||
const ArrayOfArrayOfSingleScatteringData & | scat_data, | ||
ConstVectorView | za_grid, | ||
const Index & | nstreams, | ||
const String & | pfct_method | ||
) |
check_disort_input.
*** FIXMEDOC *** in disort.cc, line 197
Checks that input of DisortCalc* is sane.
[in] | cloudbox_on | as the WSV. |
[in] | disort_is_initialized | as the WSV. |
[in] | atmfields_checked | as the WSV. |
[in] | atmgeom_checked | as the WSV. |
[in] | cloudbox_checked | as the WSV. |
[in] | scat_data | as the WSV. |
[in] | za_grid | as the WSV. |
[in] | nstreams | Number of quadrature angles (both hemispheres). |
[in] | pfct_method | see DisortCalc doc. |
Definition at line 55 of file disort.cc.
References ARTS::Var::atmfields_checked(), ARTS::Var::atmgeom_checked(), ARTS::Var::atmosphere_dim(), ARTS::Var::cloudbox_checked(), ARTS::Var::cloudbox_limits(), ARTS::Var::cloudbox_on(), is_increasing(), ConstVectorView::nelem(), PTYPE_AZIMUTH_RND, PTYPE_GENERAL, PTYPE_TOTAL_RND, PTypeToString(), ARTS::Var::scat_data(), ARTS::Var::scat_data_checked(), and ARTS::Var::za_grid().
Referenced by DisortCalc(), and DisortCalcWithARTSSurface().
void get_angs | ( | Vector & | pfct_angs, |
const ArrayOfArrayOfSingleScatteringData & | scat_data, | ||
const Index & | Npfct | ||
) |
get_angs.
Derives angular grid to derive bulk phase matrix/function data on for further Legendre decomposition.
[out] | pfct_angs | Angular grid of pfct_bulk_par. |
[in] | scat_data | As the WSV. |
[in] | nang | Number of angular grid points in pfct_angs. If<0, |
pfct_angs is taken from scat_data (the finest za_grid used over the scat elems), else an equidistant grid with nang grid points is used.
Definition at line 432 of file disort.cc.
References Absorption::nelem(), nlinspace(), ARTS::Var::scat_data(), and ARTS::Var::za_grid().
Referenced by run_cdisort().
void get_disortsurf_props | ( | Vector & | albedo, |
Numeric & | btemp, | ||
ConstVectorView | f_grid, | ||
const Numeric & | surface_skin_t, | ||
ConstVectorView | surface_scalar_reflectivity | ||
) |
get_disortsurf_props.
*** FIXMEDOC *** input/output
Derive surface property input for RT4's proprietary surface handling depending on surface reflection type.
[out] | ground_albedo | Scalar surface albedo (for ground_type=L). |
[out] | ground_reflec | Vector surface relfectivity (for ground_type=S). |
[out] | ground_index | Surface complex refractive index (for ground_type=F). |
[out] | btemp | Surface temperature |
[in] | f_grid | As the WSV. |
[in] | ground_type | Surface reflection type flag. |
[in] | surface_skin_t | As the WSV. |
[in] | surface_scalar_reflectivity | As the WSV (used with ground_type=L). |
[in] | surface_reflectivity | As the WSV (used with ground_type=S). |
[in] | surface_complex_refr_index | As the WSV (used with ground_type=F). |
[in] | stokes_dim | As the WSV. |
Definition at line 223 of file disort.cc.
References ARTS::Var::f_grid(), ARTS::Var::f_index(), max, min, ARTS::Var::surface_scalar_reflectivity(), and ARTS::Var::surface_skin_t().
Referenced by DisortCalc().
void get_dtauc_ssalb | ( | MatrixView | dtauc, |
MatrixView | ssalb, | ||
ConstMatrixView | ext_bulk_gas, | ||
ConstMatrixView | ext_bulk_par, | ||
ConstMatrixView | abs_bulk_par, | ||
ConstVectorView | z_profile | ||
) |
get_dtauc_ssalb
Calculates layer averaged cloud optical depth (dtauc) and single scattering albedo (ssalb) as required as DISORT subroutine input from level-based gas extinction and particle extinction and absorption.
[out] | dtauc | Optical depths for all layers. |
[out] | ssalb | Single scattering albedos for all layers. |
[in] | ext_bulk_gas | See get_gasoptprop. |
[in] | ext_bulk_par | See get_paroptprop. |
[in] | abs_bulk_par | See get_paroptprop. |
[in] | z_profile | Profile of geometrical altitudes. |
Definition at line 396 of file disort.cc.
References abs, ARTS::Var::f_index(), ConstMatrixView::ncols(), and ConstMatrixView::nrows().
Referenced by run_cdisort().
void get_gasoptprop | ( | Workspace & | ws, |
MatrixView | ext_bulk_gas, | ||
const Agenda & | propmat_clearsky_agenda, | ||
ConstVectorView | t_profile, | ||
ConstMatrixView | vmr_profiles, | ||
ConstVectorView | p_grid, | ||
ConstVectorView | f_grid | ||
) |
get_gasoptprop.
Derives level-based gas bulk optical properties (extinction).
[in,out] | ws | Current workspace. |
[out] | ext_bulk_gas | Gas bulk extinction (all levels & freqs). |
[in] | propmat_clearsky_agenda | As the WSV. |
[in] | t_profile | Temperature profile |
[in] | vmr_profiles | VMR profiles |
[in] | p_grid | As the WSV. |
[in] | f_grid | As the WSV. |
Definition at line 268 of file disort.cc.
References ARTS::Var::f_grid(), joker, PropagationMatrix::Kjj(), ConstMatrixView::ncols(), ConstMatrixView::nrows(), ARTS::Var::p_grid(), ARTS::Var::propmat_clearsky_agenda(), and propmat_clearsky_agendaExecute().
Referenced by run_cdisort().
void get_paroptprop | ( | MatrixView | ext_bulk_par, |
MatrixView | abs_bulk_par, | ||
const ArrayOfArrayOfSingleScatteringData & | scat_data, | ||
ConstMatrixView | pnd_profiles, | ||
ConstVectorView | t_profile, | ||
ConstVectorView | DEBUG_ONLYp_grid, | ||
const ArrayOfIndex & | cloudbox_limits, | ||
ConstVectorView | f_grid | ||
) |
Definition at line 321 of file disort.cc.
References ARTS::Var::cloudbox_limits(), DEBUG_ONLY, ARTS::Var::f_grid(), ARTS::Var::f_index(), ConstTensor4View::nbooks(), ConstMatrixView::ncols(), ConstMatrixView::nrows(), opt_prop_Bulk(), opt_prop_NScatElems(), opt_prop_ScatSpecBulk(), ARTS::Var::p_grid(), and ARTS::Var::scat_data().
Referenced by run_cdisort().
void get_parZ | ( | Tensor3 & | pha_bulk_par, |
const ArrayOfArrayOfSingleScatteringData & | scat_data, | ||
ConstMatrixView | pnd_profiles, | ||
ConstVectorView | t_profile, | ||
ConstVectorView | pfct_angs, | ||
const ArrayOfIndex & | cloudbox_limits | ||
) |
get_parZ.
Derives level-based particle bulk phase matrix Z (Csca scaled). NOTE: Provided on ssd's freq grid (i.e. for nf=1 only of ssd.f_grid.nelem==1) in order to avoid duplicate calculations in get_pmom (instead we duplicate the results there to the RT calc's f_grid).
[out] | pha_bulk_par | Particle bulk phase function (all levels & ssd freqs). |
[out] | pfct_angs | Angular grid of pfct_bulk_par. |
[in] | scat_data | As the WSV. |
[in] | pnd_profiles | PND profiles. |
[in] | t_profile | Temperature profile. |
[in] | p_grid | As the WSV. |
[in] | cloudbox_limits | As the WSV. |
[in] | ext_bulk_par | See get_paroptprop. |
[in] | abs_bulk_par | See get_paroptprop. |
[in] | nang | Number of angular grid points in pfct_angs. If<0, |
pfct_angs is taken from scat_data (the finest za_grid used over the scat elems), else an equidistant grid with nang grid points is used.
Definition at line 464 of file disort.cc.
References ARTS::Var::cloudbox_limits(), joker, ConstMatrixView::ncols(), ConstVectorView::nelem(), pha_mat_Bulk(), pha_mat_NScatElems(), pha_mat_ScatSpecBulk(), and ARTS::Var::scat_data().
Referenced by run_cdisort().
void get_pfct | ( | Tensor3 & | pfct_bulk_par, |
ConstTensor3View & | pha_bulk_par, | ||
ConstMatrixView | ext_bulk_par, | ||
ConstMatrixView | abs_bulk_par, | ||
const ArrayOfIndex & | cloudbox_limits | ||
) |
get_pfct.
Derives layer averaged particle bulk phase function P (4Pi scaled) NOTE: Provided on ssd's freq grid (i.e. for nf=1 only if ssd.f_grid.nelem==1) in order to avoid duplicate calculations in get_pmom (instead we duplicate the results there to the RT calc's f_grid).
[out] | pfct_bulk_par | Particle bulk phase function (all levels & ssd freqs). |
[in] | pha_bulk_par | See get_parZ. |
[in] | ext_bulk_par | See get_paroptprop. |
[in] | abs_bulk_par | See get_paroptprop. |
Definition at line 516 of file disort.cc.
References ARTS::Var::cloudbox_limits(), ARTS::Var::f_index(), joker, ConstTensor3View::ncols(), ConstTensor3View::npages(), ConstTensor3View::nrows(), and PI.
Referenced by run_cdisort().
void get_pmom | ( | Tensor3View | pmom, |
ConstTensor3View | pfct_bulk_par, | ||
ConstVectorView | pfct_angs, | ||
const Index & | Nlegendre | ||
) |
get_pmom
Calculates Legendre moments of the layer averaged phase functionss (pmom) as required as DISORT subroutine input from level-based bulk particle phase function (4-Pi normalized scalar phase matrix).
[out] | pmom | Legendre moments for all layers. |
[in] | pfct_bulk_par | See get_pfct. |
[in] | pfct_angs | See get_parZ. |
[in] | Nlegendre | Number of Legendre moments to derive. |
Definition at line 551 of file disort.cc.
References abs, ARTS::Var::f_index(), joker, ConstTensor3View::ncols(), ConstVectorView::nelem(), ConstTensor3View::npages(), ConstTensor3View::nrows(), and PI.
Referenced by run_cdisort().
void init_ifield | ( | Tensor7 & | cloudbox_field, |
const Vector & | f_grid, | ||
const ArrayOfIndex & | cloudbox_limits, | ||
const Index & | nang, | ||
const Index & | stokes_dim | ||
) |
init_ifield.
Initialize cloudbox_field with the right size and NaN values.
[out] | cloudbox_field | As the WSV. |
[in] | f_grid | As the WSV. |
[in] | cloudbox_limits | As the WSV. |
[in] | nang | Total number of angles with RT output. |
[in] | stokes_dim | As the WSV. |
Definition at line 207 of file disort.cc.
References ARTS::Var::cloudbox_field(), ARTS::Var::cloudbox_limits(), ARTS::Var::f_grid(), and ARTS::Var::stokes_dim().
Referenced by DisortCalc(), and DisortCalcWithARTSSurface().
void reduced_1datm | ( | Vector & | p, |
Vector & | z, | ||
Vector & | t, | ||
Matrix & | vmr, | ||
Matrix & | pnd, | ||
ArrayOfIndex & | cboxlims, | ||
Index & | ncboxremoved, | ||
ConstVectorView | p_grid, | ||
ConstVectorView | z_profile, | ||
const Numeric & | z_surface, | ||
ConstVectorView | t_profile, | ||
ConstMatrixView | vmr_profiles, | ||
ConstMatrixView | pnd_profiles, | ||
const ArrayOfIndex & | cloudbox_limits | ||
) |
reduced_1datm
Crops a 1D atmosphere, to create an atmosphere where the surface is placed at p_grid[0]. Developed to work with DISORT and RT4.
[out] | p | New pressure grid, |
[out] | z | New profile of geometrical altitudes. |
[out] | t | New temperature profile, |
[out] | vmr | New VMR profiles. |
[out] | pnd | New PND profiles. |
[out] | cboxlims | Adjusted version of cloudbox_limits. |
[out] | ncboxremoved | Number of levels inside cloudbox removed |
[in] | p_grid | Original pressure grid |
[in] | z_profile | Original profile of geometric altitudes. |
[in] | z_surface | Surface altitude. |
[in] | t_profile | Original temperature profile. |
[in] | vmr_profiles | Original VMR profiles. |
[in] | pnd_profiles | Original PND profiles. |
[in] | cloudbox_limits | Original cloudbox limits |
Definition at line 693 of file disort.cc.
References abs, and ARTS::Var::z_surface().
Referenced by run_cdisort().
void run_cdisort | ( | Workspace & | ws, |
Tensor7 & | cloudbox_field, | ||
ConstVectorView | f_grid, | ||
ConstVectorView | p_grid, | ||
ConstVectorView | z_profile, | ||
const Numeric & | z_surface, | ||
ConstVectorView | t_profile, | ||
ConstMatrixView | vmr_profiles, | ||
ConstMatrixView | pnd_profiles, | ||
const ArrayOfArrayOfSingleScatteringData & | scat_data, | ||
const Agenda & | propmat_clearsky_agenda, | ||
const ArrayOfIndex & | cloudbox_limits, | ||
const Numeric & | surface_skin_t, | ||
const Vector & | surface_scalar_reflectivity, | ||
ConstVectorView | za_grid, | ||
const Index & | nstreams, | ||
const Index & | Npfct, | ||
const Index & | quiet, | ||
const Verbosity & | verbosity | ||
) |
Calculate doit_i_feild with Disort.
Prepares actual input variables for Disort, runs it, and sorts the output into cloudbox_field.
This version uses the C implementation of Disort based on ::run_disort.
Altitudes, temperatures, VMRs and PNDs shall be provided with lat and lon dimensions removed
[in,out] | ws | Current workspace |
[out] | cloudbox_field | Radiation field |
[in] | f_grid | Frequency grid |
[in] | p_grid | Pressure grid |
[in] | z_profile | Profile of geometric altitudes. |
[in] | z_surface | Surface altitude. |
[in] | t_profile | Temperature profile. |
[in] | vmr_profiles | VMR profiles. |
[in] | pnd_profiles | PND profiles. |
[in] | scat_data | Array of single scattering data |
[in] | propmat_clearsky_agenda | calculates the absorption coefficient matrix |
[in] | cloudbox_limits | Cloudbox limits |
[in] | surface_skin_t | Surface skin temperature |
[in] | surface_scalar_reflectivity | Surface scalar reflectivity |
[in] | za_grid | Zenith angle grid |
[in] | nstreams | Number of quadrature angles (both hemispheres). |
[in] | Npfct | Number of angular grid points to calculate bulk phase function |
[in] | quiet | Silence warnings |
[in] | verbosity | Verbosity setting |
Definition at line 769 of file disort.cc.
References ARTS::Var::cloudbox_limits(), COSMIC_BG_TEMP, disort_verbosity, ARTS::Var::f_grid(), ARTS::Var::f_index(), get_angs(), get_dtauc_ssalb(), get_gasoptprop(), get_paroptprop(), get_parZ(), get_pfct(), get_pmom(), joker, ConstVectorView::nelem(), ARTS::Var::p_grid(), PI, ARTS::Var::propmat_clearsky_agenda(), reduced_1datm(), ARTS::Var::scat_data(), SPEED_OF_LIGHT, ARTS::Var::surface_skin_t(), ARTS::Var::verbosity(), ARTS::Var::z_surface(), and ARTS::Var::za_grid().
Referenced by DisortCalc(), and DisortCalcWithARTSSurface().
void surf_albedoCalc | ( | Workspace & | ws, |
VectorView | albedo, | ||
Numeric & | btemp, | ||
const Agenda & | surface_rtprop_agenda, | ||
ConstVectorView | f_grid, | ||
ConstVectorView | scat_za_grid, | ||
const Numeric & | surf_alt, | ||
const Verbosity & | verbosity | ||
) |
Surface albed.
Computes surface albedo for using ARTS' surface with DISORT.
[in,out] | ws | The workspace |
[out] | albedo | The computed albedo |
[out] | btemp | Upw. bts. |
[in] | surface_rtprop_agenda | Agenda to compute surf. props |
[in] | f_grid | Frequency grid |
[in] | scat_za_grid | Zenith angle grid |
[in] | surface_alt | surface altitude |
[in] | verbosity |
Definition at line 960 of file disort.cc.
References chk_not_empty(), CREATE_OUT2, ARTS::Var::f_grid(), ARTS::Var::f_index(), is_same_within_epsilon(), joker, ConstVectorView::nelem(), ARTS::Var::rtp_los(), ARTS::Var::rtp_pos(), ARTS::Var::surface_emission(), ARTS::Var::surface_los(), ARTS::Var::surface_rmatrix(), ARTS::Var::surface_rtprop_agenda(), surface_rtprop_agendaExecute(), and ARTS::Var::surface_skin_t().
Referenced by DisortCalcWithARTSSurface().
|
extern |
Referenced by run_cdisort().
|
extern |
thread_local Verbosity disort_verbosity |
Definition at line 631 of file disort.cc.
Referenced by c_errmsg(), c_write_bad_var(), c_write_too_small_dim(), and run_cdisort().
|
extern |
Referenced by get_pfct(), get_pmom(), and run_cdisort().
|
extern |
|
extern |
Referenced by run_cdisort().