Canoe
Comprehensive Atmosphere N' Ocean Engine
radiation.hpp
Go to the documentation of this file.
1 #ifndef SRC_HARP_RADIATION_HPP_
2 #define SRC_HARP_RADIATION_HPP_
3 
4 // C/C++ headers
5 #include <memory>
6 #include <string>
7 #include <vector>
8 
9 // athena
10 #include <athena/athena.hpp>
11 
12 // harp
13 #include "radiation_band.hpp"
14 
15 class MeshBlock;
16 class ParameterInput;
17 class Hydro;
18 class RadiationBand;
19 
20 class Radiation : public RestartGroup,
21  // public MeshOutputGroup,
22  public CounterGroup,
23  public FlagGroup {
24  public: // public access data
26  static const std::string input_key;
27 
30 
33 
36 
37  public: // constructor and destructor
38  // Radiation() {}
39  Radiation(MeshBlock *pmb, ParameterInput *pin);
40  ~Radiation();
41 
42  public: // member functions
44  size_t GetNumBands() const { return bands_.size(); }
45 
47  std::shared_ptr<RadiationBand> GetBand(int i) const { return bands_[i]; }
48 
50  std::shared_ptr<RadiationBand> GetBandByName(std::string const &name) const;
51 
53  Direction const &GetRayInput(int i) const { return rayInput_[i]; }
54 
56  size_t GetNumOutgoingRays() const;
57 
58  public: // inbound functions
60  void CalRadiativeFlux(MeshBlock const *pmb, int k, int j, int il, int iu);
61 
63  void CalRadiance(MeshBlock const *pmb, int k, int j);
64 
65  public: // outbound functions
67  void AddRadiativeFlux(Hydro *phydro, int k, int j, int il, int iu) const;
68 
69  public: // RestartGroup functions
70  size_t RestartDataSizeInBytes(Mesh const *pm) const override;
71  void DumpRestartData(char *pdst) const override;
72  size_t LoadRestartData(char *psrt) override;
73 
74  protected:
76  std::vector<RadiationBandPtr> bands_;
77 
79  std::vector<Direction> rayInput_;
80 };
81 
82 using RadiationPtr = std::shared_ptr<Radiation>;
83 
84 namespace RadiationFlags {
85 
86 const uint64_t None = 0LL;
87 const uint64_t Dynamic = 1LL << 0;
88 const uint64_t LineByLine = 1LL << 1;
89 const uint64_t CorrelatedK = 1LL << 2;
90 const uint64_t Planck = 1LL << 3;
91 const uint64_t Star = 1LL << 4;
92 const uint64_t Sphere = 1LL << 5;
93 const uint64_t FluxOnly = 1LL << 6;
94 const uint64_t Normalize = 1LL << 7;
95 const uint64_t WriteBinRadiance = 1LL << 8;
96 
99 
100 } // namespace RadiationFlags
101 
102 namespace RadiationHelper {
103 std::vector<Direction> parse_radiation_directions(std::string str);
104 uint64_t parse_radiation_flags(std::string str);
105 void get_phase_momentum(Real *pmom, int iphas, Real gg, int npmom);
106 }; // namespace RadiationHelper
107 
108 #endif // SRC_HARP_RADIATION_HPP_
AthenaArray< Real > flxdn
downward flux of all bands
Definition: radiation.hpp:35
Direction const & GetRayInput(int i) const
Get incoming ray by index.
Definition: radiation.hpp:53
Radiation(MeshBlock *pmb, ParameterInput *pin)
Definition: radiation.cpp:37
size_t RestartDataSizeInBytes(Mesh const *pm) const override
Definition: radiation.cpp:167
std::vector< Direction > rayInput_
incomming rays
Definition: radiation.hpp:79
std::shared_ptr< RadiationBand > GetBandByName(std::string const &name) const
Get band by name.
Definition: radiation.cpp:107
void CalRadiativeFlux(MeshBlock const *pmb, int k, int j, int il, int iu)
Calculate the radiative flux.
Definition: radiation.cpp:124
std::vector< RadiationBandPtr > bands_
all radiation bands
Definition: radiation.hpp:76
void DumpRestartData(char *pdst) const override
Definition: radiation.cpp:171
AthenaArray< Real > flxup
upward flux of all bands
Definition: radiation.hpp:32
std::shared_ptr< RadiationBand > GetBand(int i) const
Get band by index.
Definition: radiation.hpp:47
size_t LoadRestartData(char *psrt) override
Definition: radiation.cpp:181
size_t GetNumOutgoingRays() const
Get total number of incoming rays.
Definition: radiation.cpp:116
static const std::string input_key
radiation input key in the input file [radiation_config]
Definition: radiation.hpp:26
void CalRadiance(MeshBlock const *pmb, int k, int j)
Calculate the radiance.
Definition: radiation.cpp:139
void AddRadiativeFlux(Hydro *phydro, int k, int j, int il, int iu) const
Add the radiative flux to hydro energy flux.
Definition: radiation.cpp:156
size_t GetNumBands() const
Get number of bands.
Definition: radiation.hpp:44
AthenaArray< Real > radiance
radiance of all bands
Definition: radiation.hpp:29
const uint64_t None
Definition: radiation.hpp:86
const uint64_t Sphere
Definition: radiation.hpp:92
const uint64_t Dynamic
Definition: radiation.hpp:87
const uint64_t WriteBinRadiance
Definition: radiation.hpp:95
const uint64_t Star
Definition: radiation.hpp:91
const uint64_t LineByLine
Definition: radiation.hpp:88
const uint64_t FluxOnly
Definition: radiation.hpp:93
const uint64_t Normalize
Definition: radiation.hpp:94
const uint64_t Planck
Definition: radiation.hpp:90
const uint64_t CorrelatedK
Definition: radiation.hpp:89
std::vector< Direction > parse_radiation_directions(std::string str)
Definition: radiation.cpp:195
uint64_t parse_radiation_flags(std::string str)
Definition: radiation.cpp:212
void get_phase_momentum(Real *pmom, int iphas, Real gg, int npmom)
Definition: radiation.cpp:256
std::shared_ptr< Radiation > RadiationPtr
Definition: radiation.hpp:82