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

source: branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynbfr.F90 @ 3161

Last change on this file since 3161 was 3161, checked in by cetlod, 12 years ago

New dynamical allocation & timing in OPA_SRC/DYN routines

  • Property svn:keywords set to Id
File size: 4.4 KB
Line 
1MODULE dynbfr
2   !!==============================================================================
3   !!                 ***  MODULE  dynbfr  ***
4   !! Ocean dynamics :  bottom friction component of the momentum mixing trend
5   !!==============================================================================
6   !! History :  3.2  ! 2008-11  (A. C. Coward)  Original code
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   USE zdfbfr          ! ocean bottom friction variables
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   USE timing          ! Timing
21
22   IMPLICIT NONE
23   PRIVATE
24
25   PUBLIC   dyn_bfr    !  routine called by step.F90
26
27   !! * Substitutions
28#  include "domzgr_substitute.h90"
29#  include "zdfddm_substitute.h90"
30#  include "vectopt_loop_substitute.h90"
31   !!----------------------------------------------------------------------
32   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
33   !! $Id$
34   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
35   !!----------------------------------------------------------------------
36CONTAINS
37   
38   SUBROUTINE dyn_bfr( kt )
39      !!----------------------------------------------------------------------
40      !!                  ***  ROUTINE dyn_bfr  ***
41      !!
42      !! ** Purpose :   compute the bottom friction ocean dynamics physics.
43      !!
44      !! ** Action  :   (ua,va)   momentum trend increased by bottom friction trend
45      !!---------------------------------------------------------------------
46      USE oce, ONLY:   ztrduv => tsa   ! tsa used as 4D workspace
47      !!
48      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
49      !!
50      INTEGER  ::   ji, jj       ! dummy loop indexes
51      INTEGER  ::   ikbu, ikbv   ! local integers
52      REAL(wp) ::   zm1_2dt      ! local scalar
53      !!---------------------------------------------------------------------
54      !
55      IF( nn_timing == 1 )  CALL timing_start('dyn_bfr')
56      !
57      IF( .NOT.ln_bfrimp) THEN     ! only for explicit bottom friction form
58                                    ! implicit bfr is implemented in dynzdf_imp
59                                    ! H. Liu,  Sept. 2011
60
61        zm1_2dt = - 1._wp / ( 2._wp * rdt )
62
63        IF( l_trddyn )   THEN                      ! temporary save of ua and va trends
64           ztrduv(:,:,:,1) = ua(:,:,:)
65           ztrduv(:,:,:,2) = va(:,:,:)
66        ENDIF
67
68
69# if defined key_vectopt_loop
70        DO jj = 1, 1
71           DO ji = jpi+2, jpij-jpi-1   ! vector opt. (forced unrolling)
72# else
73        DO jj = 2, jpjm1
74           DO ji = 2, jpim1
75# endif
76              ikbu = mbku(ji,jj)          ! deepest ocean u- & v-levels
77              ikbv = mbkv(ji,jj)
78              !
79              ! Apply stability criteria on absolute value  : abs(bfr/e3) < 1/(2dt) => bfr/e3 > -1/(2dt)
80              ua(ji,jj,ikbu) = ua(ji,jj,ikbu) + MAX(  bfrua(ji,jj) / fse3u(ji,jj,ikbu) , zm1_2dt  ) * ub(ji,jj,ikbu)
81              va(ji,jj,ikbv) = va(ji,jj,ikbv) + MAX(  bfrva(ji,jj) / fse3v(ji,jj,ikbv) , zm1_2dt  ) * vb(ji,jj,ikbv)
82           END DO
83        END DO
84
85        !
86        IF( l_trddyn )   THEN                      ! save the vertical diffusive trends for further diagnostics
87           ztrduv(:,:,:,1) = ua(:,:,:) - ztrduv(:,:,:,1)
88           ztrduv(:,:,:,2) = va(:,:,:) - ztrduv(:,:,:,2)
89           CALL trd_mod( ztrduv(:,:,:,1), ztrduv(:,:,:,2), jpdyn_trd_bfr, 'DYN', kt )
90        ENDIF
91        !                                          ! print mean trends (used for debugging)
92        IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' bfr  - Ua: ', mask1=umask,               &
93           &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
94        !
95      ENDIF     ! end explicit bottom friction
96      !
97      IF( nn_timing == 1 )  CALL timing_stop('dyn_bfr')
98      !
99   END SUBROUTINE dyn_bfr
100
101   !!==============================================================================
102END MODULE dynbfr
Note: See TracBrowser for help on using the repository browser.