Canoe
Comprehensive Atmosphere N' Ocean Engine
rt_solvers.hpp
Go to the documentation of this file.
1 #ifndef SRC_HARP_RT_SOLVERS_HPP_
2 #define SRC_HARP_RT_SOLVERS_HPP_
3 
4 // C/C++
5 #include <string>
6 
7 // athena
8 #include <athena/athena.hpp>
9 
10 // application
11 #include <application/application.hpp>
12 
13 // canoe
14 #include <configure.hpp>
15 #include <virtual_groups.hpp>
16 
17 // cppdisort
18 #ifdef RT_DISORT
19 #include <cppdisort/cppdisort.hpp>
20 #endif
21 
22 // harp
23 #include "radiation_band.hpp"
24 
26  public: // constructor and destructor
27  RTSolver(RadiationBand *pmy_band, std::string name)
28  : NamedGroup(name), pmy_band_(pmy_band) {
29  Application::Logger app("harp");
30  app->Log("Initialize RTSolver " + GetName());
31 
32  farea_.NewAthenaArray(pmy_band_->GetNumLayers() + 2 * NGHOST);
33  vol_.NewAthenaArray(pmy_band_->GetNumLayers() + 2 * NGHOST);
34  }
35 
36  virtual ~RTSolver() {
37  Application::Logger app("harp");
38  app->Log("Destroy RTSolver " + GetName());
39  }
40 
41  public: // member functions
43  virtual void Prepare(MeshBlock const *pmb, int k, int j) {}
44 
46  virtual void Resize(int nlyr, int nstr, int nuphi, int numu) {}
47 
48  public: // inbound functions
49  virtual void CalBandFlux(MeshBlock const *pmb, int k, int j, int il, int iu) {
50  }
51 
52  virtual void CalBandRadiance(MeshBlock const *pmb, int k, int j) {}
53 
54  protected:
58 };
59 
61  public: // constructor and destructor
62  RTSolverLambert(RadiationBand *pmy_band, YAML::Node const &rad)
63  : RTSolver(pmy_band, "Lambert") {}
65 
66  public: // inbound functions
67  void CalBandFlux(MeshBlock const *pmb, int k, int j, int il, int iu) override;
68 
69  void CalBandRadiance(MeshBlock const *pmb, int k, int j) override;
70 };
71 
72 #ifdef RT_DISORT
73 class RadiationBand::RTSolverDisort : public RadiationBand::RTSolver,
74  protected DisortWrapper {
75  public: // constructor and destructor
76  RTSolverDisort(RadiationBand *pmy_band, YAML::Node const &rad);
77  ~RTSolverDisort() {}
78 
79  public: // member functions
80  void Prepare(MeshBlock const *pmb, int k, int j) override;
81  void Resize(int nlyr, int nstr, int nuphi, int numu) override;
82 
83  public: // inbound functions
84  void CalBandFlux(MeshBlock const *pmb, int k, int j, int il, int iu) override;
85  void CalBandRadiance(MeshBlock const *pmb, int k, int j) override;
86 
87  protected:
88  void setFlagsFromNode(YAML::Node const &flags);
89 
90  void addDisortFlux(Coordinates const *pcoord, int n, int k, int j, int il,
91  int iu);
92 
93  void addDisortRadiance(Coordinates const *pcoord, int n, int k, int j);
94 };
95 #endif
96 
97 #endif // SRC_HARP_RT_SOLVERS_HPP_
std::string GetName() const
void CalBandFlux(MeshBlock const *pmb, int k, int j, int il, int iu) override
RTSolverLambert(RadiationBand *pmy_band, YAML::Node const &rad)
Definition: rt_solvers.hpp:62
void CalBandRadiance(MeshBlock const *pmb, int k, int j) override
virtual void Prepare(MeshBlock const *pmb, int k, int j)
Prepare and seal the solver for the current column.
Definition: rt_solvers.hpp:43
virtual void Resize(int nlyr, int nstr, int nuphi, int numu)
Allocate memory for radiation solver.
Definition: rt_solvers.hpp:46
virtual void CalBandRadiance(MeshBlock const *pmb, int k, int j)
Definition: rt_solvers.hpp:52
RadiationBand * pmy_band_
Definition: rt_solvers.hpp:55
AthenaArray< Real > vol_
Definition: rt_solvers.hpp:56
AthenaArray< Real > farea_
Definition: rt_solvers.hpp:56
virtual void CalBandFlux(MeshBlock const *pmb, int k, int j, int il, int iu)
Definition: rt_solvers.hpp:49
RTSolver(RadiationBand *pmy_band, std::string name)
Definition: rt_solvers.hpp:27
size_t GetNumLayers() const
Get number of phase function moments.