6 #include <athena/coordinates/coordinates.hpp>
7 #include <athena/hydro/hydro.hpp>
8 #include <athena/stride_iterator.hpp>
17 #include "../thermodynamics/thermodynamics.hpp"
22 int jl,
int ju,
int il,
int iu) {
23 for (
int k = kl; k <= ku; ++k)
24 for (
int j = jl;
j <= ju; ++
j)
25 for (
int i = il; i <= iu; ++i)
26 psf(k,
j, i + 1) = psf(k,
j, i) - grav * w(IDN, k,
j, i) * pco->dx1f(i);
31 Real grav,
int kl,
int ku,
int jl,
int ju,
33 for (
int k = kl; k <= ku; ++k)
34 for (
int j = jl;
j <= ju; ++
j)
35 for (
int i = iu; i >= il; --i)
36 psf(k,
j, i) = psf(k,
j, i + 1) + grav * w(IDN, k,
j, i) * pco->dx1f(i);
45 Real grav = -pmb->phydro->hsrc.GetG1();
47 int is = pmb->is, ie = pmb->ie;
48 if (grav == 0.)
return;
50 std::stringstream msg;
52 msg <<
"### FATAL ERROR in function [Hydro::DecomposePressure]" << std::endl
53 <<
"number of ghost cells (NGHOST) must be at least 3" << std::endl;
61 for (
int k = kl; k <= ku; ++k)
62 for (
int j = jl;
j <= ju; ++
j) {
63 Real RdTv = w(IPR, k,
j, ie) / w(IDN, k,
j, ie);
65 w(IPR, k,
j, ie) * exp(-grav * pco->dx1f(ie) / (2 * RdTv));
76 if (pmb->pbval->block_bcs[inner_x1] == BoundaryFlag::reflect) {
77 for (
int k = kl; k <= ku; ++k)
78 for (
int j = jl;
j <= ju; ++
j)
79 for (
int i = 1; i <= NGHOST; ++i)
81 }
else if (pmb->pbval->block_bcs[inner_x1] == BoundaryFlag::outflow) {
85 if (pmb->pbval->block_bcs[outer_x1] == BoundaryFlag::reflect) {
86 for (
int k = kl; k <= ku; ++k)
87 for (
int j = jl;
j <= ju; ++
j)
88 for (
int i = 1; i <= NGHOST; ++i)
89 psf_(k,
j, ie + i + 1) =
psf_(k,
j, ie + 1 - i);
90 }
else if (pmb->pbval->block_bcs[outer_x1] == BoundaryFlag::outflow) {
99 for (
int k = kl; k <= ku; ++k)
100 for (
int j = jl;
j <= ju; ++
j) {
102 for (
int i = is - NGHOST; i <= ie + NGHOST; ++i) {
104 pres_(k,
j, i) = w(IPR, k,
j, i);
105 dens_(k,
j, i) = w(IDN, k,
j, i);
109 if (fabs(
psf_(k,
j, i) -
psf_(k,
j, i + 1)) < 1.E-6)
110 psv = (
psf_(k,
j, i) +
psf_(k,
j, i + 1)) / 2.;
118 w(IPR, k,
j, i) -= psv;
119 w(IDN, k,
j, i) -= dsv;
164 Hydro *phydro = pmb->phydro;
166 int is = pmb->is, ie = pmb->ie;
167 if (phydro->hsrc.GetG1() == 0.)
return;
169 for (
int i = is - NGHOST; i <= ie + NGHOST; ++i) {
170 w(IPR, k,
j, i) =
pres_(k,
j, i);
171 w(IDN, k,
j, i) =
dens_(k,
j, i);
174 for (
int i = il; i <= iu; ++i) {
175 wr(IPR, i) +=
psf_(k,
j, i);
176 if (wr(IPR, i) < 0.) wr(IPR, i) =
psf_(k,
j, i);
178 wl(IPR, i) +=
psf_(k,
j, i);
179 if (wl(IPR, i) < 0.) wl(IPR, i) =
psf_(k,
j, i);
185 if (wr(IDN, i) < 0.) wr(IDN, i) = dsf;
188 if (wl(IDN, i) < 0.) wl(IDN, i) = dsf;
void IntegrateDownwards(AthenaArray< Real > &psf, AthenaArray< Real > const &w, Coordinates *pco, Real grav, int kl, int ku, int jl, int ju, int il, int iu)
void IntegrateUpwards(AthenaArray< Real > &psf, AthenaArray< Real > const &w, Coordinates *pco, Real grav, int kl, int ku, int jl, int ju, int il, int iu)
void RecvBuffer(AthenaArray< Real > &psf, int kl, int ku, int jl, int ju, int il, int iu, NeighborBlock nb)
AthenaArray< Real > pres_
AthenaArray< Real > dens_
void SendBuffer(AthenaArray< Real > const &psf, int kl, int ku, int jl, int ju)
AthenaArray< Real > entropy_
void RestoreFromPerturbation(AthenaArray< Real > &w, AthenaArray< Real > &wl, AthenaArray< Real > &wr, int k, int j, int il, int iu)
void ChangeToPerturbation(AthenaArray< Real > &w, int kl, int ku, int jl, int ju)
void PopulateBotEntropy(AthenaArray< Real > const &w, int kl, int ku, int jl, int ju)
static Thermodynamics const * GetInstance()
Return a pointer to the one and only instance of Thermodynamics.