Skip to content

Commit f83e560

Browse files
authored
Bug: MHD+Fargo+MPI (#295)
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).
1 parent f68a652 commit f83e560

4 files changed

Lines changed: 16 additions & 12 deletions

File tree

src/dataBlock/fargo.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid<Phys>* hydro) {
508508
for(int ss = s-m ; ss < s ; ss++) {
509509
int sc;
510510
if(haveDomainDecomposition) {
511-
sc = ss;
511+
sc = ss + maxShift;
512512
} else {
513513
sc = sbeg + modPositive(ss-sbeg,n);
514514
}
@@ -518,7 +518,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid<Phys>* hydro) {
518518
for(int ss = s ; ss < s-m ; ss++) {
519519
int sc;
520520
if(haveDomainDecomposition) {
521-
sc = ss;
521+
sc = ss + maxShift;
522522
} else {
523523
sc = sbeg + modPositive(ss-sbeg,n);
524524
}
@@ -544,7 +544,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid<Phys>* hydro) {
544544
for(int ss = s-m ; ss < s ; ss++) {
545545
int sc;
546546
if(haveDomainDecomposition) {
547-
sc = ss;
547+
sc = ss + maxShift;
548548
} else {
549549
sc = sbeg + modPositive(ss-sbeg,n);
550550
}
@@ -554,7 +554,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid<Phys>* hydro) {
554554
for(int ss = s ; ss < s-m ; ss++) {
555555
int sc;
556556
if(haveDomainDecomposition) {
557-
sc = ss;
557+
sc = ss + maxShift;
558558
} else {
559559
sc = sbeg + modPositive(ss-sbeg,n);
560560
}
@@ -637,7 +637,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid<Phys>* hydro) {
637637
for(int ss = s-m ; ss < s ; ss++) {
638638
int sc;
639639
if(haveDomainDecomposition) {
640-
sc = ss;
640+
sc = ss + maxShift;
641641
} else {
642642
sc = sbeg + modPositive(ss-sbeg,n);
643643
}
@@ -647,7 +647,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid<Phys>* hydro) {
647647
for(int ss = s ; ss < s-m ; ss++) {
648648
int sc;
649649
if(haveDomainDecomposition) {
650-
sc = ss;
650+
sc = ss + maxShift;
651651
} else {
652652
sc = sbeg + modPositive(ss-sbeg,n);
653653
}
@@ -672,7 +672,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid<Phys>* hydro) {
672672
for(int ss = s-m ; ss < s ; ss++) {
673673
int sc;
674674
if(haveDomainDecomposition) {
675-
sc = ss;
675+
sc = ss + maxShift;
676676
} else {
677677
sc = sbeg + modPositive(ss-sbeg,n);
678678
}
@@ -682,7 +682,7 @@ void Fargo::ShiftFluid(const real t, const real dt, Fluid<Phys>* hydro) {
682682
for(int ss = s ; ss < s-m ; ss++) {
683683
int sc;
684684
if(haveDomainDecomposition) {
685-
sc = ss;
685+
sc = ss + maxShift;
686686
} else {
687687
sc = sbeg + modPositive(ss-sbeg,n);
688688
}

test/MHD/FargoMHDSpherical/idefix.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Grid]
2-
X1-grid 1 1.0 16 l 2.0
3-
X2-grid 1 1.2707963267948965 64 u 1.8707963267948966
4-
X3-grid 1 0.0 64 u 6.283185307179586
2+
X1-grid 1 1.0 16 l 2.0
3+
X2-grid 1 1.2707963267948965 16 u 1.8707963267948966
4+
X3-grid 1 0.0 128 u 6.283185307179586
55

66
[TimeIntegrator]
77
CFL 0.5

test/MHD/FargoMHDSpherical/testme.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,7 @@ def testMe(test):
5353
test.vectPot=False
5454
test.mpi=True
5555
testMe(test)
56+
57+
test.vectPot=True
58+
test.mpi=True
59+
testMe(test)

0 commit comments

Comments
 (0)