/[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.8 by heimbach, Mon Jun 23 22:29:05 2003 UTC revision 1.9 by heimbach, Tue Jun 24 16:07:06 2003 UTC
# Line 37  c              - Added call to ctrl_pack Line 37  c              - Added call to ctrl_pack
37  c              - Alternatively: transfer writing of scale files to  c              - Alternatively: transfer writing of scale files to
38  c                ctrl_unpack  c                ctrl_unpack
39  c  c
40    c              Dimitris Menemenlis menemenlis@mit.edu 7-Mar-2003
41    c              - To be consistent with usage in ctrl_getrec.F,
42    c                startrec and endrec need to be referenced to
43    c                model time = 0, not to startTime.
44    c                Also "- modelstep" -> "+ modelstep/2":
45    c old:      startrec = int((modelstart - diffsecs)/
46    c old:   &                 xx_???period) + 1
47    c old:      endrec = int((modelend   - diffsecs - modelstep)/
48    c old:   &                 xx_???period) + 2
49    c new:      startrec = int((modelstart + startTime - diffsecs)/
50    c new:   &                 xx_???period) + 1
51    c new:      endrec = int((modelend + startTime - diffsecs + modelstep/2)/
52    c new:   &                 xx_???period) + 2
53    c
54  c     ==================================================================  c     ==================================================================
55  c     SUBROUTINE ctrl_init  c     SUBROUTINE ctrl_init
56  c     ==================================================================  c     ==================================================================
# Line 52  c     == global variables == Line 66  c     == global variables ==
66  #include "ctrl.h"  #include "ctrl.h"
67    
68  #ifdef ALLOW_CALENDAR  #ifdef ALLOW_CALENDAR
69  #include "cal.h"  # include "cal.h"
70  #endif  #endif
71  #ifdef ALLOW_OBCS_CONTROL  #ifdef ALLOW_OBCS_CONTROL
72  # include "OBCS.h"  # include "OBCS.h"
73  #endif  #endif
74  #ifdef ALLOW_ECCO_OPTIMIZATION  #ifdef ALLOW_ECCO_OPTIMIZATION
75  #include "optim.h"  # include "optim.h"
76  #endif  #endif
77    
78  c     == routine arguments ==  c     == routine arguments ==
# Line 98  c     == external == Line 112  c     == external ==
112    
113  c     == end of interface ==  c     == end of interface ==
114    
115    c--   Set loop ranges.
116        jtlo = mybylo(mythid)        jtlo = mybylo(mythid)
117        jthi = mybyhi(mythid)        jthi = mybyhi(mythid)
118        itlo = mybxlo(mythid)        itlo = mybxlo(mythid)
119        ithi = mybxhi(mythid)        ithi = mybxhi(mythid)
120        jmin = 1-oly        jmin = 1
121        jmax = sny+oly        jmax = sny
122        imin = 1-olx        imin = 1
123        imax = snx+olx        imax = snx
124    
125    
126        _BEGIN_MASTER( myThid )        _BEGIN_MASTER( myThid )
127    
128    #ifdef ALLOW_CALENDAR
129    
130    c--     Get the complete dates of the control variables.
131    #if     (defined  (ALLOW_HFLUX_CONTROL))
132    c--     The heat flux contribution.
133            call cal_FullDate( xx_hfluxstartdate1, xx_hfluxstartdate2,
134         &                     xx_hfluxstartdate , mythid )
135    #elif   (defined  (ALLOW_ATEMP_CONTROL))
136    c--     Atmos. temperature contribution.
137            call cal_FullDate( xx_atempstartdate1, xx_atempstartdate2,
138         &                     xx_atempstartdate , mythid )
139    #endif
140    
141    #if     (defined  (ALLOW_SFLUX_CONTROL))
142    c--     The salt flux contribution.
143            call cal_FullDate( xx_sfluxstartdate1, xx_sfluxstartdate2,
144         &                     xx_sfluxstartdate , mythid )
145    #elif   (defined  (ALLOW_AQH_CONTROL))
146    c--     Atmospheric humidity contribution.
147            call cal_FullDate( xx_aqhstartdate1, xx_aqhstartdate2,
148         &                     xx_aqhstartdate , mythid )
149    #endif
150    
151    #if     (defined  (ALLOW_USTRESS_CONTROL))
152    c--     The zonal wind stress contribution.
153            call cal_FullDate( xx_tauustartdate1,  xx_tauustartdate2,
154         &                     xx_tauustartdate,   mythid )
155    #elif   (defined  (ALLOW_UWIND_CONTROL))
156    c--     Zonal wind speed contribution.
157            call cal_FullDate( xx_uwindstartdate1, xx_uwindstartdate2,
158         &                     xx_uwindstartdate , mythid )
159    #endif
160    
161    #if     (defined  (ALLOW_VSTRESS_CONTROL))
162    c--     The merid. wind stress contribution.
163            call cal_FullDate( xx_tauvstartdate1,  xx_tauvstartdate2,
164         &                     xx_tauvstartdate,   mythid )
165    #elif   (defined  (ALLOW_VWIND_CONTROL))
166    c--     Merid. wind speed contribution.
167            call cal_FullDate( xx_vwindstartdate1, xx_vwindstartdate2,
168         &                     xx_vwindstartdate , mythid )
169    #endif
170    
171    #ifdef ALLOW_OBCS_CONTROL
172            call cal_FullDate( xx_obcsnstartdate1,  xx_obcsnstartdate2,
173         &                     xx_obcsnstartdate,   mythid )
174            call cal_FullDate( xx_obcssstartdate1,  xx_obcssstartdate2,
175         &                     xx_obcssstartdate,   mythid )
176            call cal_FullDate( xx_obcswstartdate1,  xx_obcswstartdate2,
177         &                     xx_obcswstartdate,   mythid )
178            call cal_FullDate( xx_obcsestartdate1,  xx_obcsestartdate2,
179         &                     xx_obcsestartdate,   mythid )
180    #endif
181    
182    #endif /* ALLOW_CALENDAR */
183    
184  c--     Set default values.  c--     Set default values.
185          do ivarindex = 1,maxcvars          do ivarindex = 1,maxcvars
186            ncvarindex(ivarindex) = -1            ncvarindex(ivarindex) = -1
# Line 157  cph    index 21-22          for efluxy, Line 229  cph    index 21-22          for efluxy,
229  cph    index 23-24          for bottom drag  cph    index 23-24          for bottom drag
230  cph)  cph)
231    
232  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
233  c--  c--
234  #ifdef ALLOW_THETA0_CONTROL  #ifdef ALLOW_THETA0_CONTROL
235  c--   Initial state temperature contribution.  c--   Initial state temperature contribution.
# Line 174  c--   Initial state temperature contribu Line 246  c--   Initial state temperature contribu
246    
247  #endif /* ALLOW_THETA0_CONTROL */  #endif /* ALLOW_THETA0_CONTROL */
248    
249  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
250  c--  c--
251  #ifdef ALLOW_SALT0_CONTROL  #ifdef ALLOW_SALT0_CONTROL
252  c--   Initial state salinity contribution.  c--   Initial state salinity contribution.
# Line 195  c--   =========================== Line 267  c--   ===========================
267  c--   Surface flux contributions.  c--   Surface flux contributions.
268  c--   ===========================  c--   ===========================
269    
270  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
271  c--  c--
272  #if (defined (ALLOW_HFLUX_CONTROL))  #if (defined (ALLOW_HFLUX_CONTROL))
273  c--   Heat flux.  c--   Heat flux.
# Line 205  c--   Heat flux. Line 277  c--   Heat flux.
277          call cal_TimePassed( xx_hfluxstartdate, modelstartdate,          call cal_TimePassed( xx_hfluxstartdate, modelstartdate,
278       &                       difftime, mythid )       &                       difftime, mythid )
279          call cal_ToSeconds ( difftime, diffsecs, mythid )          call cal_ToSeconds ( difftime, diffsecs, mythid )
280          startrec = int((modelstart - diffsecs)/          startrec = int((modelstart + startTime - diffsecs)/
281       &                 xx_hfluxperiod) + 1       &                 xx_hfluxperiod) + 1
282          endrec   = int((modelend   - diffsecs - modelstep)/          endrec   = int((modelend + startTime - diffsecs + modelstep/2)/
283       &                 xx_hfluxperiod) + 2       &                 xx_hfluxperiod) + 2
284  #else  #else
285          startrec = 1          startrec = 1
# Line 232  c--   Atmos. temperature Line 304  c--   Atmos. temperature
304          call cal_TimePassed( xx_atempstartdate, modelstartdate,          call cal_TimePassed( xx_atempstartdate, modelstartdate,
305       &                       difftime, mythid )       &                       difftime, mythid )
306          call cal_ToSeconds ( difftime, diffsecs, mythid )          call cal_ToSeconds ( difftime, diffsecs, mythid )
307          startrec = int((modelstart - diffsecs)/          startrec = int((modelstart + startTime - diffsecs)/
308       &                 xx_atempperiod) + 1       &                 xx_atempperiod) + 1
309          endrec   = int((modelend   - diffsecs - modelstep)/          endrec   = int((modelend + startTime - diffsecs + modelstep/2)/
310       &                 xx_atempperiod) + 2       &                 xx_atempperiod) + 2
311  #else  #else
312          startrec = 1          startrec = 1
# Line 264  c--   initial forcing only Line 336  c--   initial forcing only
336    
337  #endif /* ALLOW_HFLUX_CONTROL */  #endif /* ALLOW_HFLUX_CONTROL */
338    
339  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
340  c--  c--
341  #if (defined (ALLOW_SFLUX_CONTROL))  #if (defined (ALLOW_SFLUX_CONTROL))
342  c--   Salt flux.  c--   Salt flux.
# Line 274  c--   Salt flux. Line 346  c--   Salt flux.
346          call cal_TimePassed( xx_sfluxstartdate, modelstartdate,          call cal_TimePassed( xx_sfluxstartdate, modelstartdate,
347       &                       difftime, mythid )       &                       difftime, mythid )
348          call cal_ToSeconds ( difftime, diffsecs, mythid )          call cal_ToSeconds ( difftime, diffsecs, mythid )
349          startrec = int((modelstart - diffsecs)/          startrec = int((modelstart + startTime - diffsecs)/
350       &                 xx_sfluxperiod) + 1       &                 xx_sfluxperiod) + 1
351          endrec   = int((modelend   - diffsecs - modelstep)/          endrec   = int((modelend + startTime - diffsecs + modelstep/2)/
352       &                 xx_sfluxperiod) + 2       &                 xx_sfluxperiod) + 2
353  #else  #else
354          startrec = 1          startrec = 1
# Line 301  c--   Atmos. humidity Line 373  c--   Atmos. humidity
373          call cal_TimePassed( xx_aqhstartdate, modelstartdate,          call cal_TimePassed( xx_aqhstartdate, modelstartdate,
374       &                       difftime, mythid )       &                       difftime, mythid )
375          call cal_ToSeconds ( difftime, diffsecs, mythid )          call cal_ToSeconds ( difftime, diffsecs, mythid )
376          startrec = int((modelstart - diffsecs)/          startrec = int((modelstart + startTime - diffsecs)/
377       &                 xx_aqhperiod) + 1       &                 xx_aqhperiod) + 1
378          endrec   = int((modelend   - diffsecs - modelstep)/          endrec   = int((modelend + startTime - diffsecs + modelstep/2)/
379       &                 xx_aqhperiod) + 2       &                 xx_aqhperiod) + 2
380  #else  #else
381          startrec = 1          startrec = 1
# Line 333  c--   initial forcing only Line 405  c--   initial forcing only
405    
406  #endif /* ALLOW_SFLUX_CONTROL */  #endif /* ALLOW_SFLUX_CONTROL */
407    
408  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
409  c--  c--
410  #if (defined (ALLOW_USTRESS_CONTROL))  #if (defined (ALLOW_USTRESS_CONTROL))
411  c--   Zonal wind stress.  c--   Zonal wind stress.
# Line 343  c--   Zonal wind stress. Line 415  c--   Zonal wind stress.
415          call cal_TimePassed( xx_tauustartdate, modelstartdate,          call cal_TimePassed( xx_tauustartdate, modelstartdate,
416       &                       difftime, mythid )       &                       difftime, mythid )
417          call cal_ToSeconds ( difftime, diffsecs, mythid )          call cal_ToSeconds ( difftime, diffsecs, mythid )
418          startrec = int((modelstart - diffsecs)/          startrec = int((modelstart + startTime - diffsecs)/
419       &                 xx_tauuperiod) + 1       &                 xx_tauuperiod) + 1
420          endrec   = int((modelend   - diffsecs - modelstep)/          endrec   = int((modelend + startTime - diffsecs + modelstep/2)/
421       &                 xx_tauuperiod) + 2       &                 xx_tauuperiod) + 2
422  #else  #else
423          startrec = 1          startrec = 1
# Line 370  c--   Zonal wind speed. Line 442  c--   Zonal wind speed.
442          call cal_TimePassed( xx_uwindstartdate, modelstartdate,          call cal_TimePassed( xx_uwindstartdate, modelstartdate,
443       &                       difftime, mythid )       &                       difftime, mythid )
444          call cal_ToSeconds ( difftime, diffsecs, mythid )          call cal_ToSeconds ( difftime, diffsecs, mythid )
445          startrec = int((modelstart - diffsecs)/          startrec = int((modelstart + startTime - diffsecs)/
446       &                 xx_uwindperiod) + 1       &                 xx_uwindperiod) + 1
447          endrec   = int((modelend   - diffsecs - modelstep)/          endrec   = int((modelend + startTime - diffsecs + modelstep/2)/
448       &                 xx_uwindperiod) + 2       &                 xx_uwindperiod) + 2
449  #else  #else
450          startrec = 1          startrec = 1
# Line 402  c--   initial forcing only Line 474  c--   initial forcing only
474    
475  #endif /* ALLOW_USTRESS_CONTROL */  #endif /* ALLOW_USTRESS_CONTROL */
476    
477  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
478  c--  c--
479  #if (defined (ALLOW_VSTRESS_CONTROL))  #if (defined (ALLOW_VSTRESS_CONTROL))
480  c--   Meridional wind stress.  c--   Meridional wind stress.
# Line 412  c--   Meridional wind stress. Line 484  c--   Meridional wind stress.
484          call cal_TimePassed( xx_tauvstartdate, modelstartdate,          call cal_TimePassed( xx_tauvstartdate, modelstartdate,
485       &                       difftime, mythid )       &                       difftime, mythid )
486          call cal_ToSeconds ( difftime, diffsecs, mythid )          call cal_ToSeconds ( difftime, diffsecs, mythid )
487          startrec = int((modelstart - diffsecs)/          startrec = int((modelstart + startTime - diffsecs)/
488       &                 xx_tauvperiod) + 1       &                 xx_tauvperiod) + 1
489          endrec   = int((modelend   - diffsecs - modelstep)/          endrec   = int((modelend + startTime - diffsecs + modelstep/2)/
490       &                 xx_tauvperiod) + 2       &                 xx_tauvperiod) + 2
491  #else  #else
492          startrec = 1          startrec = 1
# Line 439  c--   Meridional wind speed. Line 511  c--   Meridional wind speed.
511          call cal_TimePassed( xx_vwindstartdate, modelstartdate,          call cal_TimePassed( xx_vwindstartdate, modelstartdate,
512       &                       difftime, mythid )       &                       difftime, mythid )
513          call cal_ToSeconds ( difftime, diffsecs, mythid )          call cal_ToSeconds ( difftime, diffsecs, mythid )
514          startrec = int((modelstart - diffsecs)/          startrec = int((modelstart + startTime - diffsecs)/
515       &                 xx_vwindperiod) + 1       &                 xx_vwindperiod) + 1
516          endrec   = int((modelend   - diffsecs - modelstep)/          endrec   = int((modelend + startTime - diffsecs + modelstep/2)/
517       &                 xx_vwindperiod) + 2       &                 xx_vwindperiod) + 2
518  #else  #else
519          startrec = 1          startrec = 1
# Line 471  c--   initial forcing only Line 543  c--   initial forcing only
543    
544  #endif /* ALLOW_VSTRESS_CONTROL */  #endif /* ALLOW_VSTRESS_CONTROL */
545    
546  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
547  c--  c--
548  #ifdef ALLOW_OBCSN_CONTROL  #ifdef ALLOW_OBCSN_CONTROL
549  c--   Northern obc.  c--   Northern obc.
# Line 481  c--   Northern obc. Line 553  c--   Northern obc.
553          call cal_TimePassed( xx_obcsnstartdate, modelstartdate,          call cal_TimePassed( xx_obcsnstartdate, modelstartdate,
554       &                       difftime, mythid )       &                       difftime, mythid )
555          call cal_ToSeconds ( difftime, diffsecs, mythid )          call cal_ToSeconds ( difftime, diffsecs, mythid )
556          startrec = int((modelstart - diffsecs)/  cgg   O.B. future values are needed at the last timestep, so lets
557       &                 xx_obcsnperiod) + 1  cgg   take this into account.
558          endrec   = int((modelend   - diffsecs)/          startrec = int((modelstart - diffsecs)/xx_obcsnperiod) + 1
559       &                 xx_obcsnperiod) + 2          endrec   = int((modelend   - diffsecs)/xx_obcsnperiod) + 2
560  #else  #else
561          startrec = 1          startrec = 1
562          endrec   = 1          endrec   = 1
563  #endif  #endif
564          ivarindex                = 11          ivarindex                = 11
565          ncvarindex(ivarindex)    = 111          ncvarindex(ivarindex)    = 111
566    cgg( Implement heimbach fix for nobcs.
567          ncvarrecs(ivarindex)     = (endrec - startrec + 1)*nobcs          ncvarrecs(ivarindex)     = (endrec - startrec + 1)*nobcs
568          ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1          ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1
569          ncvarrecsend(ivarindex)  = endrec*nobcs          ncvarrecsend(ivarindex)  = endrec*nobcs
570    cgg)
571          ncvarxmax(ivarindex)     = snx          ncvarxmax(ivarindex)     = snx
572          ncvarymax(ivarindex)     =   1          ncvarymax(ivarindex)     =   1
573          ncvarnrmax(ivarindex)    =  nr          ncvarnrmax(ivarindex)    =  nr
# Line 505  c--   Northern obc. Line 579  c--   Northern obc.
579  #ifdef ALLOW_OBCSS_CONTROL  #ifdef ALLOW_OBCSS_CONTROL
580  c--   Southern obc.  c--   Southern obc.
581    
582  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
583  c--  c--
584        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
585  #ifdef ALLOW_CALENDAR  #ifdef ALLOW_CALENDAR
586          call cal_TimePassed( xx_obcssstartdate, modelstartdate,          call cal_TimePassed( xx_obcssstartdate, modelstartdate,
587       &                       difftime, mythid )       &                       difftime, mythid )
588          call cal_ToSeconds ( difftime, diffsecs, mythid )          call cal_ToSeconds ( difftime, diffsecs, mythid )
589          startrec = int((modelstart - diffsecs)/  cgg   O.B. future values are needed at the last timestep, so lets
590       &                 xx_obcssperiod) + 1  cgg   take this into account.
591          endrec   = int((modelend   - diffsecs)/          startrec = int((modelstart - diffsecs)/xx_obcssperiod) + 1
592       &                 xx_obcssperiod) + 2          endrec   = int((modelend   - diffsecs)/xx_obcssperiod) + 2
593  #else  #else
594          startrec = 1          startrec = 1
595          endrec   = 1          endrec   = 1
596  #endif  #endif
597          ivarindex                = 12          ivarindex                = 12
598          ncvarindex(ivarindex)    = 112          ncvarindex(ivarindex)    = 112
599    cgg( Implement heimbach fix for nobcs.
600          ncvarrecs(ivarindex)     = (endrec - startrec + 1)*nobcs          ncvarrecs(ivarindex)     = (endrec - startrec + 1)*nobcs
601          ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1          ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1
602          ncvarrecsend(ivarindex)  = endrec*nobcs          ncvarrecsend(ivarindex)  = endrec*nobcs
603    cph)
604          ncvarxmax(ivarindex)     = snx          ncvarxmax(ivarindex)     = snx
605          ncvarymax(ivarindex)     =   1          ncvarymax(ivarindex)     =   1
606          ncvarnrmax(ivarindex)    =  nr          ncvarnrmax(ivarindex)    =  nr
# Line 533  c-- Line 609  c--
609    
610  #endif /* ALLOW_OBCSS_CONTROL */  #endif /* ALLOW_OBCSS_CONTROL */
611    
612  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
613  c--  c--
614  #ifdef ALLOW_OBCSW_CONTROL  #ifdef ALLOW_OBCSW_CONTROL
615  c--   Western obc.  c--   Western obc.
# Line 543  c--   Western obc. Line 619  c--   Western obc.
619          call cal_TimePassed( xx_obcswstartdate, modelstartdate,          call cal_TimePassed( xx_obcswstartdate, modelstartdate,
620       &                       difftime, mythid )       &                       difftime, mythid )
621          call cal_ToSeconds ( difftime, diffsecs, mythid )          call cal_ToSeconds ( difftime, diffsecs, mythid )
622          startrec = int((modelstart - diffsecs)/          startrec = int((modelstart - diffsecs)/xx_obcswperiod) + 1
623       &                 xx_obcswperiod) + 1          endrec   = int((modelend   - diffsecs)/xx_obcswperiod) + 2
         endrec   = int((modelend   - diffsecs)/  
      &                 xx_obcswperiod) + 2  
