Fortran: Module Interface turbulence: its all in here ... (Source File: turbulence.F90)


INTERFACE:

    module turbulence
DESCRIPTION:

In this module, variables of the turbulence model and some member functions to manipulate them are defined. The key-functions are init_turbulence(), which initialises the model, and do_turbulence(), which manages the time step for the whole procedure. These two functions are the only `public' member functions i.e. they are callable from outside the module. There are many more internal functions, for which descriptions are provided seperately.

It should be pointed out that the turbulence module of GOTM may be used in combination with virtually any shallow-wate 3-D circulation model using a structured grid in the vertical direction. To this end, a clear interface separating the mean flow and the turbulence part of GOTM is required. Vertical columns of the three-dimensional fields have to copied into one-dimensional vectors, which are passed to GOTM. With the help of this information, GOTM updates the turbulent fields and returns one-dimensional vectors of the turbulent diffusivities and/or the turbulent fluxes to the 3-D model. The `door' between the 3-D model and GOTM is the function do_turbulence(), which has been designed with these ideas in mind.


USES:

    IMPLICIT NONE
 
    default: all is private.
    private
PUBLIC MEMBER FUNCTIONS:
    public init_turbulence, do_turbulence
    public k_bc,q2over2_bc,epsilon_bc,psi_bc,q2l_bc
    public clean_turbulence
 #ifdef _PRINTSTATE_
    public print_state_turbulence
 #endif
PUBLIC DATA MEMBERS:
    TKE, rate of dissipation, turbulent length-scale
    REALTYPE, public, dimension(:), allocatable   :: tke,eps,L
 
    TKE at old time level
    REALTYPE, public, dimension(:), allocatable   :: tkeo
 
    buoyancy variance and its destruction
    REALTYPE, public, dimension(:), allocatable   :: kb,epsb
 
    shear and buoyancy production
    of tke and buoyancy variance
    REALTYPE, public, dimension(:), allocatable   :: P,B,Pb
 
    turbulent diffusivities
    of momentum, temperature, salinity
    REALTYPE, public, dimension(:), allocatable   :: num,nuh,nus
 
    non-local fluxes of momentum
    REALTYPE, public, dimension(:), allocatable   :: gamu,gamv
 
    non-local fluxes
    of buoyancy, temperature, salinity
    REALTYPE, public, dimension(:), allocatable   :: gamb,gamh,gams
 
    non-dimensional  stability functions
    REALTYPE, public, dimension(:), allocatable   :: cmue1,cmue2
 
    non-dimensional counter-gradient term
    REALTYPE, public, dimension(:), allocatable   :: gam
 
    alpha_M, alpha_N, and alpha_B
    REALTYPE, public, dimension(:), allocatable   :: as,an,at
 
    time scale ratio r
    REALTYPE, public, dimension(:), allocatable   :: r
 
    the gradient Richardson number
    REALTYPE, public, dimension(:), allocatable   :: Rig
 
    the flux Richardson number
    REALTYPE, public, dimension(:), allocatable   :: xRf
 
    turbulent velocity variances
    REALTYPE, public, dimension(:), allocatable   :: uu,vv,ww
 
 # ifdef EXTRA_OUTPUT
 
    dummies for testing
    REALTYPE, public, dimension(:), allocatable   :: turb1,turb2,turb3,turb4,turb5
 
 # endif
 
    some additional constants
    REALTYPE, public                              :: cm0,cmsf,cde,rcm, b1
 
    Prandtl-number in neutrally stratified flow
    REALTYPE, public                              :: Prandtl0
 
    parameters for wave-breaking
    REALTYPE, public                              :: craig_m,sig_e0
 
    the 'turbulence' namelist
    integer, public                               :: turb_method
    integer, public                               :: tke_method
    integer, public                               :: len_scale_method
    integer, public                               :: stab_method
 
    the 'bc' namelist
    integer, public                               :: k_ubc
    integer, public                               :: k_lbc
    integer, public                               :: kb_ubc
    integer, public                               :: kb_lbc
    integer, public                               :: psi_ubc
    integer, public                               :: psi_lbc
    integer, public                               :: ubc_type
    integer, public                               :: lbc_type
 
    the 'turb_param' namelist
    REALTYPE, public                              :: cm0_fix
    REALTYPE, public                              :: Prandtl0_fix
    REALTYPE, public                              :: cw
    logical                                       :: compute_kappa
    REALTYPE, public                              :: kappa
    logical                                       :: compute_c3
    REALTYPE                                      :: ri_st
    logical,  public                              :: length_lim
    REALTYPE, public                              :: galp
    REALTYPE, public                              :: const_num
    REALTYPE, public                              :: const_nuh
    REALTYPE, public                              :: k_min
    REALTYPE, public                              :: eps_min
    REALTYPE, public                              :: kb_min
    REALTYPE, public                              :: epsb_min
 
    the 'generic' namelist
    logical                                       :: compute_param
    REALTYPE, public                              :: gen_m
    REALTYPE, public                              :: gen_n
    REALTYPE, public                              :: gen_p
    REALTYPE, public                              :: cpsi1
    REALTYPE, public                              :: cpsi2
    REALTYPE, public                              :: cpsi3minus
    REALTYPE, public                              :: cpsi3plus
    REALTYPE                                      :: sig_kpsi
    REALTYPE, public                              :: sig_psi
    REALTYPE                                      :: gen_d
    REALTYPE                                      :: gen_alpha
    REALTYPE                                      :: gen_l
 
    the 'keps' namelist
    REALTYPE, public                              :: ce1
    REALTYPE, public                              :: ce2
    REALTYPE, public                              :: ce3minus
    REALTYPE, public                              :: ce3plus
    REALTYPE, public                              :: sig_k
    REALTYPE, public                              :: sig_e
    logical,  public                              :: sig_peps
 
    the 'my' namelist
    REALTYPE, public                              :: e1
    REALTYPE, public                              :: e2
    REALTYPE, public                              :: e3
    REALTYPE, public                              :: sq
    REALTYPE, public                              :: sl
    integer,  public                              :: my_length
    logical,  public                              :: new_constr
 
    the 'scnd' namelist
    integer                                       ::  scnd_method
    integer                                       ::  kb_method
    integer                                       ::  epsb_method
    integer                                       ::  scnd_coeff
    REALTYPE ,public                              ::  cc1
    REALTYPE, public                              ::  ct1,ctt
    REALTYPE, public                              ::  cc2,cc3,cc4,cc5,cc6
    REALTYPE, public                              ::  ct2,ct3,ct4,ct5
 
    the a_i's for the ASM
    REALTYPE, public                              ::  a1,a2,a3,a4,a5
    REALTYPE, public                              ::  at1,at2,at3,at4,at5
 
 
    the 'iw' namelist
    integer,  public                              :: iw_model
    REALTYPE, public                              :: alpha
    REALTYPE, public                              :: klimiw
    REALTYPE, public                              :: rich_cr
    REALTYPE, public                              :: numiw
    REALTYPE, public                              :: nuhiw
    REALTYPE, public                              :: numshear
