variables_3d.F90 5.44 KB
Newer Older
1
!$Id: variables_3d.F90,v 1.7 2005-09-23 11:27:10 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_
24
   character(len=64)                   :: adv_schemes(7)
gotm's avatar
gotm committed
25 26
!
#ifdef STATIC
gotm's avatar
gotm committed
27
#include "static_3d.h"
gotm's avatar
gotm committed
28
#else
gotm's avatar
gotm committed
29
#include "dynamic_declarations_3d.h"
30 31 32 33 34
#endif

#ifdef GETM_BIO
   REALTYPE, allocatable               :: cc3d(:,:,:,:)
   REALTYPE, allocatable               :: ws3d(:,:,:,:)
gotm's avatar
gotm committed
35
#endif
kbk's avatar
kbk committed
36 37
   integer                             :: size3d_field
   integer                             :: mem3d
gotm's avatar
gotm committed
38 39 40 41 42
!
! !REVISION HISTORY:
!  Original author(s): Karsten Bolding & Hans Burchard
!
!  $Log: variables_3d.F90,v $
43 44 45 46
!  Revision 1.7  2005-09-23 11:27:10  kbk
!  support for biology via GOTMs biology modules
!
!  Revision 1.6  2004/01/06 15:04:00  kbk
47 48 49
!  FCT advection + split of advection_3d.F90 + extra adv. input checks
!
!  Revision 1.5  2003/12/16 15:58:54  kbk
50 51 52
!  back ground viscosity and diffusivity (manuel)
!
!  Revision 1.4  2003/04/23 12:16:34  kbk
kbk's avatar
kbk committed
53 54 55
!  cleaned code + TABS to spaces
!
!  Revision 1.3  2003/04/07 16:22:31  kbk
kbk's avatar
kbk committed
56
!  initialise variables
gotm's avatar
gotm committed
57 58 59
!
!  Revision 1.1.1.1  2002/05/02 14:00:58  gotm
!  recovering after CVS crash
gotm's avatar
gotm committed
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 95
!
!  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
96
   integer, intent(in)                 :: runtype
gotm's avatar
gotm committed
97 98 99 100 101 102 103 104 105 106 107 108 109
!
! !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
110
   integer                   :: rc
gotm's avatar
gotm committed
111 112 113 114 115 116 117 118 119 120
!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
121
   size3d_field=((iimax+HALO)-(iimin+HALO)+1)*        &
gotm's avatar
gotm committed
122 123 124 125 126
                ((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
127
#include "dynamic_allocations_3d.h"
gotm's avatar
gotm committed
128 129
#endif

kbk's avatar
kbk committed
130 131 132 133 134 135 136
   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

137 138
   light=_ONE_

kbk's avatar
kbk committed
139 140 141 142 143 144
#ifdef UV_TVD
   uadv = _ZERO_ ; vadv = _ZERO_ ; wadv = _ZERO_
   hnadv = _ZERO_ ; hoadv = _ZERO_
   huadv = _ZERO_ ; hvadv = _ZERO_
#endif

145 146 147 148 149 150 151 152
   adv_schemes(1) = "3D first-order upstream advection"
   adv_schemes(2) = "upstream advection (first-order, monotone)"
   adv_schemes(3) = "P2-PDM advection (third-order, non-monotone)"
   adv_schemes(4) = "TVD-Superbee advection (second-order, monotone)"
   adv_schemes(5) = "TVD-MUSCL advection (second-order, monotone)"
   adv_schemes(6) = "TVD-P2-PDM advection (third-order, monotone)"
   adv_schemes(7) = "2D-FCT advection"

gotm's avatar
gotm committed
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 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
#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)         !
!-----------------------------------------------------------------------