624  #else  #else
625          startrec = 1          startrec = 1
626          endrec   = 1          endrec   = 1
627  #endif  #endif
628          ivarindex                = 13          ivarindex                = 13
629          ncvarindex(ivarindex)    = 113          ncvarindex(ivarindex)    = 113
630    cgg( Implement heimbach fix for nobcs.
631          ncvarrecs(ivarindex)     = (endrec - startrec + 1)*nobcs          ncvarrecs(ivarindex)     = (endrec - startrec + 1)*nobcs
632          ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1          ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1
633          ncvarrecsend(ivarindex)  = endrec*nobcs          ncvarrecsend(ivarindex)  = endrec*nobcs
634    cgg)
635          ncvarxmax(ivarindex)     =   1          ncvarxmax(ivarindex)     =   1
636          ncvarymax(ivarindex)     = sny          ncvarymax(ivarindex)     = sny
637          ncvarnrmax(ivarindex)    =  nr          ncvarnrmax(ivarindex)    =  nr
# Line 564  c--   Western obc. Line 640  c--   Western obc.
640    
641  #endif /* ALLOW_OBCSW_CONTROL */  #endif /* ALLOW_OBCSW_CONTROL */
642    
643  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
644  c--  c--
645  #ifdef ALLOW_OBCSE_CONTROL  #ifdef ALLOW_OBCSE_CONTROL
646  c--   Eastern obc.  c--   Eastern obc.
# Line 574  c--   Eastern obc. Line 650  c--   Eastern obc.
650          call cal_TimePassed( xx_obcsestartdate, modelstartdate,          call cal_TimePassed( xx_obcsestartdate, modelstartdate,
651       &                       difftime, mythid )       &                       difftime, mythid )
652          call cal_ToSeconds ( difftime, diffsecs, mythid )          call cal_ToSeconds ( difftime, diffsecs, mythid )
653          startrec = int((modelstart - diffsecs)/          startrec = int((modelstart - diffsecs)/xx_obcseperiod) + 1
654       &                 xx_obcseperiod) + 1          endrec   = int((modelend   - diffsecs)/xx_obcseperiod) + 2
         endrec   = int((modelend   - diffsecs)/  
      &                 xx_obcseperiod) + 2  
