1 |
C $Header: $ |
2 |
C $Name: $ |
3 |
|
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 |
c o volumetrically balance the control vector contribution. |
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 |
|
47 |
c == routine arguments == |
48 |
|
49 |
integer myiter |
50 |
_RL mytime |
51 |
integer mythid |
52 |
|
53 |
#ifdef BALANCE_CONTROL_VOLFLUX_GLOBAL |
54 |
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 |
_GLOBAL_SUM_R8( volflux, mythid ) |
160 |
_GLOBAL_SUM_R8( area,mythid ) |
161 |
|
162 |
shiftvel(2) = volflux / area |
163 |
print*,'volflux,area',volflux,area |
164 |
endif |
165 |
cgg End of the obcsnfirst loop. |
166 |
|
167 |
if ( ( obcsnfirst) .or. (obcsnchanged)) then |
168 |
|
169 |
cgg Swap the value. |
170 |
shiftvel(1) = shiftvel(2) |
171 |
|
172 |
volflux = 0. d0 |
173 |
area= 0. d0 |
174 |
|
175 |
call ctrl_volflux( obcsncount1, area, volflux, mythid) |
176 |
|
177 |
c-- Do the global summation. |
178 |
_GLOBAL_SUM_R8( volflux, mythid ) |
179 |
_GLOBAL_SUM_R8( area,mythid ) |
180 |
|
181 |
shiftvel(2) = volflux /area |
182 |
print*,'volflux,area',volflux,area |
183 |
|
184 |
endif |
185 |
cgg End of the obcsnfirst, obcsnchanged loop. |
186 |
|
187 |
#endif |
188 |
|
189 |
#endif /* BALANCE_CONTROL_VOLFLUX_GLOBAL */ |
190 |
|
191 |
return |
192 |
end |
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|