/[MITgcm]/MITgcm/pkg/ctrl/ctrl_init.F
ViewVC logotype

Contents of /MITgcm/pkg/ctrl/ctrl_init.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.22 - (show annotations) (download)
Wed Mar 29 22:07:34 2006 UTC (18 years, 2 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint58f_post, checkpoint58d_post, checkpoint58e_post, checkpoint58g_post
Changes since 1.21: +66 -1 lines
if ALLOW_CAL, use monthly mean controls if the
control period (xx_hfluxperiod etc) is 0

1 C
2 C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_init.F,v 1.21 2006/01/05 17:05:42 heimbach Exp $
3 C $Name: $
4
5 #include "CTRL_CPPOPTIONS.h"
6
7 subroutine ctrl_init( mythid )
8
9 c ==================================================================
10 c SUBROUTINE ctrl_init
11 c ==================================================================
12 c
13 c o Set parts of the vector of control variables and initialize the
14 c rest to zero.
15 c
16 c The vector of control variables is initialized here. The
17 c temperature and salinity contributions are read from file.
18 c Subsequently, the latter are dimensionalized and the tile
19 c edges are updated.
20 c
21 c started: Christian Eckert eckert@mit.edu 30-Jun-1999
22 c
23 c changed: Christian Eckert eckert@mit.edu 23-Feb-2000
24 c - Restructured the code in order to create a package
25 c for the MITgcmUV.
26 c
27 c Patrick Heimbach heimbach@mit.edu 30-May-2000
28 c - diffsec was falsely declared.
29 c
30 c Patrick Heimbach heimbach@mit.edu 06-Jun-2000
31 c - Transferred some filename declarations
32 c from ctrl_pack/ctrl_unpack to here
33 c - Transferred mask-per-tile to here
34 c - computation of control vector length here
35 c
36 c Patrick Heimbach heimbach@mit.edu 16-Jun-2000
37 c - Added call to ctrl_pack
38 c - Alternatively: transfer writing of scale files to
39 c ctrl_unpack
40 c
41 c Dimitris Menemenlis menemenlis@mit.edu 7-Mar-2003
42 c - To be consistent with usage in ctrl_getrec.F,
43 c startrec and endrec need to be referenced to
44 c model time = 0, not to startTime.
45 c Also "- modelstep" -> "+ modelstep/2":
46 c old: startrec = int((modelstart - diffsecs)/
47 c old: & xx_???period) + 1
48 c old: endrec = int((modelend - diffsecs - modelstep)/
49 c old: & xx_???period) + 2
50 c new: startrec = int((modelstart + startTime - diffsecs)/
51 c new: & xx_???period) + 1
52 c new: endrec = int((modelend + startTime - diffsecs + modelstep/2)/
53 c new: & xx_???period) + 2
54 c
55 c heimbach@mit.edu totally restructured 28-Oct-2003
56 c
57 c ==================================================================
58 c SUBROUTINE ctrl_init
59 c ==================================================================
60
61 implicit none
62
63 c == global variables ==
64
65 #include "EEPARAMS.h"
66 #include "SIZE.h"
67 #include "PARAMS.h"
68 #include "GRID.h"
69 #include "ctrl.h"
70 #include "optim.h"
71
72 #ifdef ALLOW_CAL
73 # include "cal.h"
74 #endif
75 #ifdef ALLOW_OBCS_CONTROL
76 # include "OBCS.h"
77 #endif
78
79 c == routine arguments ==
80
81 integer mythid
82
83 c == local variables ==
84
85 integer bi,bj
86 integer i,j,k
87 integer itlo,ithi
88 integer jtlo,jthi
89 integer jmin,jmax
90 integer imin,imax
91
92 integer ntmp
93 integer ivar
94 integer iobcs
95 integer il
96 integer errio
97 integer startrec
98 integer endrec
99 integer diffrec
100 integer difftime(4)
101 _RL diffsecs
102
103 character*(max_len_prec) record
104 character*(max_len_mbuf) msgbuf
105 character*2 whichxyz
106
107 c == external ==
108
109 integer ilnblnk
110 external ilnblnk
111
112 c == end of interface ==
113
114 jtlo = mybylo(mythid)
115 jthi = mybyhi(mythid)
116 itlo = mybxlo(mythid)
117 ithi = mybxhi(mythid)
118 jmin = 1-oly
119 jmax = sny+oly
120 imin = 1-olx
121 imax = snx+olx
122
123 c-- Set default values.
124 do ivar = 1,maxcvars
125 ncvarindex(ivar) = -1
126 ncvarrecs(ivar) = 0
127 ncvarxmax(ivar) = 0
128 ncvarymax(ivar) = 0
129 ncvarnrmax(ivar) = 0
130 ncvargrd(ivar) = '?'
131 enddo
132
133 _BARRIER
134
135 c-- =====================
136 c-- Initial state fields.
137 c-- =====================
138
139 cph(
140 cph index 7-10 reserved for atmos. state,
141 cph index 11-14 reserved for open boundaries,
142 cph index 15-16 reserved for mixing coeff.
143 cph index 17 reserved for passive tracer TR1
144 cph index 18,19 reserved for sst, sss
145 cph index 20 for hFacC
146 cph index 21-22 for efluxy, efluxp
147 cph index 23 for bottom drag
148 cph index 24
149 cph index 25-26 for edtaux, edtauy
150 cph index 27-29 for uvel0, vvel0, etan0
151 cph index 30-31 for relax. SST, SSS
152 cph index 32 reserved for precip (atmos. state)
153 cph index 33 reserved for swflux (atmos. state)
154 cph index 34 reserved for swdown (atmos. state)
155 cph)
156
157 c----------------------------------------------------------------------
158 c--
159 #ifdef ALLOW_THETA0_CONTROL
160 c-- Initial state temperature contribution.
161 call ctrl_init_ctrlvar (
162 & xx_theta_file, 1, 101, 1, 1, 1,
163 & snx, sny, nr, 'c', '3d', mythid )
164 #endif /* ALLOW_THETA0_CONTROL */
165
166 c----------------------------------------------------------------------
167 c--
168 #ifdef ALLOW_SALT0_CONTROL
169 c-- Initial state salinity contribution.
170 call ctrl_init_ctrlvar (
171 & xx_salt_file, 2, 102, 1, 1, 1,
172 & snx, sny, nr, 'c', '3d', mythid )
173 #endif /* ALLOW_SALT0_CONTROL */
174
175 c-- ===========================
176 c-- Surface flux contributions.
177 c-- ===========================
178
179 c----------------------------------------------------------------------
180 c--
181 #if (defined (ALLOW_HFLUX_CONTROL))
182 c-- Heat flux.
183
184 # ifdef ALLOW_CAL
185 call cal_FullDate( xx_hfluxstartdate1, xx_hfluxstartdate2,
186 & xx_hfluxstartdate , mythid )
187 call cal_TimePassed( xx_hfluxstartdate, modelstartdate,
188 & difftime, mythid )
189 call cal_ToSeconds ( difftime, diffsecs, mythid )
190 if ( xx_hfluxperiod .EQ. 0 ) then
191 startrec=1
192 endrec=12
193 else
194 startrec = int((modelstart + startTime - diffsecs)/
195 & xx_hfluxperiod) + 1
196 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
197 & xx_hfluxperiod) + 2
198 endif
199 # else
200 startrec = 1
201 endrec = 1
202 # endif
203 diffrec = endrec - startrec + 1
204 call ctrl_init_ctrlvar (
205 & xx_hflux_file, 3, 103, diffrec, startrec, endrec,
206 & snx, sny, 1, 'c', 'xy', mythid )
207
208 #elif (defined (ALLOW_ATEMP_CONTROL))
209 c-- Atmos. temperature
210
211 # ifdef ALLOW_CAL
212 call cal_FullDate( xx_atempstartdate1, xx_atempstartdate2,
213 & xx_atempstartdate , mythid )
214 call cal_TimePassed( xx_atempstartdate, modelstartdate,
215 & difftime, mythid )
216 call cal_ToSeconds ( difftime, diffsecs, mythid )
217 if ( xx_atempperiod .EQ. 0 ) then
218 startrec=1
219 endrec=12
220 else
221 startrec = int((modelstart + startTime - diffsecs)/
222 & xx_atempperiod) + 1
223 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
224 & xx_atempperiod) + 2
225 endif
226 # else
227 startrec = 1
228 endrec = 1
229 # endif
230 diffrec = endrec - startrec + 1
231 call ctrl_init_ctrlvar (
232 & xx_atemp_file, 7, 107, diffrec, startrec, endrec,
233 & snx, sny, 1, 'c', 'xy', mythid )
234
235 #elif (defined (ALLOW_HFLUX0_CONTROL))
236 c-- initial forcing only
237 call ctrl_init_ctrlvar (
238 & xx_hflux_file, 3, 103, 1, 1, 1,
239 & snx, sny, 1, 'c', 'xy', mythid )
240
241 #endif /* ALLOW_HFLUX_CONTROL */
242
243 c----------------------------------------------------------------------
244 c--
245 #if (defined (ALLOW_SFLUX_CONTROL))
246 c-- Salt flux.
247
248 # ifdef ALLOW_CAL
249 call cal_FullDate( xx_sfluxstartdate1, xx_sfluxstartdate2,
250 & xx_sfluxstartdate , mythid )
251 call cal_TimePassed( xx_sfluxstartdate, modelstartdate,
252 & difftime, mythid )
253 call cal_ToSeconds ( difftime, diffsecs, mythid )
254 if ( xx_sfluxperiod .EQ. 0 ) then
255 startrec=1
256 endrec=12
257 else
258 startrec = int((modelstart + startTime - diffsecs)/
259 & xx_sfluxperiod) + 1
260 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
261 & xx_sfluxperiod) + 2
262 endif
263 # else
264 startrec = 1
265 endrec = 1
266 # endif
267 diffrec = endrec - startrec + 1
268 call ctrl_init_ctrlvar (
269 & xx_sflux_file, 4, 104, diffrec, startrec, endrec,
270 & snx, sny, 1, 'c', 'xy', mythid )
271
272 #elif (defined (ALLOW_AQH_CONTROL))
273 c-- Atmos. humidity
274
275 # ifdef ALLOW_CAL
276 call cal_FullDate( xx_aqhstartdate1, xx_aqhstartdate2,
277 & xx_aqhstartdate , mythid )
278 call cal_TimePassed( xx_aqhstartdate, modelstartdate,
279 & difftime, mythid )
280 call cal_ToSeconds ( difftime, diffsecs, mythid )
281 if ( xx_aqhperiod .EQ. 0 ) then
282 startrec=1
283 endrec=12
284 else
285 startrec = int((modelstart + startTime - diffsecs)/
286 & xx_aqhperiod) + 1
287 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
288 & xx_aqhperiod) + 2
289 endif
290 # else
291 startrec = 1
292 endrec = 1
293 # endif
294 diffrec = endrec - startrec + 1
295 call ctrl_init_ctrlvar (
296 & xx_aqh_file, 8, 108, diffrec, startrec, endrec,
297 & snx, sny, 1, 'c', 'xy', mythid )
298
299 #elif (defined (ALLOW_SFLUX0_CONTROL))
300 c-- initial forcing only
301 call ctrl_init_ctrlvar (
302 & xx_sflux_file, 4, 104, 1, 1, 1,
303 & snx, sny, 1, 'c', 'xy', mythid )
304
305 #endif /* ALLOW_SFLUX_CONTROL */
306
307 c----------------------------------------------------------------------
308 c--
309 #if (defined (ALLOW_USTRESS_CONTROL))
310 c-- Zonal wind stress.
311
312 # ifdef ALLOW_CAL
313 call cal_FullDate( xx_tauustartdate1, xx_tauustartdate2,
314 & xx_tauustartdate, mythid )
315 call cal_TimePassed( xx_tauustartdate, modelstartdate,
316 & difftime, mythid )
317 call cal_ToSeconds ( difftime, diffsecs, mythid )
318 if ( xx_tauuperiod .EQ. 0 ) then
319 startrec=1
320 endrec=12
321 else
322 startrec = int((modelstart + startTime - diffsecs)/
323 & xx_tauuperiod) + 1
324 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
325 & xx_tauuperiod) + 2
326 endif
327 # else
328 startrec = 1
329 endrec = 1
330 # endif
331 diffrec = endrec - startrec + 1
332 call ctrl_init_ctrlvar (
333 & xx_tauu_file, 5, 105, diffrec, startrec, endrec,
334 & snx, sny, 1, 'w', 'xy', mythid )
335
336 #elif (defined (ALLOW_UWIND_CONTROL))
337 c-- Zonal wind speed.
338
339 # ifdef ALLOW_CAL
340 call cal_FullDate( xx_uwindstartdate1, xx_uwindstartdate2,
341 & xx_uwindstartdate , mythid )
342 call cal_TimePassed( xx_uwindstartdate, modelstartdate,
343 & difftime, mythid )
344 call cal_ToSeconds ( difftime, diffsecs, mythid )
345 if ( xx_uwindperiod .EQ. 0 ) then
346 startrec=1
347 endrec=12
348 else
349 startrec = int((modelstart + startTime - diffsecs)/
350 & xx_uwindperiod) + 1
351 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
352 & xx_uwindperiod) + 2
353 endif
354 # else
355 startrec = 1
356 endrec = 1
357 # endif
358 diffrec = endrec - startrec + 1
359 call ctrl_init_ctrlvar (
360 & xx_uwind_file, 9, 109, diffrec, startrec, endrec,
361 & snx, sny, 1, 'c', 'xy', mythid )
362
363 #elif (defined (ALLOW_TAUU0_CONTROL))
364 c-- initial forcing only
365 call ctrl_init_ctrlvar (
366 & xx_tauu_file, 5, 105, 1, 1, 1,
367 & snx, sny, 1, 'w', 'xy', mythid )
368
369 #endif /* ALLOW_USTRESS_CONTROL */
370
371 c----------------------------------------------------------------------
372 c--
373 #if (defined (ALLOW_VSTRESS_CONTROL))
374 c-- Meridional wind stress.
375
376 # ifdef ALLOW_CAL
377 call cal_FullDate( xx_tauvstartdate1, xx_tauvstartdate2,
378 & xx_tauvstartdate, mythid )
379 call cal_TimePassed( xx_tauvstartdate, modelstartdate,
380 & difftime, mythid )
381 call cal_ToSeconds ( difftime, diffsecs, mythid )
382 if ( xx_tauvperiod .EQ. 0 ) then
383 startrec=1
384 endrec=12
385 else
386 startrec = int((modelstart + startTime - diffsecs)/
387 & xx_tauvperiod) + 1
388 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
389 & xx_tauvperiod) + 2
390 endif
391 # else
392 startrec = 1
393 endrec = 1
394 # endif
395 diffrec = endrec - startrec + 1
396 call ctrl_init_ctrlvar (
397 & xx_tauv_file, 6, 106, diffrec, startrec, endrec,
398 & snx, sny, 1, 's', 'xy', mythid )
399
400 #elif (defined (ALLOW_VWIND_CONTROL))
401 c-- Meridional wind speed.
402
403 # ifdef ALLOW_CAL
404 call cal_FullDate( xx_vwindstartdate1, xx_vwindstartdate2,
405 & xx_vwindstartdate , mythid )
406 call cal_TimePassed( xx_vwindstartdate, modelstartdate,
407 & difftime, mythid )
408 call cal_ToSeconds ( difftime, diffsecs, mythid )
409 if ( xx_vwindperiod .EQ. 0 ) then
410 startrec=1
411 endrec=12
412 else
413 startrec = int((modelstart + startTime - diffsecs)/
414 & xx_vwindperiod) + 1
415 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
416 & xx_vwindperiod) + 2
417 endif
418 # else
419 startrec = 1
420 endrec = 1
421 # endif
422 diffrec = endrec - startrec + 1
423 call ctrl_init_ctrlvar (
424 & xx_vwind_file, 10, 110, diffrec, startrec, endrec,
425 & snx, sny, 1, 'c', 'xy', mythid )
426
427 #elif (defined (ALLOW_TAUV0_CONTROL))
428 c-- initial forcing only
429 diffrec = endrec - startrec + 1
430 call ctrl_init_ctrlvar (
431 & xx_tauv_file, 6, 106, 1, 1, 1,
432 & snx, sny, 1, 's', 'xy', mythid )
433
434 #endif /* ALLOW_VSTRESS_CONTROL */
435
436 c-- ===========================
437 c-- Open boundary contributions.
438 c-- ===========================
439
440 c----------------------------------------------------------------------
441 c--
442 #ifdef ALLOW_OBCSN_CONTROL
443 c-- Northern obc.
444
445 # ifdef ALLOW_CAL
446 call cal_FullDate( xx_obcsnstartdate1, xx_obcsnstartdate2,
447 & xx_obcsnstartdate, mythid )
448 call cal_TimePassed( xx_obcsnstartdate, modelstartdate,
449 & difftime, mythid )
450 call cal_ToSeconds ( difftime, diffsecs, mythid )
451 startrec = int((modelstart - diffsecs)/xx_obcsnperiod) + 1
452 startrec = (startrec - 1)*nobcs + 1
453 endrec = int((modelend - diffsecs)/xx_obcsnperiod) + 2
454 endrec = (endrec - startrec + 1)*nobcs
455 # else
456 startrec = 1
457 endrec = 1
458 # endif
459 diffrec = endrec
460 call ctrl_init_ctrlvar (
461 & xx_obcsn_file, 11, 111, diffrec, startrec, endrec,
462 & snx, sny, nr, 'm', 'xz', mythid )
463
464 #endif /* ALLOW_OBCSN_CONTROL */
465
466 c----------------------------------------------------------------------
467 c--
468 #ifdef ALLOW_OBCSS_CONTROL
469 c-- Southern obc.
470
471 # ifdef ALLOW_CAL
472 call cal_FullDate( xx_obcssstartdate1, xx_obcssstartdate2,
473 & xx_obcssstartdate, mythid )
474 call cal_TimePassed( xx_obcssstartdate, modelstartdate,
475 & difftime, mythid )
476 call cal_ToSeconds ( difftime, diffsecs, mythid )
477 startrec = int((modelstart - diffsecs)/xx_obcssperiod) + 1
478 startrec = (startrec - 1)*nobcs + 1
479 endrec = int((modelend - diffsecs)/xx_obcssperiod) + 2
480 endrec = (endrec - startrec + 1)*nobcs
481 # else
482 startrec = 1
483 endrec = 1
484 # endif
485 diffrec = endrec
486 call ctrl_init_ctrlvar (
487 & xx_obcss_file, 12, 112, diffrec, startrec, endrec,
488 & snx, sny, nr, 'm', 'xz', mythid )
489
490 #endif /* ALLOW_OBCSS_CONTROL */
491
492 c----------------------------------------------------------------------
493 c--
494 #ifdef ALLOW_OBCSW_CONTROL
495 c-- Western obc.
496
497 # ifdef ALLOW_CAL
498 call cal_FullDate( xx_obcswstartdate1, xx_obcswstartdate2,
499 & xx_obcswstartdate, mythid )
500 call cal_TimePassed( xx_obcswstartdate, modelstartdate,
501 & difftime, mythid )
502 call cal_ToSeconds ( difftime, diffsecs, mythid )
503 startrec = int((modelstart - diffsecs)/xx_obcswperiod) + 1
504 startrec = (startrec - 1)*nobcs + 1
505 endrec = int((modelend - diffsecs)/xx_obcswperiod) + 2
506 endrec = (endrec - startrec + 1)*nobcs
507 # else
508 startrec = 1
509 endrec = 1
510 # endif
511 diffrec = endrec
512 call ctrl_init_ctrlvar (
513 & xx_obcsw_file, 13, 113, diffrec, startrec, endrec,
514 & snx, sny, nr, 'm', 'yz', mythid )
515
516 #endif /* ALLOW_OBCSW_CONTROL */
517
518 c----------------------------------------------------------------------
519 c--
520 #ifdef ALLOW_OBCSE_CONTROL
521 c-- Eastern obc.
522
523 # ifdef ALLOW_CAL
524 call cal_FullDate( xx_obcsestartdate1, xx_obcsestartdate2,
525 & xx_obcsestartdate, mythid )
526 call cal_TimePassed( xx_obcsestartdate, modelstartdate,
527 & difftime, mythid )
528 call cal_ToSeconds ( difftime, diffsecs, mythid )
529 startrec = int((modelstart - diffsecs)/xx_obcseperiod) + 1
530 startrec = (startrec - 1)*nobcs + 1
531 endrec = int((modelend - diffsecs)/xx_obcseperiod) + 2
532 endrec = (endrec - startrec + 1)*nobcs
533 # else
534 startrec = 1
535 endrec = 1
536 # endif
537 diffrec = endrec
538 call ctrl_init_ctrlvar (
539 & xx_obcse_file, 14, 114, diffrec, startrec, endrec,
540 & snx, sny, nr, 'm', 'yz', mythid )
541
542 #endif /* ALLOW_OBCSE_CONTROL */
543
544 c----------------------------------------------------------------------
545 c--
546 #ifdef ALLOW_DIFFKR_CONTROL
547 call ctrl_init_ctrlvar (
548 & xx_diffkr_file, 15, 115, 1, 1, 1,
549 & snx, sny, nr, 'c', '3d', mythid )
550 #endif /* ALLOW_DIFFKR_CONTROL */
551
552 c----------------------------------------------------------------------
553 c--
554 #ifdef ALLOW_KAPGM_CONTROL
555 call ctrl_init_ctrlvar (
556 & xx_kapgm_file, 16, 116, 1, 1, 1,
557 & snx, sny, nr, 'c', '3d', mythid )
558 #endif /* ALLOW_KAPGM_CONTROL */
559
560 c----------------------------------------------------------------------
561 c--
562 #ifdef ALLOW_TR10_CONTROL
563 call ctrl_init_ctrlvar (
564 & xx_tr1_file, 17, 117, 1, 1, 1,
565 & snx, sny, nr, 'c', '3d', mythid )
566 #endif /* ALLOW_TR10_CONTROL */
567
568 c----------------------------------------------------------------------
569 c--
570 #if (defined (ALLOW_SST_CONTROL))
571
572 # ifdef ALLOW_CAL
573 call cal_FullDate( xx_sststartdate1, xx_sststartdate2,
574 & xx_sststartdate , mythid )
575 call cal_TimePassed( xx_sststartdate, modelstartdate,
576 & difftime, mythid )
577 call cal_ToSeconds ( difftime, diffsecs, mythid )
578 if ( xx_sstperiod .EQ. 0 ) then
579 startrec=1
580 endrec=12
581 else
582 startrec = int((modelstart + startTime - diffsecs)/
583 & xx_sstperiod) + 1
584 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
585 & xx_sstperiod) + 2
586 endif
587 # else
588 startrec = 1
589 endrec = 1
590 # endif
591 diffrec = endrec - startrec + 1
592 call ctrl_init_ctrlvar (
593 & xx_sst_file, 18, 118, diffrec, startrec, endrec,
594 & snx, sny, 1, 'c', 'xy', mythid )
595
596 #elif (defined (ALLOW_SST0_CONTROL))
597
598 call ctrl_init_ctrlvar (
599 & xx_sst_file, 18, 118, 1, 1, 1,
600 & snx, sny, 1, 'c', 'xy', mythid )
601
602 #endif /* ALLOW_SST_CONTROL */
603
604 c----------------------------------------------------------------------
605 c--
606 #if (defined (ALLOW_SSS_CONTROL))
607
608 # ifdef ALLOW_CAL
609 call cal_FullDate( xx_sssstartdate1, xx_sssstartdate2,
610 & xx_sssstartdate , mythid )
611 call cal_TimePassed( xx_sssstartdate, modelstartdate,
612 & difftime, mythid )
613 call cal_ToSeconds ( difftime, diffsecs, mythid )
614 if ( xx_sssperiod .EQ. 0 ) then
615 startrec=1
616 endrec=12
617 else
618 startrec = int((modelstart + startTime - diffsecs)/
619 & xx_sssperiod) + 1
620 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
621 & xx_sssperiod) + 2
622 endif
623 # else
624 startrec = 1
625 endrec = 1
626 # endif
627 diffrec = endrec - startrec + 1
628 call ctrl_init_ctrlvar (
629 & xx_sss_file, 19, 119, diffrec, startrec, endrec,
630 & snx, sny, 1, 'c', 'xy', mythid )
631
632 #elif (defined (ALLOW_SSS0_CONTROL))
633
634 call ctrl_init_ctrlvar (
635 & xx_sss_file, 19, 119, 1, 1, 1,
636 & snx, sny, 1, 'c', 'xy', mythid )
637
638 #endif /* ALLOW_SSS0_CONTROL */
639
640 c----------------------------------------------------------------------
641 c--
642 #ifdef ALLOW_HFACC_CONTROL
643 # ifdef ALLOW_HFACC3D_CONTROL
644 call ctrl_init_ctrlvar (
645 & xx_hfacc_file, 20, 120, 1, 1, 1,
646 & snx, sny, nr, 'c', '3d', mythid )
647 # else
648 call ctrl_init_ctrlvar (
649 & xx_hfacc_file, 20, 120, 1, 1, 1,
650 & snx, sny, 1, 'c', 'xy', mythid )
651 # endif /*ALLOW_HFACC3D_CONTROL*/
652 #endif /* ALLOW_HFACC_CONTROL */
653
654 c----------------------------------------------------------------------
655 c--
656 #ifdef ALLOW_EFLUXY0_CONTROL
657 call ctrl_init_ctrlvar (
658 & xx_efluxy_file, 21, 121, 1, 1, 1,
659 & snx, sny, nr, 's', '3d', mythid )
660 #endif /* ALLOW_EFLUXY0_CONTROL */
661
662 c----------------------------------------------------------------------
663 c--
664 #ifdef ALLOW_EFLUXP0_CONTROL
665 call ctrl_init_ctrlvar (
666 & xx_efluxp_file, 22, 122, 1, 1, 1,
667 & snx, sny, nr, 'v', '3d', mythid )
668 #endif /* ALLOW_EFLUXP0_CONTROL */
669
670 c----------------------------------------------------------------------
671 c--
672 #ifdef ALLOW_BOTTOMDRAG_CONTROL
673 call ctrl_init_ctrlvar (
674 & xx_bottomdrag_file, 23, 123, 1, 1, 1,
675 & snx, sny, 1, 'c', 'xy', mythid )
676 #endif /* ALLOW_BOTTOMDRAG_CONTROL */
677
678 c----------------------------------------------------------------------
679 c--
680 #ifdef ALLOW_EDTAUX_CONTROL
681 call ctrl_init_ctrlvar (
682 & xx_edtaux_file, 25, 125, 1, 1, 1,
683 & snx, sny, nr, 'w', '3d', mythid )
684 #endif /* ALLOW_EDTAUX_CONTROL */
685
686 c----------------------------------------------------------------------
687 c--
688 #ifdef ALLOW_EDTAUY_CONTROL
689 call ctrl_init_ctrlvar (
690 & xx_edtauy_file, 26, 126, 1, 1, 1,
691 & snx, sny, nr, 's', '3d', mythid )
692 #endif /* ALLOW_EDTAUY_CONTROL */
693
694 c----------------------------------------------------------------------
695 c--
696 #ifdef ALLOW_UVEL0_CONTROL
697 call ctrl_init_ctrlvar (
698 & xx_uvel_file, 27, 127, 1, 1, 1,
699 & snx, sny, nr, 'w', '3d', mythid )
700 #endif /* ALLOW_UVEL0_CONTROL */
701
702 c----------------------------------------------------------------------
703 c--
704 #ifdef ALLOW_VVEL0_CONTROL
705 call ctrl_init_ctrlvar (
706 & xx_vvel_file, 28, 128, 1, 1, 1,
707 & snx, sny, nr, 's', '3d', mythid )
708 #endif /* ALLOW_VVEL0_CONTROL */
709
710 c----------------------------------------------------------------------
711 c--
712 #ifdef ALLOW_ETAN0_CONTROL
713 call ctrl_init_ctrlvar (
714 & xx_etan_file, 29, 129, 1, 1, 1,
715 & snx, sny, 1, 'c', 'xy', mythid )
716 #endif /* ALLOW_VVEL0_CONTROL */
717
718 c----------------------------------------------------------------------
719 c--
720 #ifdef ALLOW_RELAXSST_CONTROL
721 call ctrl_init_ctrlvar (
722 & xx_relaxsst_file, 30, 130, 1, 1, 1,
723 & snx, sny, 1, 'c', 'xy', mythid )
724 #endif /* ALLOW_RELAXSST_CONTROL */
725
726 c----------------------------------------------------------------------
727 c--
728 #ifdef ALLOW_RELAXSSS_CONTROL
729 call ctrl_init_ctrlvar (
730 & xx_relaxsss_file, 31, 131, 1, 1, 1,
731 & snx, sny, 1, 'c', 'xy', mythid )
732 #endif /* ALLOW_RELAXSSS_CONTROL */
733
734 c----------------------------------------------------------------------
735 c--
736 #ifdef ALLOW_PRECIP_CONTROL
737 c-- Atmos. precipitation
738
739 # ifdef ALLOW_CAL
740 call cal_FullDate( xx_precipstartdate1, xx_precipstartdate2,
741 & xx_precipstartdate , mythid )
742 call cal_TimePassed( xx_precipstartdate, modelstartdate,
743 & difftime, mythid )
744 call cal_ToSeconds ( difftime, diffsecs, mythid )
745 if ( xx_precipperiod .EQ. 0 ) then
746 startrec=1
747 endrec=12
748 else
749 startrec = int((modelstart + startTime - diffsecs)/
750 & xx_precipperiod) + 1
751 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
752 & xx_precipperiod) + 2
753 endif
754 # else
755 startrec = 1
756 endrec = 1
757 # endif
758 diffrec = endrec - startrec + 1
759 call ctrl_init_ctrlvar (
760 & xx_precip_file, 32, 132, diffrec, startrec, endrec,
761 & snx, sny, 1, 'c', 'xy', mythid )
762
763 #endif /* ALLOW_PRECIP_CONTROL */
764
765 c----------------------------------------------------------------------
766 c--
767 #ifdef ALLOW_SWFLUX_CONTROL
768 c-- Atmos. swflux
769
770 # ifdef ALLOW_CAL
771 call cal_FullDate( xx_swfluxstartdate1, xx_swfluxstartdate2,
772 & xx_swfluxstartdate , mythid )
773 call cal_TimePassed( xx_swfluxstartdate, modelstartdate,
774 & difftime, mythid )
775 call cal_ToSeconds ( difftime, diffsecs, mythid )
776 if ( xx_swfluxperiod .EQ. 0 ) then
777 startrec=1
778 endrec=12
779 else
780 startrec = int((modelstart + startTime - diffsecs)/
781 & xx_swfluxperiod) + 1
782 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
783 & xx_swfluxperiod) + 2
784 endif
785 # else
786 startrec = 1
787 endrec = 1
788 # endif
789 diffrec = endrec - startrec + 1
790 call ctrl_init_ctrlvar (
791 & xx_swflux_file, 33, 133, diffrec, startrec, endrec,
792 & snx, sny, 1, 'c', 'xy', mythid )
793
794 #endif /* ALLOW_SWFLUX_CONTROL */
795
796 c----------------------------------------------------------------------
797 c--
798 #ifdef ALLOW_SWDOWN_CONTROL
799 c-- Atmos. swdown
800
801 # ifdef ALLOW_CAL
802 call cal_FullDate( xx_swdownstartdate1, xx_swdownstartdate2,
803 & xx_swdownstartdate , mythid )
804 call cal_TimePassed( xx_swdownstartdate, modelstartdate,
805 & difftime, mythid )
806 call cal_ToSeconds ( difftime, diffsecs, mythid )
807 if ( xx_swdownperiod .EQ. 0 ) then
808 startrec=1
809 endrec=12
810 else
811 startrec = int((modelstart + startTime - diffsecs)/
812 & xx_swdownperiod) + 1
813 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
814 & xx_swdownperiod) + 2
815 endif
816 # else
817 startrec = 1
818 endrec = 1
819 # endif
820 diffrec = endrec - startrec + 1
821 call ctrl_init_ctrlvar (
822 & xx_swdown_file, 34, 134, diffrec, startrec, endrec,
823 & snx, sny, 1, 'c', 'xy', mythid )
824
825 #endif /* ALLOW_SWDOWN_CONTROL */
826
827 c----------------------------------------------------------------------
828 c----------------------------------------------------------------------
829
830 call ctrl_init_wet( mythid )
831
832 c----------------------------------------------------------------------
833 c----------------------------------------------------------------------
834
835 do bj = jtlo,jthi
836 do bi = itlo,ithi
837 do j = jmin,jmax
838 do i = imin,imax
839 wareaunit (i,j,bi,bj) = 1.0
840 #ifndef ALLOW_ECCO
841 whflux (i,j,bi,bj) = maskC(i,j,1,bi,bj)
842 wsflux (i,j,bi,bj) = maskC(i,j,1,bi,bj)
843 wtauu (i,j,bi,bj) = maskW(i,j,1,bi,bj)
844 wtauv (i,j,bi,bj) = maskS(i,j,1,bi,bj)
845 watemp (i,j,bi,bj) = maskC(i,j,1,bi,bj)
846 waqh (i,j,bi,bj) = maskC(i,j,1,bi,bj)
847 wprecip (i,j,bi,bj) = maskC(i,j,1,bi,bj)
848 wswflux (i,j,bi,bj) = maskC(i,j,1,bi,bj)
849 wswdown (i,j,bi,bj) = maskC(i,j,1,bi,bj)
850 wuwind (i,j,bi,bj) = maskC(i,j,1,bi,bj)
851 wvwind (i,j,bi,bj) = maskC(i,j,1,bi,bj)
852 wsst (i,j,bi,bj) = maskC(i,j,1,bi,bj)
853 wsss (i,j,bi,bj) = maskC(i,j,1,bi,bj)
854 #endif
855 enddo
856 enddo
857 enddo
858 enddo
859
860 return
861 end
862

  ViewVC Help
Powered by ViewVC 1.1.22