Canoe
Comprehensive Atmosphere N' Ocean Engine
heating_cooling.cpp
Go to the documentation of this file.
1 // Athena++ headers
2 #include "../communicator/communicator.hpp"
3 #include "../coordinates/coordinates.hpp"
4 #include "../debugger/debugger.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, Real dt) {
12  MeshBlock *pmb = pmy_block;
13  NeighborBlock const *ptop = pmb->pcomm->findTopNeighbor();
14  if (ptop != nullptr) return TaskStatus::success;
15 
16  pmb->pdebug->Call("Physics::TopCooling");
17 
18  Coordinates *pcoord = pmb->pcoord;
19  int is = pmb->is;
20  int js = pmb->js;
21  int ks = pmb->ks;
22  int ie = pmb->ie;
23  int je = pmb->je;
24  int ke = pmb->ke;
25 
26  for (int k = ks; k <= ke; ++k)
27  for (int j = js; j <= je; ++j) {
28  // Real cv = pthermo->GetMeanCv(w.at(k,j,ie));
29  // du(IEN,k,j,ie) -= dt*dTdt_*w(IDN,k,j,ie)*cv;
30  du(IEN, k, j, ie) += dt * flux_top_ * pcoord->GetFace1Area(k, j, ie + 1) /
31  pcoord->GetCellVolume(k, j, ie);
32  }
33 
34 #if DEBUG_LEVEL > 2
35  pmb->pdebug->CheckConservation("du", du, is, ie, js, je, ks, ke);
36 #endif
37  pmb->pdebug->Leave();
38  return TaskStatus::success;
39 }
40 
42  AthenaArray<Real> const &w, Real time, Real dt) {
43  MeshBlock *pmb = pmy_block;
44  NeighborBlock const *pbot = pmb->pcomm->findBotNeighbor();
45  if (pbot != nullptr) return TaskStatus::success;
46 
47  pmb->pdebug->Call("Physics::BotHeating");
48 
49  Coordinates *pcoord = pmb->pcoord;
50  int is = pmb->is;
51  int js = pmb->js;
52  int ks = pmb->ks;
53  int ie = pmb->ie;
54  int je = pmb->je;
55  int ke = pmb->ke;
56 
57  for (int k = ks; k <= ke; ++k)
58  for (int j = js; j <= je; ++j) {
59  du(IEN, k, j, is) += dt * flux_bot_ * pcoord->GetFace1Area(k, j, is) /
60  pcoord->GetCellVolume(k, j, is);
61  }
62 
63 #if DEBUG_LEVEL > 2
64  pmb->pdebug->CheckConservation("du", du, is, ie, js, je, ks, ke);
65 #endif
66  pmb->pdebug->Leave();
67  return TaskStatus::success;
68 }
MeshBlock * pmy_block
Definition: physics.hpp:24
TaskStatus TopCooling(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
Real flux_bot_
Definition: physics.hpp:89
TaskStatus BotHeating(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
Real flux_top_
Definition: physics.hpp:88