ReFRACtor
rt_atmosphere.cc
Go to the documentation of this file.
1 #include "rt_atmosphere.h"
2 
3 using namespace FullPhysics;
4 using namespace blitz;
5 
6 #ifdef HAVE_LUA
7 #include "register_lua.h"
10 #endif
11 
12 //-----------------------------------------------------------------------
14 //-----------------------------------------------------------------------
15 
16 AccumulatedTimer RtAtmosphere::timer("RtAtmosphere calculations");
17 
18 //-----------------------------------------------------------------------
20 //-----------------------------------------------------------------------
21 
22 std::string RtAtmosphere::timer_info() const
23 {
24  std::ostringstream os;
25  os << timer;
26  return os.str();
27 }
28 
29 
30 //-----------------------------------------------------------------------
40 //-----------------------------------------------------------------------
41 
43 RtAtmosphere::optical_depth_wrt_state_vector(double wn, int spec_index) const
44 {
45  firstIndex i1; secondIndex i2; thirdIndex i3;
46  Range ra(Range::all());
47  ArrayAd<double, 1> od(optical_depth_wrt_iv(wn, spec_index));
48  Array<double, 3> ivjac(intermediate_variable(wn, spec_index).jacobian());
49  ArrayAd<double, 1> res(od.rows(), ivjac.depth());
50  res.value() = od.value();
51  for(int i = 0; i < res.rows(); ++i)
52  res.jacobian()(i, ra) =
53  sum(od.jacobian()(i, ra)(i2) * ivjac(i, ra, ra)(i2,i1),i2);
54  return res;
55 }
56 
57 //-----------------------------------------------------------------------
69 //-----------------------------------------------------------------------
70 
73 (double wn, int spec_index) const
74 {
75  firstIndex i1; secondIndex i2; thirdIndex i3;
76  Range ra(Range::all());
77  ArrayAd<double, 1> ss(single_scattering_albedo_wrt_iv(wn, spec_index));
78  Array<double, 3> ivjac(intermediate_variable(wn, spec_index).jacobian());
79  ArrayAd<double, 1> res(ss.rows(), ivjac.depth());
80  res.value() = ss.value();
81  for(int i = 0; i < res.rows(); ++i)
82  res.jacobian()(i, ra) =
83  sum(ss.jacobian()(i, ra)(i2) * ivjac(i, ra, ra)(i2,i1),i2);
84  return res;
85 }
86 
87 //-----------------------------------------------------------------------
110 //-----------------------------------------------------------------------
111 
114 (double wn, int spec_index, int nummom, int numscat) const
115 {
116  firstIndex i1; secondIndex i2; thirdIndex i3; fourthIndex i4; fifthIndex i5;
118  pf(scattering_moment_wrt_iv(wn, spec_index, nummom, numscat));
119  Array<double, 3> ivjac(intermediate_variable(wn, spec_index).jacobian());
120  ArrayAd<double, 3> res(pf.rows(), pf.cols(), pf.depth(), ivjac.depth());
121  res.value() = pf.value();
122  res.jacobian() = sum(pf.jacobian()(i1, i2, i3, i5) * ivjac(i2,i5, i4), i5);
123  return res;
124 }
125 
int cols() const
Definition: array_ad.h:369
int depth() const
Definition: array_ad.h:370
This class is responsible for setting up the atmosphere and ground information needed to run the Radi...
Definition: rt_atmosphere.h:51
static AccumulatedTimer timer
Timer for RtAtmosphere.
Definition: rt_atmosphere.h:55
blitz::Array< T, 2 > jacobian(const blitz::Array< AutoDerivative< T >, 1 > &Ad)
Utility function to extract the Jacobian as a separate matrix from an array of AutoDerivative.
ArrayAd< double, 1 > optical_depth_wrt_state_vector(double wn, int spec_index) const
The optical depth for each layer, for the given wave number.
const blitz::Array< T, D+1 > jacobian() const
Definition: array_ad.h:307
ArrayAd< double, 1 > single_scattering_albedo_wrt_state_vector(double wn, int spec_index) const
The single scattering albedo for each layer, for the given wave number.
#define REGISTER_LUA_CLASS(X)
Definition: register_lua.h:116
Apply value function to a blitz array.
const blitz::Array< T, D > & value() const
Definition: array_ad.h:306
This is a simple timer class that can be used to accumulate the time spent in multiple calls to a fun...
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
#define REGISTER_LUA_END()
Definition: register_lua.h:134
ArrayAd< double, 3 > scattering_moment_wrt_state_vector(double wn, int spec_index, int nummom=-1, int numscat=-1) const
The scattering moments for for each layer, for the given wave number.
virtual std::string timer_info() const
Return timer information.
int rows() const
Definition: array_ad.h:368

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