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/2017/dev_r7881_no_wrk_alloc/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: branches/2017/dev_r7881_no_wrk_alloc/NEMOGCM/NEMO/OPA_SRC/DYN/dynbfr.F90 @ 7910

Last change on this file since 7910 was 7910, checked in by timgraham, 7 years ago

All wrk_alloc removed

  • Property svn:keywords set to Id
File size: 5.2 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
[3294]7   !!            3.4  ! 2011-09  (H. Liu) Make it consistent with semi-implicit
8   !!                            Bottom friction (ln_bfrimp = .true.)
[1671]9   !!----------------------------------------------------------------------
10
11   !!----------------------------------------------------------------------
[4990]12   !!   dyn_bfr       : Update the momentum trend with the bottom friction contribution
[1671]13   !!----------------------------------------------------------------------
[4990]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
[1671]23
24   IMPLICIT NONE
25   PRIVATE
26
[4990]27   PUBLIC   dyn_bfr   !  routine called by step.F90
[1671]28
29   !! * Substitutions
30#  include "vectopt_loop_substitute.h90"
31   !!----------------------------------------------------------------------
[2528]32   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
33   !! $Id$
34   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
[1671]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      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
47      !!
[7753]48      INTEGER  ::   ji, jj       ! dummy loop indexes
[2528]49      INTEGER  ::   ikbu, ikbv   ! local integers
50      REAL(wp) ::   zm1_2dt      ! local scalar
[7910]51      REAL(wp), DIMENSION(jpi,jpj,jpk) ::  ztrdu, ztrdv
[1671]52      !!---------------------------------------------------------------------
53      !
[3294]54      IF( nn_timing == 1 )  CALL timing_start('dyn_bfr')
55      !
[4990]56!!gm issue: better to put the logical in step to control the call of zdf_bfr
57!!          ==> change the logical from ln_bfrimp to ln_bfr_exp !!
[3294]58      IF( .NOT.ln_bfrimp) THEN     ! only for explicit bottom friction form
59                                    ! implicit bfr is implemented in dynzdf_imp
[1708]60
[4990]61!!gm bug : time step is only rdt (not 2 rdt if euler start !)
[3294]62        zm1_2dt = - 1._wp / ( 2._wp * rdt )
[1708]63
[6140]64        IF( l_trddyn ) THEN      ! trends: store the input trends
[7753]65           ztrdu(:,:,:) = ua(:,:,:)
66           ztrdv(:,:,:) = va(:,:,:)
[3294]67        ENDIF
68
69
70        DO jj = 2, jpjm1
71           DO ji = 2, jpim1
72              ikbu = mbku(ji,jj)          ! deepest ocean u- & v-levels
73              ikbv = mbkv(ji,jj)
74              !
75              ! Apply stability criteria on absolute value  : abs(bfr/e3) < 1/(2dt) => bfr/e3 > -1/(2dt)
[6140]76              ua(ji,jj,ikbu) = ua(ji,jj,ikbu) + MAX(  bfrua(ji,jj) / e3u_n(ji,jj,ikbu) , zm1_2dt  ) * ub(ji,jj,ikbu)
77              va(ji,jj,ikbv) = va(ji,jj,ikbv) + MAX(  bfrva(ji,jj) / e3v_n(ji,jj,ikbv) , zm1_2dt  ) * vb(ji,jj,ikbv)
[3294]78           END DO
79        END DO
[6140]80        !
81        IF( ln_isfcav ) THEN        ! ocean cavities
[5120]82           DO jj = 2, jpjm1
83              DO ji = 2, jpim1
84                 ! (ISF) stability criteria for top friction
85                 ikbu = miku(ji,jj)          ! first wet ocean u- & v-levels
86                 ikbv = mikv(ji,jj)
87                 !
88                 ! Apply stability criteria on absolute value  : abs(bfr/e3) < 1/(2dt) => bfr/e3 > -1/(2dt)
[6140]89                 ua(ji,jj,ikbu) = ua(ji,jj,ikbu) + MAX(  tfrua(ji,jj) / e3u_n(ji,jj,ikbu) , zm1_2dt  ) * ub(ji,jj,ikbu) &
[5120]90                    &             * (1.-umask(ji,jj,1))
[6140]91                 va(ji,jj,ikbv) = va(ji,jj,ikbv) + MAX(  tfrva(ji,jj) / e3v_n(ji,jj,ikbv) , zm1_2dt  ) * vb(ji,jj,ikbv) &
[5120]92                    &             * (1.-vmask(ji,jj,1))
93                 ! (ISF)
94              END DO
95           END DO
96        END IF
[3294]97        !
[6140]98        IF( l_trddyn ) THEN      ! trends: send trends to trddyn for further diagnostics
[7753]99           ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:)
100           ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
[4990]101           CALL trd_dyn( ztrdu(:,:,:), ztrdv(:,:,:), jpdyn_bfr, kt )
[3294]102        ENDIF
103        !                                          ! print mean trends (used for debugging)
104        IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' bfr  - Ua: ', mask1=umask,               &
105           &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
106        !
107      ENDIF     ! end explicit bottom friction
[1671]108      !
[3294]109      IF( nn_timing == 1 )  CALL timing_stop('dyn_bfr')
[1671]110      !
111   END SUBROUTINE dyn_bfr
112
113   !!==============================================================================
114END MODULE dynbfr
Note: See TracBrowser for help on using the repository browser.