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 NEMO/trunk/src/OCE/DYN – NEMO

source: NEMO/trunk/src/OCE/DYN/divhor.F90 @ 12914

Last change on this file since 12914 was 12377, checked in by acc, 4 years ago

The big one. Merging all 2019 developments from the option 1 branch back onto the trunk.

This changeset reproduces 2019/dev_r11943_MERGE_2019 on the trunk using a 2-URL merge
onto a working copy of the trunk. I.e.:

svn merge --ignore-ancestry \

svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/trunk \
svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/branches/2019/dev_r11943_MERGE_2019 ./

The --ignore-ancestry flag avoids problems that may otherwise arise from the fact that
the merge history been trunk and branch may have been applied in a different order but
care has been taken before this step to ensure that all applicable fixes and updates
are present in the merge branch.

The trunk state just before this step has been branched to releases/release-4.0-HEAD
and that branch has been immediately tagged as releases/release-4.0.2. Any fixes
or additions in response to tickets on 4.0, 4.0.1 or 4.0.2 should be done on
releases/release-4.0-HEAD. From now on future 'point' releases (e.g. 4.0.2) will
remain unchanged with periodic releases as needs demand. Note release-4.0-HEAD is a
transitional naming convention. Future full releases, say 4.2, will have a release-4.2
branch which fulfills this role and the first point release (e.g. 4.2.0) will be made
immediately following the release branch creation.

2020 developments can be started from any trunk revision later than this one.

  • 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
[12377]22   USE sbc_oce, ONLY : ln_rnf      ! river runoff
23   USE sbcrnf , ONLY : sbc_rnf_div ! river runoff
24   USE isf_oce, ONLY : ln_isf      ! ice shelf
25   USE isfhdiv, ONLY : isf_hdiv    ! ice shelf
[9023]26#if defined key_asminc   
27   USE asminc          ! Assimilation increment
28#endif
[5777]29   !
[3]30   USE in_out_manager  ! I/O manager
31   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
[2715]32   USE lib_mpp         ! MPP library
[3294]33   USE timing          ! Timing
[3]34
35   IMPLICIT NONE
36   PRIVATE
37
[5777]38   PUBLIC   div_hor    ! routine called by step.F90 and istate.F90
[3]39
40   !! * Substitutions
[12377]41#  include "do_loop_substitute.h90"
[3]42   !!----------------------------------------------------------------------
[9598]43   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
[1152]44   !! $Id$
[10068]45   !! Software governed by the CeCILL license (see ./LICENSE)
[3]46   !!----------------------------------------------------------------------
47CONTAINS
48
[12377]49   SUBROUTINE div_hor( kt, Kbb, Kmm )
[3]50      !!----------------------------------------------------------------------
[5777]51      !!                  ***  ROUTINE div_hor  ***
[3]52      !!                   
[5777]53      !! ** Purpose :   compute the horizontal divergence at now time-step
[3]54      !!
[5777]55      !! ** Method  :   the now divergence is computed as :
[12377]56      !!         hdiv = 1/(e1e2t*e3t) ( di[e2u*e3u un] + dj[e1v*e3v vn] )
[5777]57      !!      and correct with runoff inflow (div_rnf) and cross land flow (div_cla)
[3]58      !!
[12377]59      !! ** Action  : - update hdiv, the now horizontal divergence
[3]60      !!----------------------------------------------------------------------
[12377]61      INTEGER, INTENT(in) ::   kt        ! ocean time-step index
62      INTEGER, INTENT(in) ::   Kbb, Kmm  ! ocean time level indices
[2528]63      !
[2715]64      INTEGER  ::   ji, jj, jk    ! dummy loop indices
65      REAL(wp) ::   zraur, zdep   ! local scalars
[12377]66      REAL(wp), DIMENSION(jpi,jpj) :: ztmp
[3]67      !!----------------------------------------------------------------------
[3294]68      !
[9019]69      IF( ln_timing )   CALL timing_start('div_hor')
[3294]70      !
[3]71      IF( kt == nit000 ) THEN
72         IF(lwp) WRITE(numout,*)
[5777]73         IF(lwp) WRITE(numout,*) 'div_hor : horizontal velocity divergence '
74         IF(lwp) WRITE(numout,*) '~~~~~~~   '
[12377]75         hdiv(:,:,:) = 0._wp    ! initialize hdiv for the halos at the first time step
[3]76      ENDIF
[5777]77      !
[12377]78      DO_3D_00_00( 1, jpkm1 )
79         hdiv(ji,jj,jk) = (  e2u(ji  ,jj) * e3u(ji  ,jj,jk,Kmm) * uu(ji  ,jj,jk,Kmm)      &
80            &               - e2u(ji-1,jj) * e3u(ji-1,jj,jk,Kmm) * uu(ji-1,jj,jk,Kmm)      &
81            &               + e1v(ji,jj  ) * e3v(ji,jj  ,jk,Kmm) * vv(ji,jj  ,jk,Kmm)      &
82            &               - e1v(ji,jj-1) * e3v(ji,jj-1,jk,Kmm) * vv(ji,jj-1,jk,Kmm)  )   &
83            &            * r1_e1e2t(ji,jj) / e3t(ji,jj,jk,Kmm)
84      END_3D
85      !
[9019]86#if defined key_agrif
87      IF( .NOT. Agrif_Root() ) THEN
[12377]88         IF( nbondi == -1 .OR. nbondi == 2 )   hdiv(   2   ,  :   ,:) = 0._wp      ! west
89         IF( nbondi ==  1 .OR. nbondi == 2 )   hdiv( nlci-1,  :   ,:) = 0._wp      ! east
90         IF( nbondj == -1 .OR. nbondj == 2 )   hdiv(   :   ,  2   ,:) = 0._wp      ! south
91         IF( nbondj ==  1 .OR. nbondj == 2 )   hdiv(   :   ,nlcj-1,:) = 0._wp      ! north
[9019]92      ENDIF
93#endif
[2715]94      !
[12377]95      IF( ln_rnf )   CALL sbc_rnf_div( hdiv, Kmm )                     !==  runoffs    ==!   (update hdiv field)
[2528]96      !
[9023]97#if defined key_asminc 
[12377]98      IF( ln_sshinc .AND. ln_asmiau )   CALL ssh_asm_div( kt, Kbb, Kmm, hdiv )   !==  SSH assimilation  ==!   (update hdiv field)
[9023]99      !
100#endif
[3294]101      !
[12377]102      IF( ln_isf )                      CALL isf_hdiv( kt, Kmm, hdiv )           !==  ice shelf         ==!   (update hdiv field)
[5777]103      !
[12377]104      CALL lbc_lnk( 'divhor', hdiv, 'T', 1. )   !   (no sign change)
[6140]105      !
[9019]106      IF( ln_timing )   CALL timing_stop('div_hor')
[5777]107      !
108   END SUBROUTINE div_hor
[3]109   
110   !!======================================================================
[5777]111END MODULE divhor
Note: See TracBrowser for help on using the repository browser.