Skip to content
dcheggie edited this page Nov 22, 2016 · 1 revision

NBODY1

Experience in October 2016 revealed the following picture: on one machine, runs of a cold collapse simulation, with N = 25 and uniform spherical initial conditions, were always successful on one computer but invariably failed (after running for a short time) on all others. All systems were running linux (often ubuntu), and gfortran was the compiler (see below).

Eventually Vaclav Pavlik found the solution: the successful machine was using a 32-bit OS, and all the others had 64-bit systems. He traced the fault to stepi.f, where three arrays are declared REAL*4, including the third derivative of the acceleration, F3DOT. In the code at line 28 its euclidean norm is formed. Components of this vector can become very large, causing an overflow in this calculation. The 32-bit code did not recognise the error, and continued to integrate (producing the wrong answer, presumably), whereas the 64-bit code continued until the run was timed out, when a floating-point exception was flagged up.

A solution is to change the declaration in this file from REAL4 to REAL8.

COMPILATION

The Makefile assumes f77. In a current ubuntu system, the lines FORTRAN = gfortran and FC = gfortran are needed.

Clone this wiki locally