DEFINED PARAMETERS:
 
    general outline of the turbulence model
    integer, parameter, public                    :: convective=0
    integer, parameter, public                    :: algebraic=1
    integer, parameter, public                    :: first_order=2
    integer, parameter, public                    :: second_order=3
 
    method to update TKE
    integer, parameter, public                    :: tke_local_eq=1
    integer, parameter, public                    :: tke_keps=2
    integer, parameter, public                    :: tke_MY=3
 
    stability functions
    integer, parameter, public                    :: Constant=1
    integer, parameter, public                    :: MunkAnderson=2
    integer, parameter, public                    :: SchumGerz=3
    integer, parameter, public                    :: EiflerSchrimpf=4
 
    method to update length scale
    integer, parameter                            :: Parabola=1
    integer, parameter                            :: Triangle=2
    integer, parameter                            :: Xing=3
    integer, parameter                            :: RobertOuellet=4
    integer, parameter                            :: Blackadar=5
    integer, parameter                            :: BougeaultAndre=6
    integer, parameter                            :: ispra_length=7
    integer, parameter, public                    :: diss_eq=8
    integer, parameter, public                    :: length_eq=9
    integer, parameter, public                    :: generic_eq=10
 
    boundary conditions
    integer, parameter, public                    :: Dirichlet=0
    integer, parameter, public                    :: Neumann=1
    integer, parameter, public                    :: viscous=0
    integer, parameter, public                    :: logarithmic=1
    integer, parameter, public                    :: injection=2
 
    type of second-order model
    integer, parameter                            :: quasiEq=1
    integer, parameter                            :: weakEqKbEq=2
    integer, parameter                            :: weakEqKb=3
 
    method to solve equation for k_b
    integer, parameter                            :: kb_algebraic=1
    integer, parameter                            :: kb_dynamic=2
 
    method to solve equation for epsilon_b
    integer, parameter                            :: epsb_algebraic=1
    integer, parameter                            :: epsb_dynamic=2
BUGS:
          The algebraic equation for the TKE is not safe
          to use at the moment. Use it only in connection
          with the prescribed length-scale profiles. The
          functions report_model() will report wrong things
          for the algebraic TKE equation. To be fixed with
          the next version.
REVISION HISTORY:
    Original author(s): Karsten Bolding, Hans Burchard,
                        Manuel Ruiz Villarreal,
                        Lars Umlauf
 
    $Log: turbulence.F90,v $
    Revision 1.19  2010-09-17 12:53:52  jorn
    extensive code clean-up to ensure proper initialization and clean-up of all variables
    Revision 1.18  2007-07-23 11:28:39  hb
    cw for Craig-Banner wave breaking from namelist now used in fk_craig.F90
    Revision 1.17  2007-01-06 11:49:15  kbk
    namelist file extension changed .inp --> .nml
    Revision 1.16  2006-11-24 15:13:41  kbk
    de-allocate memory and close open files
    Revision 1.15  2005/11/15 11:35:02  lars
    documentation finish for print
    Revision 1.14  2005/09/13 10:00:54  kbk
    init_turbulence() now prints version - obtained from Makefile
    Revision 1.13  2005/08/11 13:00:15  lars
    Added explicit interface for xP. Bug found by Vicente Fernandez.
    Revision 1.12  2005/07/19 16:46:14  hb
    removed superfluous variables - NNT, NNS, SSU, SSV
    Revision 1.11  2005/07/19 16:33:22  hb
    moved  variances() from do_turbulence() to time_loop()
    Revision 1.10  2005/07/12 10:13:22  hb
    dependence of init_turbulence from depth, z0s, z0b removed
    Revision 1.9  2005/07/06 14:07:17  kbk
    added KPP, updated documentation, new structure of turbulence module
    Revision 1.7  2003/03/28 09:20:35  kbk
    added new copyright to files
    Revision 1.6  2003/03/28 08:20:01  kbk
    removed tabs
    Revision 1.5  2003/03/10 09:02:06  gotm
    Added new Generic Turbulence Model +
    improved documentation and cleaned up code
    Revision 1.3  2001/11/27 19:42:58  gotm
    Cleaned
    Revision 1.2  2001/11/18 16:15:30  gotm
    New generic two-equation model
    Revision 1.1.1.1  2001/02/12 15:55:58  gotm
    initial import into CVS



Subsections
Karsten Bolding 2012-01-24