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

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

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

revision 1.4 by heimbach, Sun Mar 24 02:13:45 2002 UTC revision 1.5 by heimbach, Sat Jul 13 02:47:32 2002 UTC
# Line 3  C $Header$ Line 3  C $Header$
3  #include "CTRL_CPPOPTIONS.h"  #include "CTRL_CPPOPTIONS.h"
4    
5    
6        subroutine ctrl_Init(        subroutine ctrl_init( mythid )
      I                      mythid  
      &                    )  
7    
8  c     ==================================================================  c     ==================================================================
9  c     SUBROUTINE ctrl_Init  c     SUBROUTINE ctrl_init
10  c     ==================================================================  c     ==================================================================
11  c  c
12  c     o Set parts of the vector of control variables and initialize the  c     o Set parts of the vector of control variables and initialize the
# Line 40  c              - Alternatively: transfer Line 38  c              - Alternatively: transfer
38  c                ctrl_unpack  c                ctrl_unpack
39  c  c
40  c     ==================================================================  c     ==================================================================
41  c     SUBROUTINE ctrl_Init  c     SUBROUTINE ctrl_init
42  c     ==================================================================  c     ==================================================================
43    
44        implicit none        implicit none
# Line 53  c     == global variables == Line 51  c     == global variables ==
51  #include "GRID.h"  #include "GRID.h"
52  #include "ctrl.h"  #include "ctrl.h"
53    
54    #ifdef ALLOW_CALENDAR
55    #include "cal.h"
56    #endif
57    #ifdef ALLOW_OBCS_CONTROL
58    # include "OBCS.h"
59    #endif
60    #ifdef ALLOW_ECCO_OPTIMIZATION
61    #include "optim.h"
62    #endif
63    
64  c     == routine arguments ==  c     == routine arguments ==
65    
66        integer mythid        integer mythid
# Line 66  c     == local variables == Line 74  c     == local variables ==
74        integer jmin,jmax        integer jmin,jmax
75        integer imin,imax        integer imin,imax
76        integer ntmp        integer ntmp
77          integer ivarindex
78    
79          integer iobcs
80        integer il        integer il
81        integer errio        integer errio
82        integer startrec        integer startrec
83        integer endrec        integer endrec
84          integer difftime(4)
85          _RL     diffsecs
86          _RL     dummy
87    
88        _RL nwetc3d        character*(80)   ymaskobcs
   
