INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Fortran Run time error: End of file

Fortran Run time error: End of file

(OP)
Hello, I am a new user of Fortran, I have recently been trying to use a fortran code for my simulation. I have been able to compile the code using Gfortran, however when I try to execute the programme, it shows me the following error:

At line 7271 of file epsc4.for (unit = 1, file = 'bench_ss\SS_new.sx')
Fortran runtime error: End of file

I am not sure what that error means, the code consists of main and subroutines in file EPSC4.For

Any help or direction about the error is much appreciated.

Regards

RE: Fortran Run time error: End of file

Most of the time, this kind of error means that you try to read too many items from the file. The last executed READ fails because of no item anymore (only an end-of-file mark is met).

Show us at least :
- the file itself
- all the read statements concerning that file including the DO loops if READ statements are inside loops

François Jacq

RE: Fortran Run time error: End of file

(OP)
Hello François,

Thanks for your reply.

The read statements concerning that file including DO loops are following (the bold line is line 7271):

CODE -->

c-----------------------------------------------------------------------
c Reads hardening law parameters
c-----------------------------------------------------------------------

      if(ioption.eq.0) then

        call voigt(aux6,aux33,ccc2,ccc4,3)      ! cnt 2010
        is=0
        do im=1,nmodes
          is=is+nsm(im)
          shearmod(im)=0.
          do i=1,3
            do j=1,3
              do k=1,3
                do l=1,3
                  shearmod(im)=shearmod(im)+
     #                          mc2(i,j,1)*ccc4(i,j,k,l)*mc2(k,l,1)  ! error
c    #                          mc2(i,j,is)*ccc4(i,j,k,l)*mc2(k,l,is)
                enddo
              enddo
            enddo
          enddo

          write(11,*)
          write(11,'(''  mode'',i4)') im
          write(11,'(''  elastic shear modulus'',e12.5)') shearmod(im)
          write(11,*)
        enddo

        do im=1,nmod      ! sets to 0 the maximum array
          do jm=1,nmod
            tlatent(im,jm)=0.
          enddo
        enddo

        READ(1,*)
        READ(1,*) chi_inter,q_rate,edot_macro

        DO is=1,nslmod
          READ(1,*)
          READ(1,*) BURG(is),ACTENER(is)
          READ(1,*) aK1(is),DRAG(is)
          READ(1,*) edot_zero(is)
          READ(1,*) rho_ini_for(is),rho_ini_deb(is)
          READ(1,*) tau0_mode_a(is),tau0_mode_b(is),tau0_mode_c(is)
          READ(1,*) (TLATENT(is,mo),mo=1,ntwmod)
          READ(1,*) HPK0(is),HPK1(is),HPK2(is)
          READ(1,*) a_deb_a(is),a_deb_b(is),a_deb_c(is)
        ENDDO

        DO it=1,ntwmod
          READ(1,*)
          READ(1,*) tau_crit_a(it),tau_crit_b(it),tau_crit_c(it)
          READ(1,*) tau_prop_a(it),tau_prop_b(it),tau_prop_c(it)
          READ(1,*) BURG_TW(it)
          itt=it+nslmod
          READ(1,*) TwinFrac(itt),TwinCRSS(itt)   !BJCL twin model parameters
        ENDDO

      endif 

The file is below (bench_ss/SS_new.sx)

CODE -->

*Material: Stainless Steel
CUBIC           crysym
   1.0   1.0   1.0   90.   90.   90.   unit cell axes and angles
Elastic stiffness (single crystal [MPa])
 204600. 137700. 137700.   000.0    000.0    000.0
 137700. 204600. 137700.   000.0    000.0    000.0
 137700. 137700. 204600.   000.0    000.0    000.0
  000.0   000.0   000.0   126200.   000.0    000.0
  000.0   000.0   000.0    000.0   126200.   000.0
  000.0   000.0   000.0    000.0    000.0   126200.
*Pressure dependence of elastic constants (iSM=0 no; iSM=1 yes)
 0
*Thermal expansion coefficients (single crystal in crystal axis):
 10.0e-6  10.0e-6  10.0e-6   0.0e0   0.0e0   0.0e0                    "alfacc"
