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/2014/dev_CNRS0_NOC1_LDF/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: branches/2014/dev_CNRS0_NOC1_LDF/NEMOGCM/NEMO/OPA_SRC/DYN/divhor.F90 @ 4596

Last change on this file since 4596 was 4596, checked in by gm, 10 years ago

#1260: LDF simplification + bilap iso-neutral for TRA and GYRE

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