89        character*(max_len_prec) record        character*(max_len_prec) record
90        character*(max_len_mbuf) msgbuf        character*(max_len_mbuf) msgbuf
91    
92          integer nwetc3d
93    
94  c     == external ==  c     == external ==
95    
96        integer  ilnblnk        integer  ilnblnk
# Line 88  c--   Read the namelist input. Line 102  c--   Read the namelist input.
102        namelist /ctrl_nml/        namelist /ctrl_nml/
103       &  xx_theta_file,       &  xx_theta_file,
104       &  xx_salt_file,       &  xx_salt_file,
105       &  xx_tr1_file,       &  xx_hflux_file,
106         &  xx_hfluxstartdate1, xx_hfluxstartdate2, xx_hfluxperiod,
107         &  xx_sflux_file,
108         &  xx_sfluxstartdate1, xx_sfluxstartdate2, xx_sfluxperiod,
109       &  xx_tauu_file,       &  xx_tauu_file,
110         &  xx_tauustartdate1,  xx_tauustartdate2,  xx_tauuperiod,
111       &  xx_tauv_file,       &  xx_tauv_file,
112       &  xx_sflux_file,       &  xx_tauvstartdate1,  xx_tauvstartdate2,  xx_tauvperiod,
113       &  xx_hflux_file,       &  xx_atemp_file,
114       &  xx_sss_file,       &  xx_atempstartdate1, xx_atempstartdate2, xx_atempperiod,
115       &  xx_sst_file,       &  xx_aqh_file,
116         &  xx_aqhstartdate1, xx_aqhstartdate2, xx_aqhperiod,
117         &  xx_uwind_file,
118         &  xx_uwindstartdate1, xx_uwindstartdate2, xx_uwindperiod,
119         &  xx_vwind_file,
120         &  xx_vwindstartdate1, xx_vwindstartdate2, xx_vwindperiod,
121         &  xx_obcsn_file,
122         &  xx_obcsnstartdate1,  xx_obcsnstartdate2,  xx_obcsnperiod,
123         &  xx_obcss_file,
124         &  xx_obcssstartdate1,  xx_obcssstartdate2,  xx_obcssperiod,
125         &  xx_obcsw_file,
126         &  xx_obcswstartdate1,  xx_obcswstartdate2,  xx_obcswperiod,
127         &  xx_obcse_file,
128         &  xx_obcsestartdate1,  xx_obcsestartdate2,  xx_obcseperiod,
129       &  xx_diffkr_file,       &  xx_diffkr_file,
130       &  xx_kapgm_file       &  xx_kapgm_file,
131         &  xx_tr1_file,
132         &  xx_efluxy_file,
133         &  xx_efluxp_file
134    
135        namelist /ctrl_packnames/        namelist /ctrl_packnames/
136       &  yadmark, expId,       &  yadmark, yctrlid,
137       &  ctrlname, costname, scalname, maskname, metaname       &  ctrlname, costname, scalname, maskname, metaname
138    
139        jtlo = mybylo(mythid)        jtlo = mybylo(mythid)
# Line 116  c--   Read the namelist input. Line 150  c--   Read the namelist input.
150  c--     Set default values.  c--     Set default values.
151          xx_theta_file      = ' '          xx_theta_file      = ' '
152          xx_salt_file       = ' '          xx_salt_file       = ' '
153          xx_tr1_file        = ' '          xx_hfluxstartdate1 =   0
154            xx_hfluxstartdate2 =   0
155            xx_hfluxperiod     =   0. _d 0
156            xx_hflux_file      = ' '
157            xx_sfluxstartdate1 =   0
158            xx_sfluxstartdate2 =   0
159            xx_sfluxperiod     =   0. _d 0
160            xx_sflux_file      = ' '
161            xx_tauustartdate1  =   0
162            xx_tauustartdate2  =   0
163            xx_tauuperiod      =   0. _d 0
164          xx_tauu_file       = ' '          xx_tauu_file       = ' '
165            xx_tauvstartdate1  =   0
166            xx_tauvstartdate2  =   0
167            xx_tauvperiod      =   0. _d 0
168          xx_tauv_file       = ' '          xx_tauv_file       = ' '
169          xx_sflux_file      = ' '          xx_atempstartdate1  =   0
170          xx_hflux_file      = ' '          xx_atempstartdate2  =   0
171          xx_sss_file        = ' '          xx_atempperiod      =   0. _d 0
172          xx_sst_file        = ' '          xx_atemp_file       = ' '
173          xx_diffkr_file     = ' '          xx_aqhstartdate1    =   0
174          xx_kapgm_file      = ' '          xx_aqhstartdate2    =   0
175          yadmark            = 'ad'          xx_aqhperiod        =   0. _d 0
176          expId              = ' '          xx_aqh_file         = ' '
177          ctrlname           = ' '          xx_uwindstartdate1  =   0
178          costname           = ' '          xx_uwindstartdate2  =   0
179          scalname           = ' '          xx_uwindperiod      =   0. _d 0
180          maskname           = ' '          xx_uwind_file       = ' '
181          metaname           = ' '          xx_vwindstartdate1  =   0
182            xx_vwindstartdate2  =   0
183            xx_vwindperiod      =   0. _d 0
184            xx_vwind_file       = ' '
185            xx_obcsnstartdate1  =   0
186            xx_obcsnstartdate2  =   0
187            xx_obcsnperiod      =   0. _d 0
188            xx_obcsn_file       = ' '
189            xx_obcssstartdate1  =   0
190            xx_obcssstartdate2  =   0
191            xx_obcssperiod      =   0. _d 0
192            xx_obcss_file       = ' '
193            xx_obcswstartdate1  =   0
194            xx_obcswstartdate2  =   0
195            xx_obcswperiod      =   0. _d 0
196            xx_obcsw_file       = ' '
197            xx_obcsestartdate1  =   0
198            xx_obcsestartdate2  =   0
199            xx_obcseperiod      =   0. _d 0
200            xx_obcse_file       = ' '
201            xx_diffkr_file      = ' '
202            xx_kapgm_file       = ' '
203            xx_tr1_file         = ' '
204            xx_efluxy_file      = ' '
205            xx_efluxp_file      = ' '
206            yadmark             = 'ad'
207            yctrlid             = 'MIT_CE_000'
208            ctrlname            = ' '
209            costname            = ' '
210            scalname            = ' '
211            maskname            = ' '
212            metaname            = ' '
213    
214  c--     Check versions.  c--     Check versions.
215    
# Line 158  c--     Next, read the ecco data file. Line 236  c--     Next, read the ecco data file.
236          read(unit = scrunit1, nml = ctrl_packnames)          read(unit = scrunit1, nml = ctrl_packnames)
237          close( scrunit1 )          close( scrunit1 )
238    
239    #ifdef ALLOW_CALENDAR
240    
241    c--     Get the complete dates of the control variables.
242    #if     (defined  (ALLOW_HFLUX_CONTROL))
243    c--     The heat flux contribution.
244            call cal_FullDate( xx_hfluxstartdate1, xx_hfluxstartdate2,
245         &                     xx_hfluxstartdate , mythid )
246    #elif   (defined  (ALLOW_ATEMP_CONTROL))
247    c--     Atmos. temperature contribution.
248            call cal_FullDate( xx_atempstartdate1, xx_atempstartdate2,
249         &                     xx_atempstartdate , mythid )
250    #endif
251    
252    #if     (defined  (ALLOW_SFLUX_CONTROL))
253    c--     The salt flux contribution.
254            call cal_FullDate( xx_sfluxstartdate1, xx_sfluxstartdate2,
255         &                     xx_sfluxstartdate , mythid )
256    #elif   (defined  (ALLOW_AQH_CONTROL))
257    c--     Atmospheric humidity contribution.
258            call cal_FullDate( xx_aqhstartdate1, xx_aqhstartdate2,
259         &                     xx_aqhstartdate , mythid )
260    #endif
261    
262    #if     (defined  (ALLOW_USTRESS_CONTROL))
263    c--     The zonal wind stress contribution.
264            call cal_FullDate( xx_tauustartdate1,  xx_tauustartdate2,
265         &                     xx_tauustartdate,   mythid )
266    #elif   (defined  (ALLOW_UWIND_CONTROL))
267    c--     Zonal wind speed contribution.
268            call cal_FullDate( xx_uwindstartdate1, xx_uwindstartdate2,
269         &                     xx_uwindstartdate , mythid )
270    #endif
271    
272    #if     (defined  (ALLOW_VSTRESS_CONTROL))
273    c--     The merid. wind stress contribution.
274            call cal_FullDate( xx_tauvstartdate1,  xx_tauvstartdate2,
275         &                     xx_tauvstartdate,   mythid )
276    #elif   (defined  (ALLOW_VWIND_CONTROL))
277    c--     Merid. wind speed contribution.
278            call cal_FullDate( xx_vwindstartdate1, xx_vwindstartdate2,
279         &                     xx_vwindstartdate , mythid )
280    #endif
281    
282    #ifdef ALLOW_OBCS_CONTROL
283            call cal_FullDate( xx_obcsnstartdate1,  xx_obcsnstartdate2,
284         &                     xx_obcsnstartdate,   mythid )
285            call cal_FullDate( xx_obcssstartdate1,  xx_obcssstartdate2,
286         &                     xx_obcssstartdate,   mythid )
287            call cal_FullDate( xx_obcswstartdate1,  xx_obcswstartdate2,
288         &                     xx_obcswstartdate,   mythid )
289            call cal_FullDate( xx_obcsestartdate1,  xx_obcsestartdate2,
290         &                     xx_obcsestartdate,   mythid )
291    #endif
292    
293    #endif /* ALLOW_CALENDAR */
294    
295  c--     Set default values.  c--     Set default values.
296          do i = 1,maxcvars          do ivarindex = 1,maxcvars
297            ncvarindex(i) = -1            ncvarindex(ivarindex) = -1
298            ncvarrecs(i)  =  0            ncvarrecs(ivarindex)  =  0
299            ncvarxmax(i)  =  0            ncvarxmax(ivarindex)  =  0
300            ncvarymax(i)  =  0            ncvarymax(ivarindex)  =  0
301            ncvarnrmax(i) =  0            ncvarnrmax(ivarindex) =  0
302            ncvargrd(i)   = '?'            ncvargrd(ivarindex)   = '?'
303          enddo          enddo
304    
305          write(msgbuf,'(a)') ' '          write(msgbuf,'(a)') ' '
# Line 195  c--   ===================== Line 329  c--   =====================
329  c--   Initial state fields.  c--   Initial state fields.
330  c--   =====================  c--   =====================
331    
332    cph(
333    cph    index  7-10 reserved for atmos. state,
334    cph    index 11-14 reserved for open boundaries,
335    cph    index 15-16 reserved for mixing coeff.
336    cph    index 17    reserved for passive tracer TR1
337    cph    index 18,19 reserved for sst, sss
338    cph    index 20             for hFacC
339    cph    index 21,22          for efluxy, efluxp
340    cph)
341    
342  #ifdef ALLOW_THETA0_CONTROL  #ifdef ALLOW_THETA0_CONTROL
343    c--   Initial state temperature contribution.
344    
345        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
346          ncvarindex(1) = 101          ivarindex             = 1
347          ncvarrecs(1)  =   1          ncvarindex(ivarindex) = 101
348          ncvarxmax(1)  = snx          ncvarrecs(ivarindex)  =   1
349          ncvarymax(1)  = sny          ncvarxmax(ivarindex)  = snx
350          ncvarnrmax(1) =  nr          ncvarymax(ivarindex)  = sny
351          ncvargrd(1)   = 'c'          ncvarnrmax(ivarindex) =  nr
352            ncvargrd(ivarindex)   = 'c'
353        _END_MASTER( mythid )        _END_MASTER( mythid )
354    
355  #endif /* ALLOW_THETA0_CONTROL */  #endif /* ALLOW_THETA0_CONTROL */
356    
357  #ifdef ALLOW_SALT0_CONTROL  #ifdef ALLOW_SALT0_CONTROL
358    c--   Initial state salinity contribution.
359    
360        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
361          ncvarindex(2) = 102          ivarindex             = 2
362          ncvarrecs(2)  =   1          ncvarindex(ivarindex) = 102
363          ncvarxmax(2)  = snx          ncvarrecs(ivarindex)  =   1
364          ncvarymax(2)  = sny          ncvarxmax(ivarindex)  = snx
365          ncvarnrmax(2) =  nr          ncvarymax(ivarindex)  = sny
366          ncvargrd(2)   = 'c'          ncvarnrmax(ivarindex) =  nr
367            ncvargrd(ivarindex)   = 'c'
368        _END_MASTER( mythid )        _END_MASTER( mythid )
369    
370  #endif /* ALLOW_SALT0_CONTROL */  #endif /* ALLOW_SALT0_CONTROL */
371    
372  #ifdef ALLOW_HFLUX0_CONTROL  c--   ===========================
373    c--   Surface flux contributions.
374    c--   ===========================
375    
376    #if (defined (ALLOW_HFLUX_CONTROL))
377    c--   Heat flux.
378    
379          _BEGIN_MASTER( mythid )
380    #ifdef ALLOW_CALENDAR
381            call cal_TimePassed( xx_hfluxstartdate, modelstartdate,
382         &                       difftime, mythid )
383            call cal_ToSeconds ( difftime, diffsecs, mythid )
384            startrec = int((modelstart - diffsecs)/
385         &                 xx_hfluxperiod) + 1
386            endrec   = int((modelend   - diffsecs - modelstep)/
387         &                 xx_hfluxperiod) + 2
388    #else
389            startrec = 1
390            endrec   = 1
391    #endif
392            ivarindex                = 3
393            ncvarindex(ivarindex)    = 103
394            ncvarrecs(ivarindex)     = endrec - startrec + 1
395            ncvarrecstart(ivarindex) = startrec
396            ncvarrecsend(ivarindex)  = endrec
397            ncvarxmax(ivarindex)     = snx
398            ncvarymax(ivarindex)     = sny
399            ncvarnrmax(ivarindex)    =   1
400            ncvargrd(ivarindex)      = 'c'
401          _END_MASTER( mythid )
402    
403    #elif (defined (ALLOW_ATEMP_CONTROL))
404    c--   Atmos. temperature
405    
406          _BEGIN_MASTER( mythid )
407    #ifdef ALLOW_CALENDAR
408            call cal_TimePassed( xx_atempstartdate, modelstartdate,
409         &                       difftime, mythid )
410            call cal_ToSeconds ( difftime, diffsecs, mythid )
411            startrec = int((modelstart - diffsecs)/
412         &                 xx_atempperiod) + 1
413            endrec   = int((modelend   - diffsecs - modelstep)/
414         &                 xx_atempperiod) + 2
415    #else
416            startrec = 1
417            endrec   = 1
418    #endif
419            ivarindex                = 7
420            ncvarindex(ivarindex)    = 107
421            ncvarrecs(ivarindex)     = endrec - startrec + 1
422            ncvarrecstart(ivarindex) = startrec
423            ncvarrecsend(ivarindex)  = endrec
424            ncvarxmax(ivarindex)     = snx
425            ncvarymax(ivarindex)     = sny
426            ncvarnrmax(ivarindex)    =   1
427            ncvargrd(ivarindex)      = 'c'
428          _END_MASTER( mythid )
429    
430    #elif (defined (ALLOW_HFLUX0_CONTROL))
431    c--   initial forcing only
432        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
433          ncvarindex(3) = 103          ncvarindex(3) = 103
434          ncvarrecs(3)  =   1          ncvarrecs(3)  =   1
# Line 226  c--   ===================== Line 437  c--   =====================
437          ncvarnrmax(3) =   1          ncvarnrmax(3) =   1
438          ncvargrd(3)   = 'c'          ncvargrd(3)   = 'c'
439        _END_MASTER( mythid )        _END_MASTER( mythid )
 #endif /* ALLOW_HFLUX0_CONTROL */  
