variables_2d.F90 5.65 KB
Newer Older
kbk's avatar
kbk committed
1
!$Id: variables_2d.F90,v 1.7 2006-03-01 15:54:07 kbk Exp $
gotm's avatar
gotm committed
2 3 4 5 6 7 8 9 10 11 12 13
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !MODULE: variables_2d - global variables for 2D model
!
! !INTERFACE:
   module variables_2d
!
! !DESCRIPTION:
!  This modules contains declarations for all variables related to 2D
!  hydrodynamical calculations. Information about the calculation domain
hb's avatar
hb committed
14
!  is included from the {\tt domain} module.
gotm's avatar
gotm committed
15
!  The module contains public subroutines to initialise and cleanup.
hb's avatar
hb committed
16 17 18
!  Depending whether the compiler option {STATIC} is set or not,
!  memory for 2D variables is statically or dynamically allocated, see
!  {\tt PUBLIC DATA MEMBERS}.
gotm's avatar
gotm committed
19 20
!
! !USES:
kbk's avatar
kbk committed
21
   use domain, only: imin,imax,jmin,jmax,H,HU,HV,min_depth
gotm's avatar
gotm committed
22 23 24 25
   IMPLICIT NONE
!
! !PUBLIC DATA MEMBERS:
#ifdef STATIC
gotm's avatar
gotm committed
26
#include "static_2d.h"
gotm's avatar
gotm committed
27
#else
gotm's avatar
gotm committed
28
#include "dynamic_declarations_2d.h"
gotm's avatar
gotm committed
29
#endif
kbk's avatar
kbk committed
30 31
   integer                             :: size2d_field
   integer                             :: mem2d
gotm's avatar
gotm committed
32
!
kbk's avatar
kbk committed
33 34 35
! !REVISION HISTORY:
!  Original author(s): Karsten Bolding & Hans Burchard
!
gotm's avatar
gotm committed
36
! !LOCAL VARIABLES:
kbk's avatar
kbk committed
37
   integer                   :: rc
gotm's avatar
gotm committed
38 39 40 41 42 43 44 45 46
!
!EOP
!-----------------------------------------------------------------------

   contains

!-----------------------------------------------------------------------
!BOP
!
hb's avatar
hb committed
47
! !IROUTINE: init_variables_2d - initialise 2D related stuff.
gotm's avatar
gotm committed
48 49 50 51 52 53
!
! !INTERFACE:
   subroutine init_variables_2d(runtype)
   IMPLICIT NONE
!
! !DESCRIPTION:
hb's avatar
hb committed
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 86 87 88 89 90 91 92 93 94
!  Allocates memory (unless {\tt STATIC} is set) for 2D related fields, 
!  by an include statement. Furthermore all public 2D variables are 
!  initialised to zero. Those are listed in table \ref{table_2d_variables}
!  on page \pageref{table_2d_variables}.
!
!  \begin{table}[h]
!  \begin{center}
!  \begin{tabular}{lll}
! {\tt z } & sea surface elevation in T-point & [m] \\ 
! {\tt zu } & sea surface elevation in U-point & [m]\\ 
! {\tt zv } & sea surface elevation in V-point & [m]\\ 
! {\tt U } & $x$ component of transport in U-point & [m$^2$s$^{-1}$] \\ 
! {\tt DU } & water depth in U-point & [m] \\ 
! {\tt fU } & Coriolis term for $V$-equation in V-point & [m$^2$s$^{-2}$] \\ 
! {\tt SlUx } & slow term for $U$-equation in U-point & [m$^2$s$^{-2}$] \\ 
! {\tt Slru } &slow bottom friction for $U$-equation in U-point &
! [m$^2$s$^{-2}$]\\ 
! {\tt V } & $y$ component of transport in V-point & [m$^2$s$^{-1}$]\\ 
! {\tt DV } & water depth in V-point & [m] \\ 
! {\tt fV } &  Coriolis term for $U$-equation in U-point & [m$^2$s$^{-2}$]\\ 
! {\tt SlVx } & slow term for $V$-equation in V-point & [m$^2$s$^{-2}$] \\ 
! {\tt Slrv } &slow bottom friction for $V$-equation in V-point &
! [m$^2$s$^{-2}$]\\ 
! {\tt Uint } & $x$-component of mean transport in U-point & [m$^2$s$^{-1}$]\\ 
! {\tt Vint } & $y$-component of mean transport in V-point & [m$^2$s$^{-1}$]\\ 
! {\tt UEx } & sum of explicit terms for for $U$-equation in U-point & [m$^2$s$^{-2}$]\\ 
! {\tt VEx } &sum of explicit terms for for $V$-equation in V-point & [m$^2$s$^{-2}$]\\ 
! {\tt ru } & bottom friction for $U$-equation in U-point & [m$^2$s$^{-2}$]\\ 
! {\tt rv } &bottom friction for $V$-equation in V-point & [m$^2$s$^{-2}$]\\ 
! {\tt res\_du } & residual depth in U-point & [m]\\ 
! {\tt res\_u } & $x$-component of residual transport in U-point &
! [m$^2$s$^{-1}$]\\ 
! {\tt res\_dv } & residual depth in V-point & [m] \\ 
! {\tt res\_v } &$y$-component of residual transport in V-point &
! [m$^2$s$^{-1}$]\\ 
! {\tt surfdiv } &divergence of surface currents in T-point & [s$^{-1}$]\\ 
! \end{tabular}
! \caption{Public 2D variables.} 
! \label{table_2d_variables}
! \end{center}
! \end{table}
gotm's avatar
gotm committed
95 96
!
! !INPUT PARAMETERS:
kbk's avatar
kbk committed
97
   integer, intent(in)                 :: runtype
