@@ -13,23 +13,31 @@ template<typename Phys>
1313void ConstrainedTransport<Phys>::EnforceVectorPotentialBoundary(IdefixArray4D<real> &Vein) {
1414 idfx::pushRegion (" Emf::EnforceVectorPotentialBoundary" );
1515
16- auto Ax1 = Kokkos::subview (Vein, IDIR, Kokkos::ALL (), Kokkos::ALL (), Kokkos::ALL ());
17- auto Ax2 = Kokkos::subview (Vein, JDIR, Kokkos::ALL (), Kokkos::ALL (), Kokkos::ALL ());
18- auto Ax3 = Kokkos::subview (Vein, KDIR, Kokkos::ALL (), Kokkos::ALL (), Kokkos::ALL ());
1916
20- if (this ->hydro ->haveAxis ) {
21- this ->hydro ->boundary ->axis ->RegularizeEMFs (Ax1, Ax2, Ax3);
22- }
17+ IdefixArray3D<real> Ax1, Ax2, Ax3;
2318
24- #ifdef ENFORCE_EMF_CONSISTENCY
25- #ifdef WITH_MPI
26- // This average the vector potential at the domain surface with immediate neighbours
27- // to ensure the vector potentials exactly match
19+ #ifdef EVOLVE_VECTOR_POTENTIAL
20+ #if DIMENSIONS == 3
21+ Ax1 = Kokkos::subview (Vein, AX1e, Kokkos::ALL (), Kokkos::ALL (), Kokkos::ALL ());
22+ Ax2 = Kokkos::subview (Vein, AX2e, Kokkos::ALL (), Kokkos::ALL (), Kokkos::ALL ());
23+ #endif
24+ Ax3 = Kokkos::subview (Vein, AX3e, Kokkos::ALL (), Kokkos::ALL (), Kokkos::ALL ());
25+
26+
27+ if (this ->hydro ->haveAxis ) {
28+ this ->hydro ->boundary ->axis ->RegularizeEMFs (Ax1, Ax2, Ax3);
29+ }
30+
31+ #ifdef ENFORCE_EMF_CONSISTENCY
32+ #ifdef WITH_MPI
33+ // This average the vector potential at the domain surface with immediate neighbours
34+ // to ensure the vector potentials exactly match
2835
29- this ->ExchangeAll (Ax1, Ax2, Ax3);
36+ this ->ExchangeAll (Ax1, Ax2, Ax3);
37+ #endif
38+ EnforceEMFBoundaryPeriodic (Ax1, Ax2, Ax3);
3039 #endif
31- EnforceEMFBoundaryPeriodic (Ax1, Ax2, Ax3);
32- #endif
40+ #endif // EVOLVE_VECTOR_POTENTIAL
3341
3442 idfx::popRegion ();
3543}
0 commit comments