! ================================================================== ! ------------------------------------------------------------------ ! subroutine uvtrop(b1) use lsgvar implicit none ! ! ------------------------------------------------------------------ ! !**** *uvtrop*. ! ! by E. Maier-Reimer. ! last modified by U. Mikolajewicz 9/87. ! optimized by E. Kirk 2/2008 ! ! Purpose. ! -------- ! *uvtrop* computes barotropic velocities and stream function ! according to the equation for the barotropic velocities. ! *uvtrop* computes the surface elevation *zeta* and its ! time derivative *zetado* from the depth-integrated equation ! of continuity. ! !** Input. ! ------ ! b1 right hand side of the equation (from *prefor1*). ! skal scaling factors. ) ! elim elimination factors. ) via common /lsgmat/. ! trisys tridiagonalsystem. ) ! zeta old surface elevation. (common /lsgsur/). ! ! Output. ! ------- ! ub ) barotropic velocities (common /lsgfie/). ! vb ) ! psi barotropic stream function. ! zeta surface elevation. (common /lsgsur/). ! zetado time derivative of *zeta*.(common /lsgsur/). ! ! Interface. ! ---------- ! *call* *uvtrop(b1)*. ! parameter b1, dimension b1(matrx). ! ! ! Parameter declaration. ! ---------------------- real (kind=8) :: b1(matrx) ! ! ! Declaration of local variables. ! ------------------------------- integer,save :: ncall = 0 integer :: i,j,k,l,jem2,itgar,itgrr,matrx1 real (kind=8) :: xr,psi1,dti,fact,aree,areo,zetame,zetamo real (kind=8) :: apafac real (kind=8) :: b(matot),x(matot) real (kind=8) :: ubla(ienjen),vbla(ienjen) real (kind=8) :: zetas(ienjen) ! ! ! !* 1. Set initial values and constants. ! --------------------------------- ! jem2=jen-2 itgar=33 matrx1=matrx-1 itgrr=31 mindi=0 mindj=0 ! x(:) = 0.0 ! ! ! * 2. Comput. of the right side of the triangular matrix. ! --------------------------------------------------- ! ! Scaling. ! b(1:matrx) = b1(:) * skal(:) * dt b(matrx+1:) = 0.0 ! ! Elimination. ! do j=1,matrx1 b(j+1:j+kb) = b(j+1:j+kb) - elim(:,j) * b(j) end do ! ! !* 3. Computation of the barotropic velocities. ! ----------------------------------------- ! ! Solving the matrix equation. ! x(matrx)=b(matrx)/trisys(1,matrx) do l=matrx1,1,-1 xr = dot_product(x(l+1:l+kb),trisys(2:kb+1,l)) x(l)=(b(l)-xr)/trisys(1,l) end do ! ! ! Computation of *ub* and *vb*. ! where (numxa(:) > 0) uba(:) = x(2*numxa(:)-1) vba(:) = x(2*numxa(:) ) else where uba(:) = 0.0 vba(:) = 0.0 end where ! ! !* 4. Computation of the barotropic stream function. ! ---------------------------------------------- ! with zero at Antarctica. psi(:,jem2:jen) = 0.0 do j=jem2,1,-1 psi(ien,j)=psi(1,j+2)+depth(ien,j+1)*dphi*ub(ien,j+1)*1.e-6 do i=1,ien-1 psi(i,j)=psi(i+1,j+2)+depth(i,j+1)*dphi*ub(i,j+1)*1.e-6 end do end do ! psimax=0.0 do j=3,jen-2 do i=1,ien psi1=abs(psi(i,j)) if (psi1