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.
divhor.F90 in branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/OPA_SRC/DYN/divhor.F90 @ 8226

Last change on this file since 8226 was 8226, checked in by clem, 7 years ago

merge with dev_r8127_AGRIF_LIM3_GHOST@r8189 and dev_r8126_ROBUST08_no_ghost@r8196

  • Property svn:keywords set to Id
File size: 5.2 KB
RevLine 
[5777]1MODULE divhor
[3]2   !!==============================================================================
[5777]3   !!                       ***  MODULE  divhor  ***
4   !! Ocean diagnostic variable : now horizontal divergence
[3]5   !!==============================================================================
[5777]6   !! History :  1.0  ! 2002-09  (G. Madec, E. Durand)  Free form, F90
[2528]7   !!             -   ! 2005-01  (J. Chanut) Unstructured open boundaries
8   !!             -   ! 2003-08  (G. Madec)  merged of cur and div, free form, F90
9   !!             -   ! 2005-01  (J. Chanut, A. Sellar) unstructured open boundaries
10   !!            3.3  ! 2010-09  (D.Storkey and E.O'Dea) bug fixes for BDY module
11   !!             -   ! 2010-10  (R. Furner, G. Madec) runoff and cla added directly here
[5777]12   !!            3.7  ! 2014-01  (G. Madec) suppression of velocity curl from in-core memory
13   !!             -   ! 2014-12  (G. Madec) suppression of cross land advection option
14   !!             -   ! 2015-10  (G. Madec) add velocity and rnf flag in argument of div_hor
[2528]15   !!----------------------------------------------------------------------
[3]16
17   !!----------------------------------------------------------------------
[5777]18   !!   div_hor    : Compute the horizontal divergence field
[3]19   !!----------------------------------------------------------------------
20   USE oce             ! ocean dynamics and tracers
21   USE dom_oce         ! ocean space and time domain
[6140]22   USE sbc_oce, ONLY : ln_rnf, ln_isf ! surface boundary condition: ocean
[2528]23   USE sbcrnf          ! river runoff
[5777]24   USE sbcisf          ! ice shelf
[6140]25   USE iscplhsb        ! ice sheet / ocean coupling
26   USE iscplini        ! ice sheet / ocean coupling
[5777]27   !
[3]28   USE in_out_manager  ! I/O manager
29   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
[2715]30   USE lib_mpp         ! MPP library
[3294]31   USE wrk_nemo        ! Memory Allocation
32   USE timing          ! Timing
[3]33
34   IMPLICIT NONE
35   PRIVATE
36
[5777]37   PUBLIC   div_hor    ! routine called by step.F90 and istate.F90
[3]38
39   !! * Substitutions
40#  include "vectopt_loop_substitute.h90"
41   !!----------------------------------------------------------------------
[5777]42   !! NEMO/OPA 3.7 , NEMO Consortium (2014)
[1152]43   !! $Id$
[2528]44   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
[3]45   !!----------------------------------------------------------------------
46CONTAINS
47
[5777]48   SUBROUTINE div_hor( kt )
[3]49      !!----------------------------------------------------------------------
[5777]50      !!                  ***  ROUTINE div_hor  ***
[3]51      !!                   
[5777]52      !! ** Purpose :   compute the horizontal divergence at now time-step
[3]53      !!
[5777]54      !! ** Method  :   the now divergence is computed as :
55      !!         hdivn = 1/(e1e2t*e3t) ( di[e2u*e3u un] + dj[e1v*e3v vn] )
56      !!      and correct with runoff inflow (div_rnf) and cross land flow (div_cla)
[3]57      !!
[5777]58      !! ** Action  : - update hdivn, the now horizontal divergence
[3]59      !!----------------------------------------------------------------------
[2715]60      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
[2528]61      !
[2715]62      INTEGER  ::   ji, jj, jk    ! dummy loop indices
63      REAL(wp) ::   zraur, zdep   ! local scalars
[3]64      !!----------------------------------------------------------------------
[3294]65      !
[5777]66      IF( nn_timing == 1 )   CALL timing_start('div_hor')
[3294]67      !
[3]68      IF( kt == nit000 ) THEN
69         IF(lwp) WRITE(numout,*)
[5777]70         IF(lwp) WRITE(numout,*) 'div_hor : horizontal velocity divergence '
71         IF(lwp) WRITE(numout,*) '~~~~~~~   '
[3]72      ENDIF
[5777]73      !
74      DO jk = 1, jpkm1                                      !==  Horizontal divergence  ==!
[3]75         DO jj = 2, jpjm1
76            DO ji = fs_2, fs_jpim1   ! vector opt.
[6140]77               hdivn(ji,jj,jk) = (  e2u(ji  ,jj) * e3u_n(ji  ,jj,jk) * un(ji  ,jj,jk)        &
78                  &               - e2u(ji-1,jj) * e3u_n(ji-1,jj,jk) * un(ji-1,jj,jk)        &
79                  &               + e1v(ji,jj  ) * e3v_n(ji,jj  ,jk) * vn(ji,jj  ,jk)        &
80                  &               - e1v(ji,jj-1) * e3v_n(ji,jj-1,jk) * vn(ji,jj-1,jk)   )    &
81                  &            / ( e1e2t(ji,jj) * e3t_n(ji,jj,jk) )
[3]82            END DO 
83         END DO 
[5777]84      END DO
[8226]85      IF( .NOT. Agrif_Root() ) THEN
86         IF( nbondi == -1 .OR. nbondi == 2 )   hdivn( 2:nbghostcells+1,:        ,:) = 0._wp      ! west
87         IF( nbondi ==  1 .OR. nbondi == 2 )   hdivn( nlci-nbghostcells:nlci-1,:,:) = 0._wp      ! east
88         IF( nbondj == -1 .OR. nbondj == 2 )   hdivn( :,2:nbghostcells+1        ,:) = 0._wp      ! south
89         IF( nbondj ==  1 .OR. nbondj == 2 )   hdivn( :,nlcj-nbghostcells:nlcj-1,:) = 0._wp      ! north
90      ENDIF
[2715]91      !
[6140]92      IF( ln_rnf )   CALL sbc_rnf_div( hdivn )      !==  runoffs    ==!   (update hdivn field)
[2528]93      !
[6140]94      IF( ln_isf )   CALL sbc_isf_div( hdivn )      !==  ice shelf  ==!   (update hdivn field)
[3294]95      !
[6140]96      IF( ln_iscpl .AND. ln_hsb ) CALL iscpl_div( hdivn )  !==  ice sheet  ==!   (update hdivn field)
[5777]97      !
[6140]98      CALL lbc_lnk( hdivn, 'T', 1. )                !==  lateral boundary cond.  ==!   (no sign change)
99      !
[5777]100      IF( nn_timing == 1 )  CALL timing_stop('div_hor')
101      !
102   END SUBROUTINE div_hor
[3]103   
104   !!======================================================================
[5777]105END MODULE divhor
Note: See TracBrowser for help on using the repository browser.