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.
dynbfr.F90 in trunk/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: trunk/NEMOGCM/NEMO/OPA_SRC/DYN/dynbfr.F90 @ 2547

Last change on this file since 2547 was 2547, checked in by rblod, 13 years ago

Correct bug in dynbfr, see ticket #786

  • Property svn:keywords set to Id
File size: 3.9 KB
RevLine 
[1671]1MODULE dynbfr
2   !!==============================================================================
3   !!                 ***  MODULE  dynbfr  ***
4   !! Ocean dynamics :  bottom friction component of the momentum mixing trend
5   !!==============================================================================
[2528]6   !! History :  3.2  ! 2008-11  (A. C. Coward)  Original code
[1671]7   !!----------------------------------------------------------------------
8
9   !!----------------------------------------------------------------------
10   !!   dyn_bfr      : Update the momentum trend with the bottom friction contribution
11   !!----------------------------------------------------------------------
12   USE oce             ! ocean dynamics and tracers variables
13   USE dom_oce         ! ocean space and time domain variables
14   USE zdf_oce         ! ocean vertical physics variables
15
16   USE trdmod          ! ocean active dynamics and tracers trends
17   USE trdmod_oce      ! ocean variables trends
18   USE in_out_manager  ! I/O manager
19   USE prtctl          ! Print control
20
21   IMPLICIT NONE
22   PRIVATE
23
24   PUBLIC   dyn_bfr    !  routine called by step.F90
25
26   !! * Substitutions
27#  include "domzgr_substitute.h90"
28#  include "zdfddm_substitute.h90"
29#  include "vectopt_loop_substitute.h90"
30   !!----------------------------------------------------------------------
[2528]31   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
32   !! $Id$
33   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
[1671]34   !!----------------------------------------------------------------------
35CONTAINS
36   
37   SUBROUTINE dyn_bfr( kt )
38      !!----------------------------------------------------------------------
39      !!                  ***  ROUTINE dyn_bfr  ***
40      !!
41      !! ** Purpose :   compute the bottom friction ocean dynamics physics.
42      !!
43      !! ** Action  :   (ua,va)   momentum trend increased by bottom friction trend
44      !!---------------------------------------------------------------------
[2528]45      USE oce, ONLY :   ztrduv => tsa   ! use tsa as 4D workspace
[1708]46      !!
[1671]47      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
48      !!
[2528]49      INTEGER  ::   ji, jj       ! dummy loop indexes
50      INTEGER  ::   ikbu, ikbv   ! local integers
51      REAL(wp) ::   zm1_2dt      ! local scalar
[1671]52      !!---------------------------------------------------------------------
53      !
[2528]54      zm1_2dt = - 1._wp / ( 2._wp * rdt )
[1708]55
56      IF( l_trddyn )   THEN                      ! temporary save of ua and va trends
[2528]57         ztrduv(:,:,:,1) = ua(:,:,:)
58         ztrduv(:,:,:,2) = va(:,:,:)
[1671]59      ENDIF
[1708]60
[1671]61# if defined key_vectopt_loop
62      DO jj = 1, 1
63         DO ji = jpi+2, jpij-jpi-1   ! vector opt. (forced unrolling)
64# else
65      DO jj = 2, jpjm1
66         DO ji = 2, jpim1
67# endif
[2528]68            ikbu = mbku(ji,jj)          ! deepest ocean u- & v-levels
69            ikbv = mbkv(ji,jj)
[1671]70            !
[2528]71            ! Apply stability criteria on absolute value  : abs(bfr/e3) < 1/(2dt) => bfr/e3 > -1/(2dt)
72            ua(ji,jj,ikbu) = ua(ji,jj,ikbu) + MAX(  bfrua(ji,jj) / fse3u(ji,jj,ikbu) , zm1_2dt  ) * ub(ji,jj,ikbu)
[2547]73            va(ji,jj,ikbv) = va(ji,jj,ikbv) + MAX(  bfrva(ji,jj) / fse3v(ji,jj,ikbv) , zm1_2dt  ) * vb(ji,jj,ikbv)
[1671]74         END DO
75      END DO
[1708]76
[1671]77      !
78      IF( l_trddyn )   THEN                      ! save the vertical diffusive trends for further diagnostics
[2528]79         ztrduv(:,:,:,1) = ua(:,:,:) - ztrduv(:,:,:,1)
80         ztrduv(:,:,:,2) = va(:,:,:) - ztrduv(:,:,:,2)
81         CALL trd_mod( ztrduv(:,:,:,1), ztrduv(:,:,:,2), jpdyn_trd_bfr, 'DYN', kt )
[1671]82      ENDIF
83      !                                          ! print mean trends (used for debugging)
84      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' bfr  - Ua: ', mask1=umask,               &
85         &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
86      !
87   END SUBROUTINE dyn_bfr
88
89   !!==============================================================================
90END MODULE dynbfr
Note: See TracBrowser for help on using the repository browser.