FORTRAN example for variable equation user subroutine

 

C---- SUB. VARIABLE

      SUBROUTINE VARIABLE_USUB

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

C---- TO EXPORT * SUBROUTINE

      !DEC$ ATTRIBUTES DLLEXPORT,C::VARIABLE_USUB

 

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 value. (Output)

 

      DOUBLE PRECISION TIME, UPAR(*)

      INTEGER NPAR

      LOGICAL JFLAG, IFLAG

      DOUBLE PRECISION RESULT[REFERENCE]

 

C---- USER STATEMENT

      DOUBLE PRECISION VALUE, VELO, STIME

      INTEGER IORD

      LOGICAL ERRFLG

 

      STIME = 1.0D0

      VELO = 74.0D0

      IORD = 0

 

      CALL RD_STEP5(TIME,0.0D0,0.0D0,STIME,VELO,IORD,VALUE,ERRFLG)

 

      RESULT = VALUE

 

      RETURN

      END