-
Notifications
You must be signed in to change notification settings - Fork 237
/
cal_getdate.F
93 lines (76 loc) · 2.84 KB
/
cal_getdate.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include "CAL_OPTIONS.h"
SUBROUTINE CAL_GETDATE(
I myIter,
I myTime,
O mydate,
I myThid )
C ==================================================================
C SUBROUTINE cal_GetDate
C ==================================================================
C
C o Determine the current date given the iteration number and/or the
C current time of integration.
C <- changed to be function of current time only (less ambiguous)
C
C started: Christian Eckert eckert@mit.edu 30-Jun-1999
C changed: Christian Eckert eckert@mit.edu 29-Dec-1999
C - restructured the original version in order to have a
C better interface to the MITgcmUV.
C Christian Eckert eckert@mit.edu 03-Feb-2000
C - Introduced new routine and function names, cal_<NAME>,
C for verion 0.1.3.
C
C ==================================================================
C SUBROUTINE cal_GetDate
C ==================================================================
IMPLICIT NONE
C == global variables ==
#include "EEPARAMS.h"
#include "cal.h"
C == routine arguments ==
INTEGER myIter
_RL myTime
INTEGER mydate(4)
INTEGER myThid
C == local variables ==
_RL secs
INTEGER workdate(4)
CHARACTER*(MAX_LEN_MBUF) msgBuf
C == end of interface ==
IF ( myIter .EQ. -1 ) THEN
C- Special case to return starDate_1 & _2 :
mydate(1) = startdate_1
mydate(2) = startdate_2
mydate(3) = 1
mydate(4) = 1
ELSEIF ( cal_setStatus .LT. 3 ) THEN
WRITE( msgBuf,'(2A,I10,A,F19.2)') 'CAL_GETDATE: ',
& 'myIter=', myIter, ' , myTime=', myTime
CALL PRINT_ERROR( msgBuf, myThid )
WRITE( msgBuf,'(2A,I2,A)') 'CAL_GETDATE: ',
& 'called too early (cal_setStatus=',cal_setStatus,' )'
CALL PRINT_ERROR( msgBuf, myThid )
STOP 'ABNORMAL END: S/R CAL_GETDATE'
c ELSEIF ( myIter.EQ.modelIter0 .OR. myTime.EQ.modelStart ) THEN
ELSEIF ( myTime.EQ.modelStart ) THEN
C- faster to just copy modelStartDate:
mydate(1) = modelStartDate(1)
mydate(2) = modelStartDate(2)
mydate(3) = modelStartDate(3)
mydate(4) = modelStartDate(4)
ELSE
c if ( myTime.lt.0. ) then
c if (myIter .ge. 0) then
c secs = float(myIter - modelIter0)*modelStep
c else
c print*,' cal_GetDate: Not a valid input!'
c STOP 'ABNORMAL END: S/R CAL_GETDATE'
c endif
c else
secs = myTime - modelStart
c endif
CALL CAL_TIMEINTERVAL( secs, 'secs', workdate, myThid )
CALL CAL_ADDTIME( modelStartDate, workdate, mydate, myThid )
ENDIF
RETURN
END