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

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

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


Revision 1.6 - (hide annotations) (download)
Fri Nov 29 13:38:37 2002 UTC (21 years, 6 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint47e_post, checkpoint47c_post, checkpoint48e_post, checkpoint48i_post, checkpoint48b_post, checkpoint48c_pre, checkpoint47d_pre, checkpoint48d_pre, checkpoint47i_post, checkpoint47d_post, checkpoint48d_post, checkpoint48f_post, checkpoint48h_post, checkpoint47g_post, checkpoint48a_post, checkpoint47j_post, branch-exfmods-tag, checkpoint48c_post, checkpoint47b_post, checkpoint47f_post, checkpoint48, checkpoint49, checkpoint48g_post, checkpoint47h_post
Branch point for: branch-exfmods-curt
Changes since 1.5: +107 -3 lines
Controls of sst, sss, hfacc, bottomdrag.
(no ice climbing).

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

  ViewVC Help
Powered by ViewVC 1.1.22