/[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.28 - (show annotations) (download)
Tue Jan 15 19:56:27 2008 UTC (16 years, 4 months ago) by dfer
Branch: MAIN
Changes since 1.27: +9 -1 lines
Bit of tutorial_global_oce_optim

1 C
2 C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_init.F,v 1.27 2007/09/06 14:04:28 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 35 lwflux
156 cph 36 lwdown
157 cph 37 evap
158 cph 38 snowprecip
159 cph 39 apressure
160 cph 40 runoff
161 cph 41 seaice SIAREA
162 cph 42 seaice SIHEFF
163 cph 43 seaice SIHSNOW
164 cph)
165
166 c----------------------------------------------------------------------
167 c--
168 #ifdef ALLOW_THETA0_CONTROL
169 c-- Initial state temperature contribution.
170 call ctrl_init_ctrlvar (
171 & xx_theta_file, 1, 101, 1, 1, 1,
172 & snx, sny, nr, 'c', '3d', mythid )
173 #endif /* ALLOW_THETA0_CONTROL */
174
175 c----------------------------------------------------------------------
176 c--
177 #ifdef ALLOW_SALT0_CONTROL
178 c-- Initial state salinity contribution.
179 call ctrl_init_ctrlvar (
180 & xx_salt_file, 2, 102, 1, 1, 1,
181 & snx, sny, nr, 'c', '3d', mythid )
182 #endif /* ALLOW_SALT0_CONTROL */
183
184 c-- ===========================
185 c-- Surface flux contributions.
186 c-- ===========================
187
188 c----------------------------------------------------------------------
189 c--
190 #if (defined (ALLOW_HFLUX_CONTROL))
191 c-- Heat flux.
192
193 # ifdef ALLOW_CAL
194 call cal_FullDate( xx_hfluxstartdate1, xx_hfluxstartdate2,
195 & xx_hfluxstartdate , mythid )
196 call cal_TimePassed( xx_hfluxstartdate, modelstartdate,
197 & difftime, mythid )
198 call cal_ToSeconds ( difftime, diffsecs, mythid )
199 if ( xx_hfluxperiod .EQ. 0 ) then
200 startrec=1
201 endrec=12
202 else
203 startrec = int((modelstart + startTime - diffsecs)/
204 & xx_hfluxperiod) + 1
205 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
206 & xx_hfluxperiod) + 2
207 endif
208 # else
209 startrec = 1
210 endrec = 1
211 # endif
212 diffrec = endrec - startrec + 1
213 call ctrl_init_ctrlvar (
214 & xx_hflux_file, 3, 103, diffrec, startrec, endrec,
215 & snx, sny, 1, 'c', 'xy', mythid )
216
217 #elif (defined (ALLOW_ATEMP_CONTROL))
218 c-- Atmos. temperature
219
220 # ifdef ALLOW_CAL
221 call cal_FullDate( xx_atempstartdate1, xx_atempstartdate2,
222 & xx_atempstartdate , mythid )
223 call cal_TimePassed( xx_atempstartdate, modelstartdate,
224 & difftime, mythid )
225 call cal_ToSeconds ( difftime, diffsecs, mythid )
226 if ( xx_atempperiod .EQ. 0 ) then
227 startrec=1
228 endrec=12
229 else
230 startrec = int((modelstart + startTime - diffsecs)/
231 & xx_atempperiod) + 1
232 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
233 & xx_atempperiod) + 2
234 endif
235 # else
236 startrec = 1
237 endrec = 1
238 # endif
239 diffrec = endrec - startrec + 1
240 call ctrl_init_ctrlvar (
241 & xx_atemp_file, 7, 107, diffrec, startrec, endrec,
242 & snx, sny, 1, 'c', 'xy', mythid )
243
244 #elif (defined (ALLOW_HFLUX0_CONTROL))
245 c-- initial forcing only
246 call ctrl_init_ctrlvar (
247 & xx_hflux_file, 3, 103, 1, 1, 1,
248 & snx, sny, 1, 'c', 'xy', mythid )
249
250 #endif /* ALLOW_HFLUX_CONTROL */
251
252 c----------------------------------------------------------------------
253 c--
254 #if (defined (ALLOW_SFLUX_CONTROL))
255 c-- Salt flux.
256
257 # ifdef ALLOW_CAL
258 call cal_FullDate( xx_sfluxstartdate1, xx_sfluxstartdate2,
259 & xx_sfluxstartdate , mythid )
260 call cal_TimePassed( xx_sfluxstartdate, modelstartdate,
261 & difftime, mythid )
262 call cal_ToSeconds ( difftime, diffsecs, mythid )
263 if ( xx_sfluxperiod .EQ. 0 ) then
264 startrec=1
265 endrec=12
266 else
267 startrec = int((modelstart + startTime - diffsecs)/
268 & xx_sfluxperiod) + 1
269 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
270 & xx_sfluxperiod) + 2
271 endif
272 # else
273 startrec = 1
274 endrec = 1
275 # endif
276 diffrec = endrec - startrec + 1
277 call ctrl_init_ctrlvar (
278 & xx_sflux_file, 4, 104, diffrec, startrec, endrec,
279 & snx, sny, 1, 'c', 'xy', mythid )
280
281 #elif (defined (ALLOW_AQH_CONTROL))
282 c-- Atmos. humidity
283
284 # ifdef ALLOW_CAL
285 call cal_FullDate( xx_aqhstartdate1, xx_aqhstartdate2,
286 & xx_aqhstartdate , mythid )
287 call cal_TimePassed( xx_aqhstartdate, modelstartdate,
288 & difftime, mythid )
289 call cal_ToSeconds ( difftime, diffsecs, mythid )
290 if ( xx_aqhperiod .EQ. 0 ) then
291 startrec=1
292 endrec=12
293 else
294 startrec = int((modelstart + startTime - diffsecs)/
295 & xx_aqhperiod) + 1
296 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
297 & xx_aqhperiod) + 2
298 endif
299 # else
300 startrec = 1
301 endrec = 1
302 # endif
303 diffrec = endrec - startrec + 1
304 call ctrl_init_ctrlvar (
305 & xx_aqh_file, 8, 108, diffrec, startrec, endrec,
306 & snx, sny, 1, 'c', 'xy', mythid )
307
308 #elif (defined (ALLOW_SFLUX0_CONTROL))
309 c-- initial forcing only
310 call ctrl_init_ctrlvar (
311 & xx_sflux_file, 4, 104, 1, 1, 1,
312 & snx, sny, 1, 'c', 'xy', mythid )
313
314 #endif /* ALLOW_SFLUX_CONTROL */
315
316 c----------------------------------------------------------------------
317 c--
318 #if (defined (ALLOW_USTRESS_CONTROL))
319 c-- Zonal wind stress.
320
321 # ifdef ALLOW_CAL
322 call cal_FullDate( xx_tauustartdate1, xx_tauustartdate2,
323 & xx_tauustartdate, mythid )
324 call cal_TimePassed( xx_tauustartdate, modelstartdate,
325 & difftime, mythid )
326 call cal_ToSeconds ( difftime, diffsecs, mythid )
327 if ( xx_tauuperiod .EQ. 0 ) then
328 startrec=1
329 endrec=12
330 else
331 startrec = int((modelstart + startTime - diffsecs)/
332 & xx_tauuperiod) + 1
333 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
334 & xx_tauuperiod) + 2
335 endif
336 # else
337 startrec = 1
338 endrec = 1
339 # endif
340 diffrec = endrec - startrec + 1
341 call ctrl_init_ctrlvar (
342 & xx_tauu_file, 5, 105, diffrec, startrec, endrec,
343 & snx, sny, 1, 'w', 'xy', mythid )
344
345 #elif (defined (ALLOW_UWIND_CONTROL))
346 c-- Zonal wind speed.
347
348 # ifdef ALLOW_CAL
349 call cal_FullDate( xx_uwindstartdate1, xx_uwindstartdate2,
350 & xx_uwindstartdate , mythid )
351 call cal_TimePassed( xx_uwindstartdate, modelstartdate,
352 & difftime, mythid )
353 call cal_ToSeconds ( difftime, diffsecs, mythid )
354 if ( xx_uwindperiod .EQ. 0 ) then
355 startrec=1
356 endrec=12
357 else
358 startrec = int((modelstart + startTime - diffsecs)/
359 & xx_uwindperiod) + 1
360 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
361 & xx_uwindperiod) + 2
362 endif
363 # else
364 startrec = 1
365 endrec = 1
366 # endif
367 diffrec = endrec - startrec + 1
368 call ctrl_init_ctrlvar (
369 & xx_uwind_file, 9, 109, diffrec, startrec, endrec,
370 & snx, sny, 1, 'c', 'xy', mythid )
371
372 #elif (defined (ALLOW_TAUU0_CONTROL))
373 c-- initial forcing only
374 call ctrl_init_ctrlvar (
375 & xx_tauu_file, 5, 105, 1, 1, 1,
376 & snx, sny, 1, 'w', 'xy', mythid )
377
378 #endif /* ALLOW_USTRESS_CONTROL */
379
380 c----------------------------------------------------------------------
381 c--
382 #if (defined (ALLOW_VSTRESS_CONTROL))
383 c-- Meridional wind stress.
384
385 # ifdef ALLOW_CAL
386 call cal_FullDate( xx_tauvstartdate1, xx_tauvstartdate2,
387 & xx_tauvstartdate, mythid )
388 call cal_TimePassed( xx_tauvstartdate, modelstartdate,
389 & difftime, mythid )
390 call cal_ToSeconds ( difftime, diffsecs, mythid )
391 if ( xx_tauvperiod .EQ. 0 ) then
392 startrec=1
393 endrec=12
394 else
395 startrec = int((modelstart + startTime - diffsecs)/
396 & xx_tauvperiod) + 1
397 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
398 & xx_tauvperiod) + 2
399 endif
400 # else
401 startrec = 1
402 endrec = 1
403 # endif
404 diffrec = endrec - startrec + 1
405 call ctrl_init_ctrlvar (
406 & xx_tauv_file, 6, 106, diffrec, startrec, endrec,
407 & snx, sny, 1, 's', 'xy', mythid )
408
409 #elif (defined (ALLOW_VWIND_CONTROL))
410 c-- Meridional wind speed.
411
412 # ifdef ALLOW_CAL
413 call cal_FullDate( xx_vwindstartdate1, xx_vwindstartdate2,
414 & xx_vwindstartdate , mythid )
415 call cal_TimePassed( xx_vwindstartdate, modelstartdate,
416 & difftime, mythid )
417 call cal_ToSeconds ( difftime, diffsecs, mythid )
418 if ( xx_vwindperiod .EQ. 0 ) then
419 startrec=1
420 endrec=12
421 else
422 startrec = int((modelstart + startTime - diffsecs)/
423 & xx_vwindperiod) + 1
424 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
425 & xx_vwindperiod) + 2
426 endif
427 # else
428 startrec = 1
429 endrec = 1
430 # endif
431 diffrec = endrec - startrec + 1
432 call ctrl_init_ctrlvar (
433 & xx_vwind_file, 10, 110, diffrec, startrec, endrec,
434 & snx, sny, 1, 'c', 'xy', mythid )
435
436 #elif (defined (ALLOW_TAUV0_CONTROL))
437 c-- initial forcing only
438 diffrec = endrec - startrec + 1
439 call ctrl_init_ctrlvar (
440 & xx_tauv_file, 6, 106, 1, 1, 1,
441 & snx, sny, 1, 's', 'xy', mythid )
442
443 #endif /* ALLOW_VSTRESS_CONTROL */
444
445 c-- ===========================
446 c-- Open boundary contributions.
447 c-- ===========================
448
449 c----------------------------------------------------------------------
450 c--
451 #ifdef ALLOW_OBCSN_CONTROL
452 c-- Northern obc.
453
454 # ifdef ALLOW_CAL
455 call cal_FullDate( xx_obcsnstartdate1, xx_obcsnstartdate2,
456 & xx_obcsnstartdate, mythid )
457 call cal_TimePassed( xx_obcsnstartdate, modelstartdate,
458 & difftime, mythid )
459 call cal_ToSeconds ( difftime, diffsecs, mythid )
460 startrec = int((modelstart - diffsecs)/xx_obcsnperiod) + 1
461 startrec = (startrec - 1)*nobcs + 1
462 endrec = int((modelend - diffsecs)/xx_obcsnperiod) + 2
463 endrec = (endrec - startrec + 1)*nobcs
464 # else
465 startrec = 1
466 endrec = 1
467 # endif
468 diffrec = endrec
469 call ctrl_init_ctrlvar (
470 & xx_obcsn_file, 11, 111, diffrec, startrec, endrec,
471 & snx, 1, nr, 'm', 'xz', mythid )
472
473 #endif /* ALLOW_OBCSN_CONTROL */
474
475 c----------------------------------------------------------------------
476 c--
477 #ifdef ALLOW_OBCSS_CONTROL
478 c-- Southern obc.
479
480 # ifdef ALLOW_CAL
481 call cal_FullDate( xx_obcssstartdate1, xx_obcssstartdate2,
482 & xx_obcssstartdate, mythid )
483 call cal_TimePassed( xx_obcssstartdate, modelstartdate,
484 & difftime, mythid )
485 call cal_ToSeconds ( difftime, diffsecs, mythid )
486 startrec = int((modelstart - diffsecs)/xx_obcssperiod) + 1
487 startrec = (startrec - 1)*nobcs + 1
488 endrec = int((modelend - diffsecs)/xx_obcssperiod) + 2
489 endrec = (endrec - startrec + 1)*nobcs
490 # else
491 startrec = 1
492 endrec = 1
493 # endif
494 diffrec = endrec
495 call ctrl_init_ctrlvar (
496 & xx_obcss_file, 12, 112, diffrec, startrec, endrec,
497 & snx, 1, nr, 'm', 'xz', mythid )
498
499 #endif /* ALLOW_OBCSS_CONTROL */
500
501 c----------------------------------------------------------------------
502 c--
503 #ifdef ALLOW_OBCSW_CONTROL
504 c-- Western obc.
505
506 # ifdef ALLOW_CAL
507 call cal_FullDate( xx_obcswstartdate1, xx_obcswstartdate2,
508 & xx_obcswstartdate, mythid )
509 call cal_TimePassed( xx_obcswstartdate, modelstartdate,
510 & difftime, mythid )
511 call cal_ToSeconds ( difftime, diffsecs, mythid )
512 startrec = int((modelstart - diffsecs)/xx_obcswperiod) + 1
513 startrec = (startrec - 1)*nobcs + 1
514 endrec = int((modelend - diffsecs)/xx_obcswperiod) + 2
515 endrec = (endrec - startrec + 1)*nobcs
516 # else
517 startrec = 1
518 endrec = 1
519 # endif
520 diffrec = endrec
521 call ctrl_init_ctrlvar (
522 & xx_obcsw_file, 13, 113, diffrec, startrec, endrec,
523 & 1, sny, nr, 'm', 'yz', mythid )
524
525 #endif /* ALLOW_OBCSW_CONTROL */
526
527 c----------------------------------------------------------------------
528 c--
529 #ifdef ALLOW_OBCSE_CONTROL
530 c-- Eastern obc.
531
532 # ifdef ALLOW_CAL
533 call cal_FullDate( xx_obcsestartdate1, xx_obcsestartdate2,
534 & xx_obcsestartdate, mythid )
535 call cal_TimePassed( xx_obcsestartdate, modelstartdate,
536 & difftime, mythid )
537 call cal_ToSeconds ( difftime, diffsecs, mythid )
538 startrec = int((modelstart - diffsecs)/xx_obcseperiod) + 1
539 startrec = (startrec - 1)*nobcs + 1
540 endrec = int((modelend - diffsecs)/xx_obcseperiod) + 2
541 endrec = (endrec - startrec + 1)*nobcs
542 # else
543 startrec = 1
544 endrec = 1
545 # endif
546 diffrec = endrec
547 call ctrl_init_ctrlvar (
548 & xx_obcse_file, 14, 114, diffrec, startrec, endrec,
549 & 1, sny, nr, 'm', 'yz', mythid )
550
551 #endif /* ALLOW_OBCSE_CONTROL */
552
553 c----------------------------------------------------------------------
554 c--
555 #ifdef ALLOW_DIFFKR_CONTROL
556 call ctrl_init_ctrlvar (
557 & xx_diffkr_file, 15, 115, 1, 1, 1,
558 & snx, sny, nr, 'c', '3d', mythid )
559 #endif /* ALLOW_DIFFKR_CONTROL */
560
561 c----------------------------------------------------------------------
562 c--
563 #ifdef ALLOW_KAPGM_CONTROL
564 call ctrl_init_ctrlvar (
565 & xx_kapgm_file, 16, 116, 1, 1, 1,
566 & snx, sny, nr, 'c', '3d', mythid )
567 #endif /* ALLOW_KAPGM_CONTROL */
568
569 c----------------------------------------------------------------------
570 c--
571 #ifdef ALLOW_TR10_CONTROL
572 call ctrl_init_ctrlvar (
573 & xx_tr1_file, 17, 117, 1, 1, 1,
574 & snx, sny, nr, 'c', '3d', mythid )
575 #endif /* ALLOW_TR10_CONTROL */
576
577 c----------------------------------------------------------------------
578 c--
579 #if (defined (ALLOW_SST_CONTROL))
580
581 # ifdef ALLOW_CAL
582 call cal_FullDate( xx_sststartdate1, xx_sststartdate2,
583 & xx_sststartdate , mythid )
584 call cal_TimePassed( xx_sststartdate, modelstartdate,
585 & difftime, mythid )
586 call cal_ToSeconds ( difftime, diffsecs, mythid )
587 if ( xx_sstperiod .EQ. 0 ) then
588 startrec=1
589 endrec=12
590 else
591 startrec = int((modelstart + startTime - diffsecs)/
592 & xx_sstperiod) + 1
593 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
594 & xx_sstperiod) + 2
595 endif
596 # else
597 startrec = 1
598 endrec = 1
599 # endif
600 diffrec = endrec - startrec + 1
601 call ctrl_init_ctrlvar (
602 & xx_sst_file, 18, 118, diffrec, startrec, endrec,
603 & snx, sny, 1, 'c', 'xy', mythid )
604
605 #elif (defined (ALLOW_SST0_CONTROL))
606
607 call ctrl_init_ctrlvar (
608 & xx_sst_file, 18, 118, 1, 1, 1,
609 & snx, sny, 1, 'c', 'xy', mythid )
610
611 #endif /* ALLOW_SST_CONTROL */
612
613 c----------------------------------------------------------------------
614 c--
615 #if (defined (ALLOW_SSS_CONTROL))
616
617 # ifdef ALLOW_CAL
618 call cal_FullDate( xx_sssstartdate1, xx_sssstartdate2,
619 & xx_sssstartdate , mythid )
620 call cal_TimePassed( xx_sssstartdate, modelstartdate,
621 & difftime, mythid )
622 call cal_ToSeconds ( difftime, diffsecs, mythid )
623 if ( xx_sssperiod .EQ. 0 ) then
624 startrec=1
625 endrec=12
626 else
627 startrec = int((modelstart + startTime - diffsecs)/
628 & xx_sssperiod) + 1
629 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
630 & xx_sssperiod) + 2
631 endif
632 # else
633 startrec = 1
634 endrec = 1
635 # endif
636 diffrec = endrec - startrec + 1
637 call ctrl_init_ctrlvar (
638 & xx_sss_file, 19, 119, diffrec, startrec, endrec,
639 & snx, sny, 1, 'c', 'xy', mythid )
640
641 #elif (defined (ALLOW_SSS0_CONTROL))
642
643 call ctrl_init_ctrlvar (
644 & xx_sss_file, 19, 119, 1, 1, 1,
645 & snx, sny, 1, 'c', 'xy', mythid )
646
647 #endif /* ALLOW_SSS0_CONTROL */
648
649 c----------------------------------------------------------------------
650 c--
651 #ifdef ALLOW_DEPTH_CONTROL
652 call ctrl_init_ctrlvar (
653 & xx_depth_file, 20, 120, 1, 1, 1,
654 & snx, sny, 1, 'c', 'xy', mythid )
655 #endif /* ALLOW_DEPTH_CONTROL */
656
657 c----------------------------------------------------------------------
658 c--
659 #ifdef ALLOW_EFLUXY0_CONTROL
660 call ctrl_init_ctrlvar (
661 & xx_efluxy_file, 21, 121, 1, 1, 1,
662 & snx, sny, nr, 's', '3d', mythid )
663 #endif /* ALLOW_EFLUXY0_CONTROL */
664
665 c----------------------------------------------------------------------
666 c--
667 #ifdef ALLOW_EFLUXP0_CONTROL
668 call ctrl_init_ctrlvar (
669 & xx_efluxp_file, 22, 122, 1, 1, 1,
670 & snx, sny, nr, 'v', '3d', mythid )
671 #endif /* ALLOW_EFLUXP0_CONTROL */
672
673 c----------------------------------------------------------------------
674 c--
675 #ifdef ALLOW_BOTTOMDRAG_CONTROL
676 call ctrl_init_ctrlvar (
677 & xx_bottomdrag_file, 23, 123, 1, 1, 1,
678 & snx, sny, 1, 'c', 'xy', mythid )
679 #endif /* ALLOW_BOTTOMDRAG_CONTROL */
680
681 c----------------------------------------------------------------------
682 c--
683 #ifdef ALLOW_HFLUXM_CONTROL
684 call ctrl_init_ctrlvar (
685 & xx_hfluxm_file, 24, 124, 1, 1, 1,
686 & snx, sny, 1, 'c', 'xy', mythid )
687 #endif /* ALLOW_HFLUXM_CONTROL */
688
689 c----------------------------------------------------------------------
690 c--
691 #ifdef ALLOW_EDTAUX_CONTROL
692 call ctrl_init_ctrlvar (
693 & xx_edtaux_file, 25, 125, 1, 1, 1,
694 & snx, sny, nr, 'w', '3d', mythid )
695 #endif /* ALLOW_EDTAUX_CONTROL */
696
697 c----------------------------------------------------------------------
698 c--
699 #ifdef ALLOW_EDTAUY_CONTROL
700 call ctrl_init_ctrlvar (
701 & xx_edtauy_file, 26, 126, 1, 1, 1,
702 & snx, sny, nr, 's', '3d', mythid )
703 #endif /* ALLOW_EDTAUY_CONTROL */
704
705 c----------------------------------------------------------------------
706 c--
707 #ifdef ALLOW_UVEL0_CONTROL
708 call ctrl_init_ctrlvar (
709 & xx_uvel_file, 27, 127, 1, 1, 1,
710 & snx, sny, nr, 'w', '3d', mythid )
711 #endif /* ALLOW_UVEL0_CONTROL */
712
713 c----------------------------------------------------------------------
714 c--
715 #ifdef ALLOW_VVEL0_CONTROL
716 call ctrl_init_ctrlvar (
717 & xx_vvel_file, 28, 128, 1, 1, 1,
718 & snx, sny, nr, 's', '3d', mythid )
719 #endif /* ALLOW_VVEL0_CONTROL */
720
721 c----------------------------------------------------------------------
722 c--
723 #ifdef ALLOW_ETAN0_CONTROL
724 call ctrl_init_ctrlvar (
725 & xx_etan_file, 29, 129, 1, 1, 1,
726 & snx, sny, 1, 'c', 'xy', mythid )
727 #endif /* ALLOW_VVEL0_CONTROL */
728
729 c----------------------------------------------------------------------
730 c--
731 #ifdef ALLOW_RELAXSST_CONTROL
732 call ctrl_init_ctrlvar (
733 & xx_relaxsst_file, 30, 130, 1, 1, 1,
734 & snx, sny, 1, 'c', 'xy', mythid )
735 #endif /* ALLOW_RELAXSST_CONTROL */
736
737 c----------------------------------------------------------------------
738 c--
739 #ifdef ALLOW_RELAXSSS_CONTROL
740 call ctrl_init_ctrlvar (
741 & xx_relaxsss_file, 31, 131, 1, 1, 1,
742 & snx, sny, 1, 'c', 'xy', mythid )
743 #endif /* ALLOW_RELAXSSS_CONTROL */
744
745 c----------------------------------------------------------------------
746 c--
747 #ifdef ALLOW_PRECIP_CONTROL
748 c-- Atmos. precipitation
749
750 # ifdef ALLOW_CAL
751 call cal_FullDate( xx_precipstartdate1, xx_precipstartdate2,
752 & xx_precipstartdate , mythid )
753 call cal_TimePassed( xx_precipstartdate, modelstartdate,
754 & difftime, mythid )
755 call cal_ToSeconds ( difftime, diffsecs, mythid )
756 if ( xx_precipperiod .EQ. 0 ) then
757 startrec=1
758 endrec=12
759 else
760 startrec = int((modelstart + startTime - diffsecs)/
761 & xx_precipperiod) + 1
762 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
763 & xx_precipperiod) + 2
764 endif
765 # else
766 startrec = 1
767 endrec = 1
768 # endif
769 diffrec = endrec - startrec + 1
770 call ctrl_init_ctrlvar (
771 & xx_precip_file, 32, 132, diffrec, startrec, endrec,
772 & snx, sny, 1, 'c', 'xy', mythid )
773
774 #endif /* ALLOW_PRECIP_CONTROL */
775
776 c----------------------------------------------------------------------
777 c--
778 #ifdef ALLOW_SWFLUX_CONTROL
779 c-- Atmos. swflux
780
781 # ifdef ALLOW_CAL
782 call cal_FullDate( xx_swfluxstartdate1, xx_swfluxstartdate2,
783 & xx_swfluxstartdate , mythid )
784 call cal_TimePassed( xx_swfluxstartdate, modelstartdate,
785 & difftime, mythid )
786 call cal_ToSeconds ( difftime, diffsecs, mythid )
787 if ( xx_swfluxperiod .EQ. 0 ) then
788 startrec=1
789 endrec=12
790 else
791 startrec = int((modelstart + startTime - diffsecs)/
792 & xx_swfluxperiod) + 1
793 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
794 & xx_swfluxperiod) + 2
795 endif
796 # else
797 startrec = 1
798 endrec = 1
799 # endif
800 diffrec = endrec - startrec + 1
801 call ctrl_init_ctrlvar (
802 & xx_swflux_file, 33, 133, diffrec, startrec, endrec,
803 & snx, sny, 1, 'c', 'xy', mythid )
804
805 #endif /* ALLOW_SWFLUX_CONTROL */
806
807 c----------------------------------------------------------------------
808 c--
809 #ifdef ALLOW_SWDOWN_CONTROL
810 c-- Atmos. swdown
811
812 # ifdef ALLOW_CAL
813 call cal_FullDate( xx_swdownstartdate1, xx_swdownstartdate2,
814 & xx_swdownstartdate , mythid )
815 call cal_TimePassed( xx_swdownstartdate, modelstartdate,
816 & difftime, mythid )
817 call cal_ToSeconds ( difftime, diffsecs, mythid )
818 if ( xx_swdownperiod .EQ. 0 ) then
819 startrec=1
820 endrec=12
821 else
822 startrec = int((modelstart + startTime - diffsecs)/
823 & xx_swdownperiod) + 1
824 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
825 & xx_swdownperiod) + 2
826 endif
827 # else
828 startrec = 1
829 endrec = 1
830 # endif
831 diffrec = endrec - startrec + 1
832 call ctrl_init_ctrlvar (
833 & xx_swdown_file, 34, 134, diffrec, startrec, endrec,
834 & snx, sny, 1, 'c', 'xy', mythid )
835
836 #endif /* ALLOW_SWDOWN_CONTROL */
837
838 c----------------------------------------------------------------------
839 c--
840 #ifdef ALLOW_LWFLUX_CONTROL
841 c-- Atmos. lwflux
842
843 # ifdef ALLOW_CAL
844 call cal_FullDate( xx_lwfluxstartdate1, xx_lwfluxstartdate2,
845 & xx_lwfluxstartdate , mythid )
846 call cal_TimePassed( xx_lwfluxstartdate, modelstartdate,
847 & difftime, mythid )
848 call cal_ToSeconds ( difftime, diffsecs, mythid )
849 if ( xx_lwfluxperiod .EQ. 0 ) then
850 startrec=1
851 endrec=12
852 else
853 startrec = int((modelstart + startTime - diffsecs)/
854 & xx_lwfluxperiod) + 1
855 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
856 & xx_lwfluxperiod) + 2
857 endif
858 # else
859 startrec = 1
860 endrec = 1
861 # endif
862 diffrec = endrec - startrec + 1
863 call ctrl_init_ctrlvar (
864 & xx_lwflux_file, 35, 135, diffrec, startrec, endrec,
865 & snx, sny, 1, 'c', 'xy', mythid )
866
867 #endif /* ALLOW_LWFLUX_CONTROL */
868
869 c----------------------------------------------------------------------
870 c--
871 #ifdef ALLOW_LWDOWN_CONTROL
872 c-- Atmos. lwdown
873
874 # ifdef ALLOW_CAL
875 call cal_FullDate( xx_lwdownstartdate1, xx_lwdownstartdate2,
876 & xx_lwdownstartdate , mythid )
877 call cal_TimePassed( xx_lwdownstartdate, modelstartdate,
878 & difftime, mythid )
879 call cal_ToSeconds ( difftime, diffsecs, mythid )
880 if ( xx_lwdownperiod .EQ. 0 ) then
881 startrec=1
882 endrec=12
883 else
884 startrec = int((modelstart + startTime - diffsecs)/
885 & xx_lwdownperiod) + 1
886 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
887 & xx_lwdownperiod) + 2
888 endif
889 # else
890 startrec = 1
891 endrec = 1
892 # endif
893 diffrec = endrec - startrec + 1
894 call ctrl_init_ctrlvar (
895 & xx_lwdown_file, 36, 136, diffrec, startrec, endrec,
896 & snx, sny, 1, 'c', 'xy', mythid )
897
898 #endif /* ALLOW_LWDOWN_CONTROL */
899
900 c----------------------------------------------------------------------
901 c--
902 #ifdef ALLOW_EVAP_CONTROL
903 c-- Atmos. evap
904
905 # ifdef ALLOW_CAL
906 call cal_FullDate( xx_evapstartdate1, xx_evapstartdate2,
907 & xx_evapstartdate , mythid )
908 call cal_TimePassed( xx_evapstartdate, modelstartdate,
909 & difftime, mythid )
910 call cal_ToSeconds ( difftime, diffsecs, mythid )
911 if ( xx_evapperiod .EQ. 0 ) then
912 startrec=1
913 endrec=12
914 else
915 startrec = int((modelstart + startTime - diffsecs)/
916 & xx_evapperiod) + 1
917 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
918 & xx_evapperiod) + 2
919 endif
920 # else
921 startrec = 1
922 endrec = 1
923 # endif
924 diffrec = endrec - startrec + 1
925 call ctrl_init_ctrlvar (
926 & xx_evap_file, 37, 137, diffrec, startrec, endrec,
927 & snx, sny, 1, 'c', 'xy', mythid )
928
929 #endif /* ALLOW_EVAP_CONTROL */
930
931 c----------------------------------------------------------------------
932 c--
933 #ifdef ALLOW_SNOWPRECIP_CONTROL
934 c-- Atmos. snowprecip
935
936 # ifdef ALLOW_CAL
937 call cal_FullDate( xx_snowprecipstartdate1,
938 & xx_snowprecipstartdate2, xx_snowprecipstartdate , mythid )
939 call cal_TimePassed( xx_snowprecipstartdate, modelstartdate,
940 & difftime, mythid )
941 call cal_ToSeconds ( difftime, diffsecs, mythid )
942 if ( xx_snowprecipperiod .EQ. 0 ) then
943 startrec=1
944 endrec=12
945 else
946 startrec = int((modelstart + startTime - diffsecs)/
947 & xx_snowprecipperiod) + 1
948 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
949 & xx_snowprecipperiod) + 2
950 endif
951 # else
952 startrec = 1
953 endrec = 1
954 # endif
955 diffrec = endrec - startrec + 1
956 call ctrl_init_ctrlvar (
957 & xx_snowprecip_file, 38, 138, diffrec, startrec, endrec,
958 & snx, sny, 1, 'c', 'xy', mythid )
959
960 #endif /* ALLOW_SNOWPRECIP_CONTROL */
961
962 c----------------------------------------------------------------------
963 c--
964 #ifdef ALLOW_APRESSURE_CONTROL
965 c-- Atmos. apressure
966
967 # ifdef ALLOW_CAL
968 call cal_FullDate( xx_apressurestartdate1,
969 & xx_apressurestartdate2, xx_apressurestartdate , mythid )
970 call cal_TimePassed( xx_apressurestartdate, modelstartdate,
971 & difftime, mythid )
972 call cal_ToSeconds ( difftime, diffsecs, mythid )
973 if ( xx_apressureperiod .EQ. 0 ) then
974 startrec=1
975 endrec=12
976 else
977 startrec = int((modelstart + startTime - diffsecs)/
978 & xx_apressureperiod) + 1
979 endrec = int((modelend + startTime - diffsecs + modelstep/2)/
980 & xx_apressureperiod) + 2
981 endif
982 # else
983 startrec = 1
984 endrec = 1
985 # endif
986 diffrec = endrec - startrec + 1
987 call ctrl_init_ctrlvar (
988 & xx_apressure_file, 39, 139, diffrec, startrec, endrec,
989 & snx, sny, 1, 'c', 'xy', mythid )
990
991 #endif /* ALLOW_APRESSURE_CONTROL */
992
993 c----------------------------------------------------------------------
994 c--
995 #ifdef ALLOW_RUNOFF_CONTROL
996 c-- Atmos. runoff
997 startrec = 1
998 endrec = 1
999 diffrec = endrec - startrec + 1
1000 call ctrl_init_ctrlvar (
1001 & xx_runoff_file, 40, 140, diffrec, startrec, endrec,
1002 & snx, sny, 1, 'c', 'xy', mythid )
1003 #endif /* ALLOW_RUNOFF_CONTROL */
1004
1005 c----------------------------------------------------------------------
1006 c--
1007 #ifdef ALLOW_SIAREA_CONTROL
1008 startrec = 1
1009 endrec = 1
1010 diffrec = endrec - startrec + 1
1011 call ctrl_init_ctrlvar (
1012 & xx_siarea_file, 41, 141, diffrec, startrec, endrec,
1013 & snx, sny, 1, 'c', 'xy', mythid )
1014 #endif /* ALLOW_siarea_CONTROL */
1015
1016 c----------------------------------------------------------------------
1017 c--
1018 #ifdef ALLOW_SIHEFF_CONTROL
1019 startrec = 1
1020 endrec = 1
1021 diffrec = endrec - startrec + 1
1022 call ctrl_init_ctrlvar (
1023 & xx_siheff_file, 42, 142, diffrec, startrec, endrec,
1024 & snx, sny, 1, 'c', 'xy', mythid )
1025 #endif /* ALLOW_siheff_CONTROL */
1026
1027 c----------------------------------------------------------------------
1028 c--
1029 #ifdef ALLOW_SIHSNOW_CONTROL
1030 startrec = 1
1031 endrec = 1
1032 diffrec = endrec - startrec + 1
1033 call ctrl_init_ctrlvar (
1034 & xx_sihsnow_file, 43, 143, diffrec, startrec, endrec,
1035 & snx, sny, 1, 'c', 'xy', mythid )
1036 #endif /* ALLOW_sihsnow_CONTROL */
1037
1038 c----------------------------------------------------------------------
1039 c----------------------------------------------------------------------
1040
1041 call ctrl_init_wet( mythid )
1042
1043 c----------------------------------------------------------------------
1044 c----------------------------------------------------------------------
1045
1046 do bj = jtlo,jthi
1047 do bi = itlo,ithi
1048 do j = jmin,jmax
1049 do i = imin,imax
1050 wareaunit (i,j,bi,bj) = 1.0
1051 #ifndef ALLOW_ECCO
1052 whflux (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1053 wsflux (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1054 wtauu (i,j,bi,bj) = maskW(i,j,1,bi,bj)
1055 wtauv (i,j,bi,bj) = maskS(i,j,1,bi,bj)
1056 watemp (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1057 waqh (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1058 wprecip (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1059 wswflux (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1060 wswdown (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1061 wuwind (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1062 wvwind (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1063 wlwflux (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1064 wlwdown (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1065 wevap (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1066 wsnowprecip(i,j,bi,bj) = maskC(i,j,1,bi,bj)
1067 wapressure(i,j,bi,bj) = maskC(i,j,1,bi,bj)
1068 wrunoff (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1069 wsst (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1070 wsss (i,j,bi,bj) = maskC(i,j,1,bi,bj)
1071 #endif
1072 enddo
1073 enddo
1074 enddo
1075 enddo
1076
1077 return
1078 end
1079

  ViewVC Help
Powered by ViewVC 1.1.22