When I write the following .dat
file, the file is only 6397 lines long even though the nested do
loops correctly iterate 6400 times. Also, when I output the data NX(BR,BC)
to Terminal, everything is fine. Only the .dat file is missing a few lines. Any idea what the issue might be?
Note NX
is defined as REAL(8),DIMENSION(0:2000,0:2000) :: NX
Here's the rest of the relevant part of the code:
OPEN(UNIT=18,FILE='test_file.dat',STATUS='UNKNOWN',ACTION='WRITE')
I = 0 ! for debugging
DO BC = 0,39
DO BR = 0,159
! do some calculations here to calculate NX(BR,BC)
! for debugging
I = I + 1
WRITE(18,*) NX(BR,BC)
ENDDO
ENDDO
WRITE(*,*) I ! outputs 6400