6 #include <athena/coordinates/coordinates.hpp>
7 #include <athena/eos/eos.hpp>
8 #include <athena/hydro/hydro.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);
46 Real grav = pmb->phydro->hsrc.GetG1();
47 Real gamma = pmb->peos->GetGamma();
48 Real
Rd = pthermo->GetRd();
50 int is = pmb->is, ie = pmb->ie;
51 if (grav == 0.)
return;
59 for (
int k = kl; k <= ku; ++k)
60 for (
int j = jl;
j <= ju; ++
j) {
61 Real RdTv = w(IPR, k,
j, ie) / w(IDN, k,
j, ie);
63 w(IPR, k,
j, ie) * exp(grav * pco->dx1f(ie) / (2 * RdTv));
72 if (pmb->pbval->block_bcs[inner_x1] == BoundaryFlag::reflect) {
79 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) {
89 for (
int i = is - NGHOST; i <= ie + NGHOST; ++i) {
91 if (fabs(
psf_(k,
j, i) -
psf_(k,
j, i + 1)) < 1.E-6)
98 Real fsig = 1., feps = 1.;
99 for (
int n = 1; n <= NVAPOR; ++n) {
100 fsig += w(n, k,
j, i) * (pthermo->GetCvRatioMass(n) - 1.);
101 feps += w(n, k,
j, i) * (1. / pthermo->GetMuRatio(n) - 1.);
103 gamma_(k,
j, i) = 1. + (gamma - 1.) * feps / fsig;
107 log(w(IPR, k,
j, i)) -
gamma_(k,
j, i) * log(w(IDN, k,
j, i));
110 w(IPR, k,
j, i) -=
psv_(k,
j, i);
114 if (pmb->pbval->block_bcs[inner_x1] == BoundaryFlag::outflow) {
115 for (
int i = is - NGHOST; i < is; ++i) {
116 w(IDN, k,
j, i) = w(IDN, k,
j, is);
117 w(IPR, k,
j, i) = w(IPR, k,
j, is);
122 if (pmb->pbval->block_bcs[outer_x1] == BoundaryFlag::outflow) {
123 for (
int i = ie + 1; i <= ie + NGHOST; ++i) {
124 w(IDN, k,
j, i) = w(IDN, k,
j, ie);
125 w(IPR, k,
j, i) = w(IPR, k,
j, ie);
134 MPI_Wait(&req_send_bot_, &status);
143 Hydro *phydro = pmb->phydro;
146 Real
Rd = pthermo->GetRd();
147 Real grav = phydro->hsrc.GetG1();
148 int is = pmb->is, ie = pmb->ie;
149 if (grav == 0.)
return;
151 for (
int i = is - NGHOST; i <= ie + NGHOST; ++i) {
152 w(IPR, k,
j, i) +=
psv_(k,
j, i);
154 exp((log(w(IPR, k,
j, i)) - w(IDN, k,
j, i)) /
gamma_(k,
j, i));
157 for (
int i = il; i <= iu; ++i) {
158 wr(IPR, i) +=
psf_(k,
j, i);
159 if (wr(IPR, i) < 0.) wr(IPR, i) =
psf_(k,
j, i);
161 wl(IPR, i) +=
psf_(k,
j, i);
162 if (wl(IPR, i) < 0.) wl(IPR, i) =
psf_(k,
j, i);
164 wl(IDN, i) = exp((log(wl(IPR, i)) - wl(IDN, i)) /
gamma_(k,
j, i - 1));
165 wr(IDN, i) = exp((log(wr(IPR, i)) - wr(IDN, i)) /
gamma_(k,
j, i));
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)
AthenaArray< Real > gamma_
void ChangeToEntropy(AthenaArray< Real > &w, int kl, int ku, int jl, int ju)
void RecvFromTop(AthenaArray< Real > &psf, int kl, int ku, int jl, int ju)
void RestoreFromEntropy(AthenaArray< Real > &w, AthenaArray< Real > &wl, AthenaArray< Real > &wr, int k, int j, int il, int iu)
void SendToBottom(AthenaArray< Real > const &psf, int kl, int ku, int jl, int ju)
static Thermodynamics const * GetInstance()
Return a pointer to the one and only instance of Thermodynamics.