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