variables_3d.F90 4.45 KB
Newer Older
kbk's avatar
kbk committed
1
!$Id: variables_3d.F90,v 1.4 2003-04-23 12:16:34 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
gotm's avatar
gotm committed
23 24
!
#ifdef STATIC
gotm's avatar
gotm committed
25
#include "static_3d.h"
gotm's avatar
gotm committed
26
#else
gotm's avatar
gotm committed
27
#include "dynamic_declarations_3d.h"
gotm's avatar
gotm committed
28
#endif
kbk's avatar
kbk committed
29 30
   integer                             :: size3d_field
   integer                             :: mem3d
gotm's avatar
gotm committed
31 32 33 34 35
!
! !REVISION HISTORY:
!  Original author(s): Karsten Bolding & Hans Burchard
!
!  $Log: variables_3d.F90,v $
kbk's avatar
kbk committed
36 37 38 39
!  Revision 1.4  2003-04-23 12:16:34  kbk
!  cleaned code + TABS to spaces
!
!  Revision 1.3  2003/04/07 16:22:31  kbk
kbk's avatar
kbk committed
40
!  initialise variables
gotm's avatar
gotm committed
41 42 43
!
!  Revision 1.1.1.1  2002/05/02 14:00:58  gotm
!  recovering after CVS crash
gotm's avatar
gotm committed
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
!
!  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
80
   integer, intent(in)                 :: runtype
gotm's avatar
gotm committed
81 82 83 84 85 86 87 88 89 90 91 92 93
!
! !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
94
   integer                   :: rc
gotm's avatar
gotm committed
95 96 97 98 99 100 101 102 103 104
!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
105
   size3d_field=((iimax+HALO)-(iimin+HALO)+1)*        &
gotm's avatar
gotm committed
106 107 108 109 110
                ((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
111
#include "dynamic_allocations_3d.h"
gotm's avatar
gotm committed
112 113
#endif

kbk's avatar
kbk committed
114 115 116 117 118 119 120 121 122 123 124 125 126
   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
127 128 129 130 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
#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)         !
!-----------------------------------------------------------------------