Skip to content

Commit

Permalink
Merge pull request #576 from IAS-Astrophysics/shock-tube-fix
Browse files Browse the repository at this point in the history
Fixed pointer issues in shock tube.
  • Loading branch information
jmstone authored Aug 16, 2024
2 parents c119bde + d3fa012 commit 3df8cbc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pgen/tests/shock_tube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ void ProblemGenerator::ShockTube(ParameterInput *pin, const bool restart) {
Real yr = pin->GetOrAddReal("problem","yr",0.0);

auto &w0 = pmbp->phydro->w0;
auto &nscal = pmbp->phydro->nscalars;
par_for("pgen_shock1", DevExeSpace(),0,(pmbp->nmb_thispack-1),ks,ke,js,je,is,ie,
KOKKOS_LAMBDA(int m,int k, int j, int i) {
Real x;
Expand Down Expand Up @@ -141,7 +142,7 @@ void ProblemGenerator::ShockTube(ParameterInput *pin, const bool restart) {
w0(m,ivy,k,j,i) = wl.vy*u0l;
w0(m,ivz,k,j,i) = wl.vz*u0l;
w0(m,IEN,k,j,i) = wl.e;
for (int r=0; r<pmbp->phydro->nscalars; ++r) {
for (int r=0; r<nscal; ++r) {
w0(m,IYF+r,k,j,i) = yl;
}
} else {
Expand All @@ -150,7 +151,7 @@ void ProblemGenerator::ShockTube(ParameterInput *pin, const bool restart) {
w0(m,ivy,k,j,i) = wr.vy*u0r;
w0(m,ivz,k,j,i) = wr.vz*u0r;
w0(m,IEN,k,j,i) = wr.e;
for (int r=0; r<pmbp->phydro->nscalars; ++r) {
for (int r=0; r<nscal; ++r) {
w0(m,IYF+r,k,j,i) = yr;
}
}
Expand Down Expand Up @@ -210,6 +211,7 @@ void ProblemGenerator::ShockTube(ParameterInput *pin, const bool restart) {
auto &w0 = pmbp->pmhd->w0;
auto &b0 = pmbp->pmhd->b0;
auto &bcc0 = pmbp->pmhd->bcc0;
auto &nscal = pmbp->pmhd->nscalars;
par_for("pgen_shock1", DevExeSpace(),0,(pmbp->nmb_thispack-1),ks,ke,js,je,is,ie,
KOKKOS_LAMBDA(int m,int k, int j, int i) {
Real x,bxl,byl,bzl,bxr,byr,bzr;
Expand Down Expand Up @@ -243,7 +245,7 @@ void ProblemGenerator::ShockTube(ParameterInput *pin, const bool restart) {
w0(m,ivy,k,j,i) = wl.vy*u0l;
w0(m,ivz,k,j,i) = wl.vz*u0l;
w0(m,IEN,k,j,i) = wl.e;
for (int r=0; r<pmbp->pmhd->nscalars; ++r) {
for (int r=0; r<nscal; ++r) {
w0(m,IYF+r,k,j,i) = yl;
}
b0.x1f(m,k,j,i) = bxl;
Expand All @@ -261,7 +263,7 @@ void ProblemGenerator::ShockTube(ParameterInput *pin, const bool restart) {
w0(m,ivy,k,j,i) = wr.vy*u0r;
w0(m,ivz,k,j,i) = wr.vz*u0r;
w0(m,IEN,k,j,i) = wr.e;
for (int r=0; r<pmbp->pmhd->nscalars; ++r) {
for (int r=0; r<nscal; ++r) {
w0(m,IYF+r,k,j,i) = yr;
}
b0.x1f(m,k,j,i) = bxr;
Expand Down

0 comments on commit 3df8cbc

Please sign in to comment.