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.
dynldf_lap.F90 in trunk/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: trunk/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_lap.F90 @ 2715

Last change on this file since 2715 was 2715, checked in by rblod, 13 years ago

First attempt to put dynamic allocation on the trunk

  • Property svn:keywords set to Id
File size: 5.0 KB
Line 
1MODULE dynldf_lap
2   !!======================================================================
3   !!                       ***  MODULE  dynldf_lap  ***
4   !! Ocean dynamics:  lateral viscosity trend
5   !!======================================================================
6   !! History :  OPA  ! 1990-09 (G. Madec) Original code
7   !!            4.0  ! 1991-11 (G. Madec)
8   !!            6.0  ! 1996-01 (G. Madec) statement function for e3 and ahm
9   !!   NEMO     1.0  ! 2002-06 (G. Madec)  F90: Free form and module
10   !!             -   ! 2004-08 (C. Talandier) New trends organization
11   !!----------------------------------------------------------------------
12
13   !!----------------------------------------------------------------------
14   !!   dyn_ldf_lap  : update the momentum trend with the lateral diffusion
15   !!                  using an iso-level harmonic operator
16   !!----------------------------------------------------------------------
17   USE oce             ! ocean dynamics and tracers
18   USE dom_oce         ! ocean space and time domain
19   USE ldfdyn_oce      ! ocean dynamics: lateral physics
20   USE zdf_oce         ! ocean vertical physics
21   USE in_out_manager  ! I/O manager
22   USE trdmod          ! ocean dynamics trends
23   USE trdmod_oce      ! ocean variables trends
24   USE ldfslp          ! iso-neutral slopes
25
26   IMPLICIT NONE
27   PRIVATE
28
29   PUBLIC dyn_ldf_lap  ! called by step.F90
30
31   !! * Substitutions
32#  include "domzgr_substitute.h90"
33#  include "ldfdyn_substitute.h90"
34#  include "vectopt_loop_substitute.h90"
35   !!----------------------------------------------------------------------
36   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
37   !! $Id$
38   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
39   !!----------------------------------------------------------------------
40CONTAINS
41
42   SUBROUTINE dyn_ldf_lap( kt )
43      !!----------------------------------------------------------------------
44      !!                     ***  ROUTINE dyn_ldf_lap  ***
45      !!                       
46      !! ** Purpose :   Compute the before horizontal tracer (t & s) diffusive
47      !!      trend and add it to the general trend of tracer equation.
48      !!
49      !! ** Method  :   The before horizontal momentum diffusion trend is an
50      !!      harmonic operator (laplacian type) which separates the divergent
51      !!      and rotational parts of the flow.
52      !!      Its horizontal components are computed as follow:
53      !!         difu = 1/e1u di[ahmt hdivb] - 1/(e2u*e3u) dj-1[e3f ahmf rotb]
54      !!         difv = 1/e2v dj[ahmt hdivb] + 1/(e1v*e3v) di-1[e3f ahmf rotb]
55      !!      in the rotational part of the diffusion.
56      !!      Add this before trend to the general trend (ua,va):
57      !!            (ua,va) = (ua,va) + (diffu,diffv)
58      !!      'key_trddyn' activated: the two components of the horizontal
59      !!                                 diffusion trend are saved.
60      !!
61      !! ** Action : - Update (ua,va) with the before iso-level harmonic
62      !!               mixing trend.
63      !!----------------------------------------------------------------------
64      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
65      !
66      INTEGER  ::   ji, jj, jk             ! dummy loop indices
67      REAL(wp) ::   zua, zva, ze2u, ze1v   ! local scalars
68      !!----------------------------------------------------------------------
69      !
70      IF( kt == nit000 ) THEN
71         IF(lwp) WRITE(numout,*)
72         IF(lwp) WRITE(numout,*) 'dyn_ldf : iso-level harmonic (laplacian) operator'
73         IF(lwp) WRITE(numout,*) '~~~~~~~ '
74      ENDIF
75      !                                                ! ===============
76      DO jk = 1, jpkm1                                 ! Horizontal slab
77         !                                             ! ===============
78         DO jj = 2, jpjm1
79            DO ji = fs_2, fs_jpim1   ! vector opt.
80               ze2u = rotb (ji,jj,jk) * fsahmf(ji,jj,jk) * fse3f(ji,jj,jk)
81               ze1v = hdivb(ji,jj,jk) * fsahmt(ji,jj,jk)
82               ! horizontal diffusive trends
83               zua = - ( ze2u - rotb (ji,jj-1,jk)*fsahmf(ji,jj-1,jk)*fse3f(ji,jj-1,jk) ) / ( e2u(ji,jj) * fse3u(ji,jj,jk) )   &
84                     + ( hdivb(ji+1,jj,jk)*fsahmt(ji+1,jj,jk) - ze1v                   ) / e1u(ji,jj)
85
86               zva = + ( ze2u - rotb (ji-1,jj,jk)*fsahmf(ji-1,jj,jk)*fse3f(ji-1,jj,jk) ) / ( e1v(ji,jj) * fse3v(ji,jj,jk) )   &
87                     + ( hdivb(ji,jj+1,jk)*fsahmt(ji,jj+1,jk) - ze1v                   ) / e2v(ji,jj)
88
89               ! add it to the general momentum trends
90               ua(ji,jj,jk) = ua(ji,jj,jk) + zua
91               va(ji,jj,jk) = va(ji,jj,jk) + zva
92            END DO
93         END DO
94         !                                             ! ===============
95      END DO                                           !   End of slab
96      !                                                ! ===============
97   END SUBROUTINE dyn_ldf_lap
98
99   !!======================================================================
100END MODULE dynldf_lap
Note: See TracBrowser for help on using the repository browser.