Canoe
Comprehensive Atmosphere N' Ocean Engine
water_cloud.hpp
Go to the documentation of this file.
1 #ifndef SRC_OPACITY_WATER_CLOUD_HPP_
2 #define SRC_OPACITY_WATER_CLOUD_HPP_
3 
4 // C/C++
5 #include <string>
6 #include <vector>
7 
8 // canoe
9 #include <air_parcel.hpp>
10 
11 // harp
12 #include "absorber.hpp"
13 
14 class SimpleCloud : public Absorber {
15  public:
16  SimpleCloud() : Absorber("H2O(c,p)") {}
17 
18  Real GetAttenuation(Real wave1, Real wave2,
19  AirParcel const& var) const override {
20  return getAttenuation1((wave1 + wave2) / 2, var);
21  }
22 
23  Real GetSingleScatteringAlbedo(Real wave1, Real wave2,
24  AirParcel const& var) const override {
25  return getSingleScatteringAlbedo1((wave1 + wave2) / 2., var);
26  }
27 
28  void GetPhaseMomentum(Real* pp, Real wave1, Real wave2, AirParcel const& var,
29  int np) const override {
30  getPhaseMomentum1(pp, (wave1 + wave2) / 2., var, np);
31  }
32 
33  protected:
34  Real getAttenuation1(Real wave, AirParcel const& var) const;
35  Real getSingleScatteringAlbedo1(Real wave, AirParcel const& var) const;
36  void getPhaseMomentum1(Real* pp, Real wave, AirParcel const& var,
37  int np) const;
38 };
39 
40 class FuWaterLiquidCloud : public Absorber {
41  public:
42  FuWaterLiquidCloud() : Absorber("H2O(l)") {}
43 
44  Real GetAttenuation(Real wave1, Real wave2,
45  AirParcel const& var) const override {
46  return getAttenuation1((wave1 + wave2) / 2, var);
47  }
48 
49  Real GetSingleScatteringAlbedo(Real wave1, Real wave2,
50  AirParcel const& var) const override {
51  return getSingleScatteringAlbedo1((wave1 + wave2) / 2., var);
52  }
53 
54  void GetPhaseMomentum(Real* pp, Real wave1, Real wave2, AirParcel const& var,
55  int np) const override {
56  getPhaseMomentum1(pp, (wave1 + wave2) / 2., var, np);
57  }
58 
59  protected:
60  Real getAttenuation1(Real wave, AirParcel const& var) const;
61  Real getSingleScatteringAlbedo1(Real wave, AirParcel const& var) const;
62  void getPhaseMomentum1(Real* pp, Real wave, AirParcel const& var,
63  int np) const;
64 };
65 
66 class FuWaterIceCloud : public Absorber {
67  public:
68  FuWaterIceCloud() : Absorber("H2O(s)") {}
69 
70  Real GetAttenuation(Real wave1, Real wave2,
71  AirParcel const& var) const override {
72  return getAttenuation1((wave1 + wave2) / 2, var);
73  }
74 
75  Real GetSingleScatteringAlbedo(Real wave1, Real wave2,
76  AirParcel const& var) const override {
77  return getSingleScatteringAlbedo1((wave1 + wave2) / 2., var);
78  }
79 
80  void GetPhaseMomentum(Real* pp, Real wave1, Real wave2, AirParcel const& var,
81  int np) const override {
82  getPhaseMomentum1(pp, (wave1 + wave2) / 2., var, np);
83  }
84 
85  protected:
86  Real getAttenuation1(Real wave, AirParcel const& var) const;
87  Real getSingleScatteringAlbedo1(Real wave, AirParcel const& var) const;
88  void getPhaseMomentum1(Real* pp, Real wave, AirParcel const& var,
89  int np) const;
90 
91  protected:
92  size_t len_[2];
93  std::vector<Real> axis_;
94  std::vector<Real> ssalb_;
95  std::vector<Real> gg_;
96 };
97 
98 class XuWaterIceCloud : public Absorber {
99  public:
100  XuWaterIceCloud() : Absorber("H2O(s)") {}
101 
102  void LoadCoefficient(std::string fname, size_t bid) override;
103 
104  Real GetAttenuation(Real wave1, Real wave2,
105  AirParcel const& var) const override {
106  return getAttenuation1((wave1 + wave2) / 2, var);
107  }
108 
109  Real GetSingleScatteringAlbedo(Real wave1, Real wave2,
110  AirParcel const& var) const override {
111  return getSingleScatteringAlbedo1((wave1 + wave2) / 2., var);
112  }
113 
114  void GetPhaseMomentum(Real* pp, Real wave1, Real wave2, AirParcel const& var,
115  int np) const override {
116  getPhaseMomentum1(pp, (wave1 + wave2) / 2., var, np);
117  }
118 
119  protected:
120  Real getAttenuation1(Real wave, AirParcel const& var) const;
121  Real getSingleScatteringAlbedo1(Real wave, AirParcel const& var) const;
122  void getPhaseMomentum1(Real* pp, Real wave, AirParcel const& var,
123  int np) const;
124 
125  protected:
126  size_t len_[2];
127  std::vector<Real> axis_;
128  std::vector<Real> ssalb_;
129  std::vector<Real> gg_;
130 };
131 
132 #endif // SRC_OPACITY_WATER_CLOUD_HPP_
base class of all absorbers
Definition: absorber.hpp:25
Real GetSingleScatteringAlbedo(Real wave1, Real wave2, AirParcel const &var) const override
Get single scattering albedo [1].
Definition: water_cloud.hpp:75
size_t len_[2]
Definition: water_cloud.hpp:92
Real GetAttenuation(Real wave1, Real wave2, AirParcel const &var) const override
Get attenuation coefficient [1/m].
Definition: water_cloud.hpp:70
void getPhaseMomentum1(Real *pp, Real wave, AirParcel const &var, int np) const
Real getSingleScatteringAlbedo1(Real wave, AirParcel const &var) const
void GetPhaseMomentum(Real *pp, Real wave1, Real wave2, AirParcel const &var, int np) const override
Get phase function [1].
Definition: water_cloud.hpp:80
Real getAttenuation1(Real wave, AirParcel const &var) const
std::vector< Real > axis_
Definition: water_cloud.hpp:93
std::vector< Real > ssalb_
Definition: water_cloud.hpp:94
std::vector< Real > gg_
Definition: water_cloud.hpp:95
Real GetAttenuation(Real wave1, Real wave2, AirParcel const &var) const override
Get attenuation coefficient [1/m].
Definition: water_cloud.hpp:44
void GetPhaseMomentum(Real *pp, Real wave1, Real wave2, AirParcel const &var, int np) const override
Get phase function [1].
Definition: water_cloud.hpp:54
Real GetSingleScatteringAlbedo(Real wave1, Real wave2, AirParcel const &var) const override
Get single scattering albedo [1].
Definition: water_cloud.hpp:49
void getPhaseMomentum1(Real *pp, Real wave, AirParcel const &var, int np) const
Real getAttenuation1(Real wave, AirParcel const &var) const
Real getSingleScatteringAlbedo1(Real wave, AirParcel const &var) const
void getPhaseMomentum1(Real *pp, Real wave, AirParcel const &var, int np) const
Real GetAttenuation(Real wave1, Real wave2, AirParcel const &var) const override
Get attenuation coefficient [1/m].
Definition: water_cloud.hpp:18
void GetPhaseMomentum(Real *pp, Real wave1, Real wave2, AirParcel const &var, int np) const override
Get phase function [1].
Definition: water_cloud.hpp:28
Real getAttenuation1(Real wave, AirParcel const &var) const
Real getSingleScatteringAlbedo1(Real wave, AirParcel const &var) const
Real GetSingleScatteringAlbedo(Real wave1, Real wave2, AirParcel const &var) const override
Get single scattering albedo [1].
Definition: water_cloud.hpp:23
std::vector< Real > axis_
void LoadCoefficient(std::string fname, size_t bid) override
Load absorption coefficient from file.
Real getAttenuation1(Real wave, AirParcel const &var) const
std::vector< Real > ssalb_
void GetPhaseMomentum(Real *pp, Real wave1, Real wave2, AirParcel const &var, int np) const override
Get phase function [1].
Real GetSingleScatteringAlbedo(Real wave1, Real wave2, AirParcel const &var) const override
Get single scattering albedo [1].
Real getSingleScatteringAlbedo1(Real wave, AirParcel const &var) const
std::vector< Real > gg_
void getPhaseMomentum1(Real *pp, Real wave, AirParcel const &var, int np) const
Real GetAttenuation(Real wave1, Real wave2, AirParcel const &var) const override
Get attenuation coefficient [1/m].