When I run the code given below, it always gives me the following error:
bash: cannot execute binary file exec format error fortran Also, the file "file" is not being created at the location mentioned in the code. I've a 64-bit processor and 64-bit version of Ubuntu 16.04, so that does not appear to be the issue. Can someone please point out where I'm wrong?
program sandpile_model implicit none integer, parameter :: len = 20 integer, dimension(len,len) :: square !real, dimension(len,len) :: blah !open(unit=1,file="\\home\\sandpile\\fortran\\file") !dummy variables integer :: i,j,d do i=1,len do j=1,len square(i,j)=2 end do end do do d=1,10000 square((len/2)-1,(len/2)-1)=square((len/2)-1,(len/2)-1)+1 if(square((len/2)-1,(len/2)-1)>3) then call toppling((len/2)-1,(len/2)-1) end if end do !open(unit=1,file="\\home\\sandpile\\fortran\\file") do i=1,len do j=1,len write(1,*), i,'\t',j,'\t',square(i,j) end do print*, '\n' end do end program sandpile_model !This subroutine specifies the evolution rules of the model recursive subroutine toppling(x,y) !implicit none integer, parameter :: len = 20 integer, dimension(len,len) :: square !real, dimension(len,len) :: blah integer, intent(in) :: x,y square(x,y)=square(x,y)-4 square(x+1,y)=square(x+1,y)+1 if(square(x+1,y)>3) then call toppling(x+1,y) end if square(x-1,y)=square(x-1,y)+1 if(square(x-1,y)>3) then call toppling(x-1,y) end if square(x,y+1)=square(x,y+1)+1 if(square(x,y+1)>3) then call toppling(x,y+1) end if square(x,y-1)=square(x,y-1)+1 if(square(x,y-1)>3) then call toppling(x,y-1) end if end subroutine toppling
try.o?gfortran try.f90