2 #include "../athena.hpp"
3 #include "../debugger/debugger.hpp"
4 #include "../mesh/mesh.hpp"
5 #include "../parameter_input.hpp"
6 #include "../task_list/task_manager.hpp"
7 #include "../thermodynamics/thermodynamics.hpp"
13 pmb->pdebug->Enter(
"Physics");
14 std::stringstream &msg = pmb->pdebug->msg;
15 char package_names[1024], *
p;
16 std::string str = pin->GetOrAddString(
"physics",
"packages",
"");
17 std::strcpy(package_names, str.c_str());
18 p = std::strtok(package_names,
" ,");
24 if (std::strcmp(
p,
"fix_bot_temperature") == 0) {
25 msg <<
"- use physcis fix_bot_temperature" << std::endl;
30 ptm->AddPackage(pkg,
"fix_bot_temperature");
32 tau_Tbot_ = pin->GetReal(
"physics",
"fix_bot_temperature.tau");
34 Tbot_ = pin->GetOrAddReal(
"physics",
"bot_temperature", -1);
36 hydro_bot_.NewAthenaArray(NHYDRO, pmb->ncells3, pmb->ncells2);
37 msg <<
"- tau = " <<
tau_Tbot_ <<
" s" << std::endl;
39 }
else if (std::strcmp(
p,
"fix_bot_velocity") == 0) {
40 msg <<
"- use physcis fix_bot_velocity" << std::endl;
45 ptm->AddPackage(pkg,
"fix_bot_velocity");
47 tau_Ubot_ = pin->GetReal(
"physics",
"fix_bot_velocity.tau");
49 hydro_bot_.NewAthenaArray(NHYDRO, pmb->ncells3, pmb->ncells2);
51 }
else if (std::strcmp(
p,
"fix_bot_composition") == 0) {
52 msg <<
"- use physcis fix_bot_composition" << std::endl;
57 ptm->AddPackage(pkg,
"fix_bot_composition");
59 tau_Ubot_ = pin->GetReal(
"physics",
"fix_bot_composition.tau");
61 hydro_bot_.NewAthenaArray(NHYDRO, pmb->ncells3, pmb->ncells2);
63 }
else if (std::strcmp(
p,
"top_sponge") == 0) {
64 msg <<
"- use physcis top_sponge" << std::endl;
69 ptm->AddPackage(pkg,
"top_sponge");
71 tau_top_ = pin->GetReal(
"physics",
"top_sponge.tau");
72 width_top_ = pin->GetReal(
"physics",
"top_sponge.width");
73 }
else if (std::strcmp(
p,
"bot_sponge") == 0) {
74 msg <<
"- use physcis bot_sponge" << std::endl;
79 ptm->AddPackage(pkg,
"bot_sponge");
81 tau_bot_ = pin->GetReal(
"physics",
"bot_sponge.tau");
82 width_bot_ = pin->GetReal(
"physics",
"bot_sponge.width");
83 }
else if (std::strcmp(
p,
"left_sponge") == 0) {
84 msg <<
"- use physcis left_sponge" << std::endl;
89 ptm->AddPackage(pkg,
"left_sponge");
91 tau_left_ = pin->GetReal(
"physics",
"left_sponge.tau");
92 width_left_ = pin->GetReal(
"physics",
"left_sponge.width");
93 }
else if (std::strcmp(
p,
"right_sponge") == 0) {
94 msg <<
"- use physcis right_sponge" << std::endl;
99 ptm->AddPackage(pkg,
"right_sponge");
101 tau_right_ = pin->GetReal(
"physics",
"right_sponge.tau");
102 width_right_ = pin->GetReal(
"physics",
"right_sponge.width");
103 }
else if (std::strcmp(
p,
"top_cooling") == 0) {
104 msg <<
"- use physcis top_cooling" << std::endl;
109 ptm->AddPackage(pkg,
"top_cooling");
113 flux_top_ = pin->GetReal(
"physics",
"top_cooling.flux");
114 }
else if (std::strcmp(
p,
"bot_heating") == 0) {
115 msg <<
"- use physcis bot_heating" << std::endl;
120 ptm->AddPackage(pkg,
"bot_heating");
122 flux_bot_ = pin->GetReal(
"physics",
"bot_heating.flux");
124 msg <<
"### FATAL ERROR in function Physics::Physics" << std::endl
125 <<
"Package '" <<
p <<
"' "
126 <<
"unrecognized." << std::endl;
130 p = std::strtok(NULL,
" ,");
132 pmb->pdebug->Leave();
160 for (
int k = pmb->ks; k <= pmb->ke; ++k)
161 for (
int j = pmb->js; j <= pmb->je; ++
j) {
163 tem_bot_(k,
j) = pmb->pthermo->GetTemp(w.at(k,
j, pmb->is));
170 for (
int n = 1; n <= NVAPOR; ++n)
AthenaArray< Real > com_bot_
TaskStatus BotSpongeLayer(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
TaskStatus RelaxBotTemperature(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
TaskStatus RightSpongeLayer(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
TaskStatus TopCooling(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
void Initialize(AthenaArray< Real > const &w)
AthenaArray< Real > vel_bot_
std::vector< PhysicsPackage > packages_
TaskStatus TopSpongeLayer(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
AthenaArray< Real > tem_bot_
TaskStatus LeftSpongeLayer(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
AthenaArray< Real > hydro_bot_
TaskStatus BotHeating(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
TaskManager< Physics > * ptm
Physics(MeshBlock *pmb, ParameterInput *pin)
const uint64_t RHT_SPONGE_LAYER
const uint64_t LFT_SPONGE_LAYER
const uint64_t BOT_HEATING
const uint64_t FIX_BOT_TEMPERATURE
const uint64_t BOT_SPONGE_LAYER
const uint64_t TOP_SPONGE_LAYER
const uint64_t FIX_BOT_COMPOSITION
const uint64_t TOP_COOLING
const uint64_t FIX_BOT_VELOCITY
task to do on a meshblock
TaskStatus(Physics::* Function)(AthenaArray< Real > &, AthenaArray< Real > const &, Real, Real)
uint64_t conflict
encodes conflict tasks
uint64_t dep
encodes dependencies to other tasks
uint64_t id
encodes task using bit positions