440    
441  #ifdef ALLOW_SFLUX0_CONTROL  #endif /* ALLOW_HFLUX_CONTROL */
442    
443    #if (defined (ALLOW_SFLUX_CONTROL))
444    c--   Salt flux.
445    
446          _BEGIN_MASTER( mythid )
447    #ifdef ALLOW_CALENDAR
448            call cal_TimePassed( xx_sfluxstartdate, modelstartdate,
449         &                       difftime, mythid )
450            call cal_ToSeconds ( difftime, diffsecs, mythid )
451            startrec = int((modelstart - diffsecs)/
452         &                 xx_sfluxperiod) + 1
453            endrec   = int((modelend   - diffsecs - modelstep)/
454         &                 xx_sfluxperiod) + 2
455    #else
456            startrec = 1
457            endrec   = 1
458    #endif
459            ivarindex                = 4
460            ncvarindex(ivarindex)    = 104
461            ncvarrecs(ivarindex)     = endrec - startrec + 1
462            ncvarrecstart(ivarindex) = startrec
463            ncvarrecsend(ivarindex)  = endrec
464            ncvarxmax(ivarindex)     = snx
465            ncvarymax(ivarindex)     = sny
466            ncvarnrmax(ivarindex)    =   1
467            ncvargrd(ivarindex)      = 'c'
468          _END_MASTER( mythid )
469    
470    #elif (defined (ALLOW_AQH_CONTROL))
471    c--   Atmos. humidity
472    
473          _BEGIN_MASTER( mythid )
474    #ifdef ALLOW_CALENDAR
475            call cal_TimePassed( xx_aqhstartdate, modelstartdate,
476         &                       difftime, mythid )
477            call cal_ToSeconds ( difftime, diffsecs, mythid )
478            startrec = int((modelstart - diffsecs)/
479         &                 xx_aqhperiod) + 1
480            endrec   = int((modelend   - diffsecs - modelstep)/
481         &                 xx_aqhperiod) + 2
482    #else
483            startrec = 1
484            endrec   = 1
485    #endif
486            ivarindex                = 8
487            ncvarindex(ivarindex)    = 108
488            ncvarrecs(ivarindex)     = endrec - startrec + 1
489            ncvarrecstart(ivarindex) = startrec
490            ncvarrecsend(ivarindex)  = endrec
491            ncvarxmax(ivarindex)     = snx
492            ncvarymax(ivarindex)     = sny
493            ncvarnrmax(ivarindex)    =   1
494            ncvargrd(ivarindex)      = 'c'
495          _END_MASTER( mythid )
496    
497    #elif (defined (ALLOW_SFLUX0_CONTROL))
498    c--   initial forcing only
499        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
500          ncvarindex(4) = 104          ncvarindex(4) = 104
501          ncvarrecs(4)  =   1          ncvarrecs(4)  =   1
# Line 237  c--   ===================== Line 504  c--   =====================
504          ncvarnrmax(4) =   1          ncvarnrmax(4) =   1
505          ncvargrd(4)   = 'c'          ncvargrd(4)   = 'c'
506        _END_MASTER( mythid )        _END_MASTER( mythid )
 #endif /* ALLOW_SFLUX0_CONTROL */  