655  #else  #else
656          startrec = 1          startrec = 1
657          endrec   = 1          endrec   = 1
658  #endif  #endif
659          ivarindex                = 14          ivarindex                = 14
660          ncvarindex(ivarindex)    = 114          ncvarindex(ivarindex)    = 114
661    cgg( Implement heimbach fix for nobcs.
662          ncvarrecs(ivarindex)     = (endrec - startrec + 1)*nobcs          ncvarrecs(ivarindex)     = (endrec - startrec + 1)*nobcs
663          ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1          ncvarrecstart(ivarindex) = (startrec - 1)*nobcs + 1
664          ncvarrecsend(ivarindex)  = endrec*nobcs          ncvarrecsend(ivarindex)  = endrec*nobcs
665    cgg)
666          ncvarxmax(ivarindex)     =   1          ncvarxmax(ivarindex)     =   1
667          ncvarymax(ivarindex)     = sny          ncvarymax(ivarindex)     = sny
668          ncvarnrmax(ivarindex)    =  nr          ncvarnrmax(ivarindex)    =  nr
# Line 595  c--   Eastern obc. Line 671  c--   Eastern obc.
671    
672  #endif /* ALLOW_OBCSE_CONTROL */  #endif /* ALLOW_OBCSE_CONTROL */
673    
674  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
675  c--  c--
676  #ifdef ALLOW_DIFFKR_CONTROL  #ifdef ALLOW_DIFFKR_CONTROL
677        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
# Line 609  c-- Line 685  c--
685        _END_MASTER( mythid )        _END_MASTER( mythid )
686  #endif /* ALLOW_DIFFKR_CONTROL */  #endif /* ALLOW_DIFFKR_CONTROL */
687    
688  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
689  c--  c--
690  #ifdef ALLOW_KAPGM_CONTROL  #ifdef ALLOW_KAPGM_CONTROL
691        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
# Line 623  c-- Line 699  c--
699        _END_MASTER( mythid )        _END_MASTER( mythid )
700  #endif /* ALLOW_KAPGM_CONTROL */  #endif /* ALLOW_KAPGM_CONTROL */
701    
702  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
703  c--  c--
704  #ifdef ALLOW_TR10_CONTROL  #ifdef ALLOW_TR10_CONTROL
705        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
# Line 637  c-- Line 713  c--
713        _END_MASTER( mythid )        _END_MASTER( mythid )
714  #endif /* ALLOW_TR10_CONTROL */  #endif /* ALLOW_TR10_CONTROL */
715    
716  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
717  c--  c--
718  #ifdef ALLOW_SST0_CONTROL  #ifdef ALLOW_SST0_CONTROL
719        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
# Line 651  c-- Line 727  c--
727        _END_MASTER( mythid )        _END_MASTER( mythid )
728  #endif /* ALLOW_SST0_CONTROL */  #endif /* ALLOW_SST0_CONTROL */
729    
730  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
731  c--  c--
732  #ifdef ALLOW_SSS0_CONTROL  #ifdef ALLOW_SSS0_CONTROL
733        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
# Line 665  c-- Line 741  c--
741        _END_MASTER( mythid )        _END_MASTER( mythid )
742  #endif /* ALLOW_SSS0_CONTROL */  #endif /* ALLOW_SSS0_CONTROL */
743    
744  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
745  c--  c--
746  #ifdef ALLOW_HFACC_CONTROL  #ifdef ALLOW_HFACC_CONTROL
747        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
# Line 683  c-- Line 759  c--
759        _END_MASTER( mythid )        _END_MASTER( mythid )
760  #endif /* ALLOW_HFACC_CONTROL */  #endif /* ALLOW_HFACC_CONTROL */
761    
762  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
763  c--  c--
764  #ifdef ALLOW_EFLUXY0_CONTROL  #ifdef ALLOW_EFLUXY0_CONTROL
765        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
# Line 697  c-- Line 773  c--
773        _END_MASTER( mythid )        _END_MASTER( mythid )
774  #endif /* ALLOW_EFLUXY0_CONTROL */  #endif /* ALLOW_EFLUXY0_CONTROL */
775    
776  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
777  c--  c--
778  #ifdef ALLOW_EFLUXP0_CONTROL  #ifdef ALLOW_EFLUXP0_CONTROL
779        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
# Line 711  c-- Line 787  c--
787        _END_MASTER( mythid )        _END_MASTER( mythid )
788  #endif /* ALLOW_EFLUXP0_CONTROL */  #endif /* ALLOW_EFLUXP0_CONTROL */
789    
790  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
791  c--  c--
792  #ifdef ALLOW_BOTTOMDRAG_CONTROL  #ifdef ALLOW_BOTTOMDRAG_CONTROL
793        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
# Line 725  c-- Line 801  c--
801        _END_MASTER( mythid )        _END_MASTER( mythid )
802  #endif /* ALLOW_BOTTOMDRAG_CONTROL */  #endif /* ALLOW_BOTTOMDRAG_CONTROL */
803    
804  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
805  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
806  c-------------------------------------------------------------------------------------------  c-------------------------------------------------------------------------------
807    
808  c--   Determine the number of wet points in each tile:  c--   Determine the number of wet points in each tile:
809  c--   maskc, masks, and maskw.  c--   maskc, masks, and maskw.
810    
 c--   Set loop ranges.  
       jmin = 1  
       jmax = sny  
       imin = 1  
       imax = snx  
   
