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/branches/2020/dev_r12527_Gurvan_ShallowWater/cfgs/penzAM98/MY_SRC – NEMO

source: NEMO/branches/2020/dev_r12527_Gurvan_ShallowWater/cfgs/penzAM98/MY_SRC/divhor.F90 @ 13562

Last change on this file since 13562 was 13562, checked in by gm, 4 years ago

zgr_pse created only for NS coast

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