--- MITgcm/pkg/ctrl/ctrl_getobcsw.F 2011/03/14 17:08:00 1.11 +++ MITgcm/pkg/ctrl/ctrl_getobcsw.F 2012/07/31 16:05:56 1.14 @@ -1,4 +1,4 @@ -C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/pkg/ctrl/ctrl_getobcsw.F,v 1.11 2011/03/14 17:08:00 mlosch Exp $ +C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/pkg/ctrl/ctrl_getobcsw.F,v 1.14 2012/07/31 16:05:56 heimbach Exp $ C $Name: $ #include "CTRL_CPPOPTIONS.h" @@ -6,7 +6,6 @@ # include "OBCS_OPTIONS.h" #endif - subroutine ctrl_getobcsw( I mytime, I myiter, @@ -29,26 +28,27 @@ implicit none -#ifdef ALLOW_OBCSW_CONTROL - c == global variables == - +#ifdef ALLOW_OBCSW_CONTROL #include "EEPARAMS.h" #include "SIZE.h" #include "PARAMS.h" #include "GRID.h" -#include "OBCS.h" - +c#include "OBCS_PARAMS.h" +#include "OBCS_GRID.h" +#include "OBCS_FIELDS.h" +#include "CTRL_SIZE.h" #include "ctrl.h" #include "ctrl_dummy.h" #include "optim.h" +#endif /* ALLOW_OBCSW_CONTROL */ c == routine arguments == - _RL mytime integer myiter integer mythid +#ifdef ALLOW_OBCSW_CONTROL c == local variables == integer bi,bj @@ -76,10 +76,11 @@ character*(80) fnameobcsw -cgg( Variables for splitting barotropic/baroclinic vels. - _RL ubaro - _RL utop -cgg) +#ifdef ALLOW_OBCS_CONTROL_MODES + integer nk,nz + _RL tmpz (nr,nsx,nsy) + _RL stmp +#endif c == external functions == @@ -99,11 +100,6 @@ imax = snx+olx ip1 = 1 -cgg( Initialize variables for balancing volume flux. - ubaro = 0.d0 - utop = 0.d0 -cgg) - c-- Now, read the control vector. doglobalread = .false. ladinit = .false. @@ -130,6 +126,44 @@ do bj = jtlo,jthi do bi = itlo,ithi +#ifdef ALLOW_OBCS_CONTROL_MODES + if (iobcs .gt. 2) then + do j = jmin,jmax + i = OB_Iw(j,bi,bj) +cih Determine number of open vertical layers. + nz = 0 + do k = 1,Nr + if (iobcs .eq. 3) then + nz = nz + maskW(i+ip1,j,k,bi,bj) + else + nz = nz + maskS(i,j,k,bi,bj) + endif + end do +cih Compute absolute velocities from the barotropic-baroclinic modes. + do k = 1,Nr + if (k.le.nz) then + stmp = 0. + do nk = 1,nz + stmp = stmp + + & modesv(k,nk,nz)*tmpfldyz(j,nk,bi,bj) + end do + tmpz(k,bi,bj) = stmp + else + tmpz(k,bi,bj) = 0. + end if + enddo + do k = 1,Nr + if (iobcs .eq. 3) then + tmpfldyz(j,k,bi,bj) = tmpz(k,bi,bj) + & *recip_hFacW(i+ip1,j,k,bi,bj) + else + tmpfldyz(j,k,bi,bj) = tmpz(k,bi,bj) + & *recip_hFacS(i,j,k,bi,bj) + endif + end do + enddo + endif +#endif do k = 1,nr do j = jmin,jmax xx_obcsw1(j,k,bi,bj,iobcs) = tmpfldyz (j,k,bi,bj) @@ -160,6 +194,44 @@ do bj = jtlo,jthi do bi = itlo,ithi +#ifdef ALLOW_OBCS_CONTROL_MODES + if (iobcs .gt. 2) then + do j = jmin,jmax + i = OB_Iw(j,bi,bj) +cih Determine number of open vertical layers. + nz = 0 + do k = 1,Nr + if (iobcs .eq. 3) then + nz = nz + maskW(i+ip1,j,k,bi,bj) + else + nz = nz + maskS(i,j,k,bi,bj) + endif + end do +cih Compute absolute velocities from the barotropic-baroclinic modes. + do k = 1,Nr + if (k.le.nz) then + stmp = 0. + do nk = 1,nz + stmp = stmp + + & modesv(k,nk,nz)*tmpfldyz(j,nk,bi,bj) + end do + tmpz(k,bi,bj) = stmp + else + tmpz(k,bi,bj) = 0. + end if + enddo + do k = 1,Nr + if (iobcs .eq. 3) then + tmpfldyz(j,k,bi,bj) = tmpz(k,bi,bj) + & *recip_hFacW(i+ip1,j,k,bi,bj) + else + tmpfldyz(j,k,bi,bj) = tmpz(k,bi,bj) + & *recip_hFacS(i,j,k,bi,bj) + endif + end do + enddo + endif +#endif do k = 1,nr do j = jmin,jmax xx_obcsw1 (j,k,bi,bj,iobcs) = tmpfldyz (j,k,bi,bj) @@ -206,21 +278,11 @@ enddo enddo enddo - + C-- End over iobcs loop enddo -#else /* ALLOW_OBCSW_CONTROL undefined */ - -c == routine arguments == - - _RL mytime - integer myiter - integer mythid - -c-- CPP flag ALLOW_OBCSW_CONTROL undefined. - #endif /* ALLOW_OBCSW_CONTROL */ + return end -