507    
508  #ifdef ALLOW_TAUU0_CONTROL  #endif /* ALLOW_SFLUX_CONTROL */
509    
510    #if (defined (ALLOW_USTRESS_CONTROL))
511    c--   Zonal wind stress.
512    
513          _BEGIN_MASTER( mythid )
514    #ifdef ALLOW_CALENDAR
515            call cal_TimePassed( xx_tauustartdate, modelstartdate,
516         &                       difftime, mythid )
517            call cal_ToSeconds ( difftime, diffsecs, mythid )
518            startrec = int((modelstart - diffsecs)/
519         &                 xx_tauuperiod) + 1
520            endrec   = int((modelend   - diffsecs - modelstep)/
521         &                 xx_tauuperiod) + 2
522    #else
523            startrec = 1
524            endrec   = 1
525    #endif
526            ivarindex                = 5
527            ncvarindex(ivarindex)    = 105
528            ncvarrecs(ivarindex)     = endrec - startrec + 1
529            ncvarrecstart(ivarindex) = startrec
530            ncvarrecsend(ivarindex)  = endrec
531            ncvarxmax(ivarindex)     = snx
532            ncvarymax(ivarindex)     = sny
533            ncvarnrmax(ivarindex)    =   1
534            ncvargrd(ivarindex)      = 'w'
535          _END_MASTER( mythid )
536    
537    #elif (defined (ALLOW_UWIND_CONTROL))
538    c--   Zonal wind speed.
539    
540          _BEGIN_MASTER( mythid )
541    #ifdef ALLOW_CALENDAR
542            call cal_TimePassed( xx_uwindstartdate, modelstartdate,
543         &                       difftime, mythid )
544            call cal_ToSeconds ( difftime, diffsecs, mythid )
545            startrec = int((modelstart - diffsecs)/
546         &                 xx_uwindperiod) + 1
547            endrec   = int((modelend   - diffsecs - modelstep)/
548         &                 xx_uwindperiod) + 2
549    #else
550            startrec = 1
551            endrec   = 1
552    #endif
553            ivarindex                = 9
554            ncvarindex(ivarindex)    = 109
555            ncvarrecs(ivarindex)     = endrec - startrec + 1
556            ncvarrecstart(ivarindex) = startrec
557            ncvarrecsend(ivarindex)  = endrec
558            ncvarxmax(ivarindex)     = snx
559            ncvarymax(ivarindex)     = sny
560            ncvarnrmax(ivarindex)    =   1
561            ncvargrd(ivarindex)      = 'w'
562          _END_MASTER( mythid )
563    
564    #elif (defined (ALLOW_TAUU0_CONTROL))
565    c--   initial forcing only
566        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
567          ncvarindex(5) = 105          ncvarindex(5) = 105
568          ncvarrecs(5)  =   1          ncvarrecs(5)  =   1
# Line 248  c--   ===================== Line 571  c--   =====================
571          ncvarnrmax(5) =   1          ncvarnrmax(5) =   1
572          ncvargrd(5)   = 'w'          ncvargrd(5)   = 'w'
573        _END_MASTER( mythid )        _END_MASTER( mythid )
 #endif /* ALLOW_TAUU0_CONTROL */  
574    
575  #ifdef ALLOW_TAUV0_CONTROL  #endif /* ALLOW_USTRESS_CONTROL */
576    
577    #if (defined (ALLOW_VSTRESS_CONTROL))
578    c--   Meridional wind stress.
579    
580          _BEGIN_MASTER( mythid )
581    #ifdef ALLOW_CALENDAR
582            call cal_TimePassed( xx_tauvstartdate, modelstartdate,
583         &                       difftime, mythid )
584            call cal_ToSeconds ( difftime, diffsecs, mythid )
585            startrec = int((modelstart - diffsecs)/
586         &                 xx_tauvperiod) + 1
587            endrec   = int((modelend   - diffsecs - modelstep)/
588         &                 xx_tauvperiod) + 2
589    #else
590            startrec = 1
591            endrec   = 1
592    #endif
593            ivarindex                = 6
594            ncvarindex(ivarindex)    = 106
595            ncvarrecs(ivarindex)     = endrec - startrec + 1
596            ncvarrecstart(ivarindex) = startrec
597            ncvarrecsend(ivarindex)  = endrec
598            ncvarxmax(ivarindex)     = snx
599            ncvarymax(ivarindex)     = sny
600            ncvarnrmax(ivarindex)    =   1
601            ncvargrd(ivarindex)      = 's'
602          _END_MASTER( mythid )
603    
604    #elif (defined (ALLOW_VWIND_CONTROL))
605    c--   Meridional wind speed.
606    
607          _BEGIN_MASTER( mythid )
608    #ifdef ALLOW_CALENDAR
609            call cal_TimePassed( xx_vwindstartdate, modelstartdate,
610         &                       difftime, mythid )
611            call cal_ToSeconds ( difftime, diffsecs, mythid )
612            startrec = int((modelstart - diffsecs)/
613         &                 xx_vwindperiod) + 1
614            endrec   = int((modelend   - diffsecs - modelstep)/
615         &                 xx_vwindperiod) + 2
616    #else
617            startrec = 1
618            endrec   = 1
619    #endif
620            ivarindex                = 10
621            ncvarindex(ivarindex)    = 110
622            ncvarrecs(ivarindex)     = endrec - startrec + 1
623            ncvarrecstart(ivarindex) = startrec
624            ncvarrecsend(ivarindex)  = endrec
625            ncvarxmax(ivarindex)     = snx
626            ncvarymax(ivarindex)     = sny
627            ncvarnrmax(ivarindex)    =   1
628            ncvargrd(ivarindex)      = 's'
629          _END_MASTER( mythid )
630    
631    #elif (defined (ALLOW_TAUV0_CONTROL))
632    c--   initial forcing only
633        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
634          ncvarindex(6) = 106          ncvarindex(6) = 106
635          ncvarrecs(6)  =   1          ncvarrecs(6)  =   1
# Line 259  c--   ===================== Line 638  c--   =====================
638          ncvarnrmax(6) =   1          ncvarnrmax(6) =   1
639          ncvargrd(6)   = 's'          ncvargrd(6)   = 's'
640        _END_MASTER( mythid )        _END_MASTER( mythid )
 #endif /* ALLOW_TAUV0_CONTROL */  
