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 branches/2014/dev_r4650_UKMO11_restart_functionality/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: branches/2014/dev_r4650_UKMO11_restart_functionality/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv.F90 @ 5313

Last change on this file since 5313 was 5313, checked in by timgraham, 9 years ago

Merged head of trunk (r5302) into branch

  • Property svn:keywords set to Id
File size: 7.8 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   LOGICAL, PUBLIC ::   ln_dynzad_zts   !: vertical advection with sub-timestepping (requires vector form)
33   
34   INTEGER ::   nadv   ! choice of the formulation and scheme for the advection
35
36   !! * Substitutions
37#  include "domzgr_substitute.h90"
38#  include "vectopt_loop_substitute.h90"
39   !!----------------------------------------------------------------------
40   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
41   !! $Id$
42   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
43   !!----------------------------------------------------------------------
44CONTAINS
45
46   SUBROUTINE dyn_adv( kt )
47      !!---------------------------------------------------------------------
48      !!                  ***  ROUTINE dyn_adv  ***
49      !!               
50      !! ** Purpose :   compute the ocean momentum advection trend.
51      !!
52      !! ** Method  : - Update (ua,va) with the advection term following nadv
53      !!      NB: in flux form advection (ln_dynadv_cen2 or ln_dynadv_ubs=T)
54      !!      a metric term is add to the coriolis term while in vector form
55      !!      it is the relative vorticity which is added to coriolis term
56      !!      (see dynvor module).
57      !!----------------------------------------------------------------------
58      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
59      !!----------------------------------------------------------------------
60      !
61      IF( nn_timing == 1 )  CALL timing_start('dyn_adv')
62      !
63      SELECT CASE ( nadv )                  ! compute advection trend and add it to general trend
64      CASE ( 0 )     
65                      CALL dyn_keg     ( kt )    ! vector form : horizontal gradient of kinetic energy
66                      CALL dyn_zad     ( kt )    ! vector form : vertical advection
67      CASE ( 1 )     
68                      CALL dyn_keg     ( kt )    ! vector form : horizontal gradient of kinetic energy
69                      CALL dyn_zad_zts ( kt )    ! vector form : vertical advection with sub-timestepping
70      CASE ( 2 ) 
71                      CALL dyn_adv_cen2( kt )    ! 2nd order centered scheme
72      CASE ( 3 )   
73                      CALL dyn_adv_ubs ( kt )    ! 3rd order UBS      scheme
74      !
75      CASE (-1 )                                 ! esopa: test all possibility with control print
76                      CALL dyn_keg     ( kt )
77                      CALL dyn_zad     ( kt )
78                      CALL dyn_adv_cen2( kt )
79                      CALL dyn_adv_ubs ( kt )
80      END SELECT
81      !
82      IF( nn_timing == 1 )  CALL timing_stop('dyn_adv')
83      !
84   END SUBROUTINE dyn_adv
85
86   
87   SUBROUTINE dyn_adv_init
88      !!---------------------------------------------------------------------
89      !!                  ***  ROUTINE dyn_adv_init  ***
90      !!               
91      !! ** Purpose :   Control the consistency between namelist options for
92      !!              momentum advection formulation & scheme and set nadv
93      !!----------------------------------------------------------------------
94      INTEGER ::   ioptio
95      INTEGER  ::   ios                 ! Local integer output status for namelist read
96      !!
97      NAMELIST/namdyn_adv/ ln_dynadv_vec, ln_dynadv_cen2 , ln_dynadv_ubs, ln_dynzad_zts
98      !!----------------------------------------------------------------------
99
100      REWIND( numnam_ref )              ! Namelist namdyn_adv in reference namelist : Momentum advection scheme
101      READ  ( numnam_ref, namdyn_adv, IOSTAT = ios, ERR = 901)
102901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_adv in reference namelist', lwp )
103
104      REWIND( numnam_cfg )              ! Namelist namdyn_adv in configuration namelist : Momentum advection scheme
105      READ  ( numnam_cfg, namdyn_adv, IOSTAT = ios, ERR = 902 )
106902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_adv in configuration namelist', lwp )
107      IF(lwm) WRITE ( numond, namdyn_adv )
108
109      IF(lwp) THEN                    ! Namelist print
110         WRITE(numout,*)
111         WRITE(numout,*) 'dyn_adv_init : choice/control of the momentum advection scheme'
112         WRITE(numout,*) '~~~~~~~~~~~'
113         WRITE(numout,*) '       Namelist namdyn_adv : chose a advection formulation & scheme for momentum'
114         WRITE(numout,*) '          Vector/flux form (T/F)             ln_dynadv_vec  = ', ln_dynadv_vec
115         WRITE(numout,*) '          2nd order centred advection scheme ln_dynadv_cen2 = ', ln_dynadv_cen2
116         WRITE(numout,*) '          3rd order UBS advection scheme     ln_dynadv_ubs  = ', ln_dynadv_ubs
117         WRITE(numout,*) '      Sub timestepping of vertical advection ln_dynzad_zts  = ', ln_dynzad_zts
118      ENDIF
119
120      ioptio = 0                      ! Parameter control
121      IF( ln_dynadv_vec  )   ioptio = ioptio + 1
122      IF( ln_dynadv_cen2 )   ioptio = ioptio + 1
123      IF( ln_dynadv_ubs  )   ioptio = ioptio + 1
124      IF( lk_esopa       )   ioptio =          1
125
126      IF( ioptio /= 1 )   CALL ctl_stop( 'Choose ONE advection scheme in namelist namdyn_adv' )
127      IF( ln_dynzad_zts .AND. .NOT. ln_dynadv_vec )   &
128          CALL ctl_stop( 'Sub timestepping of vertical advection requires vector form; set ln_dynadv_vec = .TRUE.' )
129      IF( ln_dynzad_zts .AND. ln_isfcav )   &
130          CALL ctl_stop( 'Sub timestepping of vertical advection does not work with ln_isfcav = .TRUE.' )
131
132      !                               ! Set nadv
133      IF( ln_dynadv_vec  )   nadv =  0 
134      IF( ln_dynzad_zts  )   nadv =  1
135      IF( ln_dynadv_cen2 )   nadv =  2
136      IF( ln_dynadv_ubs  )   nadv =  3
137      IF( lk_esopa       )   nadv = -1
138
139      IF(lwp) THEN                    ! Print the choice
140         WRITE(numout,*)
141         IF( nadv ==  0 )   WRITE(numout,*) '         vector form : keg + zad + vor is used'
142         IF( nadv ==  1 )   WRITE(numout,*) '         vector form : keg + zad_zts + vor is used'
143         IF( nadv ==  2 )   WRITE(numout,*) '         flux form   : 2nd order scheme is used'
144         IF( nadv ==  3 )   WRITE(numout,*) '         flux form   : UBS       scheme is used'
145         IF( nadv == -1 )   WRITE(numout,*) '         esopa test: use all advection formulation'
146      ENDIF
147      !
148   END SUBROUTINE dyn_adv_init
149
150  !!======================================================================
151END MODULE dynadv
Note: See TracBrowser for help on using the repository browser.