*Info about slip & twinning modes in this file:
  2          nmodesx    (total # of modes listed in file)
  1          nmodes     (# of modes to be used in the calculation)
  1          mode(i)    (label of the modes to be used)
  <111>{110} SLIP
 1  12  20   1   0                    modex,nsmx,nrsx,iopsysx,itwx
   1  1 -1        0  1  1
   1  1 -1        1  0  1
   1  1 -1        1 -1  0
   1 -1 -1        0  1 -1
   1 -1 -1        1  0  1
   1 -1 -1        1  1  0
   1 -1  1        0  1  1
   1 -1  1        1  0 -1
   1 -1  1        1  1  0
   1  1  1        0  1 -1
   1  1  1        1  0 -1
   1  1  1        1 -1  0
  <111>{112} TWIN
 2  12  20   0   1                    modex,nsmx,nrsx,iopsysx,itwx
 0.250                                stwx
   1  1  1       -2  1  1
   1  1  1        1 -2  1
   1  1  1        1  1 -2
  -1 -1  1        2 -1  1
  -1 -1  1       -1  2  1
  -1 -1  1       -1 -1 -2
  -1  1  1        2  1  1
  -1  1  1       -1 -2  1
  -1  1  1       -1  1 -2
   1 -1  1       -2 -1  1
   1 -1  1        1  2  1
   1 -1  1        1 -1 -2
Constitutive law
  2
DISLOCATION MODEL
  0.35  4.0 1.e-05                  !INTERACTION CONSTANT, Q IN EQ. (3.14), REF STRAIN RATE (1/s)
 FCC Slip ---------------------------------------------------------------------
 2.546e-10  3.8E-3                  !BURG (m), NORM ACTENER g IN EQ. (3.12) (0.00375)
 2.75e+08  3.0E+2                   !K1 IN EQ. (3.8) (1/m), DRAG STRESS-D IN EQ. (3.12) (MPa)
 1.E+07                             !EDOT_0 IN EQ. (3.12)
 5.0E+09 1.0E+11                    !INITIAL RHO_S (1/m^2), INITIAL RHO_DEB FOR EACH SLIP MODE (1/m^2)
 87.0  0. 1.0                       !A,B,C FOR ATHERMAL TAU = A + B * EXP(-TEMP/C) EQ. (3.17)
 1.   1.                            !TLATENT HARDENING BY THIS SLIP MODE ON TWIN1, TWIN2:  C IN EQ. (3.28)
 0. 0.   250.                       !FOR HPFAC COEF FOR THIS SLIP MODE FOR GRAIN BOUNDARY, TWIN1 BOUNDARY, TWIN2 BOUNDARY
 7.0E+1 0. 1.                       !A_deb_a, A_deb_b, A_deb_c FOR A IN EQ. (3.15) A_deb_a+A_deb_b*LOG(1+TEMP/A_deb_c) 

Thanks for your time and help.

RE: Fortran Run time error: End of file

Is that the entire bench_ss/SS_new.sx file? Or did you just showed us what you thought was relevant?

If that indeed is the entire file, then, there may be some missing data if ntwmod (index of the 'other' loop) is greater than zero...there will an attempt to read data beyond the bolded line in the code.

RE: Fortran Run time error: End of file

If ntwmod is greater than 2 you could run out of data. Suggest printing the values as you read them.

RE: Fortran Run time error: End of file

xwb: you mean nslmod?

RE: Fortran Run time error: End of file

IMO, If we should read this line poroperly

CODE

1.   1.                            !TLATENT HARDENING BY THIS SLIP MODE ON TWIN1, TWIN2: 
using this line of code

CODE

READ(1,*) (TLATENT(is,mo),mo=1,ntwmod) 
then ntwmod need to be equal 2

But, then - in case that mamunxbcc posted entire file - the loop

CODE

DO it=1,ntwmod
   READ(1,*)
   ...
ENDDO 
will cause the END-OF-FILE error


RE: Fortran Run time error: End of file

Another advice : Print out what you have read after each READ statement and compare with your input file. I think you should locate rapidly the mistake.

Do not forget, for instance, that a READ statement takes in charge at least an entire data line. In a file constaining :

CODE -->

* a comment *
1 2 7 4 

Then the following program will fail :

CODE --> fortran

read(*,*)
read(*,*) i1,i2
read(*,*) i3,i4 

Because the third READ tries to read the third line which does not exist.

François Jacq

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close