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

Contents of /MITgcm/pkg/ctrl/ctrl_volflux.F

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


Revision 1.12 - (show annotations) (download)
Mon Mar 14 17:10:55 2011 UTC (13 years, 3 months ago) by mlosch
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +1 -1 lines
FILE REMOVED
remove obsolete and partially broken code, step 2:
remove subroutines

1 C $Header: /u/gcmpack/MITgcm/pkg/ctrl/ctrl_volflux.F,v 1.11 2011/03/07 09:23:59 mlosch Exp $
2 C $Name: $
3
4 #include "CTRL_CPPOPTIONS.h"
5 #ifdef ALLOW_OBCS
6 # include "OBCS_OPTIONS.h"
7 #endif
8
9 subroutine ctrl_volflux(
10 I obcsncount,
11 O sumarea,
12 O sumflux, mythid
13 & )
14
15 c ==================================================================
16 c SUBROUTINE ctrl_volflux
17 c ==================================================================
18 c
19 c o calculate the o.b. volume flux due to control adjustments.
20 c o Assume the calendar is identical
21 c for all open boundaries. Need to save the barotropic adjustment
22 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 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 #include "optim.h"
47
48 c == routine arguments ==
49
50 integer obcsncount
51 _RL sumflux
52 _RL sumarea
53 integer mythid
54
55
56 #ifdef BALANCE_CONTROL_VOLFLUX_GLOBAL
57 c == local variables ==
58
59 integer bi,bj
60 integer i,j,k
61 integer itlo,ithi
62 integer jtlo,jthi
63 integer jmin,jmax
64 integer imin,imax
65 integer irec
66 integer il
67 integer iobcs
68 integer ip1
69 integer jp1
70 integer nrec
71 integer ilfld
72 integer igg
73
74 _RL tmpflux
75 _RL tmparea
76 _RL dummy
77 _RL gg
78 _RL tmpx
79 _RL tmpy
80 _RL obcsnfac
81 character*(80) fnamefldn
82 character*(80) fnameflds
83 character*(80) fnamefldw
84 character*(80) fnameflde
85
86 logical doglobalread
87 logical ladinit
88
89 #if (defined ALLOW_OBCSN_CONTROL || defined ALLOW_OBCSS_CONTROL)
90 _RL tmpfldxz (1-olx:snx+olx,nr,nsx,nsy)
91 #endif
92 #if (defined ALLOW_OBCSE_CONTROL || defined ALLOW_OBCSW_CONTROL)
93 _RL tmpfldyz (1-oly:sny+oly,nr,nsx,nsy)
94 #endif
95
96 #ifdef ECCO_VERBOSE
97 character*(MAX_LEN_MBUF) msgbuf
98 #endif
99
100 c == external functions ==
101
102 integer ilnblnk
103 external ilnblnk
104
105 c == end of interface ==
106
107 jtlo = mybylo(mythid)
108 jthi = mybyhi(mythid)
109 itlo = mybxlo(mythid)
110 ithi = mybxhi(mythid)
111 jmin = 1
112 jmax = sny
113 imin = 1
114 imax = snx
115
116 c-- Read tiled data.
117 doglobalread = .false.
118 ladinit = .false.
119
120 cgg Assume the number of records is the same for
121 cgg all boundaries. Needs to be improved someday.
122
123 #if (defined (ALLOW_OBCS_CONTROL) || \
124 defined (ALLOW_OBCS_COST_CONTRIBUTION))
125
126 tmpflux = 0. d 0
127 tmparea = 0. d 0
128 sumarea = 0. d 0
129 sumflux = 0. d 0
130
131 #ifdef ECCO_VERBOSE
132 _BEGIN_MASTER( mythid )
133 write(msgbuf,'(a)') ' '
134 call print_message( msgbuf, standardmessageunit,
135 & SQUEEZE_RIGHT , mythid)
136 write(msgbuf,'(a)') ' '
137 call print_message( msgbuf, standardmessageunit,
138 & SQUEEZE_RIGHT , mythid)
139 write(msgbuf,'(a,i9.8)')
140 & ' ctrl_volflux: number of records to process: ',nrec
141 call print_message( msgbuf, standardmessageunit,
142 & SQUEEZE_RIGHT , mythid)
143 write(msgbuf,'(a)') ' '
144 call print_message( msgbuf, standardmessageunit,
145 & SQUEEZE_RIGHT , mythid)
146 _END_MASTER( mythid )
147 #endif
148
149 if (optimcycle .ge. 0) then
150 c
151 #ifdef ALLOW_OBCSN_CONTROL
152 ilfld=ilnblnk( xx_obcsn_file )
153 write(fnamefldn(1:80),'(2a,i10.10)')
154 & xx_obcsn_file(1:ilfld),'.', optimcycle
155 #endif
156 #ifdef ALLOW_OBCSS_CONTROL
157 ilfld=ilnblnk( xx_obcss_file )
158 write(fnameflds(1:80),'(2a,i10.10)')
159 & xx_obcss_file(1:ilfld),'.',optimcycle
160 #endif
161 #ifdef ALLOW_OBCSW_CONTROL
162 ilfld=ilnblnk( xx_obcsw_file )
163 write(fnamefldw(1:80),'(2a,i10.10)')
164 & xx_obcsw_file(1:ilfld),'.',optimcycle
165 #endif
166 #ifdef ALLOW_OBCSE_CONTROL
167 ilfld=ilnblnk( xx_obcse_file )
168 write(fnameflde(1:80),'(2a,i10.10)')
169 & xx_obcse_file(1:ilfld),'.',optimcycle
170 #endif
171 c
172 endif
173
174 #ifdef ALLOW_OBCSN_CONTROL
175 jp1 = 0
176
177 call active_read_xz(fnamefldn,tmpfldxz,
178 & (obcsncount-1)*nobcs+3, doglobalread,
179 & ladinit, optimcycle, mythid
180 & , xx_obcsn_dummy )
181
182 c-- Loop over this thread tiles.
183 do bj = jtlo,jthi
184 do bi = itlo,ithi
185
186 tmpflux = 0. d0
187 tmparea = 0. d0
188
189 do k = 1, Nr
190 do i = imin,imax
191 j = Ob_Jn(I,bi,bj)
192 if (j.ne.0) then
193 cgg -- Alternatively I could read the maskobcs file. But this gives the same result.
194 if (maskS(i,j+jp1,k,bi,bj) .ne. 0.) then
195 cgg -- Do not let the corners contribute to the volume flux.
196 if(ob_iw(j,bi,bj).ne.i .and.ob_ie(j,bi,bj).ne.i)then
197 CGG -- Barotropic velocity stored in level 1.
198 tmpx = tmpfldxz(i,1,bi,bj)
199
200 cgg -- Pick the special point where barotropic velocity loses one degree of freedom.
201 cgg -- Add up the cross-sectional area of this column for later calculations.
202 if (ob_iw(j,bi,bj).eq.(i-1) .and.
203 & ob_iw(j,bi,bj).ne. 0) then
204 tmpx = 0.
205 tmparea = tmparea + delR(k) * dxg(i,j+jp1,bi,bj)
206 print*,'tmparea',tmparea
207 endif
208 cgg -- Positive is flux in.
209 tmpflux = tmpflux -tmpx*delR(k)*dxg(i,j+jp1,bi,bj)
210 endif
211 endif
212 endif
213 enddo
214 enddo
215
216 sumarea = sumarea+ tmparea
217 sumflux = sumflux + tmpflux
218 enddo
219 enddo
220 #endif
221
222 #ifdef ALLOW_OBCSS_CONTROL
223 jp1 = 1
224
225 call active_read_xz(fnameflds,tmpfldxz,
226 & (obcsncount-1)*nobcs+3, doglobalread,
227 & ladinit, optimcycle, mythid
228 & , xx_obcss_dummy )
229
230 c-- Loop over this thread tiles.
231 do bj = jtlo,jthi
232 do bi = itlo,ithi
233
234 tmpflux = 0. d 0
235 #ifndef ALLOW_OBCSN_CONTROL
236 tmparea = 0. d 0
237 #endif
238 do k = 1, Nr
239 do i = imin,imax
240 j = Ob_Js(I,bi,bj)
241 if (j .ne. 0) then
242 if (maskS(i,j+jp1,k,bi,bj) .ne. 0.) then
243 cgg -- Do not let the corners contribute to the volume flux.
244 if (ob_iw(j,bi,bj).ne.i.and.ob_ie(j,bi,bj).ne.i)then
245 tmpx = tmpfldxz(i,1,bi,bj)
246 #ifndef ALLOW_OBCSN_CONTROL
247 cgg -- Pick the special point where barotropic velocity loses one degree of freedom.
248 cgg -- Add up the cross-sectional area of this column for later calculations.
249 cgg -- This is just the backup case where the northern boundary does not exist.
250 cgg -- warning: never been tested.
251 if (ob_iw(j,bi,bj).eq.(i-1).and.
252 & ob_iw(j,bi,bj).ne. 0) then
253 tmpx = 0.
254 tmparea = tmparea + delR(k) * dxg(i,j+jp1,bi,bj)
255 print*,'tmparea',tmparea
256 endif
257 #endif
258 cgg -- Positive is flux in.
259 tmpflux = tmpflux +tmpx*delR(k)*dxg(i,j+jp1,bi,bj)
260 endif
261 endif
262 endif
263 enddo
264 enddo
265 #ifndef ALLOW_OBCSN_CONTROL
266 sumarea = sumarea+ tmparea
267 #endif
268 sumflux = sumflux + tmpflux
269 enddo
270 enddo
271 #endif
272
273 #ifdef ALLOW_OBCSW_CONTROL
274 ip1 = 1
275
276 call active_read_yz( fnamefldw, tmpfldyz,
277 & (obcsncount-1)*nobcs+3, doglobalread,
278 & ladinit, optimcycle, mythid
279 & , xx_obcsw_dummy )
280
281 c-- Loop over this thread tiles.
282 do bj = jtlo,jthi
283 do bi = itlo,ithi
284
285 c-- Determine the weights to be used.
286 tmpflux = 0. d 0
287 #ifndef ALLOW_OBCSN_CONTROL
288 #ifndef ALLOW_OBCSS_CONTROL
289 tmparea = 0. d 0
290 #endif
291 #endif
292 do k = 1, Nr
293 do j = jmin,jmax
294 i = ob_iw(j,bi,bj)
295 if ( i .ne. 0) then
296 if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then
297 cgg -- Do not let the corners contribute to the volume flux.
298 if (ob_jn(i,bi,bj).ne.j.and. ob_js(i,bi,bj).ne.j)then
299 tmpy = tmpfldyz(j,1,bi,bj)
300
301 #ifndef ALLOW_OBCSN_CONTROL
302 #ifndef ALLOW_OBCSS_CONTROL
303 cgg -- Pick the special point where barotropic velocity loses one degree of freedom.
304 cgg -- Add up the cross-sectional area of this column for later calculations.
305 cgg -- This is an untested backup case.
306 if (ob_jn(i,bi,bj).eq.(j+1) .and.
307 & ob_jn(i,bi,bj).ne. 0) then
308 tmpy = 0.
309 tmparea = tmparea + delR(k) * dyg(i+ip1,j,bi,bj)
310 print*,'tmparea',tmparea
311 endif
312 #endif
313 #endif
314 cgg -- Positive is flux in.
315 tmpflux = tmpflux + tmpy* delR(k)*dyg(i+ip1,j,bi,bj)
316 endif
317 endif
318 endif
319 enddo
320 enddo
321 #ifndef ALLOW_OBCSN_CONTROL
322 #ifndef ALLOW_OBCSS_CONTROL
323 sumarea =sumarea + tmparea
324 #endif
325 #endif
326 sumflux = sumflux + tmpflux
327 enddo
328 enddo
329 #endif
330
331 #ifdef ALLOW_OBCSE_CONTROL
332 ip1 = 0
333
334 call active_read_yz( fnameflde, tmpfldyz,
335 & (obcsncount-1)*nobcs+3, doglobalread,
336 & ladinit, optimcycle, mythid
337 & , xx_obcse_dummy )
338
339 c-- Loop over this thread tiles.
340 do bj = jtlo,jthi
341 do bi = itlo,ithi
342
343 c-- Determine the weights to be used.
344 tmpflux = 0. d 0
345
346 #ifndef ALLOW_OBCSN_CONTROL
347 #ifndef ALLOW_OBCSS_CONTROL
348 #ifndef ALLOW_OBCSW_CONTROL
349 tmparea = 0. d 0
350 #endif
351 #endif
352 #endif
353
354 do k = 1, Nr
355 do j = jmin,jmax
356 i = ob_ie(j,bi,bj)
357 if ( i .ne. 0) then
358 if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then
359 cgg -- Do not let the corners contribute to the volume flux.
360 if (ob_jn(i,bi,bj).ne.j .and.ob_js(i,bi,bj).ne.j)then
361 tmpy = tmpfldyz(j,1,bi,bj)
362
363 #ifndef ALLOW_OBCSN_CONTROL
364 #ifndef ALLOW_OBCSS_CONTROL
365 #ifndef ALLOW_OBCSW_CONTROL
366 cgg -- Pick the special point where barotropic velocity loses one degree of freedom.
367 cgg -- Add up the cross-sectional area of this column for later calculations.
368 cgg -- This is an untested backup case.
369 if (ob_jn(i,bi,bj).eq.(j+1) .and.
370 & ob_jn(i,bi,bj).ne. 0) then
371 tmpy = 0.
372 tmparea = tmparea + delR(k) * dyg(i+ip1,j,bi,bj)
373 print*,'tmparea',tmparea
374 endif
375 #endif
376 #endif
377 #endif
378
379 cgg -- Positive is flux in.
380 tmpflux = tmpflux - tmpy* delR(k)*dyg(i+ip1,j,bi,bj)
381 #ifndef ALLOW_OBCSN_CONTROL
382 #ifndef ALLOW_OBCSS_CONTROL
383 #ifndef ALLOW_OBCSW_CONTROL
384 tmparea = tmparea + delR(k) *dyg(i+ip1,j,bi,bj)
385 #endif
386 #endif
387 #endif
388 endif
389 endif
390 endif
391 enddo
392 enddo
393
394 #ifndef ALLOW_OBCSN_CONTROL
395 #ifndef ALLOW_OBCSS_CONTROL
396 #ifndef ALLOW_OBCSW_CONTROL
397 sumarea = sumarea+ tmparea
398 #endif
399 #endif
400 #endif
401 sumflux = sumflux + tmpflux
402 enddo
403 enddo
404 #endif
405
406 #endif
407
408 #endif /* BALANCE_CONTROL_VOLFLUX_GLOBAL */
409
410 return
411 end
412
413
414
415
416
417
418

  ViewVC Help
Powered by ViewVC 1.1.22