variables_3d.F90 4.61 KB
Newer Older
1
!$Id: variables_3d.F90,v 1.5 2003-12-16 15:58:54 kbk Exp $
gotm's avatar
gotm committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !MODULE: variables_3d - global 3D related variables
!
! !INTERFACE:
   module variables_3d
!
! !DESCRIPTION:
!  This modules contains declarations for all variables related to 3D
!  hydrodynamical calculations. Information about the calculation domain
!  is included from the \emph{domain.F90} module.
!  The module contains public subroutines to initialise and cleanup.
!
! !USES:
   use domain,     only: iimin,iimax,jjmin,jjmax,kmax
   IMPLICIT NONE
!
! !PUBLIC DATA MEMBERS:
kbk's avatar
kbk committed
22
   REALTYPE                            :: dt,cnpar=0.9
23
   REALTYPE                            :: avmback=_ZERO_,avhback=_ZERO_
gotm's avatar
gotm committed
24 25
!
#ifdef STATIC
gotm's avatar
gotm committed
26
#include "static_3d.h"
gotm's avatar
gotm committed
27
#else
gotm's avatar
gotm committed
28
#include "dynamic_declarations_3d.h"
gotm's avatar
gotm committed
29
#endif
kbk's avatar
kbk committed
30 31
   integer                             :: size3d_field
   integer                             :: mem3d
gotm's avatar
gotm committed
32 33 34 35 36
!
! !REVISION HISTORY:
!  Original author(s): Karsten Bolding & Hans Burchard
!
!  $Log: variables_3d.F90,v $
37 38 39 40
!  Revision 1.5  2003-12-16 15:58:54  kbk
!  back ground viscosity and diffusivity (manuel)
!
!  Revision 1.4  2003/04/23 12:16:34  kbk
kbk's avatar
kbk committed
41 42 43
!  cleaned code + TABS to spaces
!
!  Revision 1.3  2003/04/07 16:22:31  kbk
kbk's avatar
kbk committed
44
!  initialise variables
gotm's avatar
gotm committed
45 46 47
!
!  Revision 1.1.1.1  2002/05/02 14:00:58  gotm
!  recovering after CVS crash
gotm's avatar
gotm committed
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
!
!  Revision 1.6  2001/09/19 13:07:00  bbh
!  Moved advection related 3D fields to global allocation
!
!  Revision 1.5  2001/09/01 17:10:25  bbh
!  Vertical coordinate definition now specified via namelist
!
!  Revision 1.4  2001/08/27 11:51:45  bbh
!  TVD-advection for momentum added, some bugs removed
!
!  Revision 1.3  2001/05/21 13:07:19  bbh
!  dt and cnpar is in variables_3d.F90
!
!  Revision 1.2  2001/05/18 08:25:52  bbh
!  Added zooming variables
!
!  Revision 1.1  2001/05/03 19:31:56  bbh
!  3D variables seperated from m3d
!
! !LOCAL VARIABLES:
!
!EOP
!-----------------------------------------------------------------------

   contains

!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: init_variables_3d - initialise 3D relatedstuff.
!
! !INTERFACE:
   subroutine init_variables_3d(runtype)
   IMPLICIT NONE
!
! !INPUT PARAMETERS:
kbk's avatar
kbk committed
84
   integer, intent(in)                 :: runtype
gotm's avatar
gotm committed
85 86 87 88 89 90 91 92 93 94 95 96 97
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
!
! !DESCRIPTION:
!  Allocates memiory for 3D related fields.
!
! !REVISION HISTORY:
!
!  See log for the module.
!
! !LOCAL VARIABLES:
kbk's avatar
kbk committed
98
   integer                   :: rc
gotm's avatar
gotm committed
99 100 101 102 103 104 105 106 107 108
!EOP
!-------------------------------------------------------------------------
!BOC
#ifdef DEBUG
   integer, save :: Ncall = 0
   Ncall = Ncall+1
   write(debug,*) 'init_variables_3d() # ',Ncall
#endif

   LEVEL2 'init_variables_3d'
kbk's avatar
kbk committed
109
   size3d_field=((iimax+HALO)-(iimin+HALO)+1)*        &
gotm's avatar
gotm committed
110 111 112 113 114
                ((jjmax+HALO)-(jjmin+HALO)+1)*(kmax+1)
   mem3d=n3d_fields*size3d_field*REAL_SIZE

!  Allocates memory for the public data members - if not static
#ifndef STATIC
gotm's avatar
gotm committed
115
#include "dynamic_allocations_3d.h"
gotm's avatar
gotm committed
116 117
#endif

kbk's avatar
kbk committed
118 119 120 121 122 123 124 125 126 127 128 129 130
   hn = _ZERO_ ; hun = _ZERO_ ; hvn = _ZERO_
   uu = _ZERO_ ; vv = _ZERO_ ; ww = _ZERO_
   ssen = _ZERO_ ; ssun = _ZERO_ ; ssvn = _ZERO_
   rru= _ZERO_ ; rrv= _ZERO_
   uuEx= _ZERO_ ; vvEx= _ZERO_
   tke=1.e-10 ; eps=1.e-10

#ifdef UV_TVD
   uadv = _ZERO_ ; vadv = _ZERO_ ; wadv = _ZERO_
   hnadv = _ZERO_ ; hoadv = _ZERO_
   huadv = _ZERO_ ; hvadv = _ZERO_
#endif

gotm's avatar
gotm committed
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 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 185 186 187
#ifdef DEBUG
   write(debug,*) 'Leaving init_variables_3d()'
   write(debug,*)
#endif
   return
   end subroutine init_variables_3d
!EOC

!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: clean_variables_3d - cleanup after 3D run.
!
! !INTERFACE:
   subroutine clean_variables_3d()
   IMPLICIT NONE
!
! !INPUT PARAMETERS:
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
!
! !DESCRIPTION:
!  This routine cleans up after a 3D integration. Close open files etc.
!
! !REVISION HISTORY:
!  See log for the module.
!
! !LOCAL VARIABLES:
!
!EOP
!-----------------------------------------------------------------------
!BOC
#ifdef DEBUG
   integer, save :: Ncall = 0
   Ncall = Ncall+1
   write(debug,*) 'clean_3d() # ',Ncall
#endif

! Deallocates memory for the public data members

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

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

   end module variables_3d

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