Canoe
Comprehensive Atmosphere N' Ocean Engine
relax_bot_temperature.cpp
Go to the documentation of this file.
1 #include "../communicator/communicator.hpp"
2 #include "../coordinates/coordinates.hpp"
3 #include "../debugger/debugger.hpp"
4 #include "../eos/eos.hpp"
5 #include "../hydro/hydro.hpp"
6 #include "../mesh/mesh.hpp"
7 #include "../thermodynamics/thermodynamics.hpp"
8 #include "physics.hpp"
9 
11  AthenaArray<Real> const &w, Real time,
12  Real dt) {
13  MeshBlock *pmb = pmy_block;
14  NeighborBlock const *pbot = pmb->pcomm->findBotNeighbor();
15  if (pbot != nullptr) return TaskStatus::success;
16 
17  pmb->pdebug->Call("Physics::RelaxBotTemperature");
18 
19  Thermodynamics *pthermo = pmb->pthermo;
20 
21  int is = pmb->is;
22  int js = pmb->js;
23  int ks = pmb->ks;
24  int ie = pmb->ie;
25  int je = pmb->je;
26  int ke = pmb->ke;
27 
28  Real Rd = pthermo->GetRd();
29  Real gamma = pmb->peos->GetGamma();
30  Real cv, tem;
31 
32  if (Tbot_ < 0.) {
33  for (int k = ks; k <= ke; ++k)
34  for (int j = js; j <= je; ++j) {
35  cv = pthermo->getSpecificCv(w.at(k, j, ie));
36  tem = pthermo->GetTemp(w.at(k, j, js));
37  du(IEN, k, j, is) += dt / tau_Tbot_ * (tem_bot_(k, j) - tem) * cv;
38  }
39  } else {
40  for (int k = ks; k <= ke; ++k)
41  for (int j = js; j <= je; ++j) {
42  cv = pthermo->getSpecificCv(w.at(k, j, ie));
43  tem = pthermo->GetTemp(w.at(k, j, js));
44  du(IEN, k, j, is) += dt / tau_Tbot_ * (Tbot_ - tem) * cv;
45  }
46  }
47 
48 #if DEBUG_LEVEL > 2
49  pmb->pdebug->CheckConservation("du", du, is, ie, js, je, ks, ke);
50 #endif
51  pmb->pdebug->Leave();
52  return TaskStatus::success;
53 }
TaskStatus RelaxBotTemperature(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
MeshBlock * pmy_block
Definition: physics.hpp:24
Real Tbot_
Definition: physics.hpp:71
Real tau_Tbot_
Definition: physics.hpp:71
AthenaArray< Real > tem_bot_
Definition: physics.hpp:68
Real GetRd() const
Real GetTemp(MeshBlock const *pmb, int k, int j, int i) const
Calculate temperature from primitive variable.
Real Rd
Definition: straka.cpp:66