FORTRAN example for IMPACT

 

C---- SUB. AXIAL_FORCE : AXIAL(TRA,ROT)

      SUBROUTINE AXIAL_FORCE

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

C---- TO EXPORT * SUBROUTINE

      !DEC$ ATTRIBUTES DLLEXPORT,C::AXIAL_FORCE

 

C---- INCLUDE SYSTEM CALL

      INCLUDE 'SYSCAL.F'

 

C---- DEFINE VARIABLES

C     Parameter Information

C     TIME   : Simulation time of RD/Solver. (Input)

C     UPAR   : Parameters defined by user. (Input)

C     NPAR   : Number of user parameters. (Input)

C     JFLAG  : When RD/Solver evaluates a Jacobian, the flag is true. (Input)

C     IFLAG  : When RD/Solver initializes arrays, the flag is true. (Input)

C     RESULT : Returned axial force or torque value. (Output)

 

      DOUBLE PRECISION TIME, UPAR(*)

      INTEGER NPAR

      LOGICAL JFLAG, IFLAG

      DOUBLE PRECISION RESULT[REFERENCE]

 

C---- USER STATEMENT

C---- LOCAL VARIABLE DEFINITIONs

      DOUBLE PRECISION VALUE(3), DY, VY

      INTEGER MKID(5),PI

      INTEGER ID(2)

      LOGICAL ERRFLG

     

C---- ASSIGN IMPACT PARAMETERS

      ID(1) = INT(UPAR(1))     

      ID(2) = INT(UPAR(2))

      DO I = 1, 5

         MKID(I) = UPAR(I+2)

      ENDDO

      PI = ACOS(-1,0D0)

     

C---- CALL AUXILIARY SUBROUTINES FOR CALCULATIONS

      CALL SYSFNC('DY',ID,2,DY,ERRFLG)

      CALL SYSFNC('VY',ID,2,DY,ERRFLG)

     

      CALL RD_IMPACT(DY,VY,MKID(1),MKID(2),MKID(3)

     &               ,MKID(4),MKID(5),0,VALUE,ERRFLG)

    

C---- ASSIGN THE RETURNED VALUE

      RESULT = VALUE(1)

     

      RETURN

      END