Canoe
Comprehensive Atmosphere N' Ocean Engine
physics.hpp
Go to the documentation of this file.
1 #ifndef PHYSICS_HPP
2 #define PHYSICS_HPP
3 
4 // C/C++ headers
5 #include <string>
6 #include <vector>
7 
8 // Athena++ headers
9 #include "../athena.hpp"
10 
11 // Forward declarations
12 class MeshBlock;
13 class ParameterInput;
14 enum class TaskStatus;
15 struct PhysicsPackage;
16 
17 template <typename T>
19 
21 class Physics {
22  public:
23  // data
24  MeshBlock *pmy_block;
26 
27  // functions
28  Physics(MeshBlock *pmb, ParameterInput *pin);
29  ~Physics();
30  void Initialize(AthenaArray<Real> const &w);
31  size_t RestartDataSizeInBytes();
32  size_t DumpRestartData(char *pdst);
33  size_t LoadRestartData(char *psrc);
34 
36  Real time, Real dt);
37 
38  // package functions
40  AthenaArray<Real> const &w, Real time,
41  Real dt);
43  Real time, Real dt);
45  AthenaArray<Real> const &w, Real time,
46  Real dt);
47 
48  TaskStatus TopSpongeLayer(AthenaArray<Real> &du, AthenaArray<Real> const &w,
49  Real time, Real dt);
50  TaskStatus BotSpongeLayer(AthenaArray<Real> &du, AthenaArray<Real> const &w,
51  Real time, Real dt);
52  TaskStatus LeftSpongeLayer(AthenaArray<Real> &du, AthenaArray<Real> const &w,
53  Real time, Real dt);
54  TaskStatus RightSpongeLayer(AthenaArray<Real> &du, AthenaArray<Real> const &w,
55  Real time, Real dt);
56 
57  TaskStatus TopCooling(AthenaArray<Real> &du, AthenaArray<Real> const &w,
58  Real time, Real dt);
59  TaskStatus BotHeating(AthenaArray<Real> &du, AthenaArray<Real> const &w,
60  Real time, Real dt);
61 
62  protected:
63  // package list
64  std::vector<PhysicsPackage> packages_;
65 
66  // bottom boundary condition
69 
70  // parameters for relax bottom temperature
72 
73  // parameters for sponge layer
74  Real tau_top_;
75  Real width_top_;
77  Real tau_bot_;
78  Real width_bot_;
80  Real tau_left_;
81  Real width_left_;
83  Real tau_right_;
84  Real width_right_;
86  // parameters for heating/cooling
87  Real dTdt_;
88  Real flux_top_;
89  Real flux_bot_;
91  // parameters for friction
93 };
94 
97  uint64_t id;
98  uint64_t dep;
99  uint64_t conflict;
100  int cost;
102 
103  // ptr to member function
105  AthenaArray<Real> const &, Real, Real);
106 };
107 
109 const uint64_t NONE = 0LL;
110 const uint64_t FIX_BOT_TEMPERATURE = 1LL << 0;
111 const uint64_t FIX_BOT_VELOCITY = 1LL << 1;
112 const uint64_t FIX_BOT_COMPOSITION = 1LL << 2;
113 const uint64_t TOP_SPONGE_LAYER = 1LL << 3;
114 const uint64_t BOT_SPONGE_LAYER = 1LL << 4;
115 const uint64_t LFT_SPONGE_LAYER = 1LL << 5;
116 const uint64_t RHT_SPONGE_LAYER = 1LL << 6;
117 const uint64_t TOP_COOLING = 1LL << 7;
118 const uint64_t BOT_HEATING = 1LL << 8;
119 } // namespace PhysicsPackageNames
120 
121 #endif
manages all physics package data and functions
Definition: physics.hpp:21
~Physics()
Definition: physics.cpp:10
Real width_bot_
Definition: physics.hpp:78
size_t DumpRestartData(char *pdst)
Definition: physics.cpp:40
AthenaArray< Real > com_bot_
Definition: physics.hpp:68
TaskStatus BotSpongeLayer(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
Real tau_right_
Definition: physics.hpp:83
void ApplyPhysicsPackages(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
Definition: physics.cpp:13
TaskStatus RelaxBotTemperature(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
Real friction_bot_tau_
Definition: physics.hpp:92
TaskStatus RightSpongeLayer(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
Real tau_left_
Definition: physics.hpp:80
MeshBlock * pmy_block
Definition: physics.hpp:24
Real tau_bot_
Definition: physics.hpp:77
Real dTdt_
Definition: physics.hpp:87
TaskStatus TopCooling(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
Real width_right_
Definition: physics.hpp:84
void Initialize(AthenaArray< Real > const &w)
Real tau_Ubot_
Definition: physics.hpp:71
Real Tbot_
Definition: physics.hpp:71
Real tau_Tbot_
Definition: physics.hpp:71
AthenaArray< Real > vel_bot_
Definition: physics.hpp:68
std::vector< PhysicsPackage > packages_
Definition: physics.hpp:64
Real width_left_
Definition: physics.hpp:81
TaskStatus TopSpongeLayer(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
Real width_top_
Definition: physics.hpp:75
TaskStatus RelaxBotVelocity(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
size_t LoadRestartData(char *psrc)
Definition: physics.cpp:45
Real tau_top_
Definition: physics.hpp:74
Real flux_bot_
Definition: physics.hpp:89
AthenaArray< Real > tem_bot_
Definition: physics.hpp:68
TaskStatus LeftSpongeLayer(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
AthenaArray< Real > hydro_bot_
Definition: physics.hpp:67
size_t RestartDataSizeInBytes()
Definition: physics.cpp:33
TaskStatus BotHeating(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
Real tau_Qbot_
Definition: physics.hpp:71
TaskStatus RelaxBotComposition(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
TaskManager< Physics > * ptm
Definition: physics.hpp:25
Real flux_top_
Definition: physics.hpp:88
Physics(MeshBlock *pmb, ParameterInput *pin)
const uint64_t RHT_SPONGE_LAYER
Definition: physics.hpp:116
const uint64_t LFT_SPONGE_LAYER
Definition: physics.hpp:115
const uint64_t BOT_HEATING
Definition: physics.hpp:118
const uint64_t FIX_BOT_TEMPERATURE
Definition: physics.hpp:110
const uint64_t BOT_SPONGE_LAYER
Definition: physics.hpp:114
const uint64_t TOP_SPONGE_LAYER
Definition: physics.hpp:113
const uint64_t FIX_BOT_COMPOSITION
Definition: physics.hpp:112
const uint64_t TOP_COOLING
Definition: physics.hpp:117
const uint64_t NONE
Definition: physics.hpp:109
const uint64_t FIX_BOT_VELOCITY
Definition: physics.hpp:111
task to do on a meshblock
Definition: physics.hpp:96
int cost
cost of this task
Definition: physics.hpp:100
TaskStatus(Physics::* Function)(AthenaArray< Real > &, AthenaArray< Real > const &, Real, Real)
Definition: physics.hpp:104
uint64_t conflict
encodes conflict tasks
Definition: physics.hpp:99
uint64_t dep
encodes dependencies to other tasks
Definition: physics.hpp:98
uint64_t id
encodes task using bit positions
Definition: physics.hpp:97
bool load_balance
whether to do load balance
Definition: physics.hpp:101