2 |
C $Header$ |
C $Header$ |
3 |
C $Name$ |
C $Name$ |
4 |
|
|
|
#include "AD_CONFIG.h" |
|
5 |
#include "CTRL_CPPOPTIONS.h" |
#include "CTRL_CPPOPTIONS.h" |
6 |
|
|
|
|
|
7 |
subroutine ctrl_init( mythid ) |
subroutine ctrl_init( mythid ) |
8 |
|
|
9 |
c ================================================================== |
c ================================================================== |
52 |
c new: endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
c new: endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
53 |
c new: & xx_???period) + 2 |
c new: & xx_???period) + 2 |
54 |
c |
c |
55 |
|
c heimbach@mit.edu totally restructured 28-Oct-2003 |
56 |
|
c |
57 |
c ================================================================== |
c ================================================================== |
58 |
c SUBROUTINE ctrl_init |
c SUBROUTINE ctrl_init |
59 |
c ================================================================== |
c ================================================================== |
68 |
#include "GRID.h" |
#include "GRID.h" |
69 |
#include "ctrl.h" |
#include "ctrl.h" |
70 |
|
|
71 |
#ifdef ALLOW_CALENDAR |
#ifdef ALLOW_CAL |
72 |
# include "cal.h" |
# include "cal.h" |
73 |
#endif |
#endif |
74 |
#ifdef ALLOW_OBCS_CONTROL |
#ifdef ALLOW_OBCS_CONTROL |
84 |
|
|
85 |
c == local variables == |
c == local variables == |
86 |
|
|
87 |
integer bi,bj |
#ifndef ALLOW_ECCO_OPTIMIZATION |
88 |
integer i,j,k |
integer optimcycle |
89 |
integer itlo,ithi |
#endif |
|
integer jtlo,jthi |
|
|
integer jmin,jmax |
|
|
integer imin,imax |
|
90 |
integer ntmp |
integer ntmp |
91 |
integer ivarindex |
integer ivar |
92 |
|
|
93 |
integer iobcs |
integer iobcs |
94 |
integer il |
integer il |
95 |
integer errio |
integer errio |
96 |
integer startrec |
integer startrec |
97 |
integer endrec |
integer endrec |
98 |
|
integer diffrec |
99 |
integer difftime(4) |
integer difftime(4) |
100 |
_RL diffsecs |
_RL diffsecs |
|
_RL dummy |
|
101 |
|
|
|
character*(80) ymaskobcs |
|
102 |
character*(max_len_prec) record |
character*(max_len_prec) record |
103 |
character*(max_len_mbuf) msgbuf |
character*(max_len_mbuf) msgbuf |
104 |
|
character*2 whichxyz |
|
integer nwetc3d |
|
105 |
|
|
106 |
c == external == |
c == external == |
107 |
|
|
110 |
|
|
111 |
c == end of interface == |
c == end of interface == |
112 |
|
|
113 |
c-- Set loop ranges. |
#ifndef ALLOW_ECCO_OPTIMIZATION |
114 |
jtlo = mybylo(mythid) |
optimcycle = 0 |
|
jthi = mybyhi(mythid) |
|
|
itlo = mybxlo(mythid) |
|
|
ithi = mybxhi(mythid) |
|
|
jmin = 1 |
|
|
jmax = sny |
|
|
imin = 1 |
|
|
imax = snx |
|
|
|
|
|
|
|
|
_BEGIN_MASTER( myThid ) |
|
|
|
|
|
#ifdef ALLOW_CALENDAR |
|
|
|
|
|
c-- Get the complete dates of the control variables. |
|
|
#if (defined (ALLOW_HFLUX_CONTROL)) |
|
|
c-- The heat flux contribution. |
|
|
call cal_FullDate( xx_hfluxstartdate1, xx_hfluxstartdate2, |
|
|
& xx_hfluxstartdate , mythid ) |
|
|
#elif (defined (ALLOW_ATEMP_CONTROL)) |
|
|
c-- Atmos. temperature contribution. |
|
|
call cal_FullDate( xx_atempstartdate1, xx_atempstartdate2, |
|
|
& xx_atempstartdate , mythid ) |
|
|
#endif |
|
|
|
|
|
#if (defined (ALLOW_SFLUX_CONTROL)) |
|
|
c-- The salt flux contribution. |
|
|
call cal_FullDate( xx_sfluxstartdate1, xx_sfluxstartdate2, |
|
|
& xx_sfluxstartdate , mythid ) |
|
|
#elif (defined (ALLOW_AQH_CONTROL)) |
|
|
c-- Atmospheric humidity contribution. |
|
|
call cal_FullDate( xx_aqhstartdate1, xx_aqhstartdate2, |
|
|
& xx_aqhstartdate , mythid ) |
|
|
#endif |
|
|
|
|
|
#if (defined (ALLOW_USTRESS_CONTROL)) |
|
|
c-- The zonal wind stress contribution. |
|
|
call cal_FullDate( xx_tauustartdate1, xx_tauustartdate2, |
|
|
& xx_tauustartdate, mythid ) |
|
|
#elif (defined (ALLOW_UWIND_CONTROL)) |
|
|
c-- Zonal wind speed contribution. |
|
|
call cal_FullDate( xx_uwindstartdate1, xx_uwindstartdate2, |
|
|
& xx_uwindstartdate , mythid ) |
|
|
#endif |
|
|
|
|
|
#if (defined (ALLOW_VSTRESS_CONTROL)) |
|
|
c-- The merid. wind stress contribution. |
|
|
call cal_FullDate( xx_tauvstartdate1, xx_tauvstartdate2, |
|
|
& xx_tauvstartdate, mythid ) |
|
|
#elif (defined (ALLOW_VWIND_CONTROL)) |
|
|
c-- Merid. wind speed contribution. |
|
|
call cal_FullDate( xx_vwindstartdate1, xx_vwindstartdate2, |
|
|
& xx_vwindstartdate , mythid ) |
|
115 |
#endif |
#endif |
116 |
|
|
|
#ifdef ALLOW_OBCS_CONTROL |
|
|
call cal_FullDate( xx_obcsnstartdate1, xx_obcsnstartdate2, |
|
|
& xx_obcsnstartdate, mythid ) |
|
|
call cal_FullDate( xx_obcssstartdate1, xx_obcssstartdate2, |
|
|
& xx_obcssstartdate, mythid ) |
|
|
call cal_FullDate( xx_obcswstartdate1, xx_obcswstartdate2, |
|
|
& xx_obcswstartdate, mythid ) |
|
|
call cal_FullDate( xx_obcsestartdate1, xx_obcsestartdate2, |
|
|
& xx_obcsestartdate, mythid ) |
|
|
#endif |
|
|
|
|
|
#endif /* ALLOW_CALENDAR */ |
|
|
|
|
117 |
c-- Set default values. |
c-- Set default values. |
118 |
do ivarindex = 1,maxcvars |
do ivar = 1,maxcvars |
119 |
ncvarindex(ivarindex) = -1 |
ncvarindex(ivar) = -1 |
120 |
ncvarrecs(ivarindex) = 0 |
ncvarrecs(ivar) = 0 |
121 |
ncvarxmax(ivarindex) = 0 |
ncvarxmax(ivar) = 0 |
122 |
ncvarymax(ivarindex) = 0 |
ncvarymax(ivar) = 0 |
123 |
ncvarnrmax(ivarindex) = 0 |
ncvarnrmax(ivar) = 0 |
124 |
ncvargrd(ivarindex) = '?' |
ncvargrd(ivar) = '?' |
125 |
enddo |
enddo |
|
|
|
|
write(msgbuf,'(a)') ' ' |
|
|
call print_message( msgbuf, standardmessageunit, |
|
|
& SQUEEZE_RIGHT , mythid) |
|
|
write(msgbuf,'(a)') |
|
|
& ' ctrl_init: Initializing temperature and salinity' |
|
|
call print_message( msgbuf, standardmessageunit, |
|
|
& SQUEEZE_RIGHT , mythid) |
|
|
write(msgbuf,'(a)') |
|
|
& ' part of the control vector.' |
|
|
call print_message( msgbuf, standardmessageunit, |
|
|
& SQUEEZE_RIGHT , mythid) |
|
|
write(msgbuf,'(a,a)') |
|
|
& ' The initial surface fluxes are set', |
|
|
& ' to zero.' |
|
|
call print_message( msgbuf, standardmessageunit, |
|
|
& SQUEEZE_RIGHT , mythid) |
|
|
write(msgbuf,'(a)') ' ' |
|
|
call print_message( msgbuf, standardmessageunit, |
|
|
& SQUEEZE_RIGHT , mythid) |
|
|
_END_MASTER( mythid ) |
|
126 |
|
|
127 |
_BARRIER |
_BARRIER |
128 |
|
|
145 |
c-- |
c-- |
146 |
#ifdef ALLOW_THETA0_CONTROL |
#ifdef ALLOW_THETA0_CONTROL |
147 |
c-- Initial state temperature contribution. |
c-- Initial state temperature contribution. |
148 |
|
call ctrl_init_ctrlvar ( |
149 |
_BEGIN_MASTER( mythid ) |
& xx_theta_file, 1, 101, 1, 1, 1, |
150 |
ivarindex = 1 |
& snx, sny, nr, 'c', '3d', mythid ) |
|
ncvarindex(ivarindex) = 101 |
|
|
ncvarrecs(ivarindex) = 1 |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = nr |
|
|
ncvargrd(ivarindex) = 'c' |
|
|
_END_MASTER( mythid ) |
|
|
|
|
151 |
#endif /* ALLOW_THETA0_CONTROL */ |
#endif /* ALLOW_THETA0_CONTROL */ |
152 |
|
|
153 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
154 |
c-- |
c-- |
155 |
#ifdef ALLOW_SALT0_CONTROL |
#ifdef ALLOW_SALT0_CONTROL |
156 |
c-- Initial state salinity contribution. |
c-- Initial state salinity contribution. |
157 |
|
call ctrl_init_ctrlvar ( |
158 |
_BEGIN_MASTER( mythid ) |
& xx_salt_file, 2, 102, 1, 1, 1, |
159 |
ivarindex = 2 |
& snx, sny, nr, 'c', '3d', mythid ) |
|
ncvarindex(ivarindex) = 102 |
|
|
ncvarrecs(ivarindex) = 1 |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = nr |
|
|
ncvargrd(ivarindex) = 'c' |
|
|
_END_MASTER( mythid ) |
|
|
|
|
160 |
#endif /* ALLOW_SALT0_CONTROL */ |
#endif /* ALLOW_SALT0_CONTROL */ |
161 |
|
|
162 |
c-- =========================== |
c-- =========================== |
168 |
#if (defined (ALLOW_HFLUX_CONTROL)) |
#if (defined (ALLOW_HFLUX_CONTROL)) |
169 |
c-- Heat flux. |
c-- Heat flux. |
170 |
|
|
171 |
_BEGIN_MASTER( mythid ) |
# ifdef ALLOW_CAL |
172 |
#ifdef ALLOW_CALENDAR |
call cal_FullDate( xx_hfluxstartdate1, xx_hfluxstartdate2, |
173 |
|
& xx_hfluxstartdate , mythid ) |
174 |
call cal_TimePassed( xx_hfluxstartdate, modelstartdate, |
call cal_TimePassed( xx_hfluxstartdate, modelstartdate, |
175 |
& difftime, mythid ) |
& difftime, mythid ) |
176 |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
178 |
& xx_hfluxperiod) + 1 |
& xx_hfluxperiod) + 1 |
179 |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
180 |
& xx_hfluxperiod) + 2 |
& xx_hfluxperiod) + 2 |
181 |
#else |
# else |
182 |
startrec = 1 |
startrec = 1 |
183 |
endrec = 1 |
endrec = 1 |
184 |
#endif |
# endif |
185 |
ivarindex = 3 |
diffrec = endrec - startrec + 1 |
186 |
ncvarindex(ivarindex) = 103 |
call ctrl_init_ctrlvar ( |
187 |
ncvarrecs(ivarindex) = endrec - startrec + 1 |
& xx_hflux_file, 3, 103, diffrec, startrec, endrec, |
188 |
ncvarrecstart(ivarindex) = startrec |
& snx, sny, 1, 'c', 'xy', mythid ) |
|
ncvarrecsend(ivarindex) = endrec |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = 1 |
|
|
ncvargrd(ivarindex) = 'c' |
|
|
_END_MASTER( mythid ) |
|
189 |
|
|
190 |
#elif (defined (ALLOW_ATEMP_CONTROL)) |
#elif (defined (ALLOW_ATEMP_CONTROL)) |
191 |
c-- Atmos. temperature |
c-- Atmos. temperature |
192 |
|
|
193 |
_BEGIN_MASTER( mythid ) |
# ifdef ALLOW_CAL |
194 |
#ifdef ALLOW_CALENDAR |
call cal_FullDate( xx_atempstartdate1, xx_atempstartdate2, |
195 |
|
& xx_atempstartdate , mythid ) |
196 |
call cal_TimePassed( xx_atempstartdate, modelstartdate, |
call cal_TimePassed( xx_atempstartdate, modelstartdate, |
197 |
& difftime, mythid ) |
& difftime, mythid ) |
198 |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
200 |
& xx_atempperiod) + 1 |
& xx_atempperiod) + 1 |
201 |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
202 |
& xx_atempperiod) + 2 |
& xx_atempperiod) + 2 |
203 |
#else |
# else |
204 |
startrec = 1 |
startrec = 1 |
205 |
endrec = 1 |
endrec = 1 |
206 |
#endif |
# endif |
207 |
ivarindex = 7 |
diffrec = endrec - startrec + 1 |
208 |
ncvarindex(ivarindex) = 107 |
call ctrl_init_ctrlvar ( |
209 |
ncvarrecs(ivarindex) = endrec - startrec + 1 |
& xx_atemp_file, 7, 107, diffrec, startrec, endrec, |
210 |
ncvarrecstart(ivarindex) = startrec |
& snx, sny, 1, 'c', 'xy', mythid ) |
|
ncvarrecsend(ivarindex) = endrec |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = 1 |
|
|
ncvargrd(ivarindex) = 'c' |
|
|
_END_MASTER( mythid ) |
|
211 |
|
|
212 |
#elif (defined (ALLOW_HFLUX0_CONTROL)) |
#elif (defined (ALLOW_HFLUX0_CONTROL)) |
213 |
c-- initial forcing only |
c-- initial forcing only |
214 |
_BEGIN_MASTER( mythid ) |
call ctrl_init_ctrlvar ( |
215 |
ncvarindex(3) = 103 |
& xx_hflux_file, 3, 103, 1, 1, 1, |
216 |
ncvarrecs(3) = 1 |
& snx, sny, 1, 'c', 'xy', mythid ) |
|
ncvarxmax(3) = snx |
|
|
ncvarymax(3) = sny |
|
|
ncvarnrmax(3) = 1 |
|
|
ncvargrd(3) = 'c' |
|
|
_END_MASTER( mythid ) |
|
217 |
|
|
218 |
#endif /* ALLOW_HFLUX_CONTROL */ |
#endif /* ALLOW_HFLUX_CONTROL */ |
219 |
|
|
222 |
#if (defined (ALLOW_SFLUX_CONTROL)) |
#if (defined (ALLOW_SFLUX_CONTROL)) |
223 |
c-- Salt flux. |
c-- Salt flux. |
224 |
|
|
225 |
_BEGIN_MASTER( mythid ) |
# ifdef ALLOW_CAL |
226 |
#ifdef ALLOW_CALENDAR |
call cal_FullDate( xx_sfluxstartdate1, xx_sfluxstartdate2, |
227 |
|
& xx_sfluxstartdate , mythid ) |
228 |
call cal_TimePassed( xx_sfluxstartdate, modelstartdate, |
call cal_TimePassed( xx_sfluxstartdate, modelstartdate, |
229 |
& difftime, mythid ) |
& difftime, mythid ) |
230 |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
232 |
& xx_sfluxperiod) + 1 |
& xx_sfluxperiod) + 1 |
233 |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
234 |
& xx_sfluxperiod) + 2 |
& xx_sfluxperiod) + 2 |
235 |
#else |
# else |
236 |
startrec = 1 |
startrec = 1 |
237 |
endrec = 1 |
endrec = 1 |
238 |
#endif |
# endif |
239 |
ivarindex = 4 |
diffrec = endrec - startrec + 1 |
240 |
ncvarindex(ivarindex) = 104 |
call ctrl_init_ctrlvar ( |
241 |
ncvarrecs(ivarindex) = endrec - startrec + 1 |
& xx_sflux_file, 4, 104, diffrec, startrec, endrec, |
242 |
ncvarrecstart(ivarindex) = startrec |
& snx, sny, 1, 'c', 'xy', mythid ) |
243 |
ncvarrecsend(ivarindex) = endrec |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = 1 |
|
|
ncvargrd(ivarindex) = 'c' |
|
|
_END_MASTER( mythid ) |
|
|
|
|
244 |
#elif (defined (ALLOW_AQH_CONTROL)) |
#elif (defined (ALLOW_AQH_CONTROL)) |
245 |
c-- Atmos. humidity |
c-- Atmos. humidity |
246 |
|
|
247 |
_BEGIN_MASTER( mythid ) |
# ifdef ALLOW_CAL |
248 |
#ifdef ALLOW_CALENDAR |
call cal_FullDate( xx_aqhstartdate1, xx_aqhstartdate2, |
249 |
|
& xx_aqhstartdate , mythid ) |
250 |
call cal_TimePassed( xx_aqhstartdate, modelstartdate, |
call cal_TimePassed( xx_aqhstartdate, modelstartdate, |
251 |
& difftime, mythid ) |
& difftime, mythid ) |
252 |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
254 |
& xx_aqhperiod) + 1 |
& xx_aqhperiod) + 1 |
255 |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
256 |
& xx_aqhperiod) + 2 |
& xx_aqhperiod) + 2 |
257 |
#else |
# else |
258 |
startrec = 1 |
startrec = 1 |
259 |
endrec = 1 |
endrec = 1 |
260 |
#endif |
# endif |
261 |
ivarindex = 8 |
diffrec = endrec - startrec + 1 |
262 |
ncvarindex(ivarindex) = 108 |
call ctrl_init_ctrlvar ( |
263 |
ncvarrecs(ivarindex) = endrec - startrec + 1 |
& xx_aqh_file, 8, 108, diffrec, startrec, endrec, |
264 |
ncvarrecstart(ivarindex) = startrec |
& snx, sny, 1, 'c', 'xy', mythid ) |
|
ncvarrecsend(ivarindex) = endrec |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = 1 |
|
|
ncvargrd(ivarindex) = 'c' |
|
|
_END_MASTER( mythid ) |
|
265 |
|
|
266 |
#elif (defined (ALLOW_SFLUX0_CONTROL)) |
#elif (defined (ALLOW_SFLUX0_CONTROL)) |
267 |
c-- initial forcing only |
c-- initial forcing only |
268 |
_BEGIN_MASTER( mythid ) |
call ctrl_init_ctrlvar ( |
269 |
ncvarindex(4) = 104 |
& xx_sflux_file, 4, 104, 1, 1, 1, |
270 |
ncvarrecs(4) = 1 |
& snx, sny, 1, 'c', 'xy', mythid ) |
|
ncvarxmax(4) = snx |
|
|
ncvarymax(4) = sny |
|
|
ncvarnrmax(4) = 1 |
|
|
ncvargrd(4) = 'c' |
|
|
_END_MASTER( mythid ) |
|
271 |
|
|
272 |
#endif /* ALLOW_SFLUX_CONTROL */ |
#endif /* ALLOW_SFLUX_CONTROL */ |
273 |
|
|
276 |
#if (defined (ALLOW_USTRESS_CONTROL)) |
#if (defined (ALLOW_USTRESS_CONTROL)) |
277 |
c-- Zonal wind stress. |
c-- Zonal wind stress. |
278 |
|
|
279 |
_BEGIN_MASTER( mythid ) |
# ifdef ALLOW_CAL |
280 |
#ifdef ALLOW_CALENDAR |
call cal_FullDate( xx_tauustartdate1, xx_tauustartdate2, |
281 |
|
& xx_tauustartdate, mythid ) |
282 |
call cal_TimePassed( xx_tauustartdate, modelstartdate, |
call cal_TimePassed( xx_tauustartdate, modelstartdate, |
283 |
& difftime, mythid ) |
& difftime, mythid ) |
284 |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
286 |
& xx_tauuperiod) + 1 |
& xx_tauuperiod) + 1 |
287 |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
288 |
& xx_tauuperiod) + 2 |
& xx_tauuperiod) + 2 |
289 |
#else |
# else |
290 |
startrec = 1 |
startrec = 1 |
291 |
endrec = 1 |
endrec = 1 |
292 |
#endif |
# endif |
293 |
ivarindex = 5 |
diffrec = endrec - startrec + 1 |
294 |
ncvarindex(ivarindex) = 105 |
call ctrl_init_ctrlvar ( |
295 |
ncvarrecs(ivarindex) = endrec - startrec + 1 |
& xx_tauu_file, 5, 105, diffrec, startrec, endrec, |
296 |
ncvarrecstart(ivarindex) = startrec |
& snx, sny, 1, 'w', 'xy', mythid ) |
|
ncvarrecsend(ivarindex) = endrec |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = 1 |
|
|
ncvargrd(ivarindex) = 'w' |
|
|
_END_MASTER( mythid ) |
|
297 |
|
|
298 |
#elif (defined (ALLOW_UWIND_CONTROL)) |
#elif (defined (ALLOW_UWIND_CONTROL)) |
299 |
c-- Zonal wind speed. |
c-- Zonal wind speed. |
300 |
|
|
301 |
_BEGIN_MASTER( mythid ) |
# ifdef ALLOW_CAL |
302 |
#ifdef ALLOW_CALENDAR |
call cal_FullDate( xx_uwindstartdate1, xx_uwindstartdate2, |
303 |
|
& xx_uwindstartdate , mythid ) |
304 |
call cal_TimePassed( xx_uwindstartdate, modelstartdate, |
call cal_TimePassed( xx_uwindstartdate, modelstartdate, |
305 |
& difftime, mythid ) |
& difftime, mythid ) |
306 |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
308 |
& xx_uwindperiod) + 1 |
& xx_uwindperiod) + 1 |
309 |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
310 |
& xx_uwindperiod) + 2 |
& xx_uwindperiod) + 2 |
311 |
#else |
# else |
312 |
startrec = 1 |
startrec = 1 |
313 |
endrec = 1 |
endrec = 1 |
314 |
#endif |
# endif |
315 |
ivarindex = 9 |
diffrec = endrec - startrec + 1 |
316 |
ncvarindex(ivarindex) = 109 |
call ctrl_init_ctrlvar ( |
317 |
ncvarrecs(ivarindex) = endrec - startrec + 1 |
& xx_uwind_file, 9, 109, diffrec, startrec, endrec, |
318 |
ncvarrecstart(ivarindex) = startrec |
& snx, sny, 1, 'w', 'xy', mythid ) |
|
ncvarrecsend(ivarindex) = endrec |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = 1 |
|
|
ncvargrd(ivarindex) = 'w' |
|
|
_END_MASTER( mythid ) |
|
319 |
|
|
320 |
#elif (defined (ALLOW_TAUU0_CONTROL)) |
#elif (defined (ALLOW_TAUU0_CONTROL)) |
321 |
c-- initial forcing only |
c-- initial forcing only |
322 |
_BEGIN_MASTER( mythid ) |
call ctrl_init_ctrlvar ( |
323 |
ncvarindex(5) = 105 |
& xx_tauu_file, 5, 105, 1, 1, 1, |
324 |
ncvarrecs(5) = 1 |
& snx, sny, 1, 'w', 'xy', mythid ) |
|
ncvarxmax(5) = snx |
|
|
ncvarymax(5) = sny |
|
|
ncvarnrmax(5) = 1 |
|
|
ncvargrd(5) = 'w' |
|
|
_END_MASTER( mythid ) |
|
325 |
|
|
326 |
#endif /* ALLOW_USTRESS_CONTROL */ |
#endif /* ALLOW_USTRESS_CONTROL */ |
327 |
|
|
330 |
#if (defined (ALLOW_VSTRESS_CONTROL)) |
#if (defined (ALLOW_VSTRESS_CONTROL)) |
331 |
c-- Meridional wind stress. |
c-- Meridional wind stress. |
332 |
|
|
333 |
_BEGIN_MASTER( mythid ) |
# ifdef ALLOW_CAL |
334 |
#ifdef ALLOW_CALENDAR |
call cal_FullDate( xx_tauvstartdate1, xx_tauvstartdate2, |
335 |
|
& xx_tauvstartdate, mythid ) |
336 |
call cal_TimePassed( xx_tauvstartdate, modelstartdate, |
call cal_TimePassed( xx_tauvstartdate, modelstartdate, |
337 |
& difftime, mythid ) |
& difftime, mythid ) |
338 |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
340 |
& xx_tauvperiod) + 1 |
& xx_tauvperiod) + 1 |
341 |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
342 |
& xx_tauvperiod) + 2 |
& xx_tauvperiod) + 2 |
343 |
#else |
# else |
344 |
startrec = 1 |
startrec = 1 |
345 |
endrec = 1 |
endrec = 1 |
346 |
#endif |
# endif |
347 |
ivarindex = 6 |
diffrec = endrec - startrec + 1 |
348 |
ncvarindex(ivarindex) = 106 |
call ctrl_init_ctrlvar ( |
349 |
ncvarrecs(ivarindex) = endrec - startrec + 1 |
& xx_tauv_file, 6, 106, diffrec, startrec, endrec, |
350 |
ncvarrecstart(ivarindex) = startrec |
& snx, sny, 1, 's', 'xy', mythid ) |
|
ncvarrecsend(ivarindex) = endrec |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = 1 |
|
|
ncvargrd(ivarindex) = 's' |
|
|
_END_MASTER( mythid ) |
|
351 |
|
|
352 |
#elif (defined (ALLOW_VWIND_CONTROL)) |
#elif (defined (ALLOW_VWIND_CONTROL)) |
353 |
c-- Meridional wind speed. |
c-- Meridional wind speed. |
354 |
|
|
355 |
_BEGIN_MASTER( mythid ) |
# ifdef ALLOW_CAL |
356 |
#ifdef ALLOW_CALENDAR |
call cal_FullDate( xx_vwindstartdate1, xx_vwindstartdate2, |
357 |
|
& xx_vwindstartdate , mythid ) |
358 |
call cal_TimePassed( xx_vwindstartdate, modelstartdate, |
call cal_TimePassed( xx_vwindstartdate, modelstartdate, |
359 |
& difftime, mythid ) |
& difftime, mythid ) |
360 |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
362 |
& xx_vwindperiod) + 1 |
& xx_vwindperiod) + 1 |
363 |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
endrec = int((modelend + startTime - diffsecs + modelstep/2)/ |
364 |
& xx_vwindperiod) + 2 |
& xx_vwindperiod) + 2 |
365 |
#else |
# else |
366 |
startrec = 1 |
startrec = 1 |
367 |
endrec = 1 |
endrec = 1 |
368 |
#endif |
# endif |
369 |
ivarindex = 10 |
diffrec = endrec - startrec + 1 |
370 |
ncvarindex(ivarindex) = 110 |
call ctrl_init_ctrlvar ( |
371 |
ncvarrecs(ivarindex) = endrec - startrec + 1 |
& xx_vwind_file, 10, 110, diffrec, startrec, endrec, |
372 |
ncvarrecstart(ivarindex) = startrec |
& snx, sny, 1, 's', 'xy', mythid ) |
|
ncvarrecsend(ivarindex) = endrec |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = 1 |
|
|
ncvargrd(ivarindex) = 's' |
|
|
_END_MASTER( mythid ) |
|
373 |
|
|
374 |
#elif (defined (ALLOW_TAUV0_CONTROL)) |
#elif (defined (ALLOW_TAUV0_CONTROL)) |
375 |
c-- initial forcing only |
c-- initial forcing only |
376 |
_BEGIN_MASTER( mythid ) |
diffrec = endrec - startrec + 1 |
377 |
ncvarindex(6) = 106 |
call ctrl_init_ctrlvar ( |
378 |
ncvarrecs(6) = 1 |
& xx_tauv_file, 6, 106, 1, 1, 1, |
379 |
ncvarxmax(6) = snx |
& snx, sny, 1, 's', 'xy', mythid ) |
|
ncvarymax(6) = sny |
|
|
ncvarnrmax(6) = 1 |
|
|
ncvargrd(6) = 's' |
|
|
_END_MASTER( mythid ) |
|
380 |
|
|
381 |
#endif /* ALLOW_VSTRESS_CONTROL */ |
#endif /* ALLOW_VSTRESS_CONTROL */ |
382 |
|
|
383 |
|
c-- =========================== |
384 |
|
c-- Open boundary contributions. |
385 |
|
c-- =========================== |
386 |
|
|
387 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
388 |
c-- |
c-- |
389 |
#ifdef ALLOW_OBCSN_CONTROL |
#ifdef ALLOW_OBCSN_CONTROL |
390 |
c-- Northern obc. |
c-- Northern obc. |
391 |
|
|
392 |
_BEGIN_MASTER( mythid ) |
# ifdef ALLOW_CAL |
393 |
#ifdef ALLOW_CALENDAR |
call cal_FullDate( xx_obcsnstartdate1, xx_obcsnstartdate2, |
394 |
|
& xx_obcsnstartdate, mythid ) |
395 |
call cal_TimePassed( xx_obcsnstartdate, modelstartdate, |
call cal_TimePassed( xx_obcsnstartdate, modelstartdate, |
396 |
& difftime, mythid ) |
& difftime, mythid ) |
397 |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
|
cgg O.B. future values are needed at the last timestep, so lets |
|
|
cgg take this into account. |
|
398 |
startrec = int((modelstart - diffsecs)/xx_obcsnperiod) + 1 |
startrec = int((modelstart - diffsecs)/xx_obcsnperiod) + 1 |
399 |
|
startrec = (startrec - 1)*nobcs + 1 |
400 |
endrec = int((modelend - diffsecs)/xx_obcsnperiod) + 2 |
endrec = int((modelend - diffsecs)/xx_obcsnperiod) + 2 |
401 |
#else |
endrec = (endrec - startrec + 1)*nobcs |
402 |
|
# else |
403 |
startrec = 1 |
startrec = 1 |
404 |
endrec = 1 |
endrec = 1 |
405 |
#endif |
# endif |
406 |
ivarindex = 11 |
diffrec = endrec*nobcs |
407 |
ncvarindex(ivarindex) = 111 |
call ctrl_init_ctrlvar ( |
408 |
cgg( Implement heimbach fix for nobcs. |
& xx_obcsn_file, 11, 111, diffrec, startrec, endrec, |
409 |
ncvarrecs(ivarindex) = (endrec - startrec + 1)*nobcs |
& snx, sny, nr, 'm', 'xz', mythid ) |
|
ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1 |
|
|
ncvarrecsend(ivarindex) = endrec*nobcs |
|
|
cgg) |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = 1 |
|
|
ncvarnrmax(ivarindex) = nr |
|
|
ncvargrd(ivarindex) = 'm' |
|
|
_END_MASTER( mythid ) |
|
410 |
|
|
411 |
#endif /* ALLOW_OBCSN_CONTROL */ |
#endif /* ALLOW_OBCSN_CONTROL */ |
412 |
|
|
413 |
|
c------------------------------------------------------------------------------- |
414 |
|
c-- |
415 |
#ifdef ALLOW_OBCSS_CONTROL |
#ifdef ALLOW_OBCSS_CONTROL |
416 |
c-- Southern obc. |
c-- Southern obc. |
417 |
|
|
418 |
c------------------------------------------------------------------------------- |
# ifdef ALLOW_CAL |
419 |
c-- |
call cal_FullDate( xx_obcssstartdate1, xx_obcssstartdate2, |
420 |
_BEGIN_MASTER( mythid ) |
& xx_obcssstartdate, mythid ) |
|
#ifdef ALLOW_CALENDAR |
|
421 |
call cal_TimePassed( xx_obcssstartdate, modelstartdate, |
call cal_TimePassed( xx_obcssstartdate, modelstartdate, |
422 |
& difftime, mythid ) |
& difftime, mythid ) |
423 |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
|
cgg O.B. future values are needed at the last timestep, so lets |
|
|
cgg take this into account. |
|
424 |
startrec = int((modelstart - diffsecs)/xx_obcssperiod) + 1 |
startrec = int((modelstart - diffsecs)/xx_obcssperiod) + 1 |
425 |
|
startrec = (startrec - 1)*nobcs + 1 |
426 |
endrec = int((modelend - diffsecs)/xx_obcssperiod) + 2 |
endrec = int((modelend - diffsecs)/xx_obcssperiod) + 2 |
427 |
#else |
endrec = (endrec - startrec + 1)*nobcs |
428 |
|
# else |
429 |
startrec = 1 |
startrec = 1 |
430 |
endrec = 1 |
endrec = 1 |
431 |
#endif |
# endif |
432 |
ivarindex = 12 |
diffrec = endrec*nobcs |
433 |
ncvarindex(ivarindex) = 112 |
call ctrl_init_ctrlvar ( |
434 |
cgg( Implement heimbach fix for nobcs. |
& xx_obcss_file, 12, 112, diffrec, startrec, endrec, |
435 |
ncvarrecs(ivarindex) = (endrec - startrec + 1)*nobcs |
& snx, sny, nr, 'm', 'xz', mythid ) |
|
ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1 |
|
|
ncvarrecsend(ivarindex) = endrec*nobcs |
|
|
cph) |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = 1 |
|
|
ncvarnrmax(ivarindex) = nr |
|
|
ncvargrd(ivarindex) = 'm' |
|
|
_END_MASTER( mythid ) |
|
436 |
|
|
437 |
#endif /* ALLOW_OBCSS_CONTROL */ |
#endif /* ALLOW_OBCSS_CONTROL */ |
438 |
|
|
441 |
#ifdef ALLOW_OBCSW_CONTROL |
#ifdef ALLOW_OBCSW_CONTROL |
442 |
c-- Western obc. |
c-- Western obc. |
443 |
|
|
444 |
_BEGIN_MASTER( mythid ) |
# ifdef ALLOW_CAL |
445 |
#ifdef ALLOW_CALENDAR |
call cal_FullDate( xx_obcswstartdate1, xx_obcswstartdate2, |
446 |
|
& xx_obcswstartdate, mythid ) |
447 |
call cal_TimePassed( xx_obcswstartdate, modelstartdate, |
call cal_TimePassed( xx_obcswstartdate, modelstartdate, |
448 |
& difftime, mythid ) |
& difftime, mythid ) |
449 |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
450 |
startrec = int((modelstart - diffsecs)/xx_obcswperiod) + 1 |
startrec = int((modelstart - diffsecs)/xx_obcswperiod) + 1 |
451 |
|
startrec = (startrec - 1)*nobcs + 1 |
452 |
endrec = int((modelend - diffsecs)/xx_obcswperiod) + 2 |
endrec = int((modelend - diffsecs)/xx_obcswperiod) + 2 |
453 |
#else |
endrec = (endrec - startrec + 1)*nobcs |
454 |
|
# else |
455 |
startrec = 1 |
startrec = 1 |
456 |
endrec = 1 |
endrec = 1 |
457 |
#endif |
# endif |
458 |
ivarindex = 13 |
diffrec = endrec*nobcs |
459 |
ncvarindex(ivarindex) = 113 |
call ctrl_init_ctrlvar ( |
460 |
cgg( Implement heimbach fix for nobcs. |
& xx_obcsw_file, 13, 113, diffrec, startrec, endrec, |
461 |
ncvarrecs(ivarindex) = (endrec - startrec + 1)*nobcs |
& snx, sny, nr, 'm', 'yz', mythid ) |
|
ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1 |
|
|
ncvarrecsend(ivarindex) = endrec*nobcs |
|
|
cgg) |
|
|
ncvarxmax(ivarindex) = 1 |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = nr |
|
|
ncvargrd(ivarindex) = 'm' |
|
|
_END_MASTER( mythid ) |
|
462 |
|
|
463 |
#endif /* ALLOW_OBCSW_CONTROL */ |
#endif /* ALLOW_OBCSW_CONTROL */ |
464 |
|
|
465 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
466 |
c-- |
c-- |
467 |
#ifdef ALLOW_OBCSE_CONTROL |
#ifdef ALLOW_OBCSE_CONTROL |
468 |
c-- Eastern obc. |
c-- Eastern obc. |
469 |
|
|
470 |
_BEGIN_MASTER( mythid ) |
# ifdef ALLOW_CAL |
471 |
#ifdef ALLOW_CALENDAR |
call cal_FullDate( xx_obcsestartdate1, xx_obcsestartdate2, |
472 |
|
& xx_obcsestartdate, mythid ) |
473 |
call cal_TimePassed( xx_obcsestartdate, modelstartdate, |
call cal_TimePassed( xx_obcsestartdate, modelstartdate, |
474 |
& difftime, mythid ) |
& difftime, mythid ) |
475 |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
call cal_ToSeconds ( difftime, diffsecs, mythid ) |
476 |
startrec = int((modelstart - diffsecs)/xx_obcseperiod) + 1 |
startrec = int((modelstart - diffsecs)/xx_obcseperiod) + 1 |
477 |
|
startrec = (startrec - 1)*nobcs + 1 |
478 |
endrec = int((modelend - diffsecs)/xx_obcseperiod) + 2 |
endrec = int((modelend - diffsecs)/xx_obcseperiod) + 2 |
479 |
#else |
endrec = (endrec - startrec + 1)*nobcs |
480 |
|
# else |
481 |
startrec = 1 |
startrec = 1 |
482 |
endrec = 1 |
endrec = 1 |
483 |
#endif |
# endif |
484 |
ivarindex = 14 |
diffrec = endrec*nobcs |
485 |
ncvarindex(ivarindex) = 114 |
call ctrl_init_ctrlvar ( |
486 |
cgg( Implement heimbach fix for nobcs. |
& xx_obcse_file, 14, 114, diffrec, startrec, endrec, |
487 |
ncvarrecs(ivarindex) = (endrec - startrec + 1)*nobcs |
& snx, sny, nr, 'm', 'yz', mythid ) |
|
ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1 |
|
|
ncvarrecsend(ivarindex) = endrec*nobcs |
|
|
cgg) |
|
|
ncvarxmax(ivarindex) = 1 |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = nr |
|
|
ncvargrd(ivarindex) = 'm' |
|
|
_END_MASTER( mythid ) |
|
488 |
|
|
489 |
#endif /* ALLOW_OBCSE_CONTROL */ |
#endif /* ALLOW_OBCSE_CONTROL */ |
490 |
|
|
491 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
492 |
c-- |
c-- |
493 |
#ifdef ALLOW_DIFFKR_CONTROL |
#ifdef ALLOW_DIFFKR_CONTROL |
494 |
_BEGIN_MASTER( mythid ) |
call ctrl_init_ctrlvar ( |
495 |
ivarindex = 15 |
& xx_diffkr_file, 15, 115, 1, 1, 1, |
496 |
ncvarindex(ivarindex) = 115 |
& snx, sny, nr, 'c', '3d', mythid ) |
|
ncvarrecs (ivarindex) = 1 |
|
|
ncvarxmax (ivarindex) = snx |
|
|
ncvarymax (ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = nr |
|
|
ncvargrd (ivarindex) = 'c' |
|
|
_END_MASTER( mythid ) |
|
497 |
#endif /* ALLOW_DIFFKR_CONTROL */ |
#endif /* ALLOW_DIFFKR_CONTROL */ |
498 |
|
|
499 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
500 |
c-- |
c-- |
501 |
#ifdef ALLOW_KAPGM_CONTROL |
#ifdef ALLOW_KAPGM_CONTROL |
502 |
_BEGIN_MASTER( mythid ) |
call ctrl_init_ctrlvar ( |
503 |
ivarindex = 16 |
& xx_kapgm_file, 16, 116, 1, 1, 1, |
504 |
ncvarindex(ivarindex) = 116 |
& snx, sny, nr, 'c', '3d', mythid ) |
|
ncvarrecs (ivarindex) = 1 |
|
|
ncvarxmax (ivarindex) = snx |
|
|
ncvarymax (ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = nr |
|
|
ncvargrd (ivarindex) = 'c' |
|
|
_END_MASTER( mythid ) |
|
505 |
#endif /* ALLOW_KAPGM_CONTROL */ |
#endif /* ALLOW_KAPGM_CONTROL */ |
506 |
|
|
507 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
508 |
c-- |
c-- |
509 |
#ifdef ALLOW_TR10_CONTROL |
#ifdef ALLOW_TR10_CONTROL |
510 |
_BEGIN_MASTER( mythid ) |
call ctrl_init_ctrlvar ( |
511 |
ivarindex = 17 |
& xx_tr1_file, 17, 117, 1, 1, 1, |
512 |
ncvarindex(ivarindex) = 117 |
& snx, sny, nr, 'c', '3d', mythid ) |
|
ncvarrecs (ivarindex) = 1 |
|
|
ncvarxmax (ivarindex) = snx |
|
|
ncvarymax (ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = nr |
|
|
ncvargrd (ivarindex) = 'c' |
|
|
_END_MASTER( mythid ) |
|
513 |
#endif /* ALLOW_TR10_CONTROL */ |
#endif /* ALLOW_TR10_CONTROL */ |
514 |
|
|
515 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
516 |
c-- |
c-- |
517 |
#ifdef ALLOW_SST0_CONTROL |
#ifdef ALLOW_SST0_CONTROL |
518 |
_BEGIN_MASTER( mythid ) |
call ctrl_init_ctrlvar ( |
519 |
ivarindex = 18 |
& xx_sst_file, 18, 118, 1, 1, 1, |
520 |
ncvarindex(ivarindex) = 118 |
& snx, sny, 1, 'c', 'xy', mythid ) |
|
ncvarrecs (ivarindex) = 1 |
|
|
ncvarxmax (ivarindex) = snx |
|
|
ncvarymax (ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = 1 |
|
|
ncvargrd (ivarindex) = 'c' |
|
|
_END_MASTER( mythid ) |
|
521 |
#endif /* ALLOW_SST0_CONTROL */ |
#endif /* ALLOW_SST0_CONTROL */ |
522 |
|
|
523 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
524 |
c-- |
c-- |
525 |
#ifdef ALLOW_SSS0_CONTROL |
#ifdef ALLOW_SSS0_CONTROL |
526 |
_BEGIN_MASTER( mythid ) |
call ctrl_init_ctrlvar ( |
527 |
ivarindex = 19 |
& xx_sss_file, 19, 119, 1, 1, 1, |
528 |
ncvarindex(ivarindex) = 119 |
& snx, sny, 1, 'c', 'xy', mythid ) |
|
ncvarrecs (ivarindex) = 1 |
|
|
ncvarxmax (ivarindex) = snx |
|
|
ncvarymax (ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = 1 |
|
|
ncvargrd (ivarindex) = 'c' |
|
|
_END_MASTER( mythid ) |
|
529 |
#endif /* ALLOW_SSS0_CONTROL */ |
#endif /* ALLOW_SSS0_CONTROL */ |
530 |
|
|
531 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
532 |
c-- |
c-- |
533 |
#ifdef ALLOW_HFACC_CONTROL |
#ifdef ALLOW_HFACC_CONTROL |
534 |
_BEGIN_MASTER( mythid ) |
# ifdef ALLOW_HFACC3D_CONTROL |
535 |
ivarindex = 20 |
call ctrl_init_ctrlvar ( |
536 |
ncvarindex(ivarindex) = 120 |
& xx_hfacc_file, 20, 120, 1, 1, 1, |
537 |
ncvarrecs (ivarindex) = 1 |
& snx, sny, nr, 'c', '3d', mythid ) |
538 |
ncvarxmax (ivarindex) = snx |
# else |
539 |
ncvarymax (ivarindex) = sny |
call ctrl_init_ctrlvar ( |
540 |
ncvargrd (ivarindex) = 'c' |
& xx_hfacc_file, 20, 120, 1, 1, 1, |
541 |
#ifdef ALLOW_HFACC3D_CONTROL |
& snx, sny, 1, 'c', 'xy', mythid ) |
542 |
ncvarnrmax(ivarindex) = nr |
# endif /*ALLOW_HFACC3D_CONTROL*/ |
|
#else |
|
|
ncvarnrmax(ivarindex) = 1 |
|
|
#endif /*ALLOW_HFACC3D_CONTROL*/ |
|
|
_END_MASTER( mythid ) |
|
543 |
#endif /* ALLOW_HFACC_CONTROL */ |
#endif /* ALLOW_HFACC_CONTROL */ |
544 |
|
|
545 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
546 |
c-- |
c-- |
547 |
#ifdef ALLOW_EFLUXY0_CONTROL |
#ifdef ALLOW_EFLUXY0_CONTROL |
548 |
_BEGIN_MASTER( mythid ) |
call ctrl_init_ctrlvar ( |
549 |
ivarindex = 21 |
& xx_efluxy_file, 21, 121, 1, 1, 1, |
550 |
ncvarindex(ivarindex) = 121 |
& snx, sny, nr, 's', '3d', mythid ) |
|
ncvarrecs(ivarindex) = 1 |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = nr |
|
|
ncvargrd(ivarindex) = 's' |
|
|
_END_MASTER( mythid ) |
|
551 |
#endif /* ALLOW_EFLUXY0_CONTROL */ |
#endif /* ALLOW_EFLUXY0_CONTROL */ |
552 |
|
|
553 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
554 |
c-- |
c-- |
555 |
#ifdef ALLOW_EFLUXP0_CONTROL |
#ifdef ALLOW_EFLUXP0_CONTROL |
556 |
_BEGIN_MASTER( mythid ) |
call ctrl_init_ctrlvar ( |
557 |
ivarindex = 22 |
& xx_efluxp_file, 22, 122, 1, 1, 1, |
558 |
ncvarindex(ivarindex) = 122 |
& snx, sny, nr, 'v', '3d', mythid ) |
|
ncvarrecs(ivarindex) = 1 |
|
|
ncvarxmax(ivarindex) = snx |
|
|
ncvarymax(ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = nr |
|
|
ncvargrd(ivarindex) = 'v' |
|
|
_END_MASTER( mythid ) |
|
559 |
#endif /* ALLOW_EFLUXP0_CONTROL */ |
#endif /* ALLOW_EFLUXP0_CONTROL */ |
560 |
|
|
561 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
562 |
c-- |
c-- |
563 |
#ifdef ALLOW_BOTTOMDRAG_CONTROL |
#ifdef ALLOW_BOTTOMDRAG_CONTROL |
564 |
_BEGIN_MASTER( mythid ) |
call ctrl_init_ctrlvar ( |
565 |
ivarindex = 23 |
& xx_bottomdrag_file, 23, 123, 1, 1, 1, |
566 |
ncvarindex(ivarindex) = 123 |
& snx, sny, 1, 'c', 'xy', mythid ) |
|
ncvarrecs (ivarindex) = 1 |
|
|
ncvarxmax (ivarindex) = snx |
|
|
ncvarymax (ivarindex) = sny |
|
|
ncvarnrmax(ivarindex) = 1 |
|
|
ncvargrd (ivarindex) = 'c' |
|
|
_END_MASTER( mythid ) |
|
567 |
#endif /* ALLOW_BOTTOMDRAG_CONTROL */ |
#endif /* ALLOW_BOTTOMDRAG_CONTROL */ |
568 |
|
|
569 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
570 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
571 |
c------------------------------------------------------------------------------- |
c------------------------------------------------------------------------------- |
572 |
|
|
573 |
c-- Determine the number of wet points in each tile: |
call ctrl_init_wet( mythid ) |
574 |
c-- maskc, masks, and maskw. |
|
|
|
|
|
c-- Initialise the counters. |
|
|
do bj = jtlo,jthi |
|
|
do bi = itlo,ithi |
|
|
do k = 1,nr |
|
|
nwetctile(bi,bj,k) = 0 |
|
|
nwetstile(bi,bj,k) = 0 |
|
|
nwetwtile(bi,bj,k) = 0 |
|
|
nwetvtile(bi,bj,k) = 0 |
|
|
enddo |
|
|
enddo |
|
|
enddo |
|
|
|
|
|
#ifdef ALLOW_OBCS_CONTROL |
|
|
c-- Initialise obcs counters. |
|
|
do bj = jtlo,jthi |
|
|
do bi = itlo,ithi |
|
|
do k = 1,nr |
|
|
do iobcs = 1,nobcs |
|
|
#ifdef ALLOW_OBCSN_CONTROL |
|
|
nwetobcsn(bi,bj,k,iobcs) = 0 |
|
|
#endif |
|
|
#ifdef ALLOW_OBCSS_CONTROL |
|
|
nwetobcss(bi,bj,k,iobcs) = 0 |
|
|
#endif |
|
|
#ifdef ALLOW_OBCSW_CONTROL |
|
|
nwetobcsw(bi,bj,k,iobcs) = 0 |
|
|
#endif |
|
|
#ifdef ALLOW_OBCSE_CONTROL |
|
|
nwetobcse(bi,bj,k,iobcs) = 0 |
|
|
#endif |
|
|
enddo |
|
|
enddo |
|
|
enddo |
|
|
enddo |
|
|
#endif |
|
|
|
|
|
c-- Count wet points on each tile. |
|
|
do bj = jtlo,jthi |
|
|
do bi = itlo,ithi |
|
|
do k = 1,nr |
|
|
do j = jmin,jmax |
|
|
do i = imin,imax |
|
|
c-- Center mask. |
|
|
if (hFacC(i,j,k,bi,bj) .ne. 0.) then |
|
|
nwetctile(bi,bj,k) = nwetctile(bi,bj,k) + 1 |
|
|
endif |
|
|
c-- South mask. |
|
|
if (maskS(i,j,k,bi,bj) .eq. 1.) then |
|
|
nwetstile(bi,bj,k) = nwetstile(bi,bj,k) + 1 |
|
|
endif |
|
|
c-- West mask. |
|
|
if (maskW(i,j,k,bi,bj) .eq. 1.) then |
|
|
nwetwtile(bi,bj,k) = nwetwtile(bi,bj,k) + 1 |
|
|
endif |
|
|
#if (defined (ALLOW_EFLUXP0_CONTROL)) |
|
|
c-- Vertical mask. |
|
|
if (hFacV(i,j,k,bi,bj) .ne. 0.) then |
|
|
nwetvtile(bi,bj,k) = nwetvtile(bi,bj,k) + 1 |
|
|
endif |
|
|
#endif |
|
|
enddo |
|
|
enddo |
|
|
enddo |
|
|
enddo |
|
|
enddo |
|
|
|
|
|
#ifdef ALLOW_OBCSN_CONTROL |
|
|
c-- Count wet points at Northern boundary. |
|
|
c-- mask conventions are adopted from obcs_apply_ts, obcs_apply_uv |
|
|
ymaskobcs = 'maskobcsn' |
|
|
call ctrl_mask_set_xz( 0, OB_Jn, nwetobcsn, ymaskobcs, mythid ) |
|
|
#endif |
|
|
|
|
|
#ifdef ALLOW_OBCSS_CONTROL |
|
|
c-- Count wet points at Southern boundary. |
|
|
c-- mask conventions are adopted from obcs_apply_ts, obcs_apply_uv |
|
|
ymaskobcs = 'maskobcss' |
|
|
call ctrl_mask_set_xz( 1, OB_Js, nwetobcss, ymaskobcs, mythid ) |
|
|
#endif |
|
|
|
|
|
#ifdef ALLOW_OBCSW_CONTROL |
|
|
c-- Count wet points at Western boundary. |
|
|
c-- mask conventions are adopted from obcs_apply_ts, obcs_apply_uv |
|
|
ymaskobcs = 'maskobcsw' |
|
|
call ctrl_mask_set_yz( 1, OB_Iw, nwetobcsw, ymaskobcs, mythid ) |
|
|
#endif |
|
|
|
|
|
#ifdef ALLOW_OBCSE_CONTROL |
|
|
c-- Count wet points at Eastern boundary. |
|
|
c-- mask conventions are adopted from obcs_apply_ts, obcs_apply_uv |
|
|
ymaskobcs = 'maskobcse' |
|
|
call ctrl_mask_set_yz( 0, OB_Ie, nwetobcse, ymaskobcs, mythid ) |
|
|
#endif |
|
|
|
|
|
_BEGIN_MASTER( mythid ) |
|
|
c-- Determine the total number of control variables. |
|
|
nvartype = 0 |
|
|
nvarlength = 0 |
|
|
do i = 1,maxcvars |
|
|
c |
|
|
if ( ncvarindex(i) .ne. -1 ) then |
|
|
nvartype = nvartype + 1 |
|
|
do bj = jtlo,jthi |
|
|
do bi = itlo,ithi |
|
|
do k = 1,ncvarnrmax(i) |
|
|
if ( ncvargrd(i) .eq. 'c' ) then |
|
|
nvarlength = nvarlength + |
|
|
& ncvarrecs(i)*nwetctile(bi,bj,k) |
|
|
else if ( ncvargrd(i) .eq. 's' ) then |
|
|
nvarlength = nvarlength + |
|
|
& ncvarrecs(i)*nwetstile(bi,bj,k) |
|
|
else if ( ncvargrd(i) .eq. 'w' ) then |
|
|
nvarlength = nvarlength + |
|
|
& ncvarrecs(i)*nwetwtile(bi,bj,k) |
|
|
else if ( ncvargrd(i) .eq. 'v' ) then |
|
|
nvarlength = nvarlength + |
|
|
& ncvarrecs(i)*nwetvtile(bi,bj,k) |
|
|
else if ( ncvargrd(i) .eq. 'm' ) then |
|
|
#ifdef ALLOW_OBCS_CONTROL |
|
|
do iobcs = 1, nobcs |
|
|
cgg This overcounts the number of o.b. control points by a factor of "nobcs". |
|
|
cgg As an ad-hoc solution I've divided by nobcs everywhere. |
|
|
if ( i .eq. 11 ) then |
|
|
#ifdef ALLOW_OBCSN_CONTROL |
|
|
nvarlength = nvarlength + |
|
|
& (ncvarrecs(i)/nobcs) |
|
|
& *nwetobcsn(bi,bj,k,iobcs) |
|
|
#endif |
|
|
else if ( i .eq. 12 ) then |
|
|
#ifdef ALLOW_OBCSS_CONTROL |
|
|
nvarlength = nvarlength + |
|
|
& (ncvarrecs(i)/nobcs) |
|
|
& *nwetobcss(bi,bj,k,iobcs) |
|
|
#endif |
|
|
else if ( i .eq. 13 ) then |
|
|
#ifdef ALLOW_OBCSW_CONTROL |
|
|
nvarlength = nvarlength + |
|
|
& (ncvarrecs(i)/nobcs) |
|
|
& *nwetobcsw(bi,bj,k,iobcs) |
|
|
#endif |
|
|
else if ( i .eq. 14 ) then |
|
|
#ifdef ALLOW_OBCSE_CONTROL |
|
|
nvarlength = nvarlength + |
|
|
& (ncvarrecs(i)/nobcs) |
|
|
& *nwetobcse(bi,bj,k,iobcs) |
|
|
#endif |
|
|
end if |
|
|
enddo |
|
|
#endif |
|
|
else |
|
|
print*,'ctrl_init: invalid grid location' |
|
|
print*,' control variable = ',ncvarindex(i) |
|
|
print*,' grid location = ',ncvargrd(i) |
|
|
stop ' ... stopped in ctrl_init' |
|
|
endif |
|
|
enddo |
|
|
enddo |
|
|
enddo |
|
|
endif |
|
|
enddo |
|
|
|
|
|
cph( |
|
|
print *, 'ph-wet 1: nvarlength = ', nvarlength |
|
|
print *, 'ph-wet 2: surface wet C = ', nwetctile(1,1,1) |
|
|
print *, 'ph-wet 3: surface wet W = ', nwetwtile(1,1,1) |
|
|
print *, 'ph-wet 4: surface wet S = ', nwetstile(1,1,1) |
|
|
print *, 'ph-wet 4a:surface wet V = ', nwetvtile(1,1,1) |
|
|
nwetc3d = 0 |
|
|
do k = 1, Nr |
|
|
nwetc3d = nwetc3d + nwetctile(1,1,k) |
|
|
end do |
|
|
print *, 'ph-wet 5: 3D wet points = ', nwetc3d |
|
|
do i = 1, maxcvars |
|
|
print *, 'ph-wet 6: no recs for i = ', i, ncvarrecs(i) |
|
|
end do |
|
|
print *, 'ph-wet 7: ', |
|
|
& 2*nwetc3d + |
|
|
& ncvarrecs(3)*nwetctile(1,1,1) + |
|
|
& ncvarrecs(4)*nwetctile(1,1,1) + |
|
|
& ncvarrecs(5)*nwetwtile(1,1,1) + |
|
|
& ncvarrecs(6)*nwetstile(1,1,1) |
|
|
print *, 'ph-wet 8: ', |
|
|
& 2*nwetc3d + |
|
|
& ncvarrecs(7)*nwetctile(1,1,1) + |
|
|
& ncvarrecs(8)*nwetctile(1,1,1) + |
|
|
& ncvarrecs(9)*nwetwtile(1,1,1) + |
|
|
& ncvarrecs(10)*nwetstile(1,1,1) |
|
|
#ifdef ALLOW_OBCSN_CONTROL |
|
|
print *, 'ph-wet 9: surface wet obcsn = ' |
|
|
& , nwetobcsn(1,1,1,1), nwetobcsn(1,1,1,2) |
|
|
& , nwetobcsn(1,1,1,3), nwetobcsn(1,1,1,4) |
|
|
#endif |
|
|
#ifdef ALLOW_OBCSS_CONTROL |
|
|
print *, 'ph-wet 10: surface wet obcss = ' |
|
|
& , nwetobcss(1,1,1,1), nwetobcss(1,1,1,2) |
|
|
& , nwetobcss(1,1,1,3), nwetobcss(1,1,1,4) |
|
|
#endif |
|
|
#ifdef ALLOW_OBCSW_CONTROL |
|
|
print *, 'ph-wet 11: surface wet obcsw = ' |
|
|
& , nwetobcsw(1,1,1,1), nwetobcsw(1,1,1,2) |
|
|
& , nwetobcsw(1,1,1,3), nwetobcsw(1,1,1,4) |
|
|
#endif |
|
|
#ifdef ALLOW_OBCSE_CONTROL |
|
|
print *, 'ph-wet 12: surface wet obcse = ' |
|
|
& , nwetobcse(1,1,1,1), nwetobcse(1,1,1,2) |
|
|
& , nwetobcse(1,1,1,3), nwetobcse(1,1,1,4) |
|
|
#endif |
|
|
cph) |
|
|
|
|
|
CALL GLOBAL_SUM_INT( nvarlength, myThid ) |
|
|
|
|
|
print *, 'ph-wet 13: global nvarlength vor k=', k, nvarlength |
|
|
|
|
|
c |
|
|
c Summation of wet point counters |
|
|
c |
|
|
do k = 1, nr |
|
|
|
|
|
ntmp=0 |
|
|
do bj=1,nSy |
|
|
do bi=1,nSx |
|
|
ntmp=ntmp+nWetcTile(bi,bj,k) |
|
|
enddo |
|
|
enddo |
|
|
CALL GLOBAL_SUM_INT( ntmp, myThid ) |
|
|
nWetcGlobal(k)=ntmp |
|
|
print *, 'ph-wet 14a: global nWet... k=', k, ntmp |
|
|
|
|
|
ntmp=0 |
|
|
do bj=1,nSy |
|
|
do bi=1,nSx |
|
|
ntmp=ntmp+nWetsTile(bi,bj,k) |
|
|
enddo |
|
|
enddo |
|
|
CALL GLOBAL_SUM_INT( ntmp, myThid ) |
|
|
nWetsGlobal(k)=ntmp |
|
|
print *, 'ph-wet 14b: global nWet... k=', k, ntmp |
|
|
|
|
|
ntmp=0 |
|
|
do bj=1,nSy |
|
|
do bi=1,nSx |
|
|
ntmp=ntmp+nWetwTile(bi,bj,k) |
|
|
enddo |
|
|
enddo |
|
|
CALL GLOBAL_SUM_INT( ntmp, myThid ) |
|
|
nWetwGlobal(k)=ntmp |
|
|
print *, 'ph-wet 14c: global nWet... k=', k, ntmp |
|
|
|
|
|
ntmp=0 |
|
|
do bj=1,nSy |
|
|
do bi=1,nSx |
|
|
ntmp=ntmp+nWetvTile(bi,bj,k) |
|
|
enddo |
|
|
enddo |
|
|
CALL GLOBAL_SUM_INT( ntmp, myThid ) |
|
|
nWetvGlobal(k)=ntmp |
|
|
print *, 'ph-wet 14d: global nWet... k=', k, ntmp |
|
|
|
|
|
#ifdef ALLOW_OBCSN_CONTROL |
|
|
do iobcs = 1, nobcs |
|
|
ntmp=0 |
|
|
do bj=1,nSy |
|
|
do bi=1,nSx |
|
|
ntmp=ntmp+nwetobcsn(bi,bj,k,iobcs) |
|
|
enddo |
|
|
enddo |
|
|
CALL GLOBAL_SUM_INT( ntmp, myThid ) |
|
|
nwetobcsnglo(k,iobcs)=ntmp |
|
|
print *, 'ph-wet 15a: global nWet... k=', k, iobcs, ntmp |
|
|
enddo |
|
|
#endif |
|
|
#ifdef ALLOW_OBCSS_CONTROL |
|
|
do iobcs = 1, nobcs |
|
|
ntmp=0 |
|
|
do bj=1,nSy |
|
|
do bi=1,nSx |
|
|
ntmp=ntmp+nwetobcss(bi,bj,k,iobcs) |
|
|
enddo |
|
|
enddo |
|
|
CALL GLOBAL_SUM_INT( ntmp, myThid ) |
|
|
nwetobcssglo(k,iobcs)=ntmp |
|
|
print *, 'ph-wet 15b: global nWet... k=', k, iobcs, ntmp |
|
|
enddo |
|
|
#endif |
|
|
#ifdef ALLOW_OBCSW_CONTROL |
|
|
do iobcs = 1, nobcs |
|
|
ntmp=0 |
|
|
do bj=1,nSy |
|
|
do bi=1,nSx |
|
|
ntmp=ntmp+nwetobcsw(bi,bj,k,iobcs) |
|
|
enddo |
|
|
enddo |
|
|
CALL GLOBAL_SUM_INT( ntmp, myThid ) |
|
|
nwetobcswglo(k,iobcs)=ntmp |
|
|
print *, 'ph-wet 15c: global nWet... k=', k, iobcs, ntmp |
|
|
enddo |
|
|
#endif |
|
|
#ifdef ALLOW_OBCSE_CONTROL |
|
|
do iobcs = 1, nobcs |
|
|
ntmp=0 |
|
|
do bj=1,nSy |
|
|
do bi=1,nSx |
|
|
ntmp=ntmp+nwetobcse(bi,bj,k,iobcs) |
|
|
enddo |
|
|
enddo |
|
|
CALL GLOBAL_SUM_INT( ntmp, myThid ) |
|
|
nwetobcseglo(k,iobcs)=ntmp |
|
|
print *, 'ph-wet 15d: global nWet... k=', k, iobcs, ntmp |
|
|
enddo |
|
|
#endif |
|
|
|
|
|
enddo |
|
|
|
|
|
print*, 'ctrl_init: no. of control variables: ', nvartype |
|
|
print*, 'ctrl_init: control vector length: ', nvarlength |
|
|
_END_MASTER( mythid ) |
|
|
|
|
|
c write masks and weights to files to be read by a master process |
|
|
c |
|
|
call active_write_xyz( 'hFacC', hFacC, 1, 0, mythid, dummy) |
|
|
call active_write_xyz( 'maskW', maskW, 1, 0, mythid, dummy) |
|
|
call active_write_xyz( 'maskS', maskS, 1, 0, mythid, dummy) |
|
|
#if (defined (ALLOW_EFLUXP0_CONTROL)) |
|
|
call active_write_xyz( 'hFacV', hFacV, 1, 0, mythid, dummy) |
|
|
#endif |
|
|
|
|
|
c-- Summarize the control vector's setup. |
|
|
_BEGIN_MASTER( mythid ) |
|
|
cph call ctrl_Summary( mythid ) |
|
|
_END_MASTER( mythid ) |
|
|
|
|
|
_BARRIER |
|
|
|
|
575 |
return |
return |
576 |
end |
end |
577 |
|
|