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

source: branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_exp.F90 @ 4433

Last change on this file since 4433 was 3211, checked in by spickles2, 12 years ago

Stephen Pickles, 11 Dec 2011

Commit to bring the rest of the DCSE NEMO development branch
in line with the latest development version. This includes
array index re-ordering of all OPA_SRC/.

  • Property svn:keywords set to Id
File size: 5.7 KB
RevLine 
[358]1MODULE dynspg_exp
2   !!======================================================================
3   !!                   ***  MODULE  dynspg_exp  ***
4   !! Ocean dynamics:  surface pressure gradient trend
5   !!======================================================================
[1505]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
[1438]8   !!----------------------------------------------------------------------
[575]9#if defined key_dynspg_exp   ||   defined key_esopa
[358]10   !!----------------------------------------------------------------------
[1505]11   !!   'key_dynspg_exp'                              explicit free surface
[358]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
[888]19   USE sbc_oce         ! surface boundary condition: ocean
20   USE obc_oce         ! Lateral open boundary condition
[719]21   USE phycst          ! physical constants
[371]22   USE obc_par         ! open boundary condition parameters
[367]23   USE obcdta          ! open boundary condition data     (obc_dta_bt routine)
[888]24   USE in_out_manager  ! I/O manager
[358]25   USE lib_mpp         ! distributed memory computing library
26   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
27   USE prtctl          ! Print control
[575]28   USE iom             ! I/O library
29   USE restart         ! only for lrst_oce
[358]30
31   IMPLICIT NONE
32   PRIVATE
33
[1438]34   PUBLIC   dyn_spg_exp   ! routine called by step.F90
[358]35
[3211]36   !! * Control permutation of array indices
37#  include "oce_ftrans.h90"
38#  include "dom_oce_ftrans.h90"
39#  include "sbc_oce_ftrans.h90"
40#  include "obc_oce_ftrans.h90"
41
[358]42   !! * Substitutions
43#  include "domzgr_substitute.h90"
44#  include "vectopt_loop_substitute.h90"
45   !!----------------------------------------------------------------------
[2528]46   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
[888]47   !! $Id$
[2715]48   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
[358]49   !!----------------------------------------------------------------------
50CONTAINS
51
52   SUBROUTINE dyn_spg_exp( kt )
53      !!----------------------------------------------------------------------
54      !!                  ***  routine dyn_spg_exp  ***
55      !!
56      !! ** Purpose :   Compute the now trend due to the surface pressure
[1505]57      !!              gradient in case of explicit free surface formulation and
58      !!              add it to the general trend of momentum equation.
[358]59      !!
[1505]60      !! ** Method  :   Explicit free surface formulation. Add to the general
61      !!              momentum trend the surface pressure gradient :
62      !!                      (ua,va) = (ua,va) + (spgu,spgv)
63      !!              where spgu = -1/rau0 d/dx(ps) = -g/e1u di( sshn )
64      !!                    spgv = -1/rau0 d/dy(ps) = -g/e2v dj( sshn )
[358]65      !!
[1505]66      !! ** Action :   (ua,va)   trend of horizontal velocity increased by
67      !!                         the surf. pressure gradient trend
[358]68      !!---------------------------------------------------------------------
[2715]69      INTEGER, INTENT(in)  ::   kt   ! ocean time-step index
[1438]70      !!
[2715]71      INTEGER ::   ji, jj, jk   ! dummy loop indices
[358]72      !!----------------------------------------------------------------------
73
74      IF( kt == nit000 ) THEN
75         IF(lwp) WRITE(numout,*)
76         IF(lwp) WRITE(numout,*) 'dyn_spg_exp : surface pressure gradient trend'
77         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~   (explicit free surface)'
[1505]78         !
[2715]79         spgu(:,:) = 0._wp   ;   spgv(:,:) = 0._wp
[1505]80         !
81         IF( lk_vvl .AND. lwp ) WRITE(numout,*) '              lk_vvl=T : spg is included in dynhpg'
[358]82      ENDIF
83
84
[1505]85!!gm bug ??  Rachid we have to discuss of the call below. I don't understand why it is here and not in ssh_wzv
86      IF( lk_obc )   CALL obc_dta_bt( kt, 0 )      ! OBC: read or estimate ssh and vertically integrated velocities
87!!gm
[358]88
[1505]89      IF( .NOT. lk_vvl ) THEN          !* fixed volume : add the surface pressure gradient trend
90         !
91         DO jj = 2, jpjm1                    ! now surface pressure gradient
[358]92            DO ji = fs_2, fs_jpim1   ! vector opt.
[1505]93               spgu(ji,jj) = - grav * ( sshn(ji+1,jj) - sshn(ji,jj) ) / e1u(ji,jj)
94               spgv(ji,jj) = - grav * ( sshn(ji,jj+1) - sshn(ji,jj) ) / e2v(ji,jj)
95            END DO
96         END DO 
[3211]97#if defined key_z_first
98         DO jj = 2, jpjm1                    ! Add it to the general trend
99            DO ji = 2, jpim1
100               DO jk = 1, jpkm1
101#else
[1505]102         DO jk = 1, jpkm1                    ! Add it to the general trend
103            DO jj = 2, jpjm1
104               DO ji = fs_2, fs_jpim1   ! vector opt.
[3211]105#endif
[1505]106                  ua(ji,jj,jk) = ua(ji,jj,jk) + spgu(ji,jj)
107                  va(ji,jj,jk) = va(ji,jj,jk) + spgv(ji,jj)
108               END DO
[358]109            END DO
110         END DO
[1505]111         !
112      ENDIF
113      !
[358]114   END SUBROUTINE dyn_spg_exp
115
116#else
117   !!----------------------------------------------------------------------
118   !!   Default case :   Empty module   No standart explicit free surface
119   !!----------------------------------------------------------------------
120CONTAINS
121   SUBROUTINE dyn_spg_exp( kt )       ! Empty routine
122      WRITE(*,*) 'dyn_spg_exp: You should not have seen this print! error?', kt
123   END SUBROUTINE dyn_spg_exp
124#endif
[1438]125
[358]126   !!======================================================================
127END MODULE dynspg_exp
Note: See TracBrowser for help on using the repository browser.