Skip to content

Commit

Permalink
Minor modification; just making code clearer.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkestene committed Sep 10, 2024
1 parent 88582d9 commit 5df3619
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
40 changes: 20 additions & 20 deletions src/muscl/MHDRunFunctors2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -1366,54 +1366,54 @@ class ReconstructEdgeComputeEmfAndUpdateFunctor2D : public MHDBaseFunctor2D

if (edge_loc == MHDEdgeLocation::LB)
{
ia = 0;
ja = 0;
ib = 0;
jb = 0;
ia = i0;
ja = j0;
ib = i0;
jb = j0;
sign_x = -1;
sign_y = -1;
sign_a = -1;
sign_b = -1;
}
else if (edge_loc == MHDEdgeLocation::RT)
{
ia = 1;
ja = 0;
ib = 0;
jb = 1;
ia = i0 + 1;
ja = j0;
ib = i0;
jb = j0 + 1;
sign_x = 1;
sign_y = 1;
sign_a = 1;
sign_b = 1;
}
else if (edge_loc == MHDEdgeLocation::RB)
{
ia = 1;
ja = 0;
ib = 0;
jb = 0;
ia = i0 + 1;
ja = j0;
ib = i0;
jb = j0;
sign_x = 1;
sign_y = -1;
sign_a = -1;
sign_b = 1;
}
else if (edge_loc == MHDEdgeLocation::LT)
{
ia = 0;
ja = 0;
ib = 0;
jb = 1;
ia = i0;
ja = j0;
ib = i0;
jb = j0 + 1;
sign_x = -1;
sign_y = 1;
sign_a = 1;
sign_b = -1;
}

const real_t A = Udata_in(i0 + ia, j0 + ja, IA) + sFaceMag(i0 + ia, j0 + ja, IX);
const real_t dAy = compute_limited_slope<DIR_Y>(Udata_in, i0 + ia, j0 + ja, IA);
const real_t A = Udata_in(ia, ja, IA) + sFaceMag(ia, ja, IX);
const real_t dAy = compute_limited_slope<DIR_Y>(Udata_in, ia, ja, IA);

const real_t B = Udata_in(i0 + ib, j0 + jb, IB) + sFaceMag(i0 + ib, j0 + jb, IY);
const real_t dBx = compute_limited_slope<DIR_X>(Udata_in, i0 + ib, j0 + jb, IB);
const real_t B = Udata_in(ib, jb, IB) + sFaceMag(ib, jb, IY);
const real_t dBx = compute_limited_slope<DIR_X>(Udata_in, ib, jb, IB);

// get limited slopes
MHDState dqX, dqY;
Expand Down
24 changes: 12 additions & 12 deletions src/muscl/MHDRunFunctors3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -1415,8 +1415,8 @@ class ReconstructEdgeComputeEmfAndUpdateFunctor3D : public MHDBaseFunctor3D

int sign_dq0 = 1;
int sign_dq1 = 1;
Kokkos::Array<int, 3> ijk0{ 0, 0, 0 };
Kokkos::Array<int, 3> ijk1{ 0, 0, 0 };
Kokkos::Array<int, 3> ijk0{ ic, jc, kc };
Kokkos::Array<int, 3> ijk1{ ic, jc, kc };
int sign_b0 = 1;
int sign_b1 = 1;

Expand All @@ -1429,39 +1429,39 @@ class ReconstructEdgeComputeEmfAndUpdateFunctor3D : public MHDBaseFunctor3D
}
else if (edge_loc == MHDEdgeLocation::RT)
{
ijk0[dir0] = 1;
ijk1[dir1] = 1;
ijk0[dir0] += 1;
ijk1[dir1] += 1;
sign_dq0 = 1;
sign_dq1 = 1;
sign_b0 = 1;
sign_b1 = 1;
}
else if (edge_loc == MHDEdgeLocation::RB)
{
ijk0[dir0] = 1;
ijk0[dir0] += 1;
sign_dq0 = 1;
sign_dq1 = -1;
sign_b0 = -1;
sign_b1 = 1;
}
else if (edge_loc == MHDEdgeLocation::LT)
{
ijk1[dir1] = 1;
ijk1[dir1] += 1;
sign_dq0 = -1;
sign_dq1 = 1;
sign_b0 = 1;
sign_b1 = -1;
}

const real_t B0 = Udata_in(ic + ijk0[IX], jc + ijk0[IY], kc + ijk0[IZ], IA + dir0) +
sFaceMag(ic + ijk0[IX], jc + ijk0[IY], kc + ijk0[IZ], dir0);
const real_t B0 = Udata_in(ijk0[IX], ijk0[IY], ijk0[IZ], IA + dir0) +
sFaceMag(ijk0[IX], ijk0[IY], ijk0[IZ], dir0);
const real_t dB0d1 = compute_limited_slope<static_cast<Direction>(dir1)>(
Udata_in, ic + ijk0[IX], jc + ijk0[IY], kc + ijk0[IZ], IA + dir0);
Udata_in, ijk0[IX], ijk0[IY], ijk0[IZ], IA + dir0);

const real_t B1 = Udata_in(ic + ijk1[IX], jc + ijk1[IY], kc + ijk1[IZ], IA + dir1) +
sFaceMag(ic + ijk1[IX], jc + ijk1[IY], kc + ijk1[IZ], dir1);
const real_t B1 = Udata_in(ijk1[IX], ijk1[IY], ijk1[IZ], IA + dir1) +
sFaceMag(ijk1[IX], ijk1[IY], ijk1[IZ], dir1);
const real_t dB1d0 = compute_limited_slope<static_cast<Direction>(dir0)>(
Udata_in, ic + ijk1[IX], jc + ijk1[IY], kc + ijk1[IZ], IA + dir1);
Udata_in, ijk1[IX], ijk1[IY], ijk1[IZ], IA + dir1);

// get limited slopes
MHDState dq0, dq1;
Expand Down

0 comments on commit 5df3619

Please sign in to comment.