ReFRACtor
l_rad_driver.h
Go to the documentation of this file.
1 #ifndef L_RAD_DRIVER_H
2 #define L_RAD_DRIVER_H
3 
4 #include <boost/noncopyable.hpp>
5 #include <blitz/array.h>
6 
7 #include "linear_interpolate.h"
8 #include "array_ad.h"
9 
10 namespace FullPhysics {
11 /****************************************************************/
24 class LRadDriver : public Printable<LRadDriver>, public boost::noncopyable {
25 
26 public:
28 
29  LRadDriver(int Number_stream, int Number_stokes,
30  int surface_type,
31  bool Tms_Correction = false,
32  bool Pure_nadir = false,
33  const PsMode ps_mode = DETECT);
34 
35  virtual ~LRadDriver();
36 
37  virtual int number_stokes() const {return nstokes;}
38  virtual int number_stream() const {return nstream;}
39 
41 
44  virtual void setup_geometry(blitz::Array<double, 1> alt, double sza, double zen, double azm) const;
45 
47  virtual void setup_surface_params(const blitz::Array<double, 1>& surface_param);
48 
51  virtual void setup_optical_inputs(const blitz::Array<double, 1>& od,
52  const blitz::Array<double, 1>& ssa,
53  const blitz::Array<double, 3>& pf,
54  const blitz::Array<double, 2>& zmat);
55 
57  virtual void clear_linear_inputs();
58 
60  virtual void setup_linear_inputs(const ArrayAd<double, 1>& od,
61  const ArrayAd<double, 1>& ssa,
62  const ArrayAd<double, 3>& pf,
63  const ArrayAd<double, 2>& zmat);
64 
68  virtual void calculate_first_order();
69 
73  virtual void calculate_second_order();
74 
76  virtual blitz::Array<double, 1> stokes() const;
77 
79  virtual blitz::Array<double, 3> atmospheric_jacobian() const;
80 
82  virtual blitz::Array<double, 2> surface_jacobian() const;
83 
84  virtual void print(std::ostream& Os, bool Short_form = false) const;
85 
86 private:
87 
90  void set_ps_mode(const PsMode& mode)
91  {
92  switch(mode) {
93  case REGULAR:
94  regular_ps = true;
95  enhanced_ps = false;
96  break;
97 
98  case ENHANCED:
99  regular_ps = false;
100  enhanced_ps = true;
101  break;
102 
103  case PLANE_PARALLEL:
104  regular_ps = false;
105  enhanced_ps = false;
106  break;
107 
108  case DETECT:
109  default:
110 
111  // Determine which pseudo-spherical mode to use based on the zenith angle
112  // ie, how close are we to nadir
113  if (pure_nadir) {
114  set_ps_mode(REGULAR);
115  } else {
116  set_ps_mode(ENHANCED);
117  }
118 
119  break;
120  }
121  }
122 
123  void initialize(const PsMode ps_mode);
124  void check_rt_inputs();
125 
126  // Options configured at construction
127  int nstream, nstokes;
128  int surface_type;
129  bool use_tms_correction;
130  bool pure_nadir;
131  bool regular_ps, enhanced_ps;
132 
133  // Integer boolean for l_rad indicating if jacobians are needed, false until linear
134  // values are initialized
135  int need_jacobians_i;
136 
137  // Fortran ordered Blitz arrays used when calling l_rad. They are initialized on first use
138  blitz::Array<double, 1> surface_param_f;
139  blitz::Array<double, 1> tau_f;
140  blitz::Array<double, 1> omega_f;
141  blitz::Array<double, 3> pf_f;
142  blitz::Array<double, 2> zmat_f;
143  blitz::Array<double, 1> fscale_f;
144  blitz::Array<double, 3> jac_atm_f;
145  blitz::Array<double, 2> jac_surf_f;
146  blitz::Array<double, 2> l_tau_f;
147  blitz::Array<double, 2> l_omega_f;
148  blitz::Array<double, 4> l_pf_f;
149  blitz::Array<double, 3> l_zmat_f;
150  blitz::Array<double, 2> l_fscale_f;
151  blitz::Array<double, 1> stokes_val_f;
152 
155  mutable void *l_rad_struct;
156 
157 };
158 }
159 #endif
virtual blitz::Array< double, 3 > atmospheric_jacobian() const
Atmospheric jacobian from last calculation.
virtual void calculate_first_order()
Perform radiative transfer calculation with the values setup by setup_optical_inputs and setup_linear...
virtual void setup_geometry(blitz::Array< double, 1 > alt, double sza, double zen, double azm) const
Setup viewing geometry, should only be called once per instance or if the viewing geometry changes...
Definition: l_rad_driver.cc:97
virtual int number_stokes() const
Definition: l_rad_driver.h:37
This is a Mixin for classes that can be printed.
Definition: printable.h:24
virtual void print(std::ostream &Os, bool Short_form=false) const
virtual void setup_linear_inputs(const ArrayAd< double, 1 > &od, const ArrayAd< double, 1 > &ssa, const ArrayAd< double, 3 > &pf, const ArrayAd< double, 2 > &zmat)
Set up linearization, weighting functions.
virtual int number_stream() const
Definition: l_rad_driver.h:38
virtual blitz::Array< double, 2 > surface_jacobian() const
Surface jacobian.
virtual blitz::Array< double, 1 > stokes() const
Retrieve the stokes values calculated.
LRadDriver(int Number_stream, int Number_stokes, int surface_type, bool Tms_Correction=false, bool Pure_nadir=false, const PsMode ps_mode=DETECT)
Definition: l_rad_driver.cc:47
virtual void setup_surface_params(const blitz::Array< double, 1 > &surface_param)
Set up surface parameters for spectral point.
ArrayAd< double, 2 > z_matrix(const ArrayAd< double, 3 > &pf) const
Calculate the z matrix.
This class drives the LRAD code, which gives a polarization correction to scalar intensity and jacobi...
Definition: l_rad_driver.h:24
virtual void setup_optical_inputs(const blitz::Array< double, 1 > &od, const blitz::Array< double, 1 > &ssa, const blitz::Array< double, 3 > &pf, const blitz::Array< double, 2 > &zmat)
Set up optical depth, single scattering albedo and scattering matrix Should be called per spectral po...
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
virtual ~LRadDriver()
Destructor.
Definition: l_rad_driver.cc:87
virtual void clear_linear_inputs()
Mark that we are not retrieving weighting functions.
virtual void calculate_second_order()
Perform radiative transfer calculation with the values setup by setup_optical_inputs and setup_linear...

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:08