I am having a simple problem with a Fortran program I have built in Fortran. The program will run as desired in the NAG compiler but not in Silverfrost (plato). Can anybody see the problem?
The program imports external data. Using a subroutine it calculates enginnering strain and writes to an external file. Using a second subroutine it calculates true strain and writes to an external file.
PROGRAM array_true_stress
INTEGER, PARAMETER :: MAX_SIZE = 5970 REAL, DIMENSION(MAX_SIZE) :: a REAL, DIMENSION(MAX_SIZE) :: b REAL, DIMENSION(MAX_SIZE) :: c
CHARACTER(len=20) :: filename INTEGER :: i INTEGER :: nvals = 0 INTEGER :: status REAL :: temp
WRITE(,1000) 1000 FORMAT(1X,'Enter the filename with the data to be manipulated: ') READ(,'(A20)') filename
OPEN(UNIT=9, FILE=filename, STATUS='OLD', ACTION='READ', IOSTAT=status) fileopen: IF( STATUS == 0 ) THEN
DO
READ(9,*,IOSTAT=status) temp
IF( status /= 0) EXIT
nvals=nvals+1
a(nvals)=temp
END DO
CALL engineering_strain (i, nvals, b, a)
OPEN(UNIT=10, FILE='eng_strain.txt', STATUS='OLD', ACTION='WRITE')
WRITE(10,960) (b(i), i=1, nvals)
WRITE(*,*) 'Engineering strain data written to an external file'
960 FORMAT (4X,F16.9)
CALL true_strain (i, nvals, a, c)
OPEN(UNIT=11, FILE='true_strain.txt', STATUS='OLD', ACTION='WRITE')
WRITE(11,960) (c(i), i=1, nvals)
WRITE(*,*) 'True strain data written to an external file'
ELSE fileopen WRITE(*,1050) status 1050 FORMAT(1X,'File open failed--status=',I6) END IF fileopen
CONTAINS SUBROUTINE engineering_strain (i, nvals, b, a) REAL, INTENT(IN):: a(i) REAL, INTENT(OUT):: b(i) convert_eng: DO i=1, nvals b(i)=a(i)/100 END DO convert_eng END SUBROUTINE engineering_strain
SUBROUTINE true_strain (i, nvals, a, c)
REAL, INTENT(IN):: a(i)
REAL, INTENT(OUT):: c(i)
add: DO i=1, nvals
c(i)=LOG((a(i)/100)+1)
END DO add
END SUBROUTINE true_strain
END PROGRAM array_true_stress