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

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

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


Revision 1.6 - (hide annotations) (download)
Tue Apr 28 18:09:28 2009 UTC (15 years ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62t, checkpoint61n, checkpoint61o, checkpoint61m, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.5: +5 -5 lines
change macros (EXCH & GLOBAL_SUM/MAX) sufix _R4/_R8 to _RS/_RL
 when applied to _RS/_RL variable

1 jmc 1.6 C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_obcsbal.F,v 1.5 2007/10/09 00:00:00 jmc Exp $
2 jmc 1.5 C $Name: $
3 heimbach 1.2
4     #include "CTRL_CPPOPTIONS.h"
5     #ifdef ALLOW_OBCS
6     # include "OBCS_OPTIONS.h"
7     #endif
8    
9     subroutine ctrl_obcsbal(
10     I mytime,
11     I myiter,
12     I mythid
13     & )
14    
15     c ==================================================================
16     c SUBROUTINE ctrl_obcsbal
17     c ==================================================================
18     c
19 jmc 1.5 c o volumetrically balance the control vector contribution.
20 heimbach 1.2 c o Assume the calendar is identical
21     c for all open boundaries. Need to save the barotropic adjustment
22 jmc 1.5 c velocity so it can be used in all ctrl_getobcs files.
23     c o WARNING: eastern boundary (not defined) filenames have been a
24 heimbach 1.2 c problem in the past.
25     c
26     c - started G. Gebbie, MIT-WHOI, 15-June-2002
27     c ==================================================================
28     c SUBROUTINE ctrl_obcsvol
29     c ==================================================================
30    
31     implicit none
32    
33     c == global variables ==
34    
35     #include "EEPARAMS.h"
36     #include "SIZE.h"
37     #include "PARAMS.h"
38     #include "GRID.h"
39     #include "DYNVARS.h"
40     #ifdef ALLOW_OBCS
41     # include "OBCS.h"
42     #endif
43    
44     #include "ctrl.h"
45     #include "ctrl_dummy.h"
46    
47     c == routine arguments ==
48    
49     integer myiter
50     _RL mytime
51     integer mythid
52    
53 mlosch 1.4 #ifdef BALANCE_CONTROL_VOLFLUX_GLOBAL
54 heimbach 1.2 c == local variables ==
55    
56     integer bi,bj
57     integer i,j,k
58     integer itlo,ithi
59     integer jtlo,jthi
60     integer jmin,jmax
61     integer imin,imax
62     integer irec
63     integer il
64     integer iobcs
65     integer ip1
66     integer jp1
67     integer nrec
68     integer ilfld
69     integer igg
70    
71     _RL volflux
72     _RL area
73     _RL tmpflux
74     _RL tmparea
75     _RL dummy
76     _RL gg
77     _RL tmpx
78     _RL tmpy
79     _RL obcsnfac
80     character*(80) fnamefldn
81     character*(80) fnameflds
82     character*(80) fnamefldw
83     character*(80) fnameflde
84    
85     logical doglobalread
86     logical ladinit
87     logical obcsnfirst, obcsnchanged
88     integer obcsncount0, obcsncount1
89    
90     #ifdef ECCO_VERBOSE
91     character*(MAX_LEN_MBUF) msgbuf
92     #endif
93    
94     c == external functions ==
95    
96     integer ilnblnk
97     external ilnblnk
98    
99     c == end of interface ==
100    
101     jtlo = mybylo(mythid)
102     jthi = mybyhi(mythid)
103     itlo = mybxlo(mythid)
104     ithi = mybxhi(mythid)
105     jmin = 1
106     jmax = sny
107     imin = 1
108     imax = snx
109    
110     c-- Read tiled data.
111     doglobalread = .false.
112     ladinit = .false.
113    
114     cgg Assume the number of records is the same for
115     cgg all boundaries. Needs to be improved someday.
116    
117     #if (defined (ALLOW_OBCS_CONTROL) || \
118     defined (ALLOW_OBCS_COST_CONTRIBUTION))
119    
120     tmpflux= 0. d 0
121     tmparea= 0. d 0
122     area= 0. d 0
123     volflux = 0. d 0
124    
125     #ifdef ECCO_VERBOSE
126     _BEGIN_MASTER( mythid )
127     write(msgbuf,'(a)') ' '
128     call print_message( msgbuf, standardmessageunit,
129     & SQUEEZE_RIGHT , mythid)
130     write(msgbuf,'(a)') ' '
131     call print_message( msgbuf, standardmessageunit,
132     & SQUEEZE_RIGHT , mythid)
133     write(msgbuf,'(a,i9.8)')
134     & ' ctrl_obcsvol: number of records to process: ',nrec
135     call print_message( msgbuf, standardmessageunit,
136     & SQUEEZE_RIGHT , mythid)
137     write(msgbuf,'(a)') ' '
138     call print_message( msgbuf, standardmessageunit,
139     & SQUEEZE_RIGHT , mythid)
140     _END_MASTER( mythid )
141     #endif
142    
143     c-- Get the counters, flags, and the interpolation factor.
144     call ctrl_GetRec( 'xx_obcsn',
145     O obcsnfac, obcsnfirst, obcsnchanged,
146     O obcsncount0,obcsncount1,
147     I mytime, myiter, mythid )
148    
149     c-- Loop over records. For north boundary, we only need V velocity.
150    
151     if ( obcsnfirst ) then
152    
153     shiftvel(1) = 0. d0
154     shiftvel(2) = 0. d0
155    
156     call ctrl_volflux( obcsncount0, area, volflux, mythid)
157    
158     c-- Do the global summation.
159 jmc 1.6 _GLOBAL_SUM_RL( volflux, mythid )
160     _GLOBAL_SUM_RL( area,mythid )
161 heimbach 1.2
162     shiftvel(2) = volflux / area
163     print*,'volflux,area',volflux,area
164 jmc 1.5 endif
165     cgg End of the obcsnfirst loop.
166 heimbach 1.2
167     if ( ( obcsnfirst) .or. (obcsnchanged)) then
168    
169     cgg Swap the value.
170     shiftvel(1) = shiftvel(2)
171 jmc 1.5
172 heimbach 1.2 volflux = 0. d0
173     area= 0. d0
174    
175     call ctrl_volflux( obcsncount1, area, volflux, mythid)
176    
177     c-- Do the global summation.
178 jmc 1.6 _GLOBAL_SUM_RL( volflux, mythid )
179     _GLOBAL_SUM_RL( area,mythid )
180 heimbach 1.2
181     shiftvel(2) = volflux /area
182     print*,'volflux,area',volflux,area
183    
184 jmc 1.5 endif
185     cgg End of the obcsnfirst, obcsnchanged loop.
186 heimbach 1.2
187     #endif
188    
189 mlosch 1.4 #endif /* BALANCE_CONTROL_VOLFLUX_GLOBAL */
190    
191 heimbach 1.2 return
192     end
193    
194    
195    
196    
197    
198    
199    

  ViewVC Help
Powered by ViewVC 1.1.22