1 |
C $Header: /u/gcmpack/MITgcm/pkg/cal/cal_stepsperday.F,v 1.2 2003/10/09 04:19:19 edhill Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CAL_OPTIONS.h" |
5 |
|
6 |
subroutine cal_StepsPerDay( |
7 |
I myiter, |
8 |
I mytime, |
9 |
O numsteps, |
10 |
I mythid |
11 |
& ) |
12 |
|
13 |
c ================================================================== |
14 |
c SUBROUTINE cal_StepsPerDay |
15 |
c ================================================================== |
16 |
c |
17 |
c o Given the iteration number and/or the current time of |
18 |
c integration return the number of steps left for the current |
19 |
c calendar day including the step belonging to iter/currenttime. |
20 |
c |
21 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
22 |
c |
23 |
c changed: Christian Eckert eckert@mit.edu 29-Dec-1999 |
24 |
c |
25 |
c - restructured the original version in order to have a |
26 |
c better interface to the MITgcmUV. |
27 |
c |
28 |
c Christian Eckert eckert@mit.edu 03-Feb-2000 |
29 |
c |
30 |
c - Introduced new routine and function names, cal_<NAME>, |
31 |
c for verion 0.1.3. |
32 |
c |
33 |
c ================================================================== |
34 |
c SUBROUTINE cal_StepsPerDay |
35 |
c ================================================================== |
36 |
|
37 |
implicit none |
38 |
|
39 |
c == global variables == |
40 |
|
41 |
#include "cal.h" |
42 |
|
43 |
c == routine arguments == |
44 |
|
45 |
integer myiter |
46 |
_RL mytime |
47 |
integer numsteps |
48 |
integer mythid |
49 |
|
50 |
c == local variables == |
51 |
|
52 |
integer currentdate(4) |
53 |
integer present |
54 |
integer presentsecs |
55 |
integer final |
56 |
integer finalsecs |
57 |
integer ierr |
58 |
integer modelstepsperday |
59 |
|
60 |
c == end of interface == |
61 |
|
62 |
call cal_GetDate( myiter, mytime, currentdate, mythid ) |
63 |
|
64 |
present = currentdate(1) |
65 |
presentsecs = (currentdate(2)/10000)*secondsperhour + |
66 |
& mod(currentdate(2)/100,100)*secondsperminute + |
67 |
& mod(currentdate(2),100) |
68 |
final = modelenddate(1) |
69 |
|
70 |
if (present .lt. final) then |
71 |
C modelstepsperday = cal_nStepDay(mythid) |
72 |
C-jmc: inline Function "cal_nStepDay": |
73 |
modelstepsperday = secondsperday/nint(modelstep) |
74 |
numsteps = modelstepsperday - |
75 |
& int(presentsecs/modelstep) |
76 |
else if (present .eq. final) then |
77 |
finalsecs = (modelenddate(2)/10000)*secondsperhour + |
78 |
& mod(modelenddate(2)/100,100)*secondsperminute + |
79 |
& mod(modelenddate(2),100) |
80 |
numsteps = int((finalsecs - presentsecs)/modelstep) |
81 |
else |
82 |
|
83 |
ierr = 1101 |
84 |
call cal_PrintError( ierr, mythid ) |
85 |
stop ' stopped in cal_StepsPerDay.' |
86 |
|
87 |
endif |
88 |
|
89 |
return |
90 |
end |