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.
dynadv.F90 in trunk/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: trunk/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv.F90 @ 4624

Last change on this file since 4624 was 4624, checked in by acc, 8 years ago

#1305. Fix slow start-up problems on some systems by introducing and using lwm logical to restrict output of merged namelists to the first (or only) processor. lwm is true only on the first processor regardless of ln_ctl. Small changes to all flavours of nemogcm.F90 are also required to write namctl and namcfg after the call to mynode which now opens output.namelist.dyn and writes nammpp.

  • Property svn:keywords set to Id
File size: 6.9 KB
Line 
1MODULE dynadv
2   !!==============================================================================
3   !!                       ***  MODULE  dynadv  ***
4   !! Ocean active tracers:  advection scheme control
5   !!==============================================================================
6   !! History :  1.0  !  2006-11  (G. Madec)  Original code
7   !!            3.3  !  2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase
8   !!----------------------------------------------------------------------
9
10   !!----------------------------------------------------------------------
11   !!   dyn_adv      : compute the momentum advection trend
12   !!   dyn_adv_init : control the different options of advection scheme
13   !!----------------------------------------------------------------------
14   USE dom_oce         ! ocean space and time domain
15   USE dynadv_cen2     ! centred flux form advection      (dyn_adv_cen2 routine)
16   USE dynadv_ubs      ! UBS flux form advection          (dyn_adv_ubs  routine)
17   USE dynkeg          ! kinetic energy gradient          (dyn_keg      routine)
18   USE dynzad          ! vertical advection               (dyn_zad      routine)
19   USE in_out_manager  ! I/O manager
20   USE lib_mpp         ! MPP library
21   USE timing          ! Timing
22
23   IMPLICIT NONE
24   PRIVATE
25
26   PUBLIC dyn_adv       ! routine called by step module
27   PUBLIC dyn_adv_init  ! routine called by opa module
28 
29   LOGICAL, PUBLIC ::   ln_dynadv_vec   !: vector form flag
30   LOGICAL, PUBLIC ::   ln_dynadv_cen2  !: flux form - 2nd order centered scheme flag
31   LOGICAL, PUBLIC ::   ln_dynadv_ubs   !: flux form - 3rd order UBS scheme flag
32   
33   INTEGER ::   nadv   ! choice of the formulation and scheme for the advection
34
35   !! * Substitutions
36#  include "domzgr_substitute.h90"
37#  include "vectopt_loop_substitute.h90"
38   !!----------------------------------------------------------------------
39   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
40   !! $Id$
41   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
42   !!----------------------------------------------------------------------
43CONTAINS
44
45   SUBROUTINE dyn_adv( kt )
46      !!---------------------------------------------------------------------
47      !!                  ***  ROUTINE dyn_adv  ***
48      !!               
49      !! ** Purpose :   compute the ocean momentum advection trend.
50      !!
51      !! ** Method  : - Update (ua,va) with the advection term following nadv
52      !!      NB: in flux form advection (ln_dynadv_cen2 or ln_dynadv_ubs=T)
53      !!      a metric term is add to the coriolis term while in vector form
54      !!      it is the relative vorticity which is added to coriolis term
55      !!      (see dynvor module).
56      !!----------------------------------------------------------------------
57      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
58      !!----------------------------------------------------------------------
59      !
60      IF( nn_timing == 1 )  CALL timing_start('dyn_adv')
61      !
62      SELECT CASE ( nadv )                  ! compute advection trend and add it to general trend
63      CASE ( 0 )     
64                      CALL dyn_keg     ( kt )    ! vector form : horizontal gradient of kinetic energy
65                      CALL dyn_zad     ( kt )    ! vector form : vertical advection
66      CASE ( 1 ) 
67                      CALL dyn_adv_cen2( kt )    ! 2nd order centered scheme
68      CASE ( 2 )   
69                      CALL dyn_adv_ubs ( kt )    ! 3rd order UBS      scheme
70      !
71      CASE (-1 )                                 ! esopa: test all possibility with control print
72                      CALL dyn_keg     ( kt )
73                      CALL dyn_zad     ( kt )
74                      CALL dyn_adv_cen2( kt )
75                      CALL dyn_adv_ubs ( kt )
76      END SELECT
77      !
78      IF( nn_timing == 1 )  CALL timing_stop('dyn_adv')
79      !
80   END SUBROUTINE dyn_adv
81
82   
83   SUBROUTINE dyn_adv_init
84      !!---------------------------------------------------------------------
85      !!                  ***  ROUTINE dyn_adv_init  ***
86      !!               
87      !! ** Purpose :   Control the consistency between namelist options for
88      !!              momentum advection formulation & scheme and set nadv
89      !!----------------------------------------------------------------------
90      INTEGER ::   ioptio
91      INTEGER  ::   ios                 ! Local integer output status for namelist read
92      !!
93      NAMELIST/namdyn_adv/ ln_dynadv_vec, ln_dynadv_cen2 , ln_dynadv_ubs
94      !!----------------------------------------------------------------------
95
96      REWIND( numnam_ref )              ! Namelist namdyn_adv in reference namelist : Momentum advection scheme
97      READ  ( numnam_ref, namdyn_adv, IOSTAT = ios, ERR = 901)
98901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_adv in reference namelist', lwp )
99
100      REWIND( numnam_cfg )              ! Namelist namdyn_adv in configuration namelist : Momentum advection scheme
101      READ  ( numnam_cfg, namdyn_adv, IOSTAT = ios, ERR = 902 )
102902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_adv in configuration namelist', lwp )
103      IF(lwm) WRITE ( numond, namdyn_adv )
104
105      IF(lwp) THEN                    ! Namelist print
106         WRITE(numout,*)
107         WRITE(numout,*) 'dyn_adv_init : choice/control of the momentum advection scheme'
108         WRITE(numout,*) '~~~~~~~~~~~'
109         WRITE(numout,*) '       Namelist namdyn_adv : chose a advection formulation & scheme for momentum'
110         WRITE(numout,*) '          Vector/flux form (T/F)             ln_dynadv_vec  = ', ln_dynadv_vec
111         WRITE(numout,*) '          2nd order centred advection scheme ln_dynadv_cen2 = ', ln_dynadv_cen2
112         WRITE(numout,*) '          3rd order UBS advection scheme     ln_dynadv_ubs  = ', ln_dynadv_ubs
113      ENDIF
114
115      ioptio = 0                      ! Parameter control
116      IF( ln_dynadv_vec  )   ioptio = ioptio + 1
117      IF( ln_dynadv_cen2 )   ioptio = ioptio + 1
118      IF( ln_dynadv_ubs  )   ioptio = ioptio + 1
119      IF( lk_esopa       )   ioptio =          1
120
121      IF( ioptio /= 1 )   CALL ctl_stop( 'Choose ONE advection scheme in namelist namdyn_adv' )
122
123      !                               ! Set nadv
124      IF( ln_dynadv_vec  )   nadv =  0 
125      IF( ln_dynadv_cen2 )   nadv =  1
126      IF( ln_dynadv_ubs  )   nadv =  2
127      IF( lk_esopa       )   nadv = -1
128
129      IF(lwp) THEN                    ! Print the choice
130         WRITE(numout,*)
131         IF( nadv ==  0 )   WRITE(numout,*) '         vector form : keg + zad + vor is used'
132         IF( nadv ==  1 )   WRITE(numout,*) '         flux form   : 2nd order scheme is used'
133         IF( nadv ==  2 )   WRITE(numout,*) '         flux form   : UBS       scheme is used'
134         IF( nadv == -1 )   WRITE(numout,*) '         esopa test: use all advection formulation'
135      ENDIF
136      !
137   END SUBROUTINE dyn_adv_init
138
139  !!======================================================================
140END MODULE dynadv
Note: See TracBrowser for help on using the repository browser.