FORTRAN example for REG_FILE

 

C---- SUB. CONTACT_FORCE

SUBROUTINE CONTACT_FORCE

&    (TIME,UPAR,NPAR,PEN,RVEL,JFLAG,IFLAG,RESULT)

 

C---- USER STATEMENT

DOUBLE PRECISION A, DIST

INTEGER MKID(2), REPFLG, OPENFILE(2)

LOGICAL ERRFLG

 

C---------- INITIALIZE

ERRFLG = .TRUE.

OPENFILE(1) = 10000

OPENFILE(2) = 10001

IF ( IFLAG ) CALL REG_FILE(OPENFILE,2)

CALL RD_SYSTEM(REPFLG)

OPEN

 

C--------- FOR REPORT

WRITE(10000,*) ‘* TIME =’, TIME

IF ( REPFLG .EQ. 1 ) WRITE(10000,*) ‘* PENETRATION =’, PEN

 

C---------- PROGRAM

CALL SYSFNC(‘DX’,MKID,2,DIST,ERRFLG)

CALL ERRMES(ERRFLG,’SYSFNC_DX$’,1,’CONTACT$’)

WRITE(10001,*) ‘* DISTANCE X =’, DIST

IF ( DIST .EQ. 0.0D0 ) THEN

  ERRFLG = .FALSE.

ELSE

  A = 100.0D0 / DIST

ENDIF

CALL ERRMES(ERRFLG,’DEVIDED BY ZERO$’,1,’CONTACT$’)

 

RETURN

END