1 |
|
C $Header$ |
2 |
|
C $Name$ |
3 |
|
|
4 |
#include "CTRL_CPPOPTIONS.h" |
#include "CTRL_CPPOPTIONS.h" |
5 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
108 |
|
|
109 |
if (optimcycle .ge. 0) then |
if (optimcycle .ge. 0) then |
110 |
ilobcse=ilnblnk( xx_obcse_file ) |
ilobcse=ilnblnk( xx_obcse_file ) |
111 |
write(fnameobcse(1:80),'(2a,i10.10)') |
write(fnameobcse(1:80),'(2a,i10.10)') |
112 |
& xx_obcse_file(1:ilobcse), '.', optimcycle |
& xx_obcse_file(1:ilobcse), '.', optimcycle |
113 |
endif |
endif |
114 |
|
|
122 |
do iobcs = 1,nobcs |
do iobcs = 1,nobcs |
123 |
|
|
124 |
if ( obcsefirst ) then |
if ( obcsefirst ) then |
125 |
call active_read_yz( fnameobcse, tmpfldyz, |
call active_read_yz( fnameobcse, tmpfldyz, |
126 |
& (obcsecount0-1)*nobcs+iobcs, |
& (obcsecount0-1)*nobcs+iobcs, |
127 |
& doglobalread, ladinit, optimcycle, |
& doglobalread, ladinit, optimcycle, |
128 |
& mythid, xx_obcse_dummy ) |
& mythid, xx_obcse_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 ( (obcsefirst) .or. (obcsechanged)) then |
if ( (obcsefirst) .or. (obcsechanged)) then |
220 |
|
|
221 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |
222 |
do bi = itlo,ithi |
do bi = itlo,ithi |
223 |
do j = jmin,jmax |
do j = jmin,jmax |
240 |
enddo |
enddo |
241 |
enddo |
enddo |
242 |
|
|
243 |
call active_read_yz( fnameobcse, tmpfldyz, |
call active_read_yz( fnameobcse, tmpfldyz, |
244 |
& (obcsecount1-1)*nobcs+iobcs, |
& (obcsecount1-1)*nobcs+iobcs, |
245 |
& doglobalread, ladinit, optimcycle, |
& doglobalread, ladinit, optimcycle, |
246 |
& mythid, xx_obcse_dummy ) |
& mythid, xx_obcse_dummy ) |
247 |
|
|
248 |
#ifdef ALLOW_CTRL_OBCS_BALANCE |
#ifdef ALLOW_CTRL_OBCS_BALANCE |
249 |
|
|
250 |
if ( optimcycle .gt. 0) then |
if ( optimcycle .gt. 0) then |
251 |
if (iobcs .eq. 3) then |
if (iobcs .eq. 3) then |
252 |
cgg Special attention is needed for the normal velocity. |
cgg Special attention is needed for the normal velocity. |
253 |
cgg For the north, this is the v velocity, iobcs = 4. |
cgg For the north, this is the v velocity, iobcs = 4. |
264 |
|
|
265 |
do k = 1,Nr |
do k = 1,Nr |
266 |
cgg If cells are not full, this should be modified with hFac. |
cgg If cells are not full, this should be modified with hFac. |
267 |
cgg |
cgg |
268 |
cgg The xx field (tmpfldxz) does not contain the velocity at the |
cgg The xx field (tmpfldxz) does not contain the velocity at the |
269 |
cgg surface level. This velocity is not independent; it must |
cgg surface level. This velocity is not independent; it must |
270 |
cgg exactly balance the volume flux, since we are dealing with |
cgg exactly balance the volume flux, since we are dealing with |
271 |
cgg the baroclinic velocity structure.. |
cgg the baroclinic velocity structure.. |
272 |
utop = tmpfldyz(j,k,bi,bj)* |
utop = tmpfldyz(j,k,bi,bj)* |
273 |
& maskW(i+ip1,j,k,bi,bj) * delR(k) + utop |
& maskW(i+ip1,j,k,bi,bj) * delR(k) + utop |
274 |
cgg Add the barotropic velocity component. |
cgg Add the barotropic velocity component. |
275 |
if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then |
if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then |
276 |
tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro |
tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro |
277 |
endif |
endif |
278 |
enddo |
enddo |
279 |
cgg Compute the baroclinic velocity at level 1. Should balance flux. |
cgg Compute the baroclinic velocity at level 1. Should balance flux. |
280 |
tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) |
tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) |
281 |
& - utop / delR(1) |
& - utop / delR(1) |
282 |
enddo |
enddo |
283 |
enddo |
enddo |
299 |
|
|
300 |
do k = 1,Nr |
do k = 1,Nr |
301 |
cgg If cells are not full, this should be modified with hFac. |
cgg If cells are not full, this should be modified with hFac. |
302 |
cgg |
cgg |
303 |
cgg The xx field (tmpfldxz) does not contain the velocity at the |
cgg The xx field (tmpfldxz) does not contain the velocity at the |
304 |
cgg surface level. This velocity is not independent; it must |
cgg surface level. This velocity is not independent; it must |
305 |
cgg exactly balance the volume flux, since we are dealing with |
cgg exactly balance the volume flux, since we are dealing with |
306 |
cgg the baroclinic velocity structure.. |
cgg the baroclinic velocity structure.. |
307 |
utop = tmpfldyz(j,k,bi,bj)* |
utop = tmpfldyz(j,k,bi,bj)* |
308 |
& maskS(i,j,k,bi,bj) * delR(k) + utop |
& maskS(i,j,k,bi,bj) * delR(k) + utop |
309 |
cgg Add the barotropic velocity component. |
cgg Add the barotropic velocity component. |
310 |
if (maskS(i,j,k,bi,bj) .ne. 0.) then |
if (maskS(i,j,k,bi,bj) .ne. 0.) then |
311 |
tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro |
tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro |
312 |
endif |
endif |
313 |
enddo |
enddo |
314 |
cgg Compute the baroclinic velocity at level 1. Should balance flux. |
cgg Compute the baroclinic velocity at level 1. Should balance flux. |
315 |
tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) |
tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) |
316 |
& - utop / delR(1) |
& - utop / delR(1) |
317 |
enddo |
enddo |
318 |
enddo |
enddo |