1 |
|
C $Header$ |
2 |
|
C $Name$ |
3 |
|
|
4 |
#include "CTRL_CPPOPTIONS.h" |
#include "CTRL_CPPOPTIONS.h" |
5 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
109 |
|
|
110 |
if (optimcycle .ge. 0) then |
if (optimcycle .ge. 0) then |
111 |
ilobcsw=ilnblnk( xx_obcsw_file ) |
ilobcsw=ilnblnk( xx_obcsw_file ) |
112 |
write(fnameobcsw(1:80),'(2a,i10.10)') |
write(fnameobcsw(1:80),'(2a,i10.10)') |
113 |
& xx_obcsw_file(1:ilobcsw), '.', optimcycle |
& xx_obcsw_file(1:ilobcsw), '.', optimcycle |
114 |
endif |
endif |
115 |
|
|
122 |
|
|
123 |
do iobcs = 1,nobcs |
do iobcs = 1,nobcs |
124 |
if ( obcswfirst ) then |
if ( obcswfirst ) then |
125 |
call active_read_yz_loc( fnameobcsw, tmpfldyz, |
call active_read_yz( fnameobcsw, tmpfldyz, |
126 |
& (obcswcount0-1)*nobcs+iobcs, |
& (obcswcount0-1)*nobcs+iobcs, |
127 |
& doglobalread, ladinit, optimcycle, |
& doglobalread, ladinit, optimcycle, |
128 |
& mythid, xx_obcsw_dummy ) |
& mythid, xx_obcsw_dummy ) |
129 |
|
|
130 |
#ifdef ALLOW_CTRL_OBCS_BALANCE |
#ifdef ALLOW_CTRL_OBCS_BALANCE |
131 |
|
|
132 |
if ( optimcycle .gt. 0) then |
if ( optimcycle .gt. 0) then |
133 |
if (iobcs .eq. 3) then |
if (iobcs .eq. 3) then |
134 |
cgg Special attention is needed for the normal velocity. |
cgg Special attention is needed for the normal velocity. |
135 |
cgg For the north, this is the v velocity, iobcs = 4. |
cgg For the north, this is the v velocity, iobcs = 4. |
146 |
|
|
147 |
do k = 1,Nr |
do k = 1,Nr |
148 |
cgg If cells are not full, this should be modified with hFac. |
cgg If cells are not full, this should be modified with hFac. |
149 |
cgg |
cgg |
150 |
cgg The xx field (tmpfldxz) does not contain the velocity at the |
cgg The xx field (tmpfldxz) does not contain the velocity at the |
151 |
cgg surface level. This velocity is not independent; it must |
cgg surface level. This velocity is not independent; it must |
152 |
cgg exactly balance the volume flux, since we are dealing with |
cgg exactly balance the volume flux, since we are dealing with |
153 |
cgg the baroclinic velocity structure.. |
cgg the baroclinic velocity structure.. |
154 |
utop = tmpfldyz(j,k,bi,bj)* |
utop = tmpfldyz(j,k,bi,bj)* |
155 |
& maskW(i+ip1,j,k,bi,bj) * delR(k) + utop |
& maskW(i+ip1,j,k,bi,bj) * delR(k) + utop |
156 |
cgg Add the barotropic velocity component. |
cgg Add the barotropic velocity component. |
157 |
if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then |
if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then |
158 |
tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro |
tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro |
159 |
endif |
endif |
160 |
enddo |
enddo |
161 |
cgg Compute the baroclinic velocity at level 1. Should balance flux. |
cgg Compute the baroclinic velocity at level 1. Should balance flux. |
162 |
tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) |
tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) |
163 |
& - utop / delR(1) |
& - utop / delR(1) |
164 |
enddo |
enddo |
165 |
enddo |
enddo |
181 |
|
|
182 |
do k = 1,Nr |
do k = 1,Nr |
183 |
cgg If cells are not full, this should be modified with hFac. |
cgg If cells are not full, this should be modified with hFac. |
184 |
cgg |
cgg |
185 |
cgg The xx field (tmpfldxz) does not contain the velocity at the |
cgg The xx field (tmpfldxz) does not contain the velocity at the |
186 |
cgg surface level. This velocity is not independent; it must |
cgg surface level. This velocity is not independent; it must |
187 |
cgg exactly balance the volume flux, since we are dealing with |
cgg exactly balance the volume flux, since we are dealing with |
188 |
cgg the baroclinic velocity structure.. |
cgg the baroclinic velocity structure.. |
189 |
utop = tmpfldyz(j,k,bi,bj)* |
utop = tmpfldyz(j,k,bi,bj)* |
190 |
& maskS(i,j,k,bi,bj) * delR(k) + utop |
& maskS(i,j,k,bi,bj) * delR(k) + utop |
191 |
cgg Add the barotropic velocity component. |
cgg Add the barotropic velocity component. |
192 |
if (maskS(i,j,k,bi,bj) .ne. 0.) then |
if (maskS(i,j,k,bi,bj) .ne. 0.) then |
193 |
tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro |
tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro |
194 |
endif |
endif |
195 |
enddo |
enddo |
196 |
cgg Compute the baroclinic velocity at level 1. Should balance flux. |
cgg Compute the baroclinic velocity at level 1. Should balance flux. |
197 |
tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) |
tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) |
198 |
& - utop / delR(1) |
& - utop / delR(1) |
199 |
enddo |
enddo |
200 |
enddo |
enddo |
217 |
endif |
endif |
218 |
|
|
219 |
if ( (obcswfirst) .or. (obcswchanged)) then |
if ( (obcswfirst) .or. (obcswchanged)) then |
220 |
|
|
221 |
cgg( This is a terribly long way to do it. However, the dimensions do not exactly |
cgg( This is a terribly long way to do it. However, the dimensions do not exactly |
222 |
cgg match up. I will blame Fortran for the ugliness. |
cgg match up. I will blame Fortran for the ugliness. |
223 |
|
|
243 |
enddo |
enddo |
244 |
enddo |
enddo |
245 |
|
|
246 |
call active_read_yz_loc( fnameobcsw, tmpfldyz, |
call active_read_yz( fnameobcsw, tmpfldyz, |
247 |
& (obcswcount1-1)*nobcs+iobcs, |
& (obcswcount1-1)*nobcs+iobcs, |
248 |
& doglobalread, ladinit, optimcycle, |
& doglobalread, ladinit, optimcycle, |
249 |
& mythid, xx_obcsw_dummy ) |
& mythid, xx_obcsw_dummy ) |
250 |
|
|
251 |
#ifdef ALLOW_CTRL_OBCS_BALANCE |
#ifdef ALLOW_CTRL_OBCS_BALANCE |
252 |
|
|
253 |
if ( optimcycle .gt. 0) then |
if ( optimcycle .gt. 0) then |
254 |
if (iobcs .eq. 3) then |
if (iobcs .eq. 3) then |
255 |
cgg Special attention is needed for the normal velocity. |
cgg Special attention is needed for the normal velocity. |
256 |
cgg For the north, this is the v velocity, iobcs = 4. |
cgg For the north, this is the v velocity, iobcs = 4. |
267 |
|
|
268 |
do k = 1,Nr |
do k = 1,Nr |
269 |
cgg If cells are not full, this should be modified with hFac. |
cgg If cells are not full, this should be modified with hFac. |
270 |
cgg |
cgg |
271 |
cgg The xx field (tmpfldxz) does not contain the velocity at the |
cgg The xx field (tmpfldxz) does not contain the velocity at the |
272 |
cgg surface level. This velocity is not independent; it must |
cgg surface level. This velocity is not independent; it must |
273 |
cgg exactly balance the volume flux, since we are dealing with |
cgg exactly balance the volume flux, since we are dealing with |
274 |
cgg the baroclinic velocity structure.. |
cgg the baroclinic velocity structure.. |
275 |
utop = tmpfldyz(j,k,bi,bj)* |
utop = tmpfldyz(j,k,bi,bj)* |
276 |
& maskW(i+ip1,j,k,bi,bj) * delR(k) + utop |
& maskW(i+ip1,j,k,bi,bj) * delR(k) + utop |
277 |
cgg Add the barotropic velocity component. |
cgg Add the barotropic velocity component. |
278 |
if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then |
if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then |
279 |
tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro |
tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro |
280 |
endif |
endif |
281 |
enddo |
enddo |
282 |
cgg Compute the baroclinic velocity at level 1. Should balance flux. |
cgg Compute the baroclinic velocity at level 1. Should balance flux. |
283 |
tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) |
tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) |
284 |
& - utop / delR(1) |
& - utop / delR(1) |
285 |
enddo |
enddo |
286 |
enddo |
enddo |
302 |
|
|
303 |
do k = 1,Nr |
do k = 1,Nr |
304 |
cgg If cells are not full, this should be modified with hFac. |
cgg If cells are not full, this should be modified with hFac. |
305 |
cgg |
cgg |
306 |
cgg The xx field (tmpfldxz) does not contain the velocity at the |
cgg The xx field (tmpfldxz) does not contain the velocity at the |
307 |
cgg surface level. This velocity is not independent; it must |
cgg surface level. This velocity is not independent; it must |
308 |
cgg exactly balance the volume flux, since we are dealing with |
cgg exactly balance the volume flux, since we are dealing with |
309 |
cgg the baroclinic velocity structure.. |
cgg the baroclinic velocity structure.. |
310 |
utop = tmpfldyz(j,k,bi,bj)* |
utop = tmpfldyz(j,k,bi,bj)* |
311 |
& maskS(i,j,k,bi,bj) * delR(k) + utop |
& maskS(i,j,k,bi,bj) * delR(k) + utop |
312 |
cgg Add the barotropic velocity component. |
cgg Add the barotropic velocity component. |
313 |
if (maskS(i,j,k,bi,bj) .ne. 0.) then |
if (maskS(i,j,k,bi,bj) .ne. 0.) then |
314 |
tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro |
tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro |
315 |
endif |
endif |
316 |
enddo |
enddo |
317 |
cgg Compute the baroclinic velocity at level 1. Should balance flux. |
cgg Compute the baroclinic velocity at level 1. Should balance flux. |
318 |
tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) |
tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) |
319 |
& - utop / delR(1) |
& - utop / delR(1) |
320 |
enddo |
enddo |
321 |
enddo |
enddo |