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 NEMO/branches/UKMO/r8395_coupling_sequence/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: NEMO/branches/UKMO/r8395_coupling_sequence/NEMOGCM/NEMO/OPA_SRC/DYN/dynbfr.F90 @ 10762

Last change on this file since 10762 was 10762, checked in by jcastill, 5 years ago

Revert previous changes as the removal of keywords was not uncoupled of the actual changes

File size: 5.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   !!            3.4  ! 2011-09  (H. Liu) Make it consistent with semi-implicit
8   !!                            Bottom friction (ln_bfrimp = .true.)
9   !!----------------------------------------------------------------------
10
11   !!----------------------------------------------------------------------
12   !!   dyn_bfr       : Update the momentum trend with the bottom friction contribution
13   !!----------------------------------------------------------------------
14   USE oce            ! ocean dynamics and tracers variables
15   USE dom_oce        ! ocean space and time domain variables
16   USE zdf_oce        ! ocean vertical physics variables
17   USE zdfbfr         ! ocean bottom friction variables
18   USE trd_oce        ! trends: ocean variables
19   USE trddyn         ! trend manager: dynamics
20   USE in_out_manager ! I/O manager
21   USE prtctl         ! Print control
22   USE timing         ! Timing
23   USE wrk_nemo       ! Memory Allocation
24
25   IMPLICIT NONE
26   PRIVATE
27
28   PUBLIC   dyn_bfr   !  routine called by step.F90
29
30   !! * Substitutions
31#  include "vectopt_loop_substitute.h90"
32   !!----------------------------------------------------------------------
33   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
34   !! $Id: dynbfr.F90 7753 2017-03-03 11:46:59Z mocavero $
35   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
36   !!----------------------------------------------------------------------
37CONTAINS
38   
39   SUBROUTINE dyn_bfr( kt )
40      !!----------------------------------------------------------------------
41      !!                  ***  ROUTINE dyn_bfr  ***
42      !!
43      !! ** Purpose :   compute the bottom friction ocean dynamics physics.
44      !!
45      !! ** Action  :   (ua,va)   momentum trend increased by bottom friction trend
46      !!---------------------------------------------------------------------
47      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
48      !!
49      INTEGER  ::   ji, jj       ! dummy loop indexes
50      INTEGER  ::   ikbu, ikbv   ! local integers
51      REAL(wp) ::   zm1_2dt      ! local scalar
52      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrdu, ztrdv
53      !!---------------------------------------------------------------------
54      !
55      IF( nn_timing == 1 )  CALL timing_start('dyn_bfr')
56      !
57!!gm issue: better to put the logical in step to control the call of zdf_bfr
58!!          ==> change the logical from ln_bfrimp to ln_bfr_exp !!
59      IF( .NOT.ln_bfrimp) THEN     ! only for explicit bottom friction form
60                                    ! implicit bfr is implemented in dynzdf_imp
61
62!!gm bug : time step is only rdt (not 2 rdt if euler start !)
63        zm1_2dt = - 1._wp / ( 2._wp * rdt )
64
65        IF( l_trddyn ) THEN      ! trends: store the input trends
66           CALL wrk_alloc( jpi,jpj,jpk,   ztrdu, ztrdv )
67           ztrdu(:,:,:) = ua(:,:,:)
68           ztrdv(:,:,:) = va(:,:,:)
69        ENDIF
70
71
72        DO jj = 2, jpjm1
73           DO ji = 2, jpim1
74              ikbu = mbku(ji,jj)          ! deepest ocean u- & v-levels
75              ikbv = mbkv(ji,jj)
76              !
77              ! Apply stability criteria on absolute value  : abs(bfr/e3) < 1/(2dt) => bfr/e3 > -1/(2dt)
78              ua(ji,jj,ikbu) = ua(ji,jj,ikbu) + MAX(  bfrua(ji,jj) / e3u_n(ji,jj,ikbu) , zm1_2dt  ) * ub(ji,jj,ikbu)
79              va(ji,jj,ikbv) = va(ji,jj,ikbv) + MAX(  bfrva(ji,jj) / e3v_n(ji,jj,ikbv) , zm1_2dt  ) * vb(ji,jj,ikbv)
80           END DO
81        END DO
82        !
83        IF( ln_isfcav ) THEN        ! ocean cavities
84           DO jj = 2, jpjm1
85              DO ji = 2, jpim1
86                 ! (ISF) stability criteria for top friction
87                 ikbu = miku(ji,jj)          ! first wet ocean u- & v-levels
88                 ikbv = mikv(ji,jj)
89                 !
90                 ! Apply stability criteria on absolute value  : abs(bfr/e3) < 1/(2dt) => bfr/e3 > -1/(2dt)
91                 ua(ji,jj,ikbu) = ua(ji,jj,ikbu) + MAX(  tfrua(ji,jj) / e3u_n(ji,jj,ikbu) , zm1_2dt  ) * ub(ji,jj,ikbu) &
92                    &             * (1.-umask(ji,jj,1))
93                 va(ji,jj,ikbv) = va(ji,jj,ikbv) + MAX(  tfrva(ji,jj) / e3v_n(ji,jj,ikbv) , zm1_2dt  ) * vb(ji,jj,ikbv) &
94                    &             * (1.-vmask(ji,jj,1))
95                 ! (ISF)
96              END DO
97           END DO
98        END IF
99        !
100        IF( l_trddyn ) THEN      ! trends: send trends to trddyn for further diagnostics
101           ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:)
102           ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
103           CALL trd_dyn( ztrdu(:,:,:), ztrdv(:,:,:), jpdyn_bfr, kt )
104           CALL wrk_dealloc( jpi,jpj,jpk,   ztrdu, ztrdv )
105        ENDIF
106        !                                          ! print mean trends (used for debugging)
107        IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' bfr  - Ua: ', mask1=umask,               &
108           &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
109        !
110      ENDIF     ! end explicit bottom friction
111      !
112      IF( nn_timing == 1 )  CALL timing_stop('dyn_bfr')
113      !
114   END SUBROUTINE dyn_bfr
115
116   !!==============================================================================
117END MODULE dynbfr
Note: See TracBrowser for help on using the repository browser.