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

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

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


Revision 1.2 - (show annotations) (download)
Tue Jun 24 16:07:06 2003 UTC (20 years, 10 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint51k_post, checkpoint51l_post, checkpoint51j_post, checkpoint51o_pre, checkpoint51n_pre, branchpoint-genmake2, checkpoint51q_post, checkpoint51r_post, checkpoint51a_post, checkpoint51i_post, checkpoint51e_post, checkpoint51l_pre, checkpoint51c_post, checkpoint51f_pre, checkpoint51o_post, checkpoint51p_post, checkpoint51, checkpoint51f_post, checkpoint51b_post, checkpoint51b_pre, checkpoint51h_pre, checkpoint51g_post, checkpoint51d_post, checkpoint51m_post, checkpoint51t_post, checkpoint51n_post, checkpoint51i_pre, checkpoint51s_post
Branch point for: branch-nonh, branch-genmake2, tg2-branch, checkpoint51n_branch
Changes since 1.1: +199 -0 lines
Merging for c51 vs. e34

1
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 #ifdef ALLOW_CALENDAR
43 # include "cal.h"
44 #endif
45 #include "cost.h"
46 #include "ctrl.h"
47 #include "ctrl_dummy.h"
48 #include "optim.h"
49
50 c == routine arguments ==
51
52 integer myiter
53 _RL mytime
54 integer mythid
55
56 c == local variables ==
57
58 integer bi,bj
59 integer i,j,k
60 integer itlo,ithi
61 integer jtlo,jthi
62 integer jmin,jmax
63 integer imin,imax
64 integer irec
65 integer il
66 integer iobcs
67 integer ip1
68 integer jp1
69 integer nrec
70 integer ilfld
71 integer igg
72
73 _RL volflux
74 _RL area
75 _RL tmpflux
76 _RL tmparea
77 _RL dummy
78 _RL gg
79 _RL tmpx
80 _RL tmpy
81 _RL obcsnfac
82 character*(80) fnamefldn
83 character*(80) fnameflds
84 character*(80) fnamefldw
85 character*(80) fnameflde
86
87 logical doglobalread
88 logical ladinit
89 logical obcsnfirst, obcsnchanged
90 integer obcsncount0, obcsncount1
91
92 #ifdef ECCO_VERBOSE
93 character*(MAX_LEN_MBUF) msgbuf
94 #endif
95
96 c == external functions ==
97
98 integer ilnblnk
99 external ilnblnk
100
101 c == end of interface ==
102
103 jtlo = mybylo(mythid)
104 jthi = mybyhi(mythid)
105 itlo = mybxlo(mythid)
106 ithi = mybxhi(mythid)
107 jmin = 1
108 jmax = sny
109 imin = 1
110 imax = snx
111
112 c-- Read tiled data.
113 doglobalread = .false.
114 ladinit = .false.
115
116 cgg Assume the number of records is the same for
117 cgg all boundaries. Needs to be improved someday.
118
119 #if (defined (ALLOW_OBCS_CONTROL) || \
120 defined (ALLOW_OBCS_COST_CONTRIBUTION))
121
122 tmpflux= 0. d 0
123 tmparea= 0. d 0
124 area= 0. d 0
125 volflux = 0. d 0
126
127 #ifdef ECCO_VERBOSE
128 _BEGIN_MASTER( mythid )
129 write(msgbuf,'(a)') ' '
130 call print_message( msgbuf, standardmessageunit,
131 & SQUEEZE_RIGHT , mythid)
132 write(msgbuf,'(a)') ' '
133 call print_message( msgbuf, standardmessageunit,
134 & SQUEEZE_RIGHT , mythid)
135 write(msgbuf,'(a,i9.8)')
136 & ' ctrl_obcsvol: number of records to process: ',nrec
137 call print_message( msgbuf, standardmessageunit,
138 & SQUEEZE_RIGHT , mythid)
139 write(msgbuf,'(a)') ' '
140 call print_message( msgbuf, standardmessageunit,
141 & SQUEEZE_RIGHT , mythid)
142 _END_MASTER( mythid )
143 #endif
144
145 c-- Get the counters, flags, and the interpolation factor.
146 call ctrl_GetRec( 'xx_obcsn',
147 O obcsnfac, obcsnfirst, obcsnchanged,
148 O obcsncount0,obcsncount1,
149 I mytime, myiter, mythid )
150
151 c-- Loop over records. For north boundary, we only need V velocity.
152
153 if ( obcsnfirst ) then
154
155 shiftvel(1) = 0. d0
156 shiftvel(2) = 0. d0
157
158 call ctrl_volflux( obcsncount0, area, volflux, mythid)
159
160 c-- Do the global summation.
161 _GLOBAL_SUM_R8( volflux, mythid )
162 _GLOBAL_SUM_R8( area,mythid )
163
164 shiftvel(2) = volflux / area
165 print*,'volflux,area',volflux,area
166 endif
167 cgg End of the obcsnfirst loop.
168
169 if ( ( obcsnfirst) .or. (obcsnchanged)) then
170
171 cgg Swap the value.
172 shiftvel(1) = shiftvel(2)
173
174 volflux = 0. d0
175 area= 0. d0
176
177 call ctrl_volflux( obcsncount1, area, volflux, mythid)
178
179 c-- Do the global summation.
180 _GLOBAL_SUM_R8( volflux, mythid )
181 _GLOBAL_SUM_R8( area,mythid )
182
183 shiftvel(2) = volflux /area
184 print*,'volflux,area',volflux,area
185
186 endif
187 cgg End of the obcsnfirst, obcsnchanged loop.
188
189 #endif
190
191 return
192 end
193
194
195
196
197
198
199

  ViewVC Help
Powered by ViewVC 1.1.22