811  c--   Initialise the counters.  c--   Initialise the counters.
812        do bj = jtlo,jthi        do bj = jtlo,jthi
813          do bi = itlo,ithi          do bi = itlo,ithi
# Line 808  c--             Vertical mask. Line 878  c--             Vertical mask.
878  c--   Count wet points at Northern boundary.  c--   Count wet points at Northern boundary.
879  c--   mask conventions are adopted from obcs_apply_ts, obcs_apply_uv  c--   mask conventions are adopted from obcs_apply_ts, obcs_apply_uv
880        ymaskobcs = 'maskobcsn'        ymaskobcs = 'maskobcsn'
881        call ctrl_mask_set_xz(        call ctrl_mask_set_xz( 0, OB_Jn, nwetobcsn, ymaskobcs, mythid )
      &                       0, OB_Jn, nwetobcsn, ymaskobcs, mythid  
      &                     )  
882  #endif  #endif
883    
884  #ifdef ALLOW_OBCSS_CONTROL  #ifdef ALLOW_OBCSS_CONTROL
885  c--   Count wet points at Northern boundary.  c--   Count wet points at Southern boundary.
886  c--   mask conventions are adopted from obcs_apply_ts, obcs_apply_uv  c--   mask conventions are adopted from obcs_apply_ts, obcs_apply_uv
887        ymaskobcs = 'maskobcss'        ymaskobcs = 'maskobcss'
888        call ctrl_mask_set_xz(        call ctrl_mask_set_xz( 1, OB_Js, nwetobcss, ymaskobcs, mythid )
      &                       1, OB_Js, nwetobcss, ymaskobcs, mythid  
      &                     )  
