New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
ldftra.F90 in branches/UKMO/test_moci_test_suite_namelist_read/NEMOGCM/NEMO/OPA_SRC/LDF – NEMO

source: branches/UKMO/test_moci_test_suite_namelist_read/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra.F90 @ 9383

Last change on this file since 9383 was 9383, checked in by andmirek, 6 years ago

#2050 fixes and changes

File size: 10.4 KB
Line 
1MODULE ldftra
2   !!======================================================================
3   !!                       ***  MODULE  ldftra  ***
4   !! Ocean physics:  lateral diffusivity coefficient
5   !!=====================================================================
6   !! History :        ! 1997-07  (G. Madec)  from inimix.F split in 2 routines
7   !!   NEMO      1.0  ! 2002-09  (G. Madec)  F90: Free form and module
8   !!             2.0  ! 2005-11  (G. Madec) 
9   !!----------------------------------------------------------------------
10
11   !!----------------------------------------------------------------------
12   !!   ldf_tra_init : initialization, namelist read, and parameters control
13   !!   ldf_tra_c3d   : 3D eddy viscosity coefficient initialization
14   !!   ldf_tra_c2d   : 2D eddy viscosity coefficient initialization
15   !!   ldf_tra_c1d   : 1D eddy viscosity coefficient initialization
16   !!----------------------------------------------------------------------
17   USE oce             ! ocean dynamics and tracers
18   USE dom_oce         ! ocean space and time domain
19   USE phycst          ! physical constants
20   USE ldftra_oce      ! ocean tracer   lateral physics
21   USE ldfslp          ! ???
22   USE in_out_manager  ! I/O manager
23   USE ioipsl
24   USE lib_mpp         ! distribued memory computing library
25   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
26
27   IMPLICIT NONE
28   PRIVATE
29
30   PUBLIC   ldf_tra_init   ! called by opa.F90
31   PRIVATE  tra_namelist
32
33   !! * Substitutions
34#  include "domzgr_substitute.h90"
35#  include "vectopt_loop_substitute.h90"
36   !!----------------------------------------------------------------------
37   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
38   !! $Id$
39   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
40   !!----------------------------------------------------------------------
41CONTAINS
42
43   SUBROUTINE ldf_tra_init
44      !!----------------------------------------------------------------------
45      !!                  ***  ROUTINE ldf_tra_init  ***
46      !!
47      !! ** Purpose :   initializations of the tracer lateral mixing coeff.
48      !!
49      !! ** Method  :   the Eddy diffusivity and eddy induced velocity ceoff.
50      !!      are defined as follows:
51      !!         default option   : constant coef. aht0, aeiv0 (namelist)
52      !!        'key_traldf_c1d': depth dependent coef. defined in
53      !!                            in ldf_tra_c1d routine
54      !!        'key_traldf_c2d': latitude and longitude dependent coef.
55      !!                            defined in ldf_tra_c2d routine
56      !!        'key_traldf_c3d': latitude, longitude, depth dependent coef.
57      !!                            defined in ldf_tra_c3d routine
58      !!
59      !!      N.B. User defined include files.  By default, 3d and 2d coef.
60      !!      are set to a constant value given in the namelist and the 1d
61      !!      coefficients are initialized to a hyperbolic tangent vertical
62      !!      profile.
63      !!----------------------------------------------------------------------
64      INTEGER ::   ioptio               ! temporary integer
65      INTEGER ::   ios                  ! temporary integer
66      LOGICAL ::   ll_print = .FALSE.   ! =T print eddy coef. in numout
67      !!
68      NAMELIST/namtra_ldf/ ln_traldf_lap  , ln_traldf_bilap,                  &
69         &                 ln_traldf_level, ln_traldf_hor  , ln_traldf_iso,   &
70         &                 ln_traldf_grif , ln_traldf_gdia ,                  &
71         &                 ln_triad_iso   , ln_botmix_grif ,                  &
72         &                 rn_aht_0       , rn_ahtb_0      , rn_aeiv_0,       &
73         &                 rn_slpmax      , rn_chsmag      ,    rn_smsh,      &
74         &                 rn_aht_m
75      !!----------------------------------------------------------------------
76
77      !  Define the lateral tracer physics parameters
78      ! =============================================
79   
80      IF(lwm) THEN
81         REWIND( numnam_ref )              ! Namelist namtra_ldf in reference namelist : Lateral physics on tracers
82         READ  ( numnam_ref, namtra_ldf, IOSTAT = ios, ERR = 901)
83901      CONTINUE
84      ENDIF
85      call mpp_bcast(ios)
86      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_ldf in reference namelist', lwp )
87      IF(lwm) THEN
88         REWIND( numnam_cfg )              ! Namelist namtra_ldf in configuration namelist : Lateral physics on tracers
89         READ  ( numnam_cfg, namtra_ldf, IOSTAT = ios, ERR = 902 )
90902      CONTINUE
91      ENDIF
92      call mpp_bcast(ios)
93      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtra_ldf in configuration namelist', lwp )
94
95      IF(lwm) WRITE ( numond, namtra_ldf )
96
97      CALL tra_namelist()
98
99      IF(lwp) THEN                      ! control print
100         WRITE(numout,*)
101         WRITE(numout,*) 'ldf_tra_init : lateral tracer physics'
102         WRITE(numout,*) '~~~~~~~~~~~~ '
103         WRITE(numout,*) '   Namelist namtra_ldf : lateral mixing parameters (type, direction, coefficients)'
104         WRITE(numout,*) '      laplacian operator            ln_traldf_lap   = ', ln_traldf_lap
105         WRITE(numout,*) '      bilaplacian operator          ln_traldf_bilap = ', ln_traldf_bilap
106         WRITE(numout,*) '      iso-level                     ln_traldf_level = ', ln_traldf_level
107         WRITE(numout,*) '      horizontal (geopotential)     ln_traldf_hor   = ', ln_traldf_hor
108         WRITE(numout,*) '      iso-neutral                   ln_traldf_iso   = ', ln_traldf_iso
109         WRITE(numout,*) '      iso-neutral (Griffies)        ln_traldf_grif  = ', ln_traldf_grif
110         WRITE(numout,*) '      Griffies strmfn diagnostics   ln_traldf_gdia  = ', ln_traldf_gdia
111         WRITE(numout,*) '      lateral eddy diffusivity      rn_aht_0        = ', rn_aht_0
112         WRITE(numout,*) '      background hor. diffusivity   rn_ahtb_0       = ', rn_ahtb_0
113         WRITE(numout,*) '      eddy induced velocity coef.   rn_aeiv_0       = ', rn_aeiv_0
114         WRITE(numout,*) '      maximum isoppycnal slope      rn_slpmax       = ', rn_slpmax
115         WRITE(numout,*) '      pure lateral mixing in ML     ln_triad_iso    = ', ln_triad_iso
116         WRITE(numout,*) '      lateral mixing on bottom      ln_botmix_grif  = ', ln_botmix_grif
117         WRITE(numout,*)
118      ENDIF
119
120      !                                ! convert DOCTOR namelist names into OLD names
121      aht0  = rn_aht_0
122      ahtb0 = rn_ahtb_0
123      aeiv0 = rn_aeiv_0
124
125      !                                ! Parameter control
126
127      ! ... Check consistency for type and direction :
128      !           ==> will be done in traldf module
129
130      ! ... Space variation of eddy coefficients
131      ioptio = 0
132#if defined key_traldf_c3d
133      IF(lwp) WRITE(numout,*) '          tracer mixing coef. = F( latitude, longitude, depth)'
134      ioptio = ioptio + 1
135#endif
136#if defined key_traldf_c2d
137      IF(lwp) WRITE(numout,*) '          tracer mixing coef. = F( latitude, longitude)'
138      ioptio = ioptio + 1
139#endif
140#if defined key_traldf_c1d
141      IF(lwp) WRITE(numout,*) '          tracer mixing coef. = F( depth )'
142      ioptio = ioptio + 1
143      IF( .NOT. ln_zco )   CALL ctl_stop( 'key_traldf_c1d can only be used in z-coordinate - full step' )
144#endif
145      IF( ioptio == 0 ) THEN
146          IF(lwp) WRITE(numout,*) '          tracer mixing coef. = constant (default option)'
147        ELSEIF( ioptio > 1 ) THEN
148           CALL ctl_stop('          use only one of the following keys:',   &
149             &           ' key_traldf_c3d, key_traldf_c2d, key_traldf_c1d' )
150      ENDIF
151
152      IF( ln_traldf_bilap ) THEN
153         IF(lwp) WRITE(numout,*) '          biharmonic tracer diffusion'
154         IF( aht0 > 0 .AND. .NOT. lk_esopa )   CALL ctl_stop( 'The horizontal diffusivity coef. aht0 must be negative' )
155      ELSE
156         IF(lwp) WRITE(numout,*) '          harmonic tracer diffusion (default)'
157         IF( aht0 < 0 .AND. .NOT. lk_esopa )   CALL ctl_stop('The horizontal diffusivity coef. aht0 must be positive' )
158      ENDIF
159
160
161      !  Lateral eddy diffusivity and eddy induced velocity coefficients
162      ! ================================================================
163#if defined key_traldf_c3d
164      CALL ldf_tra_c3d( ll_print )      ! aht = 3D coef. = F( longitude, latitude, depth )
165#elif defined key_traldf_c2d
166      CALL ldf_tra_c2d( ll_print )      ! aht = 2D coef. = F( longitude, latitude )
167#elif defined key_traldf_c1d
168      CALL ldf_tra_c1d( ll_print )      ! aht = 1D coef. = F( depth )
169#else
170                                        ! Constant coefficients
171      IF(lwp)WRITE(numout,*)
172      IF(lwp)WRITE(numout,*) '      constant eddy diffusivity coef.   ahtu = ahtv = ahtw = aht0 = ', aht0
173      IF( lk_traldf_eiv ) THEN
174         IF(lwp)WRITE(numout,*) '      constant eddy induced velocity coef.   aeiu = aeiv = aeiw = aeiv0 = ', aeiv0
175     
176      ENDIF
177#endif
178
179#if defined key_traldf_smag && ! defined key_traldf_c3d
180        CALL ctl_stop( 'key_traldf_smag can only be used with key_traldf_c3d' )
181#endif
182#if defined key_traldf_smag
183        IF(lwp) WRITE(numout,*)' SMAGORINSKY DIFFUSION'
184        IF(lwp .AND. rn_smsh < 1)  WRITE(numout,*)' only  shear is used '
185        IF(lwp.and.ln_traldf_bilap) CALL ctl_stop(' SMAGORINSKY + BILAPLACIAN - UNSTABLE OR NON_CONSERVATIVE' )
186#endif
187
188      !
189   END SUBROUTINE ldf_tra_init
190
191   SUBROUTINE tra_namelist()
192     !!---------------------------------------------------------------------
193     !!                   ***  ROUTINE tra_namelist  ***
194     !!                     
195     !! ** Purpose :   Broadcast namelist variables read by procesor lwm
196     !!
197     !! ** Method  :   use lib_mpp
198     !!----------------------------------------------------------------------
199#if defined key_mpp_mpi
200      CALL mpp_bcast(ln_traldf_lap)
201      CALL mpp_bcast(ln_traldf_bilap)
202      CALL mpp_bcast(ln_traldf_level)
203      CALL mpp_bcast(ln_traldf_hor)
204      CALL mpp_bcast(ln_traldf_iso)
205      CALL mpp_bcast(ln_traldf_grif)
206      CALL mpp_bcast(ln_traldf_gdia)
207      CALL mpp_bcast(ln_triad_iso)
208      CALL mpp_bcast(ln_botmix_grif)
209      CALL mpp_bcast(rn_aht_0)
210      CALL mpp_bcast(rn_ahtb_0)
211      CALL mpp_bcast(rn_aeiv_0)
212      CALL mpp_bcast(rn_slpmax)
213      CALL mpp_bcast(rn_chsmag)
214      CALL mpp_bcast(rn_smsh)
215      CALL mpp_bcast(rn_aht_m)
216#endif
217   END SUBROUTINE tra_namelist
218
219#if defined key_traldf_c3d
220#   include "ldftra_c3d.h90"
221#elif defined key_traldf_c2d
222#   include "ldftra_c2d.h90"
223#elif defined key_traldf_c1d
224#   include "ldftra_c1d.h90"
225#endif
226
227   !!======================================================================
228END MODULE ldftra
Note: See TracBrowser for help on using the repository browser.