ReFRACtor
aerosol_optical.h
Go to the documentation of this file.
1 #ifndef AEROSOL_OPTICAL_H
2 #define AEROSOL_OPTICAL_H
3 #include "aerosol.h"
4 #include "aerosol_property.h"
5 #include "aerosol_extinction.h"
6 #include <limits>
7 #include <vector>
8 
9 namespace FullPhysics {
10 /****************************************************************/
14 class AerosolOptical: public Aerosol,
15  public Observer<Pressure>,
16  public Observer<AerosolExtinction>,
17  public Observer<AerosolProperty> {
18 public:
19  AerosolOptical(const std::vector<boost::shared_ptr<AerosolExtinction> >& Aext,
20  const std::vector<boost::shared_ptr<AerosolProperty> >& Aerosol_prop,
21  const boost::shared_ptr<Pressure>& Press,
23  double Reference_wn = 1e4/0.755);
24  virtual ~AerosolOptical() {}
25  virtual void notify_update(const StateVector& Sv)
26  {
28  notify_update_do(*this);
29  }
30 
32  const;
33  virtual ArrayAd<double, 1>
34  ssa_each_layer(double wn, int particle_index,
35  const ArrayAd<double, 1>& Od) const;
36  virtual ArrayAd<double, 1>
37  ssa_each_layer(double wn) const;
38 
39 //-----------------------------------------------------------------------
43 //-----------------------------------------------------------------------
44 
45  virtual void notify_update(const Pressure& P)
46  {
47  cache_is_stale = true;
48  notify_update_do(*this);
49  }
50  virtual void notify_update(const AerosolExtinction& A)
51  {
52  cache_is_stale = true;
53  notify_update_do(*this);
54  }
55  virtual void notify_update(const AerosolProperty& A)
56  {
57  cache_is_stale = true;
58  notify_update_do(*this);
59  }
60 
61  virtual ArrayAd<double, 3> pf_mom(double wn, int pindex) const;
62  virtual blitz::Array<double, 3> pf_mom(double wn,
63  const blitz::Array<double, 2>& frac_aer) const;
64  virtual ArrayAd<double, 3> pf_mom(double wn,
65  const ArrayAd<double, 2>& frac_aer,
66  int nummom = -1, int numscat = -1) const;
67  virtual int number_particle() const { return (int) aext.size(); }
68 
69  virtual void print(std::ostream& Os) const;
70 
71 //-----------------------------------------------------------------------
72 // Optical depth of each aerosol type or total
73 //-----------------------------------------------------------------------
75  (int aer_idx,
76  double pmin = std::numeric_limits<double>::min(),
77  double pmax = std::numeric_limits<double>::max()) const;
79  (double pmin = std::numeric_limits<double>::min(),
80  double pmax = std::numeric_limits<double>::max()) const;
81 
82 //-----------------------------------------------------------------------
86 //-----------------------------------------------------------------------
87 
89  { return clone(press->clone(), rh->clone()); }
92  const boost::shared_ptr<RelativeHumidity>& Rh) const;
93  std::vector<std::string> aerosol_name() const;
94 
95  blitz::Array<std::string, 1> aerosol_name_arr() const;
96 
97 //-----------------------------------------------------------------------
99 //-----------------------------------------------------------------------
101  { range_check(i, 0, number_particle()); return aext[i];}
102 
103 //-----------------------------------------------------------------------
105 //-----------------------------------------------------------------------
106 
108  { range_check(i, 0, number_particle()); aext[i] = V;
109  cache_is_stale = true; notify_update_do(*this); }
110 
111 //-----------------------------------------------------------------------
113 //-----------------------------------------------------------------------
114 
116  { range_check(i, 0, number_particle()); return aprop[i];}
117 
118 //-----------------------------------------------------------------------
120 //-----------------------------------------------------------------------
121 
123  { range_check(i, 0, number_particle()); aprop[i] = V;
124  cache_is_stale = true; notify_update_do(*this); }
125 
126 //-----------------------------------------------------------------------
128 //-----------------------------------------------------------------------
129 
131  { return press; }
132 private:
133  std::vector<boost::shared_ptr<AerosolExtinction> > aext;
134  std::vector<boost::shared_ptr<AerosolProperty> > aprop;
137  double reference_wn_;
138  // We cache to part of optical_depth_each_layer calculation that
139  // independent of wn.
140  mutable bool cache_is_stale;
141  mutable ArrayAd<double, 2> od_ind_wn;
142  mutable int nlay;
143  void fill_cache() const;
144  int nvar;
145 };
146 }
147 #endif
#define range_check(V, Min, Max)
Range check.
Definition: fp_exception.h:140
virtual void notify_update(const Pressure &P)
For performance, we cache some data as we calculate it.
This gives the Aerosol properties for an Aerosol.
blitz::Array< std::string, 1 > aerosol_name_arr() const
Aerosol names, plus the string "total" as the 1st entry.
const ArrayAd< double, 1 > & state_with_derivative() const
Return the state vector as state() does, but also make each value a AutoDerivative.
Definition: state_vector.h:45
void aerosol_extinction(int i, const boost::shared_ptr< AerosolExtinction > &V)
Set AerosolExtinction.
virtual void print(std::ostream &Os) const
std::vector< std::string > aerosol_name() const
Name of aerosols.
const boost::shared_ptr< Pressure > & pressure() const
Return pressure.
double aerosol_optical_depth_total(double pmin=std::numeric_limits< double >::min(), double pmax=std::numeric_limits< double >::max()) const
This gives the total optical depth for each particle, plus adds the total optical depth for all parti...
void notify_update_do(const Aerosol &Self)
Function to call to notify Observers of a state change.
Definition: observer.h:121
double aerosol_optical_depth(int aer_idx, double pmin=std::numeric_limits< double >::min(), double pmax=std::numeric_limits< double >::max()) const
This gives the total aerosol optical depth for a given particle.
void aerosol_property(int i, const boost::shared_ptr< AerosolProperty > &V)
Set AerosolProperty.
AerosolOptical(const std::vector< boost::shared_ptr< AerosolExtinction > > &Aext, const std::vector< boost::shared_ptr< AerosolProperty > > &Aerosol_prop, const boost::shared_ptr< Pressure > &Press, const boost::shared_ptr< RelativeHumidity > &Rh, double Reference_wn=1e4/0.755)
Create an aerosol.
const Unit A("A", 1.0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0)
virtual void notify_update(const AerosolExtinction &A)
Called when the Observed object is updated.
This class maintains the aerosol portion of the state.
Definition: aerosol.h:24
virtual ArrayAd< double, 2 > optical_depth_each_layer(double wn) const
This gives the optical depth for each layer, for the given wave number.
virtual boost::shared_ptr< Aerosol > clone() const
Clone a Aerosol object.
const boost::shared_ptr< AerosolProperty > & aerosol_property(int i) const
Return aerosol property.
Implementation of Aerosol.
This handles informing a set of interested objects when the state vector has updated.
Definition: state_vector.h:16
int number_variable() const
Definition: array_ad.h:376
virtual void notify_update(const AerosolProperty &A)
Called when the Observed object is updated.
This class maintains the pressure portion of the state.
Definition: pressure.h:32
virtual int number_particle() const
Number of aerosol particles.
virtual ArrayAd< double, 3 > pf_mom(double wn, int pindex) const
This calculates the portion of the phase function moments that come from the aerosol for a single par...
Contains classes to abstract away details in various Spurr Radiative Transfer software.
Definition: doxygen_python.h:1
const boost::shared_ptr< AerosolExtinction > & aerosol_extinction(int i) const
Return aerosol extinction.
This class maps the state vector to the aerosol extinction on each level.
Simple Mixin to be and Observer of another object of class T.
Definition: observer.h:29
virtual void notify_update(const StateVector &Sv)
Called when the Observed object is updated.
virtual ArrayAd< double, 1 > ssa_each_layer(double wn, int particle_index, const ArrayAd< double, 1 > &Od) const
This gives the single scatter albedo for each layer, for the given wave number, for the given particl...

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