From daf38135ea70a0364e388e310a32e4b39b715dce Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Tue, 20 Jan 2026 11:29:06 +0100 Subject: [PATCH 1/2] fix incorrect subviews when using vector_potential in 2.5D --- .../enforceVectorPotentialBoundary.hpp | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/fluid/constrainedTransport/enforceVectorPotentialBoundary.hpp b/src/fluid/constrainedTransport/enforceVectorPotentialBoundary.hpp index fea9b47b..4228d829 100644 --- a/src/fluid/constrainedTransport/enforceVectorPotentialBoundary.hpp +++ b/src/fluid/constrainedTransport/enforceVectorPotentialBoundary.hpp @@ -13,23 +13,31 @@ template void ConstrainedTransport::EnforceVectorPotentialBoundary(IdefixArray4D &Vein) { idfx::pushRegion("Emf::EnforceVectorPotentialBoundary"); - auto Ax1 = Kokkos::subview(Vein, IDIR, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL()); - auto Ax2 = Kokkos::subview(Vein, JDIR, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL()); - auto Ax3 = Kokkos::subview(Vein, KDIR, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL()); - if(this->hydro->haveAxis) { - this->hydro->boundary->axis->RegularizeEMFs(Ax1, Ax2, Ax3); - } + IdefixArray3D Ax1, Ax2, Ax3; - #ifdef ENFORCE_EMF_CONSISTENCY - #ifdef WITH_MPI - // This average the vector potential at the domain surface with immediate neighbours - // to ensure the vector potentials exactly match + #ifdef EVOLVE_VECTOR_POTENTIAL + #if DIMENSIONS == 3 + Ax1 = Kokkos::subview(Vein, AX1e, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL()); + Ax2 = Kokkos::subview(Vein, AX2e, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL()); + #endif + Ax3 = Kokkos::subview(Vein, AX3e, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL()); + + + if(this->hydro->haveAxis) { + this->hydro->boundary->axis->RegularizeEMFs(Ax1, Ax2, Ax3); + } + + #ifdef ENFORCE_EMF_CONSISTENCY + #ifdef WITH_MPI + // This average the vector potential at the domain surface with immediate neighbours + // to ensure the vector potentials exactly match - this->ExchangeAll(Ax1, Ax2, Ax3); + this->ExchangeAll(Ax1, Ax2, Ax3); + #endif + EnforceEMFBoundaryPeriodic(Ax1, Ax2, Ax3); #endif - EnforceEMFBoundaryPeriodic(Ax1, Ax2, Ax3); - #endif + #endif // EVOLVE_VECTOR_POTENTIAL idfx::popRegion(); } From 8cb9e63750443563f53147719c1b3f4bf726ac2a Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Tue, 20 Jan 2026 16:40:46 +0100 Subject: [PATCH 2/2] fix linting error --- .../constrainedTransport/enforceVectorPotentialBoundary.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fluid/constrainedTransport/enforceVectorPotentialBoundary.hpp b/src/fluid/constrainedTransport/enforceVectorPotentialBoundary.hpp index 4228d829..3019edfd 100644 --- a/src/fluid/constrainedTransport/enforceVectorPotentialBoundary.hpp +++ b/src/fluid/constrainedTransport/enforceVectorPotentialBoundary.hpp @@ -22,7 +22,7 @@ void ConstrainedTransport::EnforceVectorPotentialBoundary(IdefixArray4Dhydro->haveAxis) { this->hydro->boundary->axis->RegularizeEMFs(Ax1, Ax2, Ax3);