889  #endif  #endif
890    
891  #ifdef ALLOW_OBCSW_CONTROL  #ifdef ALLOW_OBCSW_CONTROL
892  c--   Count wet points at Northern boundary.  c--   Count wet points at Western boundary.
893  c--   mask conventions are adopted from obcs_apply_ts, obcs_apply_uv  c--   mask conventions are adopted from obcs_apply_ts, obcs_apply_uv
894        ymaskobcs = 'maskobcsw'        ymaskobcs = 'maskobcsw'
895        call ctrl_mask_set_yz(        call ctrl_mask_set_yz( 1, OB_Iw, nwetobcsw, ymaskobcs, mythid )
      &                       1, OB_Iw, nwetobcsw, ymaskobcs, mythid  
      &                     )  
896  #endif  #endif
897    
898  #ifdef ALLOW_OBCSE_CONTROL  #ifdef ALLOW_OBCSE_CONTROL
899  c--   Count wet points at Northern boundary.  c--   Count wet points at Eastern boundary.
900  c--   mask conventions are adopted from obcs_apply_ts, obcs_apply_uv  c--   mask conventions are adopted from obcs_apply_ts, obcs_apply_uv
901        ymaskobcs = 'maskobcse'        ymaskobcs = 'maskobcse'
902        call ctrl_mask_set_yz(        call ctrl_mask_set_yz( 0, OB_Ie, nwetobcse, ymaskobcs, mythid )
      &                       0, OB_Ie, nwetobcse, ymaskobcs, mythid  
      &                     )  
