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.
dynspg.F90 in branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg.F90 @ 2287

Last change on this file since 2287 was 2287, checked in by smasson, 13 years ago

update licence of all NEMO files...

  • Property svn:keywords set to Id
File size: 8.8 KB
Line 
1MODULE dynspg
2   !!======================================================================
3   !!                       ***  MODULE  dynspg  ***
4   !! Ocean dynamics:  surface pressure gradient control
5   !!======================================================================
6   !! History :  1.0  ! 2005-12  (C. Talandier, G. Madec, V. Garnier)  Original code
7   !!            3.2  ! 2009-07  (R. Benshila)  Suppression of rigid-lid option
8   !!----------------------------------------------------------------------
9
10   !!----------------------------------------------------------------------
11   !!   dyn_spg     : update the dynamics trend with the lateral diffusion
12   !!   dyn_spg_ctl : initialization, namelist read, and parameters control
13   !!----------------------------------------------------------------------
14   USE oce            ! ocean dynamics and tracers variables
15   USE dom_oce        ! ocean space and time domain variables
16   USE obc_oce        ! ocean open boundary conditions
17   USE dynspg_oce     ! surface pressure gradient variables
18   USE dynspg_exp     ! surface pressure gradient     (dyn_spg_exp routine)
19   USE dynspg_ts      ! surface pressure gradient     (dyn_spg_ts  routine)
20   USE dynspg_flt     ! surface pressure gradient     (dyn_spg_flt routine)
21   USE trdmod         ! ocean dynamics trends
22   USE trdmod_oce     ! ocean variables trends
23   USE prtctl         ! Print control                     (prt_ctl routine)
24   USE in_out_manager ! I/O manager
25
26   IMPLICIT NONE
27   PRIVATE
28
29   PUBLIC   dyn_spg        ! routine called by step module
30   PUBLIC   dyn_spg_init   ! routine called by opa module
31
32   INTEGER ::   nspg = 0   ! type of surface pressure gradient scheme defined from lk_dynspg_...
33
34   !! * Substitutions
35#  include "domzgr_substitute.h90"
36#  include "vectopt_loop_substitute.h90"
37   !!----------------------------------------------------------------------
38   !! NEMO/OPA 3.2 , LODYC-IPSL  (2009)
39   !! $Id$
40   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
41   !!----------------------------------------------------------------------
42
43CONTAINS
44
45   SUBROUTINE dyn_spg( kt, kindic )
46      !!----------------------------------------------------------------------
47      !!                  ***  ROUTINE dyn_spg  ***
48      !!
49      !! ** Purpose :   achieve the momentum time stepping by computing the
50      !!              last trend, the surface pressure gradient, and performing
51      !!              the Leap-Frog integration.
52      !!gm              In the current version only the filtered solution provide
53      !!gm            the after velocity, in the 2 other (ua,va) are still the trends
54      !!
55      !! ** Method  :   Three schemes:
56      !!              - explicit computation      : the spg is evaluated at now
57      !!              - filtered computation      : the Roulet & madec (2000) technique is used
58      !!              - split-explicit computation: a time splitting technique is used
59      !!
60      !! N.B. : When key_esopa is used all the scheme are tested, regardless
61      !!        of the physical meaning of the results.
62      !!----------------------------------------------------------------------
63      INTEGER, INTENT(in   ) ::   kt       ! ocean time-step index
64      INTEGER, INTENT(  out) ::   kindic   ! solver flag
65      !!
66      REAL(wp) ::   z2dt   ! temporary scalar
67      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ztrdu, ztrdv   ! 3D workspace
68      !!----------------------------------------------------------------------
69
70
71!!gm NOTA BENE : the dynspg_exp and dynspg_ts should be modified so that
72!!gm             they return the after velocity, not the trends (as in trazdf_imp...)
73!!gm             In this case, change/simplify dynnxt
74
75
76
77      IF( l_trddyn )   THEN                      ! temporary save of ta and sa trends
78         ztrdu(:,:,:) = ua(:,:,:)
79         ztrdv(:,:,:) = va(:,:,:)
80      ENDIF
81
82      SELECT CASE ( nspg )                       ! compute surf. pressure gradient trend and add it to the general trend
83      !                                                     
84      CASE (  0 )   ;   CALL dyn_spg_exp( kt )              ! explicit
85      CASE (  1 )   ;   CALL dyn_spg_ts ( kt )              ! time-splitting
86      CASE (  2 )   ;   CALL dyn_spg_flt( kt, kindic )      ! filtered
87      !                                                   
88      CASE ( -1 )                                ! esopa: test all possibility with control print
89                        CALL dyn_spg_exp( kt )
90                        CALL prt_ctl( tab3d_1=ua, clinfo1=' spg0 - Ua: ', mask1=umask, &
91         &                            tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
92                        CALL dyn_spg_ts ( kt )
93                        CALL prt_ctl( tab3d_1=ua, clinfo1=' spg1 - Ua: ', mask1=umask, &
94         &                           tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
95                        CALL dyn_spg_flt( kt, kindic )
96                        CALL prt_ctl( tab3d_1=ua, clinfo1=' spg2 - Ua: ', mask1=umask, &
97         &                            tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
98      END SELECT
99      !                   
100      IF( l_trddyn )   THEN                      ! save the surface pressure gradient trends for further diagnostics
101         SELECT CASE ( nspg )
102         CASE ( 0, 1 )
103            ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:)
104            ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
105         CASE( 2 )
106            z2dt = 2. * rdt
107            IF( neuler == 0 .AND. kt == nit000 ) z2dt = rdt
108            ztrdu(:,:,:) = ( ua(:,:,:) - ub(:,:,:) ) / z2dt - ztrdu(:,:,:)
109            ztrdv(:,:,:) = ( va(:,:,:) - vb(:,:,:) ) / z2dt - ztrdv(:,:,:)
110         END SELECT
111         CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_spg, 'DYN', kt )
112      ENDIF
113      !                                          ! print mean trends (used for debugging)
114      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' spg  - Ua: ', mask1=umask, &
115         &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
116      !
117   END SUBROUTINE dyn_spg
118
119
120   SUBROUTINE dyn_spg_init
121      !!---------------------------------------------------------------------
122      !!                  ***  ROUTINE dyn_spg_init  ***
123      !!               
124      !! ** Purpose :   Control the consistency between cpp options for
125      !!              surface pressure gradient schemes
126      !!----------------------------------------------------------------------
127      INTEGER ::   ioptio
128      !!----------------------------------------------------------------------
129
130      IF(lwp) THEN             ! Control print
131         WRITE(numout,*)
132         WRITE(numout,*) 'dyn_spg_init : choice of the surface pressure gradient scheme'
133         WRITE(numout,*) '~~~~~~~~~~~'
134         WRITE(numout,*) '     Explicit free surface                  lk_dynspg_exp = ', lk_dynspg_exp
135         WRITE(numout,*) '     Free surface with time splitting       lk_dynspg_ts  = ', lk_dynspg_ts
136         WRITE(numout,*) '     Filtered free surface cst volume       lk_dynspg_flt = ', lk_dynspg_flt
137      ENDIF
138
139      !                        ! Control of surface pressure gradient scheme options
140      ioptio = 0
141      IF(lk_dynspg_exp)   ioptio = ioptio + 1
142      IF(lk_dynspg_ts )   ioptio = ioptio + 1
143      IF(lk_dynspg_flt)   ioptio = ioptio + 1
144      !
145      IF( ( ioptio > 1 .AND. .NOT. lk_esopa ) .OR. ioptio == 0 )   &
146           &   CALL ctl_stop( ' Choose only one surface pressure gradient scheme with a key cpp' )
147      !
148      IF( lk_esopa     )   nspg = -1
149      IF( lk_dynspg_exp)   nspg =  0
150      IF( lk_dynspg_ts )   nspg =  1
151      IF( lk_dynspg_flt)   nspg =  2
152      !
153      IF( lk_esopa     )   nspg = -1
154      !
155      IF(lwp) THEN
156         WRITE(numout,*)
157         IF( nspg == -1 )   WRITE(numout,*) '     ESOPA test All scheme used'
158         IF( nspg ==  0 )   WRITE(numout,*) '     explicit free surface'
159         IF( nspg ==  1 )   WRITE(numout,*) '     free surface with time splitting scheme'
160         IF( nspg ==  2 )   WRITE(numout,*) '     filtered free surface'
161      ENDIF
162
163      !                        ! Control of timestep choice
164      IF( lk_dynspg_ts .OR. lk_dynspg_exp ) THEN
165         IF( n_cla == 1 )   &
166           &   CALL ctl_stop( ' Crossland advection not implemented for this free surface formulation ' )
167      ENDIF
168
169#if defined key_obc
170      !                        ! Conservation of ocean volume (key_dynspg_flt)
171      IF( lk_dynspg_flt )   ln_vol_cst = .true.
172
173      !                        ! Application of Flather's algorithm at open boundaries
174      IF( lk_dynspg_flt )   ln_obc_fla = .false.
175      IF( lk_dynspg_exp )   ln_obc_fla = .true.
176      IF( lk_dynspg_ts  )   ln_obc_fla = .true.
177#endif
178      !
179   END SUBROUTINE dyn_spg_init
180
181  !!======================================================================
182END MODULE dynspg
Note: See TracBrowser for help on using the repository browser.