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