--- MITgcm/pkg/ctrl/ctrl_getobcsw.F 2003/07/18 21:10:16 1.3 +++ MITgcm/pkg/ctrl/ctrl_getobcsw.F 2007/10/09 00:00:00 1.8 @@ -1,3 +1,5 @@ +C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/pkg/ctrl/ctrl_getobcsw.F,v 1.8 2007/10/09 00:00:00 jmc Exp $ +C $Name: $ #include "CTRL_CPPOPTIONS.h" #ifdef ALLOW_OBCS @@ -107,7 +109,7 @@ if (optimcycle .ge. 0) then ilobcsw=ilnblnk( xx_obcsw_file ) - write(fnameobcsw(1:80),'(2a,i10.10)') + write(fnameobcsw(1:80),'(2a,i10.10)') & xx_obcsw_file(1:ilobcsw), '.', optimcycle endif @@ -120,12 +122,14 @@ do iobcs = 1,nobcs if ( obcswfirst ) then - call active_read_yz_loc( fnameobcsw, tmpfldyz, + call active_read_yz( fnameobcsw, tmpfldyz, & (obcswcount0-1)*nobcs+iobcs, & doglobalread, ladinit, optimcycle, & mythid, xx_obcsw_dummy ) - if ( optimcycle .gt. 0) then +#ifdef ALLOW_CTRL_OBCS_BALANCE + + if ( optimcycle .gt. 0) then if (iobcs .eq. 3) then cgg Special attention is needed for the normal velocity. cgg For the north, this is the v velocity, iobcs = 4. @@ -142,21 +146,21 @@ do k = 1,Nr cgg If cells are not full, this should be modified with hFac. -cgg -cgg The xx field (tmpfldxz) does not contain the velocity at the -cgg surface level. This velocity is not independent; it must +cgg +cgg The xx field (tmpfldxz) does not contain the velocity at the +cgg surface level. This velocity is not independent; it must cgg exactly balance the volume flux, since we are dealing with -cgg the baroclinic velocity structure.. +cgg the baroclinic velocity structure.. utop = tmpfldyz(j,k,bi,bj)* - & maskW(i+ip1,j,k,bi,bj) * delZ(k) + utop -cgg Add the barotropic velocity component. + & maskW(i+ip1,j,k,bi,bj) * delR(k) + utop +cgg Add the barotropic velocity component. if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro endif enddo cgg Compute the baroclinic velocity at level 1. Should balance flux. - tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) - & - utop / delZ(1) + tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) + & - utop / delR(1) enddo enddo enddo @@ -177,27 +181,29 @@ do k = 1,Nr cgg If cells are not full, this should be modified with hFac. -cgg -cgg The xx field (tmpfldxz) does not contain the velocity at the -cgg surface level. This velocity is not independent; it must +cgg +cgg The xx field (tmpfldxz) does not contain the velocity at the +cgg surface level. This velocity is not independent; it must cgg exactly balance the volume flux, since we are dealing with -cgg the baroclinic velocity structure.. +cgg the baroclinic velocity structure.. utop = tmpfldyz(j,k,bi,bj)* - & maskS(i,j,k,bi,bj) * delZ(k) + utop -cgg Add the barotropic velocity component. + & maskS(i,j,k,bi,bj) * delR(k) + utop +cgg Add the barotropic velocity component. if (maskS(i,j,k,bi,bj) .ne. 0.) then tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro endif enddo cgg Compute the baroclinic velocity at level 1. Should balance flux. - tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) - & - utop / delZ(1) + tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) + & - utop / delR(1) enddo enddo enddo endif endif +#endif /* ALLOW_CTRL_OBCS_BALANCE */ + do bj = jtlo,jthi do bi = itlo,ithi do k = 1,nr @@ -211,8 +217,8 @@ endif if ( (obcswfirst) .or. (obcswchanged)) then - -cgg( This is a terribly long way to do it. However, the dimensions don't exactly + +cgg( This is a terribly long way to do it. However, the dimensions do not exactly cgg match up. I will blame Fortran for the ugliness. do bj = jtlo,jthi @@ -237,12 +243,14 @@ enddo enddo - call active_read_yz_loc( fnameobcsw, tmpfldyz, + call active_read_yz( fnameobcsw, tmpfldyz, & (obcswcount1-1)*nobcs+iobcs, & doglobalread, ladinit, optimcycle, & mythid, xx_obcsw_dummy ) - if ( optimcycle .gt. 0) then +#ifdef ALLOW_CTRL_OBCS_BALANCE + + if ( optimcycle .gt. 0) then if (iobcs .eq. 3) then cgg Special attention is needed for the normal velocity. cgg For the north, this is the v velocity, iobcs = 4. @@ -259,21 +267,21 @@ do k = 1,Nr cgg If cells are not full, this should be modified with hFac. -cgg -cgg The xx field (tmpfldxz) does not contain the velocity at the -cgg surface level. This velocity is not independent; it must +cgg +cgg The xx field (tmpfldxz) does not contain the velocity at the +cgg surface level. This velocity is not independent; it must cgg exactly balance the volume flux, since we are dealing with -cgg the baroclinic velocity structure.. +cgg the baroclinic velocity structure.. utop = tmpfldyz(j,k,bi,bj)* - & maskW(i+ip1,j,k,bi,bj) * delZ(k) + utop -cgg Add the barotropic velocity component. + & maskW(i+ip1,j,k,bi,bj) * delR(k) + utop +cgg Add the barotropic velocity component. if (maskW(i+ip1,j,k,bi,bj) .ne. 0.) then tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro endif enddo cgg Compute the baroclinic velocity at level 1. Should balance flux. - tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) - & - utop / delZ(1) + tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) + & - utop / delR(1) enddo enddo enddo @@ -294,27 +302,29 @@ do k = 1,Nr cgg If cells are not full, this should be modified with hFac. -cgg -cgg The xx field (tmpfldxz) does not contain the velocity at the -cgg surface level. This velocity is not independent; it must +cgg +cgg The xx field (tmpfldxz) does not contain the velocity at the +cgg surface level. This velocity is not independent; it must cgg exactly balance the volume flux, since we are dealing with -cgg the baroclinic velocity structure.. +cgg the baroclinic velocity structure.. utop = tmpfldyz(j,k,bi,bj)* - & maskS(i,j,k,bi,bj) * delZ(k) + utop -cgg Add the barotropic velocity component. + & maskS(i,j,k,bi,bj) * delR(k) + utop +cgg Add the barotropic velocity component. if (maskS(i,j,k,bi,bj) .ne. 0.) then tmpfldyz(j,k,bi,bj) = tmpfldyz(j,k,bi,bj)+ ubaro endif enddo cgg Compute the baroclinic velocity at level 1. Should balance flux. - tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) - & - utop / delZ(1) + tmpfldyz(j,1,bi,bj) = tmpfldyz(j,1,bi,bj) + & - utop / delR(1) enddo enddo enddo endif endif +#endif /* ALLOW_CTRL_OBCS_BALANCE */ + do bj = jtlo,jthi do bi = itlo,ithi do k = 1,nr