1 | MODULE 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, ln_isf ! surface boundary condition: ocean |
---|
23 | USE sbcrnf ! river runoff |
---|
24 | USE sbcisf ! ice shelf |
---|
25 | USE iscplhsb ! ice sheet / ocean coupling |
---|
26 | USE iscplini ! ice sheet / ocean coupling |
---|
27 | #if defined key_asminc |
---|
28 | USE asminc ! Assimilation increment |
---|
29 | #endif |
---|
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 timing ! Timing |
---|
35 | |
---|
36 | IMPLICIT NONE |
---|
37 | PRIVATE |
---|
38 | |
---|
39 | PUBLIC div_hor ! routine called by step.F90 and istate.F90 |
---|
40 | |
---|
41 | !! * Substitutions |
---|
42 | # include "vectopt_loop_substitute.h90" |
---|
43 | !!---------------------------------------------------------------------- |
---|
44 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
45 | !! $Id$ |
---|
46 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
47 | !!---------------------------------------------------------------------- |
---|
48 | CONTAINS |
---|
49 | |
---|
50 | SUBROUTINE div_hor( kt ) |
---|
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 | !! hdivn = 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 hdivn, the now horizontal divergence |
---|
61 | !!---------------------------------------------------------------------- |
---|
62 | INTEGER, INTENT(in) :: kt ! ocean time-step index |
---|
63 | ! |
---|
64 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
65 | REAL(wp) :: zraur, zdep ! local scalars |
---|
66 | !!---------------------------------------------------------------------- |
---|
67 | ! |
---|
68 | IF( ln_timing ) CALL timing_start('div_hor') |
---|
69 | ! |
---|
70 | IF( kt == nit000 ) THEN |
---|
71 | IF(lwp) WRITE(numout,*) |
---|
72 | IF(lwp) WRITE(numout,*) 'div_hor : horizontal velocity divergence ' |
---|
73 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
74 | hdivn(:,:,:) = 0._wp ! initialize hdivn for the halos at the first time step |
---|
75 | ENDIF |
---|
76 | ! |
---|
77 | DO jk = 1, jpkm1 !== Horizontal divergence ==! |
---|
78 | DO jj = 2, jpjm1 |
---|
79 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
80 | hdivn(ji,jj,jk) = ( e2u(ji ,jj) * e3u_n(ji ,jj,jk) * un(ji ,jj,jk) & |
---|
81 | & - e2u(ji-1,jj) * e3u_n(ji-1,jj,jk) * un(ji-1,jj,jk) & |
---|
82 | & + e1v(ji,jj ) * e3v_n(ji,jj ,jk) * vn(ji,jj ,jk) & |
---|
83 | & - e1v(ji,jj-1) * e3v_n(ji,jj-1,jk) * vn(ji,jj-1,jk) ) & |
---|
84 | & * r1_e1e2t(ji,jj) / e3t_n(ji,jj,jk) |
---|
85 | END DO |
---|
86 | END DO |
---|
87 | END DO |
---|
88 | #if defined key_agrif |
---|
89 | IF( .NOT. Agrif_Root() ) THEN |
---|
90 | IF( l_Westedge ) hdivn( 2 , : ,:) = 0._wp ! west |
---|
91 | IF( l_Eastedge ) hdivn( nlci-1, : ,:) = 0._wp ! east |
---|
92 | IF( l_Southedge ) hdivn( : , 2 ,:) = 0._wp ! south |
---|
93 | IF( l_Northedge ) hdivn( : ,nlcj-1,:) = 0._wp ! north |
---|
94 | ENDIF |
---|
95 | #endif |
---|
96 | ! |
---|
97 | IF( ln_rnf ) CALL sbc_rnf_div( hdivn ) !== runoffs ==! (update hdivn field) |
---|
98 | ! |
---|
99 | #if defined key_asminc |
---|
100 | IF( ln_sshinc .AND. ln_asmiau ) CALL ssh_asm_div( kt, hdivn ) !== SSH assimilation ==! (update hdivn field) |
---|
101 | ! |
---|
102 | #endif |
---|
103 | IF( ln_isf ) CALL sbc_isf_div( hdivn ) !== ice shelf ==! (update hdivn field) |
---|
104 | ! |
---|
105 | IF( ln_iscpl .AND. ln_hsb ) CALL iscpl_div( hdivn ) !== ice sheet ==! (update hdivn field) |
---|
106 | ! |
---|
107 | CALL lbc_lnk( 'divhor', hdivn, 'T', 1. ) ! (no sign change) |
---|
108 | ! |
---|
109 | IF( ln_timing ) CALL timing_stop('div_hor') |
---|
110 | ! |
---|
111 | END SUBROUTINE div_hor |
---|
112 | |
---|
113 | !!====================================================================== |
---|
114 | END MODULE divhor |
---|