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