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

source: branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/DYN/divhor.F90 @ 7114

Last change on this file since 7114 was 7114, checked in by jcastill, 7 years ago

Changes as in UKMO/restart_datestamp@6336

File size: 5.0 KB
Line 
1MODULE divhor
2   !!==============================================================================
3   !!                       ***  MODULE  divhor  ***
4   !! Ocean diagnostic variable : now horizontal divergence
5   !!==============================================================================
6   !! History :  1.0  ! 2002-09  (G. Madec, E. Durand)  Free form, F90
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
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
15   !!----------------------------------------------------------------------
16
17   !!----------------------------------------------------------------------
18   !!   div_hor    : Compute the horizontal divergence field
19   !!----------------------------------------------------------------------
20   USE oce             ! ocean dynamics and tracers
21   USE dom_oce         ! ocean space and time domain
22   USE sbc_oce, ONLY : ln_rnf, nn_isf ! surface boundary condition: ocean
23   USE sbcrnf          ! river runoff
24   USE sbcisf          ! ice shelf
25   !
26   USE in_out_manager  ! I/O manager
27   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
28   USE lib_mpp         ! MPP library
29   USE wrk_nemo        ! Memory Allocation
30   USE timing          ! Timing
31
32   IMPLICIT NONE
33   PRIVATE
34
35   PUBLIC   div_hor    ! routine called by step.F90 and istate.F90
36
37   !! * Substitutions
38#  include "domzgr_substitute.h90"
39#  include "vectopt_loop_substitute.h90"
40   !!----------------------------------------------------------------------
41   !! NEMO/OPA 3.7 , NEMO Consortium (2014)
42   !! $Id$
43   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
44   !!----------------------------------------------------------------------
45CONTAINS
46
47   SUBROUTINE div_hor( kt )
48      !!----------------------------------------------------------------------
49      !!                  ***  ROUTINE div_hor  ***
50      !!                   
51      !! ** Purpose :   compute the horizontal divergence at now time-step
52      !!
53      !! ** Method  :   the now divergence is computed as :
54      !!         hdivn = 1/(e1e2t*e3t) ( di[e2u*e3u un] + dj[e1v*e3v vn] )
55      !!      and correct with runoff inflow (div_rnf) and cross land flow (div_cla)
56      !!
57      !! ** Action  : - update hdivn, the now horizontal divergence
58      !!----------------------------------------------------------------------
59      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
60      !
61      INTEGER  ::   ji, jj, jk    ! dummy loop indices
62      REAL(wp) ::   zraur, zdep   ! local scalars
63      !!----------------------------------------------------------------------
64      !
65      IF( nn_timing == 1 )   CALL timing_start('div_hor')
66      !
67      IF( kt == nit000 ) THEN
68         IF(lwp) WRITE(numout,*)
69         IF(lwp) WRITE(numout,*) 'div_hor : horizontal velocity divergence '
70         IF(lwp) WRITE(numout,*) '~~~~~~~   '
71      ENDIF
72      !
73      DO jk = 1, jpkm1                                      !==  Horizontal divergence  ==!
74         DO jj = 2, jpjm1
75            DO ji = fs_2, fs_jpim1   ! vector opt.
76               hdivn(ji,jj,jk) = (  e2u(ji  ,jj) * fse3u_n(ji  ,jj,jk) * un(ji  ,jj,jk)        &
77                  &               - e2u(ji-1,jj) * fse3u_n(ji-1,jj,jk) * un(ji-1,jj,jk)        &
78                  &               + e1v(ji,jj  ) * fse3v_n(ji,jj  ,jk) * vn(ji,jj  ,jk)        &
79                  &               - e1v(ji,jj-1) * fse3v_n(ji,jj-1,jk) * vn(ji,jj-1,jk)   )    &
80                  &            / ( e1e2t(ji,jj) * fse3t_n(ji,jj,jk) )
81            END DO 
82         END DO 
83         IF( .NOT. AGRIF_Root() ) THEN
84            IF( nbondi ==  1 .OR. nbondi == 2 )   hdivn(nlci-1,   :  ,jk) = 0._wp      ! east
85            IF( nbondi == -1 .OR. nbondi == 2 )   hdivn(  2   ,   :  ,jk) = 0._wp      ! west
86            IF( nbondj ==  1 .OR. nbondj == 2 )   hdivn(  :   ,nlcj-1,jk) = 0._wp      ! north
87            IF( nbondj == -1 .OR. nbondj == 2 )   hdivn(  :   ,  2   ,jk) = 0._wp      ! south
88         ENDIF
89      END DO
90      !
91      IF( ln_rnf                     )   CALL sbc_rnf_div( hdivn )      !==  runoffs    ==!   (update hdivn field)
92      !
93      IF( ln_divisf .AND. nn_isf > 0 )   CALL sbc_isf_div( hdivn )      !==  ice shelf  ==!   (update hdivn field)
94      !
95      CALL lbc_lnk( hdivn, 'T', 1. )                       !==  lateral boundary cond.  ==!   (no sign change)
96      !
97      IF( nn_timing == 1 )  CALL timing_stop('div_hor')
98      !
99   END SUBROUTINE div_hor
100   
101   !!======================================================================
102END MODULE divhor
Note: See TracBrowser for help on using the repository browser.