From da92099c4f66efd2c32a1403017d08f7f13ca2f2 Mon Sep 17 00:00:00 2001 From: Pierre Kestener Date: Tue, 10 Sep 2024 17:58:29 +0200 Subject: [PATCH] Minor modification; just making code clearer. --- src/muscl/MHDRunFunctors2D.h | 40 ++++++++++++++++++------------------ src/muscl/MHDRunFunctors3D.h | 24 +++++++++++----------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/muscl/MHDRunFunctors2D.h b/src/muscl/MHDRunFunctors2D.h index 61c662d..442c13f 100644 --- a/src/muscl/MHDRunFunctors2D.h +++ b/src/muscl/MHDRunFunctors2D.h @@ -1366,10 +1366,10 @@ 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; @@ -1377,10 +1377,10 @@ class ReconstructEdgeComputeEmfAndUpdateFunctor2D : public MHDBaseFunctor2D } 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; @@ -1388,10 +1388,10 @@ class ReconstructEdgeComputeEmfAndUpdateFunctor2D : public MHDBaseFunctor2D } 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; @@ -1399,21 +1399,21 @@ class ReconstructEdgeComputeEmfAndUpdateFunctor2D : public MHDBaseFunctor2D } 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(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(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(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(Udata_in, ib, jb, IB); // get limited slopes MHDState dqX, dqY; diff --git a/src/muscl/MHDRunFunctors3D.h b/src/muscl/MHDRunFunctors3D.h index e0194dc..d119923 100644 --- a/src/muscl/MHDRunFunctors3D.h +++ b/src/muscl/MHDRunFunctors3D.h @@ -1415,8 +1415,8 @@ class ReconstructEdgeComputeEmfAndUpdateFunctor3D : public MHDBaseFunctor3D int sign_dq0 = 1; int sign_dq1 = 1; - Kokkos::Array ijk0{ 0, 0, 0 }; - Kokkos::Array ijk1{ 0, 0, 0 }; + Kokkos::Array ijk0{ ic, jc, kc }; + Kokkos::Array ijk1{ ic, jc, kc }; int sign_b0 = 1; int sign_b1 = 1; @@ -1429,8 +1429,8 @@ 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; @@ -1438,7 +1438,7 @@ class ReconstructEdgeComputeEmfAndUpdateFunctor3D : public MHDBaseFunctor3D } else if (edge_loc == MHDEdgeLocation::RB) { - ijk0[dir0] = 1; + ijk0[dir0] += 1; sign_dq0 = 1; sign_dq1 = -1; sign_b0 = -1; @@ -1446,22 +1446,22 @@ class ReconstructEdgeComputeEmfAndUpdateFunctor3D : public MHDBaseFunctor3D } 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(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(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;