641    
642  cph(  #endif /* ALLOW_VSTRESS_CONTROL */
643  cph    index  7-10 reserved for atmos. state,  
644  cph    index 11-14 reserved for open boundaries,  #ifdef ALLOW_OBCSN_CONTROL
645  cph    index 15-16 reserved for mixing coeff.  c--   Northern obc.
646  cph    index 17    reserved for passive tracer TR1  
647  cph    index 18,19 reserved for sst, sss        _BEGIN_MASTER( mythid )
648  cph)  #ifdef ALLOW_CALENDAR
649            call cal_TimePassed( xx_obcsnstartdate, modelstartdate,
650         &                       difftime, mythid )
651            call cal_ToSeconds ( difftime, diffsecs, mythid )
652            startrec = int((modelstart - diffsecs)/
653         &                 xx_obcsnperiod) + 1
654            endrec   = int((modelend   - diffsecs)/
655         &                 xx_obcsnperiod) + 2
656    #else
657            startrec = 1
658            endrec   = 1
659    #endif
660            ivarindex                = 11
661            ncvarindex(ivarindex)    = 111
662            ncvarrecs(ivarindex)     = (endrec - startrec + 1)*nobcs
663            ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1
664            ncvarrecsend(ivarindex)  = endrec*nobcs
665            ncvarxmax(ivarindex)     = snx
666            ncvarymax(ivarindex)     =   1
667            ncvarnrmax(ivarindex)    =  nr
668            ncvargrd(ivarindex)      = 'm'
669          _END_MASTER( mythid )
670    
671    #endif /* ALLOW_OBCSN_CONTROL */
672    
673    #ifdef ALLOW_OBCSS_CONTROL
674    c--   Southern obc.
675    
676          _BEGIN_MASTER( mythid )
677    #ifdef ALLOW_CALENDAR
678            call cal_TimePassed( xx_obcssstartdate, modelstartdate,
679         &                       difftime, mythid )
680            call cal_ToSeconds ( difftime, diffsecs, mythid )
681            startrec = int((modelstart - diffsecs)/
682         &                 xx_obcssperiod) + 1
683            endrec   = int((modelend   - diffsecs)/
684         &                 xx_obcssperiod) + 2
685    #else
686            startrec = 1
687            endrec   = 1
688    #endif
689            ivarindex                = 12
690            ncvarindex(ivarindex)    = 112
691            ncvarrecs(ivarindex)     = (endrec - startrec + 1)*nobcs
692            ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1
693            ncvarrecsend(ivarindex)  = endrec*nobcs
694            ncvarxmax(ivarindex)     = snx
695            ncvarymax(ivarindex)     =   1
696            ncvarnrmax(ivarindex)    =  nr
697            ncvargrd(ivarindex)      = 'm'
698          _END_MASTER( mythid )
699    
700    #endif /* ALLOW_OBCSS_CONTROL */
701    
702    #ifdef ALLOW_OBCSW_CONTROL
703    c--   Western obc.
704    
705          _BEGIN_MASTER( mythid )
706    #ifdef ALLOW_CALENDAR
707            call cal_TimePassed( xx_obcswstartdate, modelstartdate,
708         &                       difftime, mythid )
709            call cal_ToSeconds ( difftime, diffsecs, mythid )
710            startrec = int((modelstart - diffsecs)/
711         &                 xx_obcswperiod) + 1
712            endrec   = int((modelend   - diffsecs)/
713         &                 xx_obcswperiod) + 2
714    #else
715            startrec = 1
716            endrec   = 1
717    #endif
718            ivarindex                = 13
719            ncvarindex(ivarindex)    = 113
720            ncvarrecs(ivarindex)     = (endrec - startrec + 1)*nobcs
721            ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1
722            ncvarrecsend(ivarindex)  = endrec*nobcs
723            ncvarxmax(ivarindex)     =   1
724            ncvarymax(ivarindex)     = sny
725            ncvarnrmax(ivarindex)    =  nr
726            ncvargrd(ivarindex)      = 'm'
727          _END_MASTER( mythid )
728    
729    #endif /* ALLOW_OBCSW_CONTROL */
730    
731    #ifdef ALLOW_OBCSE_CONTROL
732    c--   Eastern obc.
733    
734          _BEGIN_MASTER( mythid )
735    #ifdef ALLOW_CALENDAR
736            call cal_TimePassed( xx_obcsestartdate, modelstartdate,
737         &                       difftime, mythid )
738            call cal_ToSeconds ( difftime, diffsecs, mythid )
739            startrec = int((modelstart - diffsecs)/
740         &                 xx_obcseperiod) + 1
741            endrec   = int((modelend   - diffsecs)/
742         &                 xx_obcseperiod) + 2
743    #else
744            startrec = 1
745            endrec   = 1
746    #endif
747            ivarindex                = 14
748            ncvarindex(ivarindex)    = 114
749            ncvarrecs(ivarindex)     = (endrec - startrec + 1)*nobcs
750            ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1
751            ncvarrecsend(ivarindex)  = endrec*nobcs
752            ncvarxmax(ivarindex)     =   1
753            ncvarymax(ivarindex)     = sny
754            ncvarnrmax(ivarindex)    =  nr
755            ncvargrd(ivarindex)      = 'm'
756          _END_MASTER( mythid )
757    
758    #endif /* ALLOW_OBCSE_CONTROL */
759    
760  #ifdef ALLOW_DIFFKR_CONTROL  #ifdef ALLOW_DIFFKR_CONTROL
761        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
762          ncvarindex(15) = 115          ivarindex                = 15
763          ncvarrecs (15) =   1          ncvarindex(ivarindex)    = 115
764          ncvarxmax (15) = snx          ncvarrecs (ivarindex)    =   1
765          ncvarymax (15) = sny          ncvarxmax (ivarindex)    = snx
766          ncvarnrmax(15) =  nr          ncvarymax (ivarindex)    = sny
767          ncvargrd  (15) = 'c'          ncvarnrmax(ivarindex)    =  nr
768            ncvargrd  (ivarindex)    = 'c'
769        _END_MASTER( mythid )        _END_MASTER( mythid )
770  #endif /* ALLOW_DIFFKR_CONTROL */  #endif /* ALLOW_DIFFKR_CONTROL */
771    
772  #ifdef ALLOW_KAPGM_CONTROL  #ifdef ALLOW_KAPGM_CONTROL
773        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
774          ncvarindex(16) = 116          ivarindex                = 16
775          ncvarrecs (16) =   1          ncvarindex(ivarindex)    = 116
776          ncvarxmax (16) = snx          ncvarrecs (ivarindex)    =   1
777          ncvarymax (16) = sny          ncvarxmax (ivarindex)    = snx
778          ncvarnrmax(16) =  nr          ncvarymax (ivarindex)    = sny
779          ncvargrd  (16) = 'c'          ncvarnrmax(ivarindex)    =  nr
780            ncvargrd  (ivarindex)    = 'c'
781        _END_MASTER( mythid )        _END_MASTER( mythid )
782  #endif /* ALLOW_KAPGM_CONTROL */  #endif /* ALLOW_KAPGM_CONTROL */
783    
784  #ifdef ALLOW_TR10_CONTROL  #ifdef ALLOW_TR10_CONTROL
785        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
786          ncvarindex(17) = 117          ivarindex                = 17
787          ncvarrecs (17) =   1          ncvarindex(ivarindex)    = 117
788          ncvarxmax (17) = snx          ncvarrecs (ivarindex)    =   1
789          ncvarymax (17) = sny          ncvarxmax (ivarindex)    = snx
790          ncvarnrmax(17) =  nr          ncvarymax (ivarindex)    = sny
791          ncvargrd  (17) = 'c'          ncvarnrmax(ivarindex)    =  nr
792            ncvargrd  (ivarindex)    = 'c'
793        _END_MASTER( mythid )        _END_MASTER( mythid )
794  #endif /* ALLOW_TR10_CONTROL */  #endif /* ALLOW_TR10_CONTROL */
795    
796  #ifdef ALLOW_SST0_CONTROL  #ifdef ALLOW_EFLUXY0_CONTROL
797        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
798          ncvarindex(18) = 118          ivarindex                = 21
799          ncvarrecs (18) =   1          ncvarindex(ivarindex)    = 121
800          ncvarxmax (18) = snx          ncvarrecs(ivarindex)     =   1
801          ncvarymax (18) = sny          ncvarxmax(ivarindex)     = snx
802          ncvarnrmax(18) =   1          ncvarymax(ivarindex)     = sny
803          ncvargrd  (18) = 'c'          ncvarnrmax(ivarindex)    =  nr
804        _END_MASTER( mythid )          ncvargrd(ivarindex)      = 's'
 #endif /* ALLOW_SST0_CONTROL */  
   
 #ifdef ALLOW_SSS0_CONTROL  
       _BEGIN_MASTER( mythid )  
         ncvarindex(19) = 119  
         ncvarrecs (19) =   1  
         ncvarxmax (19) = snx  
         ncvarymax (19) = sny  
         ncvarnrmax(19) =   1  
         ncvargrd  (19) = 'c'  
