From df7a23f5c359eae416b77fefad2cf2602ff28901 Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Wed, 13 Nov 2024 17:26:23 +0100 Subject: [PATCH] fix a bug that lead to segfault when MHD+Fargo+MPI (with X3 domain decomposition) are all activated This went undetected for a while as the test FargoMHDSpherical was actually testing for small fargo shifts (less than a cell). --- reference | 2 +- src/dataBlock/fargo.hpp | 16 ++++++++-------- test/MHD/FargoMHDSpherical/idefix.ini | 6 +++--- test/MHD/FargoMHDSpherical/testme.py | 4 ++++ 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/reference b/reference index 609a6016..b675bcea 160000 --- a/reference +++ b/reference @@ -1 +1 @@ -Subproject commit 609a60164461fb2d4fbeffa89ce148acf1191525 +Subproject commit b675bceaa6aabc01dded346e2d631857f698dc76 diff --git a/src/dataBlock/fargo.hpp b/src/dataBlock/fargo.hpp index 3c3a9401..099c9935 100644 --- a/src/dataBlock/fargo.hpp +++ b/src/dataBlock/fargo.hpp @@ -508,7 +508,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid* hydro) { for(int ss = s-m ; ss < s ; ss++) { int sc; if(haveDomainDecomposition) { - sc = ss; + sc = ss + maxShift; } else { sc = sbeg + modPositive(ss-sbeg,n); } @@ -518,7 +518,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid* hydro) { for(int ss = s ; ss < s-m ; ss++) { int sc; if(haveDomainDecomposition) { - sc = ss; + sc = ss + maxShift; } else { sc = sbeg + modPositive(ss-sbeg,n); } @@ -544,7 +544,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid* hydro) { for(int ss = s-m ; ss < s ; ss++) { int sc; if(haveDomainDecomposition) { - sc = ss; + sc = ss + maxShift; } else { sc = sbeg + modPositive(ss-sbeg,n); } @@ -554,7 +554,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid* hydro) { for(int ss = s ; ss < s-m ; ss++) { int sc; if(haveDomainDecomposition) { - sc = ss; + sc = ss + maxShift; } else { sc = sbeg + modPositive(ss-sbeg,n); } @@ -637,7 +637,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid* hydro) { for(int ss = s-m ; ss < s ; ss++) { int sc; if(haveDomainDecomposition) { - sc = ss; + sc = ss + maxShift; } else { sc = sbeg + modPositive(ss-sbeg,n); } @@ -647,7 +647,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid* hydro) { for(int ss = s ; ss < s-m ; ss++) { int sc; if(haveDomainDecomposition) { - sc = ss; + sc = ss + maxShift; } else { sc = sbeg + modPositive(ss-sbeg,n); } @@ -672,7 +672,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid* hydro) { for(int ss = s-m ; ss < s ; ss++) { int sc; if(haveDomainDecomposition) { - sc = ss; + sc = ss + maxShift; } else { sc = sbeg + modPositive(ss-sbeg,n); } @@ -682,7 +682,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid* hydro) { for(int ss = s ; ss < s-m ; ss++) { int sc; if(haveDomainDecomposition) { - sc = ss; + sc = ss + maxShift; } else { sc = sbeg + modPositive(ss-sbeg,n); } diff --git a/test/MHD/FargoMHDSpherical/idefix.ini b/test/MHD/FargoMHDSpherical/idefix.ini index 4165ebc7..06bfcdf7 100644 --- a/test/MHD/FargoMHDSpherical/idefix.ini +++ b/test/MHD/FargoMHDSpherical/idefix.ini @@ -1,7 +1,7 @@ [Grid] -X1-grid 1 1.0 16 l 2.0 -X2-grid 1 1.2707963267948965 64 u 1.8707963267948966 -X3-grid 1 0.0 64 u 6.283185307179586 +X1-grid 1 1.0 16 l 2.0 +X2-grid 1 1.2707963267948965 16 u 1.8707963267948966 +X3-grid 1 0.0 128 u 6.283185307179586 [TimeIntegrator] CFL 0.5 diff --git a/test/MHD/FargoMHDSpherical/testme.py b/test/MHD/FargoMHDSpherical/testme.py index a09d3eeb..7ee3100b 100755 --- a/test/MHD/FargoMHDSpherical/testme.py +++ b/test/MHD/FargoMHDSpherical/testme.py @@ -53,3 +53,7 @@ def testMe(test): test.vectPot=False test.mpi=True testMe(test) + + test.vectPot=True + test.mpi=True + testMe(test)