gotm's avatar
gotm committed
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
!
! !LOCAL VARIABLES:
!
!EOP
!-------------------------------------------------------------------------
!BOC
#ifdef DEBUG
   integer, save :: Ncall = 0
   Ncall = Ncall+1
   write(debug,*) 'init_variables_2d() # ',Ncall
#endif

   LEVEL2 'init_variables_2d'
   size2d_field=((imax+HALO)-(imin+HALO)+1)*((jmax+HALO)-(jmin+HALO)+1)
   mem2d=n2d_fields*size2d_field*REAL_SIZE

!  Allocates memory for the public data members - if not static
#ifndef STATIC
gotm's avatar
gotm committed
120
#include "dynamic_allocations_2d.h"
gotm's avatar
gotm committed
121 122
#endif

kbk's avatar
kbk committed
123 124 125
   z = _ZERO_; zu = _ZERO_; zv = _ZERO_
   U = _ZERO_; DU = _ZERO_; fU = _ZERO_; SlUx = _ZERO_; Slru = _ZERO_
   V = _ZERO_; DV = _ZERO_; fV = _ZERO_; SlVx = _ZERO_; Slrv = _ZERO_
kbk's avatar
kbk committed
126

kbk's avatar
kbk committed
127 128 129 130
   Uint = _ZERO_; Vint = _ZERO_
   UEx = _ZERO_; VEx = _ZERO_
   ru = _ZERO_; rv = _ZERO_
   res_du = _ZERO_; res_u = _ZERO_; res_dv = _ZERO_; res_v =  _ZERO_
kbk's avatar
kbk committed
131 132
   surfdiv = _ZERO_

gotm's avatar
gotm committed
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
#ifdef DEBUG
   write(debug,*) 'Leaving init_variables_2d()'
   write(debug,*)
#endif
   return
   end subroutine init_variables_2d
!EOC

!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: clean_variables_2d - cleanup after 2D run.
!
! !INTERFACE:
   subroutine clean_variables_2d()
   IMPLICIT NONE
!
! !INPUT PARAMETERS:
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
!
! !DESCRIPTION:
hb's avatar
hb committed
157
!  This routine is currently empty.
gotm's avatar
gotm committed
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
!
! !LOCAL VARIABLES:
!
!EOP
!-----------------------------------------------------------------------
!BOC
#ifdef DEBUG
   integer, save :: Ncall = 0
   Ncall = Ncall+1
   write(debug,*) 'clean_variables_2d() # ',Ncall
#endif

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

!-----------------------------------------------------------------------

   end module variables_2d

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