1 |
C $Header: /u/gcmpack/development/heimbach/ecco_env/pkg/cal/cal_init.F,v 1.4 2001/02/02 16:57:22 heimbach Exp $ |
2 |
|
3 |
#include "CAL_CPPOPTIONS.h" |
4 |
|
5 |
#ifdef ALLOW_CAL_NENDITER |
6 |
subroutine cal_Init( |
7 |
I modstart, |
8 |
I modend, |
9 |
I modstep, |
10 |
I moditerini, |
11 |
I moditerend, |
12 |
I modintsteps, |
13 |
I mythid |
14 |
& ) |
15 |
#else |
16 |
subroutine cal_Init( |
17 |
I modstart, |
18 |
I modend, |
19 |
I modstep, |
20 |
I moditerini, |
21 |
I modintsteps, |
22 |
I mythid |
23 |
& ) |
24 |
#endif |
25 |
|
26 |
c ================================================================== |
27 |
c SUBROUTINE cal_Init |
28 |
c ================================================================== |
29 |
c |
30 |
c o This routine initialises the calendar according to the user |
31 |
c specifications in "data.calendar". |
32 |
c |
33 |
c started: Christian Eckert eckert@mit.edu 30-Jun-1999 |
34 |
c |
35 |
c changed: Christian Eckert eckert@mit.edu 29-Dec-1999 |
36 |
c |
37 |
c - restructured the original version in order to have a |
38 |
c better interface to the MITgcmUV. |
39 |
c |
40 |
c Christian Eckert eckert@mit.edu 10-Jan-2000 |
41 |
c |
42 |
c - Modified namelist input. The data file is first copied |
43 |
c to scrunit1 with the comment lines being left out. |
44 |
c After this, scrunit1 is used to read the namelist data. |
45 |
c |
46 |
c Christian Eckert eckert@mit.edu 19-Jan-2000 |
47 |
c |
48 |
c - Changed the role of the routine arguments. Chris Hill |
49 |
c proposed to make the calendar less "invasive". The tool |
50 |
c now assumes that the MITgcmUV already provides an ade- |
51 |
c quate set of time stepping parameters. The calendar |
52 |
c only associates a date with the given starttime of the |
53 |
c numerical model. startdate corresponds to zero start- |
54 |
c time. So, given niter0 or startdate .ne. zero the actual |
55 |
c startdate of the current integration is shifted by the |
56 |
c time interval correponding to niter0, startdate respec- |
57 |
c tively. |
58 |
c |
59 |
c Christian Eckert eckert@mit.edu 03-Feb-2000 |
60 |
c |
61 |
c - Introduced new routine and function names, cal_<NAME>, |
62 |
c for verion 0.1.3. |
63 |
c |
64 |
c ================================================================== |
65 |
c SUBROUTINE cal_Init |
66 |
c ================================================================== |
67 |
|
68 |
implicit none |
69 |
|
70 |
c == global variables == |
71 |
|
72 |
#include "EEPARAMS.h" |
73 |
|
74 |
c == routine arguments == |
75 |
|
76 |
c modstart - start time of the model integration |
77 |
c modend - end time of the model integration |
78 |
c moditerini - initial iteration number of the model |
79 |
c moditerend - last iteration number of the model |
80 |
c modstep - timestep of the numerical model |
81 |
c modintsteps - number of timesteps that are to be performed. |
82 |
c mythid - number of this instance of the subrotuine. |
83 |
|
84 |
_RL modstart |
85 |
_RL modend |
86 |
_RL modstep |
87 |
integer moditerini |
88 |
#ifdef ALLOW_CAL_NENDITER |
89 |
integer moditerend |
90 |
#endif |
91 |
integer modintsteps |
92 |
integer mythid |
93 |
|
94 |
c == local variables == |
95 |
|
96 |
integer errio |
97 |
integer ierr |
98 |
integer il |
99 |
integer enddate_1 |
100 |
integer enddate_2 |
101 |
|
102 |
c Variables related to the calendar tool. |
103 |
character*(9) TheCalendar |
104 |
integer startdate_1 |
105 |
integer startdate_2 |
106 |
|
107 |
character*(max_len_prec) record |
108 |
|
109 |
c == external == |
110 |
|
111 |
integer ilnblnk |
112 |
external ilnblnk |
113 |
|
114 |
c == end of interface == |
115 |
|
116 |
c Calendar parameters |
117 |
c (version 0.1.3 >> START << ) |
118 |
|
119 |
namelist /CAL_NML/ |
120 |
& TheCalendar, |
121 |
& startDate_1,startDate_2 |
122 |
|
123 |
c (version 0.1.3 >> END << ) |
124 |
|
125 |
|
126 |
_BEGIN_MASTER(myThid) |
127 |
|
128 |
c Initialise the calendar's parameters |
129 |
TheCalendar = ' ' |
130 |
startdate_1 = 0 |
131 |
startdate_2 = 0 |
132 |
enddate_1 = 0 |
133 |
enddate_2 = 0 |
134 |
|
135 |
open(unit=scrunit1,status='scratch') |
136 |
|
137 |
c Next, read the calendar data file. |
138 |
open(unit = modeldataunit,file = 'data.cal', |
139 |
& status = 'old', iostat = errio) |
140 |
if ( errio .lt. 0 ) then |
141 |
ierr = 1 |
142 |
call cal_PrintError( ierr, mythid ) |
143 |
stop ' stopped in cal_Init.' |
144 |
endif |
145 |
|
146 |
do while ( .true. ) |
147 |
read(modeldataunit, fmt='(a)', end=1001) record |
148 |
il = max(ilnblnk(record),1) |
149 |
if ( record(1:1) .ne. commentcharacter ) |
150 |
& write(unit=scrunit1, fmt='(a)') record(:il) |
151 |
enddo |
152 |
1001 continue |
153 |
|
154 |
close( modeldataunit ) |
155 |
|
156 |
rewind( scrunit1 ) |
157 |
read(unit = scrunit1, nml = cal_nml) |
158 |
close( scrunit1 ) |
159 |
|
160 |
|
161 |
c Check consistency of the date specifications with the MITgcmUV's |
162 |
c startTime, endTime, and nTimeSteps, then set all the calendar |
163 |
c parameters. |
164 |
|
165 |
#ifdef ALLOW_CAL_NENDITER |
166 |
call cal_Set( |
167 |
I modstart, |
168 |
I modend, |
169 |
I modstep, |
170 |
I TheCalendar, |
171 |
I startdate_1, |
172 |
I startdate_2, |
173 |
I enddate_1, |
174 |
I enddate_2, |
175 |
I moditerini, |
176 |
I moditerend, |
177 |
I modintsteps, |
178 |
I mythid |
179 |
& ) |
180 |
#else |
181 |
call cal_Set( |
182 |
I modstart, |
183 |
I modend, |
184 |
I modstep, |
185 |
I TheCalendar, |
186 |
I startdate_1, |
187 |
I startdate_2, |
188 |
I enddate_1, |
189 |
I enddate_2, |
190 |
I moditerini, |
191 |
I modintsteps, |
192 |
I mythid |
193 |
& ) |
194 |
#endif |
195 |
|
196 |
call cal_Summary( mythid ) |
197 |
|
198 |
_END_MASTER(myThid) |
199 |
|
200 |
c Everyone else must wait for the parameters to be loaded |
201 |
_BARRIER |
202 |
|
203 |
return |
204 |
end |