903  #endif  #endif
904    
905        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
# Line 866  c Line 928  c
928                       else if ( ncvargrd(i) .eq. 'm' ) then                       else if ( ncvargrd(i) .eq. 'm' ) then
929  #ifdef ALLOW_OBCS_CONTROL  #ifdef ALLOW_OBCS_CONTROL
930                          do iobcs = 1, nobcs                          do iobcs = 1, nobcs
931    cgg   This overcounts the number of o.b. control points by a factor of "nobcs".
932    cgg   As an ad-hoc solution I've divided by nobcs everywhere.
933                             if ( i .eq. 11 ) then                             if ( i .eq. 11 ) then
934  #ifdef ALLOW_OBCSN_CONTROL  #ifdef ALLOW_OBCSN_CONTROL
935                                nvarlength = nvarlength +                                nvarlength = nvarlength +
# Line 970  c Line 1034  c
1034           enddo           enddo
1035           CALL GLOBAL_SUM_INT( ntmp,  myThid )           CALL GLOBAL_SUM_INT( ntmp,  myThid )
1036           nWetcGlobal(k)=ntmp           nWetcGlobal(k)=ntmp
1037             print *, 'ph-wet 14a: global nWet... k=', k, ntmp
          print *, 'ph-wet 14a: global nWet... vor k=', k, ntmp  
