Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9e5d02a
exchange one additional B face to maintain consistency
glesur Jun 23, 2025
0507668
improve error message
glesur Jun 23, 2025
ffb470c
keep memory of send/recv
glesur Jun 23, 2025
254edf9
fix send/recv directions
glesur Jun 23, 2025
3e803b7
fix non blocking mpi comms
glesur Jun 23, 2025
82e7869
avoid overwriting data when there is no neighbour
glesur Jun 23, 2025
4b4f4e9
fix pack/unpak loop name for debug
glesur Jun 23, 2025
336345b
fix non-sending X1 direction
glesur Jun 23, 2025
c654523
back to mpi_persistent
Jun 23, 2025
dfd52ca
fix linter
glesur Nov 27, 2025
a2d610f
- use the left domain as the reference domain for EMFs (instead of
glesur Nov 30, 2025
aa51d37
fix file spellink
glesur Nov 30, 2025
1b87a84
Check shearing box with MPI. As expected, shearingbox+MPI is broken a…
glesur Dec 1, 2025
309c975
refactor MPI exchange routine.
glesur Dec 2, 2025
fe06b2b
fix shearing boxes
glesur Dec 3, 2025
8984d0d
boundaryFor implemented with variable boundingBoxes, now allowing to
glesur Dec 3, 2025
c0e797c
Final fix to the vector potential consistancy in serial, to do the
glesur Dec 3, 2025
65547ef
-fix bounding box implementation for serial BCs
glesur Dec 5, 2025
b44d615
cleaning up exchange routine
glesur Dec 5, 2025
ee5f74a
fix nghost bug in mpi exchanger
glesur Dec 6, 2025
636e6fd
use a single exchanger for fargo with domain decomposition
glesur Dec 6, 2025
0644fb8
Different message tag for each mpi exchanger
glesur Dec 6, 2025
03634be
-ensure that mpi is using the datablock's boundary conditions
glesur Dec 7, 2025
ddfc25d
fix linter
glesur Dec 7, 2025
219e0b2
fix linter #2
glesur Dec 7, 2025
c75ac9c
Update src/fluid/constrainedTransport/enforceEMFBoundary.hpp
glesur Dec 15, 2025
1a7bb49
add missing pushRegion
glesur Dec 15, 2025
6d72125
Update src/fluid/boundary/axis.hpp
glesur Dec 15, 2025
eec2a85
Merge branch 'fixBxSConsistencyAccrossMPIDecomposition' of github.com…
glesur Dec 15, 2025
fa10688
fix typo
glesur Dec 15, 2025
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ CMakeFiles
CMakeCache.txt
cmake_install.cmake
Makefile.local
git-state.txt
Kokkos_Version_info.*


# test artifacts
test/**/*.o
Expand All @@ -36,6 +39,8 @@ test/**/KokkosCore*
test/**/*.csv
test/**/*.pyc
test/**/*.dat
test/**/cmake_packages*
test/**/

# machine specific cache and hidden files
.*
Expand Down
6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ if(Idefix_MPI)
add_compile_definitions("WITH_MPI")
find_package(MPI REQUIRED)
target_link_libraries(idefix MPI::MPI_CXX)
target_sources(idefix
PUBLIC src/mpi.cpp
PUBLIC src/mpi.hpp
)
add_subdirectory(src/mpi)
endif()

if(Idefix_HDF5)
Expand Down Expand Up @@ -234,6 +231,7 @@ target_include_directories(idefix PUBLIC
src/gravity
src/utils
src/utils/iterativesolver
src/mpi
src
)

Expand Down
1 change: 1 addition & 0 deletions src/dataBlock/dataBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ real DataBlock::ComputeTimestep() {
void DataBlock::DeriveVectorPotential() {
if constexpr(DefaultPhysics::mhd) {
#ifdef EVOLVE_VECTOR_POTENTIAL
hydro->emf->EnforceVectorPotentialBoundary(hydro->Ve);
hydro->emf->ComputeMagFieldFromA(hydro->Ve, hydro->Vs);
#endif
}
Expand Down
9 changes: 7 additions & 2 deletions src/dataBlock/fargo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,15 @@ Fargo::Fargo(Input &input, int nmax, DataBlock *data) {
for(int i=0 ; i < nvar ; i++) {
vars.push_back(i);
}
#if GEOMETRY == CARTESIAN || GEOMETRY == POLAR
const int dirShift = JDIR;
#elif GEOMETRY == SPHERICAL
const int dirShift = KDIR;
#endif
#if MHD == YES
this->mpi.Init(data->mygrid, vars, this->nghost.data(), data->np_int.data(), true);
this->mpiExchanger.Init(data->mygrid, dirShift, vars, this->nghost, data->np_int, true);
#else
this->mpi.Init(data->mygrid, vars, this->nghost.data(), data->np_int.data());
this->mpiExchanger.Init(data->mygrid, dirShift, vars, this->nghost, data->np_int, false);
#endif
}
#endif
Expand Down
10 changes: 3 additions & 7 deletions src/dataBlock/fargo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <vector>
#include "idefix.hpp"
#ifdef WITH_MPI
#include "mpi.hpp"
#include "exchanger.hpp"
#endif

#include "physics.hpp"
Expand Down Expand Up @@ -63,7 +63,7 @@ class Fargo {
IdefixArray4D<real> scrhVs;

#ifdef WITH_MPI
Mpi mpi; // Fargo-specific MPI layer
Exchanger mpiExchanger; // Fargo-specific MPI layer
#endif

std::array<int,3> beg;
Expand Down Expand Up @@ -290,11 +290,7 @@ void Fargo::StoreToScratch(Fluid<Phys>* hydro) {
}
#if WITH_MPI
if(haveDomainDecomposition) {
#if GEOMETRY == CARTESIAN || GEOMETRY == POLAR
this->mpi.ExchangeX2(scrhUc, scrhVs);
#elif GEOMETRY == SPHERICAL
this->mpi.ExchangeX3(scrhUc, scrhVs);
#endif
this->mpiExchanger.Exchange(scrhUc, scrhVs);
}
#endif
}
Expand Down
19 changes: 9 additions & 10 deletions src/fluid/boundary/axis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ void Axis::ShowConfig() {
}


void Axis::SymmetrizeEx1Side(int jref) {
void Axis::SymmetrizeEx1Side(int jref, IdefixArray3D<real> Ex1) {
#if DIMENSIONS == 3

IdefixArray3D<real> Ex1 = this->ex;
IdefixArray1D<real> Ex1Avg = this->Ex1Avg;

idefix_for("Ex1_ini",0,data->np_tot[IDIR],
Expand Down Expand Up @@ -63,9 +62,7 @@ void Axis::SymmetrizeEx1Side(int jref) {
// Hence, we enforce a regularisation of Ex3 for consistancy.


void Axis::RegularizeEx3side(int jref) {
IdefixArray3D<real> Ex3 = this->ez;

void Axis::RegularizeEx3side(int jref, IdefixArray3D<real> Ex3) {
idefix_for("Ex3_Regularise",0,data->np_tot[KDIR],0,data->np_tot[IDIR],
KOKKOS_LAMBDA(int k,int i) {
Ex3(k,jref,i) = 0.0;
Expand Down Expand Up @@ -133,18 +130,20 @@ void Axis::RegularizeCurrentSide(int side) {

// Average the Emf component along the axis

void Axis::RegularizeEMFs() {
void Axis::RegularizeEMFs(IdefixArray3D<real> ex,
IdefixArray3D<real> ey,
IdefixArray3D<real> ez) {
idfx::pushRegion("Axis::RegularizeEMFs");

if(this->axisLeft) {
int jref = data->beg[JDIR];
SymmetrizeEx1Side(jref);
RegularizeEx3side(jref);
SymmetrizeEx1Side(jref, ex);
RegularizeEx3side(jref, ez);
}
if(this->axisRight) {
int jref = data->end[JDIR];
SymmetrizeEx1Side(jref);
RegularizeEx3side(jref);
SymmetrizeEx1Side(jref, ex);
RegularizeEx3side(jref, ez);
}

idfx::popRegion();
Expand Down
17 changes: 5 additions & 12 deletions src/fluid/boundary/axis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ class Axis {
public:
template <typename Phys>
explicit Axis(Boundary<Phys> *); // Initialisation
void RegularizeEMFs(); // Regularize the EMF sitting on the axis
void RegularizeEMFs(IdefixArray3D<real>, IdefixArray3D<real>, IdefixArray3D<real>);
// Regularize the EMF sitting on the axis
void RegularizeCurrent(); // Regularize the currents along the axis
void EnforceAxisBoundary(int side); // Enforce the boundary conditions (along X2)
void RegularizeBX2s(); // Regularize BX2s on the axis
void ShowConfig();


void SymmetrizeEx1Side(int); // Symmetrize on a specific side (internal method)
void RegularizeEx3side(int); // Regularize Ex3 along the axis (internal method)
// Internal methods
void SymmetrizeEx1Side(int, IdefixArray3D<real>); // Symmetrize on a specific side
void RegularizeEx3side(int side, IdefixArray3D<real> ex3); // Regularize Ex3 along the axis
void RegularizeCurrentSide(int); // Regularize J along the axis (internal method)
void FixBx2sAxis(int side); // Fix BX2s on the axis using the field around it (internal)
void FixBx2sAxisGhostAverage(int side); //Fix BX2s on the axis using the average of neighbouring
Expand Down Expand Up @@ -76,9 +77,6 @@ class Axis {
IdefixArray1D<int> symmetryVc;
IdefixArray1D<int> symmetryVs;

IdefixArray3D<real> ex;
IdefixArray3D<real> ey;
IdefixArray3D<real> ez;
IdefixArray4D<real> J;

IdefixArray4D<real> Vc;
Expand All @@ -94,11 +92,6 @@ Axis::Axis(Boundary<Phys> *boundary) {
Vc = boundary->Vc;
Vs = boundary->Vs;
J = boundary->fluid->J;
if constexpr(Phys::mhd) {
ex = boundary->fluid->emf->ex;
ey = boundary->fluid->emf->ey;
ez = boundary->fluid->emf->ez;
}

data = boundary->data;
haveMHD = Phys::mhd;
Expand Down
Loading