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/DEV_r1879_FCM/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: branches/DEV_r1879_FCM/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg.F90 @ 2013

Last change on this file since 2013 was 2013, checked in by smasson, 14 years ago

remove propertie svn:executabe of fortran files in DEV_r1879_FCM

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