1038    
1039           ntmp=0           ntmp=0
1040           do bj=1,nSy           do bj=1,nSy
# Line 981  c Line 1044  c
1044           enddo           enddo
1045           CALL GLOBAL_SUM_INT( ntmp,  myThid )           CALL GLOBAL_SUM_INT( ntmp,  myThid )
1046           nWetsGlobal(k)=ntmp           nWetsGlobal(k)=ntmp
1047             print *, 'ph-wet 14b: global nWet... k=', k, ntmp
          print *, 'ph-wet 14b: global nWet... vor k=', k, ntmp  
1048    
1049           ntmp=0           ntmp=0
1050           do bj=1,nSy           do bj=1,nSy
# Line 992  c Line 1054  c
1054           enddo           enddo
1055           CALL GLOBAL_SUM_INT( ntmp,  myThid )           CALL GLOBAL_SUM_INT( ntmp,  myThid )
1056           nWetwGlobal(k)=ntmp           nWetwGlobal(k)=ntmp
1057             print *, 'ph-wet 14c: global nWet... k=', k, ntmp
          print *, 'ph-wet 14c: global nWet... vor k=', k, ntmp  
1058    
1059           ntmp=0           ntmp=0
1060           do bj=1,nSy           do bj=1,nSy
# Line 1003  c Line 1064  c
1064           enddo           enddo
1065           CALL GLOBAL_SUM_INT( ntmp,  myThid )           CALL GLOBAL_SUM_INT( ntmp,  myThid )
1066           nWetvGlobal(k)=ntmp           nWetvGlobal(k)=ntmp
1067             print *, 'ph-wet 14d: global nWet... k=', k, ntmp
          print *, 'ph-wet 14d: global nWet... vor k=', k, ntmp  
