2 #include "../communicator/communicator.hpp"
3 #include "../coordinates/coordinates.hpp"
4 #include "../debugger/debugger.hpp"
5 #include "../globals.hpp"
6 #include "../math/core.h"
7 #include "../mesh/mesh.hpp"
14 NeighborBlock
const *ptop = pmb->pcomm->findTopNeighbor();
15 if (ptop !=
nullptr)
return TaskStatus::success;
17 pmb->pdebug->Call(
"Physics::TopSpongerLayer");
19 Real x1max = pmb->block_size.x1max;
21 for (
int k = pmb->ks; k <= pmb->ke; ++k)
22 for (
int j = pmb->js; j <= pmb->je; ++
j)
23 for (
int i = pmb->ie; i >= pmb->is; --i) {
27 Real scale =
sqr(sin(M_PI / 2. * eta));
29 w(IDN, k,
j, i) * w(IVX, k,
j, i) /
tau_top_ * scale * dt;
31 w(IDN, k,
j, i) * w(IVY, k,
j, i) /
tau_top_ * scale * dt;
33 w(IDN, k,
j, i) * w(IVZ, k,
j, i) /
tau_top_ * scale * dt;
37 pmb->pdebug->CheckConservation(
"du", du, pmb->is, pmb->ie, pmb->js, pmb->je,
41 return TaskStatus::success;
48 NeighborBlock
const *pbot = pmb->pcomm->findBotNeighbor();
49 if (pbot !=
nullptr)
return TaskStatus::success;
51 pmb->pdebug->Call(
"Physics::BotSpongeLayer");
53 Real x1min = pmb->block_size.x1min;
55 for (
int k = pmb->ks; k <= pmb->ke; ++k)
56 for (
int j = pmb->js; j <= pmb->je; ++
j)
57 for (
int i = pmb->is; i <= pmb->ie; ++i) {
61 Real scale =
sqr(sin(M_PI / 2. * eta));
63 w(IDN, k,
j, i) * w(IVX, k,
j, i) /
tau_bot_ * scale * dt;
65 w(IDN, k,
j, i) * w(IVY, k,
j, i) /
tau_bot_ * scale * dt;
67 w(IDN, k,
j, i) * w(IVZ, k,
j, i) /
tau_bot_ * scale * dt;
71 pmb->pdebug->CheckConservation(
"du", du, pmb->is, pmb->ie, pmb->js, pmb->je,
75 return TaskStatus::success;
82 NeighborBlock
const *pleft = pmb->pcomm->findLeftNeighbor();
83 if (pleft !=
nullptr)
return TaskStatus::success;
85 pmb->pdebug->Call(
"Physics::LeftSpongerLayer");
87 Real x2min = pmb->block_size.x2min;
89 for (
int k = pmb->ks; k <= pmb->ke; ++k)
90 for (
int j = pmb->js; j <= pmb->je; ++
j) {
93 for (
int i = pmb->is; i <= pmb->ie; ++i) {
94 Real scale =
sqr(sin(M_PI / 2. * eta));
96 w(IDN, k,
j, i) * w(IVX, k,
j, i) /
tau_left_ * scale * dt;
98 w(IDN, k,
j, i) * w(IVY, k,
j, i) /
tau_left_ * scale * dt;
100 w(IDN, k,
j, i) * w(IVZ, k,
j, i) /
tau_left_ * scale * dt;
105 pmb->pdebug->CheckConservation(
"du", du, pmb->is, pmb->ie, pmb->js, pmb->je,
108 pmb->pdebug->Leave();
109 return TaskStatus::success;
116 NeighborBlock
const *pright = pmb->pcomm->findRightNeighbor();
117 if (pright !=
nullptr)
return TaskStatus::success;
119 pmb->pdebug->Call(
"Physics::RightSpongeLayer");
121 Real x2max = pmb->block_size.x2max;
123 for (
int k = pmb->ks; k <= pmb->ke; ++k)
124 for (
int j = pmb->je; j <= pmb->js; --
j) {
127 for (
int i = pmb->is; i <= pmb->ie; ++i) {
128 Real scale =
sqr(sin(M_PI / 2. * eta));
130 w(IDN, k,
j, i) * w(IVX, k,
j, i) /
tau_right_ * scale * dt;
132 w(IDN, k,
j, i) * w(IVY, k,
j, i) /
tau_right_ * scale * dt;
134 w(IDN, k,
j, i) * w(IVZ, k,
j, i) /
tau_right_ * scale * dt;
138 #if (DEBUG_LEVEL > 1)
139 pmb->pdebug->CheckConservation(
"du", du, pmb->is, pmb->ie, pmb->js, pmb->je,
142 pmb->pdebug->Leave();
143 return TaskStatus::success;
TaskStatus BotSpongeLayer(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 TopSpongeLayer(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)
TaskStatus LeftSpongeLayer(AthenaArray< Real > &du, AthenaArray< Real > const &w, Real time, Real dt)