start_macro.F90 3.04 KB
Newer Older
kbk's avatar
kbk committed
1
!$Id: start_macro.F90,v 1.10 2006-03-01 15:54:08 kbk Exp $
gotm's avatar
gotm committed
2 3 4 5
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
6
! !ROUTINE: start_macro - initialise the macro loop \label{sec-start-macro}
gotm's avatar
gotm committed
7 8 9 10 11 12
!
! !INTERFACE:
   subroutine start_macro()
!
! !DESCRIPTION:
!
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
! This routine needs to be called from {\tt m3d} at the beginning
! of each macro time step. Here, the sea surface elevations at the
! before and after the macro time step are updated at the
! T-, U- and V-points.the sea surface elevations at the
! before and after the macro time step are updated at the
! T-, U- and V-points, their notation is {\tt sseo}, {\tt ssen},
! {\tt ssuo}, {\tt ssun}, {\tt ssvo} and {\tt ssvn}, where {\tt e},
! {\tt u} and {\tt v} stand for T-, U- and V-point and {\tt o} and
! {\tt n} for old and new, respectively, see also the description of
! {\tt variables\_3d} in section \ref{sec-variables-3d} on page 
! \pageref{sec-variables-3d}.
!
! Furthermore, the vertically integrated transports {\tt Uint}
! and {\tt Vint} are here divided by the number of micro time
! steps per macro time step, {\tt M}, in order to obtain 
! the time-averaged transports.
!
!
gotm's avatar
gotm committed
31
! !USES:
kbk's avatar
kbk committed
32 33 34 35
   use domain, only: iimin,iimax,jjmin,jjmax,H,HU,HV,min_depth
   use m2d, only: z,Uint,Vint
   use m3d, only: M
   use variables_3d, only: sseo,ssen,ssuo,ssun,ssvo,ssvn
gotm's avatar
gotm committed
36 37 38 39 40 41 42 43
   IMPLICIT NONE
!
! !INPUT PARAMETERS:
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
!
kbk's avatar
kbk committed
44 45 46
! !REVISION HISTORY:
!  Original author(s): Hans Burchard & Karsten Bolding
!
gotm's avatar
gotm committed
47
! !LOCAL VARIABLES:
kbk's avatar
kbk committed
48 49
   integer                   :: i,j
   REALTYPE                  :: split
gotm's avatar
gotm committed
50 51 52 53 54 55 56 57 58
!EOP
!-----------------------------------------------------------------------
!BOC
#ifdef DEBUG
   integer, save :: Ncall = 0
   Ncall = Ncall+1
   write(debug,*) 'start_macro() # ',Ncall
#endif

kbk's avatar
kbk committed
59 60
   do j=jjmin-HALO,jjmax+HALO         ! Defining 'old' and 'new' sea surface
      do i=iimin-HALO,iimax+HALO      ! elevation for macro time step
gotm's avatar
gotm committed
61
         sseo(i,j)=ssen(i,j)
gotm's avatar
gotm committed
62
         ssen(i,j)=z(i,j)
gotm's avatar
gotm committed
63 64 65
      end do
   end do

kbk's avatar
kbk committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
   do j=jjmin-HALO,jjmax+HALO             ! Same for U-points
      do i=iimin-HALO,iimax+HALO-1
         ssuo(i,j)=ssun(i,j)
         ssun(i,j)=0.25*(sseo(i,j)+sseo(i+1,j)+ssen(i,j)+ssen(i+1,j))
         ssun(i,j)=max(ssun(i,j),-HU(i,j)+min_depth)
      end do
   end do

   do j=jjmin-HALO,jjmax+HALO-1
      do i=iimin-HALO,iimax+HALO             ! Same for V-points
         ssvo(i,j)=ssvn(i,j)
         ssvn(i,j)=0.25*(sseo(i,j)+sseo(i,j+1)+ssen(i,j)+ssen(i,j+1))
         ssvn(i,j)=max(ssvn(i,j),-HV(i,j)+min_depth)
      end do
   end do
gotm's avatar
gotm committed
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

! Defining vertically integrated, conservative
! u- and v-transport for macro time step

   split = _ONE_/float(M)
   Uint = split*Uint
   Vint = split*Vint

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

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