1068    
1069  #ifdef ALLOW_OBCSN_CONTROL  #ifdef ALLOW_OBCSN_CONTROL
1070           do iobcs = 1, nobcs           do iobcs = 1, nobcs
# Line 1016  c Line 1076  c
1076              enddo              enddo
1077              CALL GLOBAL_SUM_INT( ntmp,  myThid )              CALL GLOBAL_SUM_INT( ntmp,  myThid )
1078              nwetobcsnglo(k,iobcs)=ntmp              nwetobcsnglo(k,iobcs)=ntmp
1079                print *, 'ph-wet 15a: global nWet... k=', k, iobcs, ntmp
1080           enddo           enddo
1081  #endif  #endif
1082  #ifdef ALLOW_OBCSS_CONTROL  #ifdef ALLOW_OBCSS_CONTROL
# Line 1028  c Line 1089  c
1089              enddo              enddo
1090              CALL GLOBAL_SUM_INT( ntmp,  myThid )              CALL GLOBAL_SUM_INT( ntmp,  myThid )
1091              nwetobcssglo(k,iobcs)=ntmp              nwetobcssglo(k,iobcs)=ntmp
1092                print *, 'ph-wet 15b: global nWet... k=', k, iobcs, ntmp
1093           enddo           enddo
1094  #endif  #endif
1095  #ifdef ALLOW_OBCSW_CONTROL  #ifdef ALLOW_OBCSW_CONTROL
# Line 1040  c Line 1102  c
1102              enddo              enddo
1103              CALL GLOBAL_SUM_INT( ntmp,  myThid )              CALL GLOBAL_SUM_INT( ntmp,  myThid )
1104              nwetobcswglo(k,iobcs)=ntmp              nwetobcswglo(k,iobcs)=ntmp
1105                print *, 'ph-wet 15c: global nWet... k=', k, iobcs, ntmp
1106           enddo           enddo
1107  #endif  #endif
1108  #ifdef ALLOW_OBCSE_CONTROL  #ifdef ALLOW_OBCSE_CONTROL
# Line 1052  c Line 1115  c
1115              enddo              enddo
1116              CALL GLOBAL_SUM_INT( ntmp,  myThid )              CALL GLOBAL_SUM_INT( ntmp,  myThid )
1117              nwetobcseglo(k,iobcs)=ntmp              nwetobcseglo(k,iobcs)=ntmp
1118                print *, 'ph-wet 15d: global nWet... k=', k, iobcs, ntmp
1119           enddo           enddo
1120  #endif  #endif
1121    

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.22