Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions src/fluid/constrainedTransport/enforceVectorPotentialBoundary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,31 @@ template<typename Phys>
void ConstrainedTransport<Phys>::EnforceVectorPotentialBoundary(IdefixArray4D<real> &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<real> 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();
}
Expand Down