hiddenSymmetries / VMEC2000

MIT License
8 stars 5 forks source link

Fix runtime seg-fualts on Mac #5

Open mbkumar opened 3 years ago

mbkumar commented 3 years ago

Matt reports VMEC compiles fine on Mac, but fails at runtime with seg-faults.

mbkumar commented 9 months ago

Damient Hunt also reported this issue. The minimal simsopt code and the input file are attached.

vmec_segfault.zip

Debugging this issue shows that the code fails with

At line 115 of file /Users/bharatmedasani/Software/VMEC2000/Sources/TimeStep/evolve.f
Fortran runtime error: Index '3' of dimension 1 of array 'f3d_num' above upper bound of 2

The code at that line is

./TimeStep/evolve.f:115:      f3d_num(NS_RESLTN) = f3d_num(NS_RESLTN)+1

Grepping for NS_RESLTN shows

./TimeStep/runvmec.f:294:         IF (PARVMEC .AND. NS_RESLTN .GE. 1) THEN
./TimeStep/evolve.f:115:      f3d_num(NS_RESLTN) = f3d_num(NS_RESLTN)+1
./TimeStep/evolve.f:122:      f3d_time(NS_RESLTN) = f3d_time(NS_RESLTN) + (f3dt2 - f3dt1)

./TimeStep/parallel_vmec_module.f90:26:    INTEGER :: NS_RESLTN=0
./TimeStep/parallel_vmec_module.f90:133:!    NS_RESLTN = 0  ! SAL 070619
./TimeStep/parallel_vmec_module.f90:163:    NS_RESLTN = NS_RESLTN + 1
./TimeStep/parallel_vmec_module.f90:433:    NS_RESLTN=0
./TimeStep/parallel_include_module.f90:24:        USE parallel_vmec_module, ONLY: NS_RESLTN
./General/blocktridiagonalsolver_bst.f90:9:USE parallel_include_module, ONLY: NS_RESLTN
./General/blocktridiagonalsolver.f90:15:USE parallel_include_module, ONLY: NS_RESLTN

Should the commented out code at ./TimeStep/parallel_vmec_module.f90:133 be enabled?

mbkumar commented 9 months ago

I uncommented the line ./TimeStep/parallel_vmec_module.f90:133, but it didn't help.