sealevel.F90 3.6 KB
Newer Older
kbk's avatar
kbk committed
1
!$Id: sealevel.F90,v 1.3 2003-04-07 15:44:13 kbk Exp $
gotm's avatar
gotm committed
2 3 4 5 6 7 8 9 10 11 12 13
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: sealevel() - using the cont. eq. to get the sealevel.
!
! !INTERFACE:
   subroutine sealevel
!
! !DESCRIPTION:
!
! !USES:
kbk's avatar
kbk committed
14
   use domain, only: imin,imax,jmin,jmax,az,H
gotm's avatar
gotm committed
15 16 17 18 19
#if defined(SPHERICAL) || defined(CURVILINEAR)
   use domain, only : arcd1,dxv,dyu
#else
   use domain, only : dx,dy,ard1
#endif
kbk's avatar
kbk committed
20 21 22
   use m2d, only: dtm
   use variables_2d, only: z,zo,U,V
   use halo_zones, only : update_2d_halo,wait_halo,z_TAG
gotm's avatar
gotm committed
23 24 25 26 27 28 29 30 31 32 33 34
   IMPLICIT NONE
!
! !INPUT PARAMETERS:
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
!
! !REVISION HISTORY:
!  Original author(s): Hans Burchard & Karsten Bolding
!
!  $Log: sealevel.F90,v $
kbk's avatar
kbk committed
35 36
!  Revision 1.3  2003-04-07 15:44:13  kbk
!  parallel support
37 38 39
!
!  Revision 1.1.1.1  2002/05/02 14:00:45  gotm
!  recovering after CVS crash
gotm's avatar
gotm committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
!
!  Revision 1.9  2001/10/22 11:56:44  bbh
!  NOMADS_TEST kk =1.0 included
!
!  Revision 1.8  2001/09/01 17:15:13  bbh
!  Forgot to remove a few print statements
!
!  Revision 1.7  2001/09/01 16:49:27  bbh
!  A nasty hard-coding of z = 0. if mask = 2
!
!  Revision 1.6  2001/08/27 11:53:13  bbh
!  TVD-advection for momentum added, some bugs removed
!
!  Revision 1.5  2001/08/01 08:25:52  bbh
!  CURVILINEAR now implemented
!
!  Revision 1.4  2001/06/22 08:19:10  bbh
!  Compiler options such as USE_MASK and OLD_DRY deleted.
!  Open and passive boundary for z created.
!  Various inconsistencies removed.
!  wait_halo added.
!  Checked loop boundaries
!
!  Revision 1.3  2001/05/18 12:55:13  bbh
!  Included masks in calls to update_2d_halo()
!
!  Revision 1.2  2001/05/03 19:35:01  bbh
!  Use of variables_2d
!
!  Revision 1.1.1.1  2001/04/17 08:43:07  bbh
!  initial import into CVS
!
!
! !LOCAL VARIABLES:
   integer	:: i,j
   REALTYPE	:: kk
!
!EOP
!-----------------------------------------------------------------------
!BOC
#ifdef DEBUG
   integer, save :: Ncall = 0
   Ncall = Ncall+1
   write(debug,*) 'sealevel() # ',Ncall
#endif

kbk's avatar
kbk committed
86
   zo = z
gotm's avatar
gotm committed
87 88
   do j=jmin,jmax
      do i=imin,imax
kbk's avatar
kbk committed
89
!KBK         zo(i,j) = z(i,j)
gotm's avatar
gotm committed
90
         if (az(i,j) .eq. 1) then
91 92
            z(i,j)=z(i,j)-dtm*((U(i,j)*DYU-U(i-1,j  )*DYUIM1) &
                              +(V(i,j)*DXV-V(i  ,j-1)*DXVJM1))*ARCD1
kbk's avatar
kbk committed
93

gotm's avatar
gotm committed
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
#ifdef NOMADS_TEST
	       kk=1.0
	       if ((((i.eq.1).or.(i.eq.imax)).and.(j.ge.1).and.(j.le.jmax)).or.(((j.eq.1).or.(j.eq.jmax)).and.(i.ge.1).and.(i.le.imax))) &
	       z(i,j)=(1.-kk)*z(i,j)
	       kk=0.5625
	       if ((((i.eq.2).or.(i.eq.imax-1)).and.(j.ge.2).and.(j.le.jmax-1)).or.(((j.eq.2).or.(j.eq.jmax-1)).and.(i.ge.2).and.(i.le.imax-1))) &
	       z(i,j)=(1.-kk)*z(i,j)
	       kk=0.25
	       if ((((i.eq.3).or.(i.eq.imax-2)).and.(j.ge.3).and.(j.le.jmax-2)).or.(((j.eq.3).or.(j.eq.jmax-2)).and.(i.ge.3).and.(i.le.imax-2))) &
	       z(i,j)=(1.-kk)*z(i,j)
	       kk=0.0625
	       if ((((i.eq.4).or.(i.eq.imax-3)).and.(j.ge.4).and.(j.le.jmax-3)).or.(((j.eq.4).or.(j.eq.jmax-3)).and.(i.ge.4).and.(i.le.imax-3))) &
	       z(i,j)=(1.-kk)*z(i,j)
#endif
#ifdef SALTWEDGE_TEST
!   z(imax,:)=z(imax-1,:)
    z(imax-1,2)= z(imax-1,2) + 700. * dtm / dx / dy
#endif
         end if
      end do
   end do

   call update_2d_halo(z,z,az,imin,jmin,imax,jmax,z_TAG)
   call wait_halo(z_TAG)
kbk's avatar
kbk committed
118
!KBK   call cp_outside_openbdy_2d(z)
gotm's avatar
gotm committed
119 120 121 122 123 124 125 126 127 128 129 130

#ifdef DEBUG
   write(debug,*) 'Leaving sealevel()'
   write(debug,*)
#endif
   return
   end subroutine sealevel
!EOC

!-----------------------------------------------------------------------
! Copyright (C) 2001 - Hans Burchard and Karsten Bolding               !
!-----------------------------------------------------------------------