805        _END_MASTER( mythid )        _END_MASTER( mythid )
806  #endif /* ALLOW_SSS0_CONTROL */  #endif /* ALLOW_EFLUXY0_CONTROL */
807    
808    #ifdef ALLOW_EFLUXP0_CONTROL
809          _BEGIN_MASTER( mythid )
810            ivarindex                = 22
811            ncvarindex(ivarindex)    = 122
812            ncvarrecs(ivarindex)     =   1
813            ncvarxmax(ivarindex)     = snx
814            ncvarymax(ivarindex)     = sny
815            ncvarnrmax(ivarindex)    =  nr
816            ncvargrd(ivarindex)      = 'v'
817          _END_MASTER( mythid )
818    #endif /* ALLOW_EFLUXP0_CONTROL */
819    
820  c--   Determine the number of wet points in each tile:  c--   Determine the number of wet points in each tile:
821  c--   maskc, masks, and maskw.  c--   maskc, masks, and maskw.
# Line 340  c--   Initialise the counters. Line 833  c--   Initialise the counters.
833              nwetctile(bi,bj,k) = 0              nwetctile(bi,bj,k) = 0
834              nwetstile(bi,bj,k) = 0              nwetstile(bi,bj,k) = 0
835              nwetwtile(bi,bj,k) = 0              nwetwtile(bi,bj,k) = 0
836                nwetvtile(bi,bj,k) = 0
837              enddo
838            enddo
839          enddo
840    
841    #ifdef ALLOW_OBCS_CONTROL
842    c--   Initialise obcs counters.
843          do bj = jtlo,jthi
844            do bi = itlo,ithi
845              do k = 1,nr
846                do iobcs = 1,nobcs
847    #ifdef ALLOW_OBCSN_CONTROL
848                  nwetobcsn(bi,bj,k,iobcs) = 0
849    #endif
850    #ifdef ALLOW_OBCSS_CONTROL
851                  nwetobcss(bi,bj,k,iobcs) = 0
852    #endif
853    #ifdef ALLOW_OBCSW_CONTROL
854                  nwetobcsw(bi,bj,k,iobcs) = 0
855    #endif
856    #ifdef ALLOW_OBCSE_CONTROL
857                  nwetobcse(bi,bj,k,iobcs) = 0
858    #endif
859                enddo
860            enddo            enddo
861          enddo          enddo
862        enddo        enddo
863    #endif
864    
865  c--   Count wet points on each tile.  c--   Count wet points on each tile.
866        do bj = jtlo,jthi        do bj = jtlo,jthi
# Line 362  c--             West mask. Line 880  c--             West mask.
880                  if (maskW(i,j,k,bi,bj) .eq. 1.) then                  if (maskW(i,j,k,bi,bj) .eq. 1.) then
881                    nwetwtile(bi,bj,k) = nwetwtile(bi,bj,k) + 1                    nwetwtile(bi,bj,k) = nwetwtile(bi,bj,k) + 1
882                  endif                  endif
883    #if (defined (ALLOW_EFLUXP0_CONTROL))
884    c--             Vertical mask.
885                    if (hFacV(i,j,k,bi,bj) .ne. 0.) then
886                      nwetvtile(bi,bj,k) = nwetvtile(bi,bj,k) + 1
887                    endif
888    #endif
889                enddo                enddo
890              enddo              enddo
891            enddo            enddo
892          enddo          enddo
893        enddo        enddo
894    
895    #ifdef ALLOW_OBCSN_CONTROL
896    c--   Count wet points at Northern boundary.
897    c--   mask conventions are adopted from obcs_apply_ts, obcs_apply_uv
898          ymaskobcs = 'maskobcsn'
899          call ctrl_mask_set_xz(
900         &                       0, OB_Jn, nwetobcsn, ymaskobcs, mythid
901         &                     )
902    #endif
903    
904    #ifdef ALLOW_OBCSS_CONTROL
905    c--   Count wet points at Northern boundary.
906    c--   mask conventions are adopted from obcs_apply_ts, obcs_apply_uv
907          ymaskobcs = 'maskobcss'
908          call ctrl_mask_set_xz(
909         &                       1, OB_Js, nwetobcss, ymaskobcs, mythid
910         &                     )
911    #endif
912    
913    #ifdef ALLOW_OBCSW_CONTROL
914    c--   Count wet points at Northern boundary.
915    c--   mask conventions are adopted from obcs_apply_ts, obcs_apply_uv
916          ymaskobcs = 'maskobcsw'
917          call ctrl_mask_set_yz(
918         &                       1, OB_Iw, nwetobcsw, ymaskobcs, mythid
919         &                     )
920    #endif
921    
922    #ifdef ALLOW_OBCSE_CONTROL
923    c--   Count wet points at Northern boundary.
924    c--   mask conventions are adopted from obcs_apply_ts, obcs_apply_uv
925          ymaskobcs = 'maskobcse'
926          call ctrl_mask_set_yz(
927         &                       0, OB_Ie, nwetobcse, ymaskobcs, mythid
928         &                     )
929    #endif
930    
931        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
932  c--   Determine the total number of control variables.  c--   Determine the total number of control variables.
933        nvartype   = 0        nvartype   = 0
934        nvarlength = 0        nvarlength = 0
935        do i = 1,maxcvars        do i = 1,maxcvars
936    c
937           if ( ncvarindex(i) .ne. -1 ) then           if ( ncvarindex(i) .ne. -1 ) then
938              nvartype = nvartype + 1              nvartype = nvartype + 1
939              do bj = jtlo,jthi              do bj = jtlo,jthi
940                 do bi = itlo,ithi                 do bi = itlo,ithi
941                    if ( ncvargrd(i) .eq. 'c' ) then                    do k = 1,ncvarnrmax(i)
942                       do k = 1,ncvarnrmax(i)                       if ( ncvargrd(i) .eq. 'c' ) then
943                          nvarlength = nvarlength +                          nvarlength = nvarlength +
944       &                       ncvarrecs(i)*nwetctile(bi,bj,k)       &                       ncvarrecs(i)*nwetctile(bi,bj,k)
945                       enddo                       else if ( ncvargrd(i) .eq. 's' ) then
                   else if ( ncvargrd(i) .eq. 's' ) then  
                      do k = 1,ncvarnrmax(i)  
