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_exp.F90 in branches/UKMO/dev_r5518_GO6_under_ice_relax_dr_hook/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: branches/UKMO/dev_r5518_GO6_under_ice_relax_dr_hook/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_exp.F90 @ 11738

Last change on this file since 11738 was 11738, checked in by marc, 4 years ago

The Dr Hook changes from my perl code.

File size: 6.0 KB
Line 
1MODULE dynspg_exp
2   !!======================================================================
3   !!                   ***  MODULE  dynspg_exp  ***
4   !! Ocean dynamics:  surface pressure gradient trend
5   !!======================================================================
6   !! History :  2.0  !  2005-11  (V. Garnier, G. Madec, L. Bessieres) Original code
7   !!            3.2  !  2009-06  (G. Madec, M. Leclair, R. Benshila) introduce sshwzv module
8   !!----------------------------------------------------------------------
9#if defined key_dynspg_exp   ||   defined key_esopa
10   !!----------------------------------------------------------------------
11   !!   'key_dynspg_exp'                              explicit free surface
12   !!----------------------------------------------------------------------
13   !!   dyn_spg_exp  : update the momentum trend with the surface
14   !!                      pressure gradient in the free surface constant 
15   !!                      volume case with vector optimization
16   !!----------------------------------------------------------------------
17   USE oce             ! ocean dynamics and tracers
18   USE dom_oce         ! ocean space and time domain
19   USE sbc_oce         ! surface boundary condition: ocean
20   USE phycst          ! physical constants
21   !
22   USE in_out_manager  ! I/O manager
23   USE lib_mpp         ! distributed memory computing library
24   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
25   USE prtctl          ! Print control
26   USE iom             ! I/O library
27   USE timing          ! Timing
28
29
30   USE yomhook, ONLY: lhook, dr_hook
31   USE parkind1, ONLY: jprb, jpim
32
33   IMPLICIT NONE
34   PRIVATE
35
36   PUBLIC   dyn_spg_exp   ! routine called by step.F90
37
38   !! * Substitutions
39#  include "domzgr_substitute.h90"
40#  include "vectopt_loop_substitute.h90"
41   !!----------------------------------------------------------------------
42   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
43   !! $Id$
44   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
45   !!----------------------------------------------------------------------
46CONTAINS
47
48   SUBROUTINE dyn_spg_exp( kt )
49      !!----------------------------------------------------------------------
50      !!                  ***  routine dyn_spg_exp  ***
51      !!
52      !! ** Purpose :   Compute the now trend due to the surface pressure
53      !!              gradient in case of explicit free surface formulation and
54      !!              add it to the general trend of momentum equation.
55      !!
56      !! ** Method  :   Explicit free surface formulation. Add to the general
57      !!              momentum trend the surface pressure gradient :
58      !!                      (ua,va) = (ua,va) + (spgu,spgv)
59      !!              where spgu = -1/rau0 d/dx(ps) = -g/e1u di( sshn )
60      !!                    spgv = -1/rau0 d/dy(ps) = -g/e2v dj( sshn )
61      !!
62      !! ** Action :   (ua,va)   trend of horizontal velocity increased by
63      !!                         the surf. pressure gradient trend
64      !!---------------------------------------------------------------------
65      INTEGER, INTENT(in)  ::   kt   ! ocean time-step index
66      !!
67      INTEGER ::   ji, jj, jk   ! dummy loop indices
68      INTEGER(KIND=jpim), PARAMETER :: zhook_in = 0
69      INTEGER(KIND=jpim), PARAMETER :: zhook_out = 1
70      REAL(KIND=jprb)               :: zhook_handle
71
72      CHARACTER(LEN=*), PARAMETER :: RoutineName='DYN_SPG_EXP'
73
74      IF (lhook) CALL dr_hook(RoutineName,zhook_in,zhook_handle)
75
76      !!----------------------------------------------------------------------
77      !
78      IF( nn_timing == 1 )  CALL timing_start('dyn_spg_exp')
79      !
80      IF( kt == nit000 ) THEN
81         IF(lwp) WRITE(numout,*)
82         IF(lwp) WRITE(numout,*) 'dyn_spg_exp : surface pressure gradient trend'
83         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~   (explicit free surface)'
84         !
85         spgu(:,:) = 0._wp   ;   spgv(:,:) = 0._wp
86         !
87         IF( lk_vvl .AND. lwp ) WRITE(numout,*) '              lk_vvl=T : spg is included in dynhpg'
88      ENDIF
89
90      IF( .NOT. lk_vvl ) THEN          !* fixed volume : add the surface pressure gradient trend
91         !
92         DO jj = 2, jpjm1                    ! now surface pressure gradient
93            DO ji = fs_2, fs_jpim1   ! vector opt.
94               spgu(ji,jj) = - grav * ( sshn(ji+1,jj) - sshn(ji,jj) ) / e1u(ji,jj)
95               spgv(ji,jj) = - grav * ( sshn(ji,jj+1) - sshn(ji,jj) ) / e2v(ji,jj)
96            END DO
97         END DO
98         !
99         DO jk = 1, jpkm1                    ! Add it to the general trend
100            DO jj = 2, jpjm1
101               DO ji = fs_2, fs_jpim1   ! vector opt.
102                  ua(ji,jj,jk) = ua(ji,jj,jk) + spgu(ji,jj)
103                  va(ji,jj,jk) = va(ji,jj,jk) + spgv(ji,jj)
104               END DO
105            END DO
106         END DO
107         !
108      ENDIF
109      !
110      IF( nn_timing == 1 )  CALL timing_stop('dyn_spg_exp')
111      !
112      IF (lhook) CALL dr_hook(RoutineName,zhook_out,zhook_handle)
113   END SUBROUTINE dyn_spg_exp
114
115#else
116   !!----------------------------------------------------------------------
117   !!   Default case :   Empty module   No standart explicit free surface
118   !!----------------------------------------------------------------------
119CONTAINS
120   SUBROUTINE dyn_spg_exp( kt )       ! Empty routine
121   USE yomhook, ONLY: lhook, dr_hook
122   USE parkind1, ONLY: jprb, jpim
123
124   IMPLICIT NONE
125      INTEGER, INTENT(in)  ::   kt   ! ocean time-step index 
126      INTEGER(KIND=jpim), PARAMETER :: zhook_in = 0
127      INTEGER(KIND=jpim), PARAMETER :: zhook_out = 1
128      REAL(KIND=jprb)               :: zhook_handle
129
130      CHARACTER(LEN=*), PARAMETER :: RoutineName='DYN_SPG_EXP'
131
132      IF (lhook) CALL dr_hook(RoutineName,zhook_in,zhook_handle)
133
134      WRITE(*,*) 'dyn_spg_exp: You should not have seen this print! error?', kt
135      IF (lhook) CALL dr_hook(RoutineName,zhook_out,zhook_handle)
136   END SUBROUTINE dyn_spg_exp
137#endif
138
139   !!======================================================================
140END MODULE dynspg_exp
Note: See TracBrowser for help on using the repository browser.