ARTS  2.4.0(git:4fb77825)
m_disort.cc
Go to the documentation of this file.
1 /* Copyright (C) 2006-2012 Claudia Emde <claudia.emde@dlr.de>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA.
17 */
18 
31 /*===========================================================================
32  === External declarations
33  ===========================================================================*/
34 
35 #include <cmath>
36 #include <cstdlib>
37 #include <cstring>
38 #include <iostream>
39 #include <stdexcept>
40 #include "array.h"
41 #include "arts.h"
42 #include "auto_md.h"
43 #include "disort.h"
44 #include "m_general.h"
45 #include "math_funcs.h"
46 #include "messages.h"
47 #include "wsv_aux.h"
48 #include "xml_io.h"
49 
50 /* Workspace method: Doxygen documentation will be auto-generated */
52  // WS Output:
54  // WS Input
55  const Index& atmfields_checked,
56  const Index& atmgeom_checked,
57  const Index& scat_data_checked,
58  const Index& cloudbox_checked,
59  const Index& cloudbox_on,
62  const Index& atmosphere_dim,
63  const Tensor4& pnd_field,
64  const Tensor3& t_field,
65  const Tensor3& z_field,
66  const Tensor4& vmr_field,
67  const Vector& p_grid,
69  const Vector& f_grid,
70  const Vector& za_grid,
71  const Index& stokes_dim,
72  const Matrix& z_surface,
73  const Numeric& surface_skin_t,
75  const Index& nstreams,
76  const String& pfct_method,
77  const Index& Npfct,
78  const Index& cdisort_quiet,
79  const Verbosity& verbosity) {
80  // Don't do anything if there's no cloudbox defined.
81  if (!cloudbox_on) {
83  out0 << " Cloudbox is off, DISORT calculation will be skipped.\n";
84  return;
85  }
86 
87  // FIXME: At the moment, combining scattering elements stored on different
88  // scattering angle grids is only possible for pfct_method 'interpolate'.
89 
96  stokes_dim,
98  scat_data,
99  za_grid,
100  nstreams,
101  pfct_method);
102 
103  init_ifield(
105 
106  Vector albedo(f_grid.nelem(), 0.);
107  Numeric btemp;
108 
111 
112  run_cdisort(ws,
114  f_grid,
115  p_grid,
116  z_field(joker, 0, 0),
117  z_surface(0, 0),
118  t_field(joker, 0, 0),
119  vmr_field(joker, joker, 0, 0),
120  pnd_field(joker, joker, 0, 0),
121  scat_data,
124  btemp,
125  albedo,
126  za_grid,
127  nstreams,
128  Npfct,
129  cdisort_quiet,
130  verbosity);
131 }
132 
133 /* Workspace method: Doxygen documentation will be auto-generated */
135  Workspace& ws,
136  // WS Output:
138  // WS Input
139  const Index& atmfields_checked,
140  const Index& atmgeom_checked,
141  const Index& scat_data_checked,
142  const Index& cloudbox_checked,
143  const Index& cloudbox_on,
147  const Index& atmosphere_dim,
148  const Tensor4& pnd_field,
149  const Tensor3& t_field,
150  const Tensor3& z_field,
151  const Tensor4& vmr_field,
152  const Vector& p_grid,
154  const Vector& f_grid,
155  const Vector& za_grid,
156  const Index& stokes_dim,
157  const Index& nstreams,
158  const String& pfct_method,
159  const Index& Npfct,
160  const Index& cdisort_quiet,
161  const Verbosity& verbosity) {
162  if (!cloudbox_on) {
163  CREATE_OUT0;
164  out0 << " Cloudbox is off, DISORT calculation will be skipped.\n";
165  return;
166  }
167 
168  // FIXME: so far surface is implictly assumed at lowest atmospheric level.
169  // That should be fixed (using z_surface and allowing other altitudes) at some
170  // point.
171 
172  // FIXME: At the moment, combining scattering elements stored on different
173  // scattering angle grids is only possible for pfct_method 'interpolate'.
174 
181  stokes_dim,
183  scat_data,
184  za_grid,
185  nstreams,
186  pfct_method);
187 
188  init_ifield(
190 
191  Vector albedo(f_grid.nelem(), 0.);
192  Numeric btemp;
193 
194  // for now, surface at lowest atm level. later use z_surface or the like
195  // for that.
196  // at the moment this is only required for groundtype "A", but
197  const Numeric surf_altitude = z_field(0, 0, 0);
198  //const Numeric surf_altitude = z_surface(0,0);
199 
200  surf_albedoCalc(ws,
201  albedo,
202  btemp,
204  f_grid,
205  za_grid,
206  surf_altitude,
207  verbosity);
208 
209  run_cdisort(ws,
211  f_grid,
212  p_grid,
213  z_field(joker, 0, 0),
214  surf_altitude,
215  t_field(joker, 0, 0),
216  vmr_field(joker, joker, 0, 0),
217  pnd_field(joker, joker, 0, 0),
218  scat_data,
221  btemp,
222  albedo,
223  za_grid,
224  nstreams,
225  Npfct,
226  cdisort_quiet,
227  verbosity);
228 }
229 
230 /* Workspace method: Doxygen documentation will be auto-generated */
233  const Index& atmfields_checked,
234  const Index& atmgeom_checked,
236  const Index& atmosphere_dim,
237  const Tensor3& t_field,
238  const Tensor3& z_field,
239  const Tensor4& vmr_field,
240  const Vector& p_grid,
241  const Vector& f_grid,
242  const Vector& za_grid,
243  const Index& stokes_dim,
244  const Matrix& z_surface,
245  const Numeric& surface_skin_t,
247  const Index& nstreams,
248  const Index& cdisort_quiet,
249  const Verbosity& verbosity) {
250  if (atmosphere_dim != 1)
251  throw runtime_error(
252  "For running DISORT, atmospheric dimensionality "
253  "must be 1.\n");
254 
255  // Set cloudbox to cover complete atmosphere
258  const Index cloudbox_checked = 1;
259  //
263  p_grid,
264  Vector(0),
265  Vector(0),
266  verbosity);
267 
268  // Create data matching no particles
272  const Index scat_data_checked = 1;
273  //
276  scat_data,
278  f_grid,
281  verbosity);
282 
283  // Call standard DISORT method
284  DisortCalc(ws,
290  cloudbox_on,
294  pnd_field,
295  t_field,
296  z_field,
297  vmr_field,
298  p_grid,
299  scat_data,
300  f_grid,
301  za_grid,
302  stokes_dim,
303  z_surface,
306  nstreams,
307  "median",
308  181,
309  cdisort_quiet,
310  verbosity);
311 }
Matrix
The Matrix class.
Definition: matpackI.h:1193
ARTS::Var::atmosphere_dim
Index atmosphere_dim(Workspace &ws) noexcept
Definition: autoarts.h:2510
ARTS::Var::z_field
Tensor3 z_field(Workspace &ws) noexcept
Definition: autoarts.h:7690
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.
Definition: disort.cc:769
auto_md.h
ARTS::Var::atmgeom_checked
Index atmgeom_checked(Workspace &ws) noexcept
Definition: autoarts.h:2489
get_disortsurf_props
void get_disortsurf_props(Vector &albedo, Numeric &btemp, ConstVectorView f_grid, const Numeric &surface_skin_t, ConstVectorView surface_scalar_reflectivity)
get_disortsurf_props.
Definition: disort.cc:223
Tensor3
The Tensor3 class.
Definition: matpackIII.h:339
joker
const Joker joker
ARTS::Var::pnd_field
Tensor4 pnd_field(Workspace &ws) noexcept
Definition: autoarts.h:5081
ARTS::Var::verbosity
Verbosity verbosity(Workspace &ws) noexcept
Definition: autoarts.h:7112
check_disort_input
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.
Definition: disort.cc:55
ARTS::Var::cloudbox_limits
ArrayOfIndex cloudbox_limits(Workspace &ws) noexcept
Definition: autoarts.h:2762
ARTS::Var::stokes_dim
Index stokes_dim(Workspace &ws) noexcept
Definition: autoarts.h:6650
surf_albedoCalc
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.
Definition: disort.cc:960
ArrayOfRetrievalQuantity
Array< RetrievalQuantity > ArrayOfRetrievalQuantity
Definition: jacobian.h:402
DisortCalcClearsky
void DisortCalcClearsky(Workspace &ws, Tensor7 &spectral_radiance_field, const Index &atmfields_checked, const Index &atmgeom_checked, const Agenda &propmat_clearsky_agenda, const Index &atmosphere_dim, const Tensor3 &t_field, const Tensor3 &z_field, const Tensor4 &vmr_field, const Vector &p_grid, const Vector &f_grid, const Vector &za_grid, const Index &stokes_dim, const Matrix &z_surface, const Numeric &surface_skin_t, const Vector &surface_scalar_reflectivity, const Index &nstreams, const Index &cdisort_quiet, const Verbosity &verbosity)
WORKSPACE METHOD: DisortCalcClearsky.
Definition: m_disort.cc:231
Tensor4
The Tensor4 class.
Definition: matpackIV.h:421
array.h
This file contains the definition of Array.
ARTS::Var::surface_rtprop_agenda
Agenda surface_rtprop_agenda(Workspace &ws) noexcept
Definition: autoarts.h:6807
Agenda
The Agenda class.
Definition: agenda_class.h:44
DisortCalcWithARTSSurface
void DisortCalcWithARTSSurface(Workspace &ws, Tensor7 &cloudbox_field, const Index &atmfields_checked, const Index &atmgeom_checked, const Index &scat_data_checked, const Index &cloudbox_checked, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Agenda &propmat_clearsky_agenda, const Agenda &surface_rtprop_agenda, const Index &atmosphere_dim, const Tensor4 &pnd_field, const Tensor3 &t_field, const Tensor3 &z_field, const Tensor4 &vmr_field, const Vector &p_grid, const ArrayOfArrayOfSingleScatteringData &scat_data, const Vector &f_grid, const Vector &za_grid, const Index &stokes_dim, const Index &nstreams, const String &pfct_method, const Index &Npfct, const Index &cdisort_quiet, const Verbosity &verbosity)
WORKSPACE METHOD: DisortCalcWithARTSSurface.
Definition: m_disort.cc:134
Array
This can be used to make arrays out of anything.
Definition: array.h:108
DisortCalc
void DisortCalc(Workspace &ws, Tensor7 &cloudbox_field, const Index &atmfields_checked, const Index &atmgeom_checked, const Index &scat_data_checked, const Index &cloudbox_checked, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Agenda &propmat_clearsky_agenda, const Index &atmosphere_dim, const Tensor4 &pnd_field, const Tensor3 &t_field, const Tensor3 &z_field, const Tensor4 &vmr_field, const Vector &p_grid, const ArrayOfArrayOfSingleScatteringData &scat_data, const Vector &f_grid, const Vector &za_grid, const Index &stokes_dim, const Matrix &z_surface, const Numeric &surface_skin_t, const Vector &surface_scalar_reflectivity, const Index &nstreams, const String &pfct_method, const Index &Npfct, const Index &cdisort_quiet, const Verbosity &verbosity)
WORKSPACE METHOD: DisortCalc.
Definition: m_disort.cc:51
CREATE_OUT0
#define CREATE_OUT0
Definition: messages.h:204
messages.h
Declarations having to do with the four output streams.
my_basic_string< char >
ARTS::Var::vmr_field
Tensor4 vmr_field(Workspace &ws) noexcept
Definition: autoarts.h:7130
ARTS::Var::atmfields_checked
Index atmfields_checked(Workspace &ws) noexcept
Definition: autoarts.h:2473
ARTS::Var::p_grid
Vector p_grid(Workspace &ws) noexcept
Definition: autoarts.h:4763
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
Verbosity
Definition: messages.h:49
ARTS::Var::surface_scalar_reflectivity
Vector surface_scalar_reflectivity(Workspace &ws) noexcept
Definition: autoarts.h:6864
math_funcs.h
ARTS::Var::f_grid
Vector f_grid(Workspace &ws) noexcept
Definition: autoarts.h:3449
ARTS::Var::scat_data
ArrayOfArrayOfSingleScatteringData scat_data(Workspace &ws) noexcept
Definition: autoarts.h:5840
ARTS::Var::za_grid
Vector za_grid(Workspace &ws) noexcept
Definition: autoarts.h:7771
ARTS::Var::dpnd_field_dx
ArrayOfTensor4 dpnd_field_dx(Workspace &ws) noexcept
Definition: autoarts.h:3251
ARTS::Var::scat_data_checked
Index scat_data_checked(Workspace &ws) noexcept
Definition: autoarts.h:5850
oem::Vector
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
Definition: oem.h:32
disort.h
Functions for disort interface.
pnd_fieldZero
void pnd_fieldZero(Tensor4 &pnd_field, ArrayOfTensor4 &dpnd_field_dx, ArrayOfArrayOfSingleScatteringData &scat_data, const Index &atmosphere_dim, const Vector &f_grid, const ArrayOfIndex &cloudbox_limits, const ArrayOfRetrievalQuantity &jacobian_quantities, const Verbosity &)
WORKSPACE METHOD: pnd_fieldZero.
Definition: m_cloudbox.cc:2030
ARTS::Var::t_field
Tensor3 t_field(Workspace &ws) noexcept
Definition: autoarts.h:6947
Workspace
Workspace class.
Definition: workspace_ng.h:40
init_ifield
void init_ifield(Tensor7 &cloudbox_field, const Vector &f_grid, const ArrayOfIndex &cloudbox_limits, const Index &nang, const Index &stokes_dim)
init_ifield.
Definition: disort.cc:207
ARTS::Var::cloudbox_field
Tensor7 cloudbox_field(Workspace &ws) noexcept
Definition: autoarts.h:2676
ARTS::Var::propmat_clearsky_agenda
Agenda propmat_clearsky_agenda(Workspace &ws) noexcept
Definition: autoarts.h:5405
cloudboxSetFullAtm
void cloudboxSetFullAtm(Index &cloudbox_on, ArrayOfIndex &cloudbox_limits, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Verbosity &)
WORKSPACE METHOD: cloudboxSetFullAtm.
Definition: m_cloudbox.cc:283
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
ARTS::Var::surface_skin_t
Numeric surface_skin_t(Workspace &ws) noexcept
Definition: autoarts.h:6877
Vector
The Vector class.
Definition: matpackI.h:860
ARTS::Var::spectral_radiance_field
Tensor7 spectral_radiance_field(Workspace &ws) noexcept
Definition: autoarts.h:6573
ARTS::Var::cloudbox_checked
Index cloudbox_checked(Workspace &ws) noexcept
Definition: autoarts.h:2650
wsv_aux.h
Auxiliary header stuff related to workspace variable groups.
ARTS::Var::z_surface
Matrix z_surface(Workspace &ws) noexcept
Definition: autoarts.h:7754
Tensor7
The Tensor7 class.
Definition: matpackVII.h:2382
arts.h
The global header file for ARTS.
ARTS::Var::cloudbox_on
Index cloudbox_on(Workspace &ws) noexcept
Definition: autoarts.h:2782
xml_io.h
This file contains basic functions to handle XML data files.
m_general.h
Template functions for general supergeneric ws methods.