946                          nvarlength = nvarlength +                          nvarlength = nvarlength +
947       &                       ncvarrecs(i)*nwetstile(bi,bj,k)       &                       ncvarrecs(i)*nwetstile(bi,bj,k)
948                       enddo                       else if ( ncvargrd(i) .eq. 'w' ) then
                   else if ( ncvargrd(i) .eq. 'w' ) then  
                      do k = 1,ncvarnrmax(i)  
949                          nvarlength = nvarlength +                          nvarlength = nvarlength +
950       &                       ncvarrecs(i)*nwetwtile(bi,bj,k)       &                       ncvarrecs(i)*nwetwtile(bi,bj,k)
951                       enddo                       else if ( ncvargrd(i) .eq. 'v' ) then
952                    else                          nvarlength = nvarlength +
953                       print*,'ctrl_init: invalid grid location'       &                       ncvarrecs(i)*nwetvtile(bi,bj,k)
954                       print*,'     control variable = ',ncvarindex(i)                       else if ( ncvargrd(i) .eq. 'm' ) then
955                       print*,'     grid location    = ',ncvargrd(i)  #ifdef ALLOW_OBCS_CONTROL
956                       stop   ' ... stopped in ctrl_init'                          do iobcs = 1, nobcs
957                    endif                             if ( i .eq. 11 ) then
958    #ifdef ALLOW_OBCSN_CONTROL
959                                  nvarlength = nvarlength +
960         &                             (ncvarrecs(i)/nobcs)
961         &                             *nwetobcsn(bi,bj,k,iobcs)
962    #endif
963                               else if ( i .eq. 12 ) then
964    #ifdef ALLOW_OBCSS_CONTROL
965                                  nvarlength = nvarlength +
966         &                             (ncvarrecs(i)/nobcs)
967         &                             *nwetobcss(bi,bj,k,iobcs)
968    #endif
969                               else if ( i .eq. 13 ) then
970    #ifdef ALLOW_OBCSW_CONTROL
971                                  nvarlength = nvarlength +
972         &                             (ncvarrecs(i)/nobcs)
973         &                             *nwetobcsw(bi,bj,k,iobcs)
974    #endif
975                               else if ( i .eq. 14 ) then
976    #ifdef ALLOW_OBCSE_CONTROL
977                                  nvarlength = nvarlength +
978         &                             (ncvarrecs(i)/nobcs)
979         &                             *nwetobcse(bi,bj,k,iobcs)
980    #endif
981                               end if
982                            enddo
983    #endif
984                         else
985                            print*,'ctrl_init: invalid grid location'
986                            print*,'     control variable = ',ncvarindex(i)
987                            print*,'     grid location    = ',ncvargrd(i)
988                            stop   ' ... stopped in ctrl_init'
989                         endif
990                      enddo
991                 enddo                 enddo
992              enddo              enddo
993           endif           endif
994        enddo        enddo
995          
996  cph(  cph(
997        print *, 'ph-wet 1: nvarlength = ', nvarlength        print *, 'ph-wet 1: nvarlength = ', nvarlength
998        print *, 'ph-wet 2: surface wet C = ', nwetctile(1,1,1)        print *, 'ph-wet 2: surface wet C = ', nwetctile(1,1,1)
999        print *, 'ph-wet 3: surface wet W = ', nwetwtile(1,1,1)        print *, 'ph-wet 3: surface wet W = ', nwetwtile(1,1,1)
1000        print *, 'ph-wet 4: surface wet S = ', nwetstile(1,1,1)        print *, 'ph-wet 4: surface wet S = ', nwetstile(1,1,1)
1001          print *, 'ph-wet 4a:surface wet V = ', nwetvtile(1,1,1)
1002        nwetc3d = 0        nwetc3d = 0
1003        do k = 1, Nr        do k = 1, Nr
1004           nwetc3d = nwetc3d + nwetctile(1,1,k)           nwetc3d = nwetc3d + nwetctile(1,1,k)
1005        end do        end do
1006        print *, 'ph-wet 5: 3D center wet points = ', nwetc3d        print *, 'ph-wet 5: 3D wet points = ', nwetc3d
1007        do i = 1, 6        do i = 1, maxcvars
1008           print *, 'ph-wet 6: no recs for i = ', i, ncvarrecs(i)           print *, 'ph-wet 6: no recs for i = ', i, ncvarrecs(i)
1009        end do        end do
1010        print *, 'ph-wet 7: ',        print *, 'ph-wet 7: ',
1011       &     2*nwetc3d +       &     2*nwetc3d +
1012       &     ncvarrecs(3)*nwetctile(1,1,1) +       &     ncvarrecs(3)*nwetctile(1,1,1) +
1013       &     ncvarrecs(4)*nwetctile(1,1,1) +       &     ncvarrecs(4)*nwetctile(1,1,1) +
1014       &     ncvarrecs(5)*nwetwtile(1,1,1) +       &     ncvarrecs(5)*nwetwtile(1,1,1) +
1015       &     ncvarrecs(6)*nwetstile(1,1,1)       &     ncvarrecs(6)*nwetstile(1,1,1)
1016          print *, 'ph-wet 8: ',
1017         &     2*nwetc3d +
1018         &     ncvarrecs(7)*nwetctile(1,1,1) +
1019         &     ncvarrecs(8)*nwetctile(1,1,1) +
1020         &     ncvarrecs(9)*nwetwtile(1,1,1) +
1021         &     ncvarrecs(10)*nwetstile(1,1,1)
1022    #ifdef ALLOW_OBCSN_CONTROL
1023          print *, 'ph-wet 9: surface wet obcsn = '
1024         &     , nwetobcsn(1,1,1,1), nwetobcsn(1,1,1,2)
1025         &     , nwetobcsn(1,1,1,3), nwetobcsn(1,1,1,4)
1026    #endif
1027    #ifdef ALLOW_OBCSS_CONTROL
1028          print *, 'ph-wet 10: surface wet obcss = '
1029         &     , nwetobcss(1,1,1,1), nwetobcss(1,1,1,2)
1030         &     , nwetobcss(1,1,1,3), nwetobcss(1,1,1,4)
1031    #endif
1032    #ifdef ALLOW_OBCSW_CONTROL
1033          print *, 'ph-wet 11: surface wet obcsw = '
1034         &     , nwetobcsw(1,1,1,1), nwetobcsw(1,1,1,2)
1035         &     , nwetobcsw(1,1,1,3), nwetobcsw(1,1,1,4)
1036    #endif
1037    #ifdef ALLOW_OBCSE_CONTROL
1038          print *, 'ph-wet 12: surface wet obcse = '
1039         &     , nwetobcse(1,1,1,1), nwetobcse(1,1,1,2)
1040         &     , nwetobcse(1,1,1,3), nwetobcse(1,1,1,4)
1041    #endif
1042  cph)  cph)
1043          
1044          CALL GLOBAL_SUM_INT( nvarlength,  myThid )
1045    
1046          print *, 'ph-wet 13: global nvarlength vor k=', k, nvarlength
1047    
1048  c  c
1049  c     Summation of wet point counters  c     Summation of wet point counters
1050  c  c
1051        do k = 1, Nr        do k = 1, nr
1052           CALL GLOBAL_SUM_INT( nvarlength,  myThid )  
1053           ntmp=0           ntmp=0
1054           do bj=1,nSy           do bj=1,nSy
1055              do bi=1,nSx              do bi=1,nSx
# Line 437  c Line 1057  c
1057              enddo              enddo
1058           enddo           enddo
1059           CALL GLOBAL_SUM_INT( ntmp,  myThid )           CALL GLOBAL_SUM_INT( ntmp,  myThid )
1060           nWetcTile(1,1,k)=ntmp           nWetcGlobal(k)=ntmp
1061    
1062             print *, 'ph-wet 14a: global nWet... vor k=', k, ntmp
1063    
1064           ntmp=0           ntmp=0
1065           do bj=1,nSy           do bj=1,nSy
1066              do bi=1,nSx              do bi=1,nSx
# Line 445  c Line 1068  c
1068              enddo              enddo
1069           enddo           enddo
1070           CALL GLOBAL_SUM_INT( ntmp,  myThid )           CALL GLOBAL_SUM_INT( ntmp,  myThid )
1071           nWetsTile(1,1,k)=ntmp           nWetsGlobal(k)=ntmp
1072    
1073             print *, 'ph-wet 14b: global nWet... vor k=', k, ntmp
1074    
1075           ntmp=0           ntmp=0
1076           do bj=1,nSy           do bj=1,nSy
1077              do bi=1,nSx              do bi=1,nSx
# Line 453  c Line 1079  c
1079              enddo              enddo
1080           enddo           enddo
1081           CALL GLOBAL_SUM_INT( ntmp,  myThid )           CALL GLOBAL_SUM_INT( ntmp,  myThid )
1082           nWetwTile(1,1,k)=ntmp           nWetwGlobal(k)=ntmp
1083    
1084             print *, 'ph-wet 14c: global nWet... vor k=', k, ntmp
1085    
1086             ntmp=0
1087             do bj=1,nSy
1088                do bi=1,nSx
1089                   ntmp=ntmp+nWetvTile(bi,bj,k)
1090                enddo
1091             enddo
1092             CALL GLOBAL_SUM_INT( ntmp,  myThid )
1093             nWetvGlobal(k)=ntmp
1094    
1095             print *, 'ph-wet 14d: global nWet... vor k=', k, ntmp
1096    
1097    #ifdef ALLOW_OBCSN_CONTROL
1098             do iobcs = 1, nobcs
1099                ntmp=0
1100                do bj=1,nSy
1101                   do bi=1,nSx
1102                      ntmp=ntmp+nwetobcsn(bi,bj,k,iobcs)
1103                   enddo
1104                enddo
1105                CALL GLOBAL_SUM_INT( ntmp,  myThid )
1106                nwetobcsnglo(k,iobcs)=ntmp
1107             enddo
1108    #endif
1109    #ifdef ALLOW_OBCSS_CONTROL
1110             do iobcs = 1, nobcs
1111                ntmp=0
1112                do bj=1,nSy
1113                   do bi=1,nSx
1114                      ntmp=ntmp+nwetobcss(bi,bj,k,iobcs)
1115                   enddo
1116                enddo
1117                CALL GLOBAL_SUM_INT( ntmp,  myThid )
1118                nwetobcssglo(k,iobcs)=ntmp
1119             enddo
1120    #endif
1121    #ifdef ALLOW_OBCSW_CONTROL
1122             do iobcs = 1, nobcs
1123                ntmp=0
1124                do bj=1,nSy
1125                   do bi=1,nSx
1126                      ntmp=ntmp+nwetobcsw(bi,bj,k,iobcs)
1127                   enddo
1128                enddo
1129                CALL GLOBAL_SUM_INT( ntmp,  myThid )
1130                nwetobcswglo(k,iobcs)=ntmp
1131             enddo
1132    #endif
1133    #ifdef ALLOW_OBCSE_CONTROL
1134             do iobcs = 1, nobcs
1135                ntmp=0
1136                do bj=1,nSy
1137                   do bi=1,nSx
1138                      ntmp=ntmp+nwetobcse(bi,bj,k,iobcs)
1139                   enddo
1140                enddo
1141                CALL GLOBAL_SUM_INT( ntmp,  myThid )
1142                nwetobcseglo(k,iobcs)=ntmp
1143             enddo
1144    #endif
1145    
1146        enddo        enddo
1147    
1148        print*, 'ctrl_init: no. of control variables: ', nvartype        print*, 'ctrl_init: no. of control variables: ', nvartype
1149        print*, 'ctrl_init: control vector length:    ', nvarlength        print*, 'ctrl_init: control vector length:    ', nvarlength
1150        _END_MASTER( mythid )        _END_MASTER( mythid )
1151    
1152    c     write masks and weights to files to be read by a master process
1153    c
1154          call active_write_xyz( 'hFacC', hFacC,   1, 0, mythid, dummy)
1155          call active_write_xyz( 'maskW', maskW,   1, 0, mythid, dummy)
1156          call active_write_xyz( 'maskS', maskS,   1, 0, mythid, dummy)
1157    #if (defined (ALLOW_EFLUXP0_CONTROL))
1158          call active_write_xyz( 'hFacV', hFacV,   1, 0, mythid, dummy)
1159    #endif
1160    
1161    c--   Summarize the control vector's setup.
1162          _BEGIN_MASTER( mythid )
1163    cph        call ctrl_Summary( mythid )
1164          _END_MASTER( mythid )
1165    
1166        _BARRIER        _BARRIER
1167    
1168        return        return

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.22