I am writing a user FORTRAN junction box and would like to know the best way to access time as a variable for use in my routine.




Although one can obtain transient information by browsing to the relevant directory in the MMS structure and doing a PEEKR, i.e.:

C get time value
CALL PSHDIR ('/FLOW/SOLUTION/LATEST/ZN1', 'STOP', CRESLT)
CALL PEEKR ('TIME', 1, GTIME, 'STOP', CRESLT, RZ)
CALL POPDIR ('STOP', CRESLT)

this structure is not guaranteed to remain intact for future releases. Therefore, it is highly recommended not to use this approach.

A better approach is to call the utility routine:

USER_GET_TRANS_INFO

The first three arguments that get passed to USER_GET_TRANS_INFO are character variables defining WHO,ACTION, and WHERE, i.e. the name of the calling routine, the action (i.e. 'GET' or 'RELEASE') and the name of the MMS directory under /USER in which to store the data. If the directory name is left blank, then the data will be stored in /USER/TRANS_INFO

A call to USER_GET_TRANS_INFO will make the following information available:

ATSTEP (accumulated time step)
CTSTEP (current timestep)
DT (current timestep interval)
ATIME (accumulated time, i.e. for all runs)
CTIME (current time, i.e. for the current run)

An example call to USER_GET_TRANS_INFO to get this data is shown below, where the directory to store the data is specified as /USER/TIME_INFO

C
CALL USER_GET_TRANS_INFO (ROUTIN,'GET','TIME_INFO',
& CZ,DZ,IZ,LZ,RZ)
C Obtain a pointer to the stored data
CALL PSHDIR ('/USER/TIME_INFO', 'STOP', CRESLT)
C Get the desired values
CALL PEEKI('ATSTEP',IONE,ATSTEP,'SKIP',CRESLT,IZ)
CALL PEEKI('CTSTEP',IONE,CTSTEP,'SKIP',CRESLT,IZ)
CALL PEEKR('DT', IONE,DT,'SKIP',CRESLT, RZ)
CALL PEEKR('ATIME', IONE,ATIME,'SKIP',CRESLT, RZ)
CALL PEEKR('CTIME', IONE,CTIME,'SKIP',CRESLT, RZ)
C Gets you back out to MMS main directory, ie cd ..
CALL POPDIR ('STOP', CRESLT)
C Release workspace for USER_GET_TRANS_INFO
CALL USER_GET_TRANS_INFO (ROUTIN,'RELEASE','TIME_INFO',
& CZ,DZ,IZ,LZ,RZ)





Show Form
No comments yet. Be the first to add a comment!