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.F90 in branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf.F90 @ 4438

Last change on this file since 4438 was 3211, checked in by spickles2, 12 years ago

Stephen Pickles, 11 Dec 2011

Commit to bring the rest of the DCSE NEMO development branch
in line with the latest development version. This includes
array index re-ordering of all OPA_SRC/.

  • Property svn:keywords set to Id
File size: 12.5 KB
Line 
1MODULE dynldf
2   !!======================================================================
3   !!                       ***  MODULE  dynldf  ***
4   !! Ocean physics:  lateral diffusivity trends
5   !!=====================================================================
6   !! History :  9.0  !  05-11  (G. Madec)  Original code (new step architecture)
7   !!----------------------------------------------------------------------
8
9   !!----------------------------------------------------------------------
10   !!   dyn_ldf      : update the dynamics trend with the lateral diffusion
11   !!   dyn_ldf_init : initialization, namelist read, and parameters control
12   !!----------------------------------------------------------------------
13   USE oce            ! ocean dynamics and tracers
14   USE dom_oce        ! ocean space and time domain
15   USE phycst         ! physical constants
16   USE ldfdyn_oce     ! ocean dynamics lateral physics
17   USE ldfslp         ! lateral mixing: slopes of mixing orientation
18   USE dynldf_bilapg  ! lateral mixing            (dyn_ldf_bilapg routine)
19   USE dynldf_bilap   ! lateral mixing            (dyn_ldf_bilap  routine)
20   USE dynldf_iso     ! lateral mixing            (dyn_ldf_iso    routine)
21   USE dynldf_lap     ! lateral mixing            (dyn_ldf_lap    routine)
22   USE trdmod         ! ocean dynamics and tracer trends
23   USE trdmod_oce     ! ocean variables trends
24   USE prtctl         ! Print control
25   USE in_out_manager ! I/O manager
26   USE lib_mpp        ! distribued memory computing library
27   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
28
29   IMPLICIT NONE
30   PRIVATE
31
32   PUBLIC   dyn_ldf       ! called by step module
33   PUBLIC   dyn_ldf_init  ! called by opa  module
34
35   INTEGER ::   nldf = -2   ! type of lateral diffusion used defined from ln_dynldf_... namlist logicals)
36
37   !! * Control permutation of array indices
38#  include "oce_ftrans.h90"
39#  include "dom_oce_ftrans.h90"
40#  include "ldfdyn_oce_ftrans.h90"
41#  include "ldfslp_ftrans.h90"
42
43   !! * Substitutions
44#  include "domzgr_substitute.h90"
45#  include "vectopt_loop_substitute.h90"
46   !!----------------------------------------------------------------------
47   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
48   !! $Id$
49   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
50   !!----------------------------------------------------------------------
51CONTAINS
52
53   SUBROUTINE dyn_ldf( kt )
54      !!----------------------------------------------------------------------
55      !!                  ***  ROUTINE dyn_ldf  ***
56      !!
57      !! ** Purpose :   compute the lateral ocean dynamics physics.
58      !!----------------------------------------------------------------------
59      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
60      USE wrk_nemo, ONLY:   ztrdu => wrk_3d_1 , ztrdv => wrk_3d_2
61      !! DCSE_NEMO: need additional directives for renamed module variables
62!FTRANS ztrdu :I :I :z
63!FTRANS ztrdv :I :I :z
64
65      !
66      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
67      !!----------------------------------------------------------------------
68
69      IF( wrk_in_use(3, 1,2) ) THEN
70         CALL ctl_stop('dyn_ldf: requested workspace arrays unavailable')   ;   RETURN
71      ENDIF
72      !
73      IF( l_trddyn )   THEN                      ! temporary save of ta and sa trends
74         ztrdu(:,:,:) = ua(:,:,:) 
75         ztrdv(:,:,:) = va(:,:,:) 
76      ENDIF
77
78      SELECT CASE ( nldf )                       ! compute lateral mixing trend and add it to the general trend
79      !
80      CASE ( 0 )    ;   CALL dyn_ldf_lap    ( kt )      ! iso-level laplacian
81      CASE ( 1 )    ;   CALL dyn_ldf_iso    ( kt )      ! rotated laplacian (except dk[ dk[.] ] part)
82      CASE ( 2 )    ;   CALL dyn_ldf_bilap  ( kt )      ! iso-level bilaplacian
83      CASE ( 3 )    ;   CALL dyn_ldf_bilapg ( kt )      ! s-coord. horizontal bilaplacian
84      CASE ( 4 )                                        ! iso-level laplacian + bilaplacian
85         CALL dyn_ldf_lap    ( kt )
86         CALL dyn_ldf_bilap  ( kt )
87      CASE ( 5 )                                        ! rotated laplacian + bilaplacian (s-coord)
88         CALL dyn_ldf_iso    ( kt )
89         CALL dyn_ldf_bilapg ( kt )
90      !
91      CASE ( -1 )                                       ! esopa: test all possibility with control print
92                        CALL dyn_ldf_lap    ( kt )
93                        CALL prt_ctl( tab3d_1=ua, clinfo1=' ldf0 - Ua: ', mask1=umask,   &
94            &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
95                        CALL dyn_ldf_iso    ( kt )
96                        CALL prt_ctl( tab3d_1=ua, clinfo1=' ldf1 - Ua: ', mask1=umask,   &
97            &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
98                        CALL dyn_ldf_bilap  ( kt )
99                        CALL prt_ctl( tab3d_1=ua, clinfo1=' ldf2 - Ua: ', mask1=umask,   &
100            &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
101                        CALL dyn_ldf_bilapg ( kt )
102                        CALL prt_ctl( tab3d_1=ua, clinfo1=' ldf3 - Ua: ', mask1=umask,   &
103            &                         tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
104      !
105      CASE ( -2 )                                       ! neither laplacian nor bilaplacian schemes used
106         IF( kt == nit000 ) THEN
107            IF(lwp) WRITE(numout,*)
108            IF(lwp) WRITE(numout,*) 'dyn_ldf : no lateral diffusion on momentum setup'
109            IF(lwp) WRITE(numout,*) '~~~~~~~ '
110         ENDIF
111      END SELECT
112
113      IF( l_trddyn ) THEN                        ! save the horizontal diffusive trends for further diagnostics
114         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:)
115         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
116         CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_ldf, 'DYN', kt )
117      ENDIF
118      !                                          ! print sum trends (used for debugging)
119      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' ldf  - Ua: ', mask1=umask,   &
120         &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
121      !
122      IF( wrk_not_released(3, 1,2) )   CALL ctl_stop('dyn_ldf: failed to release workspace arrays')
123      !
124   END SUBROUTINE dyn_ldf
125
126
127   SUBROUTINE dyn_ldf_init
128      !!----------------------------------------------------------------------
129      !!                  ***  ROUTINE dyn_ldf_init  ***
130      !!
131      !! ** Purpose :   initializations of the horizontal ocean dynamics physics
132      !!----------------------------------------------------------------------
133      INTEGER ::   ioptio, ierr         ! temporary integers
134      !!----------------------------------------------------------------------
135   
136      !                                   ! Namelist nam_dynldf: already read in ldfdyn module
137
138      IF(lwp) THEN                        ! Namelist print
139         WRITE(numout,*)
140         WRITE(numout,*) 'dyn_ldf_init : Choice of the lateral diffusive operator on dynamics'
141         WRITE(numout,*) '~~~~~~~~~~~'
142         WRITE(numout,*) '       Namelist nam_dynldf : set lateral mixing parameters (type, direction, coefficients)'
143         WRITE(numout,*) '          laplacian operator          ln_dynldf_lap   = ', ln_dynldf_lap
144         WRITE(numout,*) '          bilaplacian operator        ln_dynldf_bilap = ', ln_dynldf_bilap
145         WRITE(numout,*) '          iso-level                   ln_dynldf_level = ', ln_dynldf_level
146         WRITE(numout,*) '          horizontal (geopotential)   ln_dynldf_hor   = ', ln_dynldf_hor
147         WRITE(numout,*) '          iso-neutral                 ln_dynldf_iso   = ', ln_dynldf_iso
148      ENDIF
149
150      !                                   ! control the consistency
151      ioptio = 0
152      IF( ln_dynldf_lap   )   ioptio = ioptio + 1
153      IF( ln_dynldf_bilap )   ioptio = ioptio + 1
154      IF( ioptio <  1 ) CALL ctl_warn( '          neither laplacian nor bilaplacian operator set for dynamics' )
155      ioptio = 0
156      IF( ln_dynldf_level )   ioptio = ioptio + 1
157      IF( ln_dynldf_hor   )   ioptio = ioptio + 1
158      IF( ln_dynldf_iso   )   ioptio = ioptio + 1
159      IF( ioptio /= 1 ) CALL ctl_stop( '          use only ONE direction (level/hor/iso)' )
160
161      !                                   ! Set nldf, the type of lateral diffusion, from ln_dynldf_... logicals
162      ierr = 0
163      IF ( ln_dynldf_lap ) THEN      ! laplacian operator
164         IF ( ln_zco ) THEN                ! z-coordinate
165            IF ( ln_dynldf_level )   nldf = 0      ! iso-level  (no rotation)
166            IF ( ln_dynldf_hor   )   nldf = 0      ! horizontal (no rotation)
167            IF ( ln_dynldf_iso   )   nldf = 1      ! isoneutral (   rotation)
168         ENDIF
169         IF ( ln_zps ) THEN             ! z-coordinate
170            IF ( ln_dynldf_level )   ierr = 1      ! iso-level not allowed
171            IF ( ln_dynldf_hor   )   nldf = 0      ! horizontal (no rotation)
172            IF ( ln_dynldf_iso   )   nldf = 1      ! isoneutral (   rotation)
173         ENDIF
174         IF ( ln_sco ) THEN             ! s-coordinate
175            IF ( ln_dynldf_level )   nldf = 0      ! iso-level  (no rotation)
176            IF ( ln_dynldf_hor   )   nldf = 1      ! horizontal (   rotation)
177            IF ( ln_dynldf_iso   )   nldf = 1      ! isoneutral (   rotation)
178         ENDIF
179      ENDIF
180
181      IF( ln_dynldf_bilap ) THEN      ! bilaplacian operator
182         IF ( ln_zco ) THEN                ! z-coordinate
183            IF ( ln_dynldf_level )   nldf = 2      ! iso-level  (no rotation)
184            IF ( ln_dynldf_hor   )   nldf = 2      ! horizontal (no rotation)
185            IF ( ln_dynldf_iso   )   ierr = 2      ! isoneutral (   rotation)
186         ENDIF
187         IF ( ln_zps ) THEN             ! z-coordinate
188            IF ( ln_dynldf_level )   ierr = 1      ! iso-level not allowed
189            IF ( ln_dynldf_hor   )   nldf = 2      ! horizontal (no rotation)
190            IF ( ln_dynldf_iso   )   ierr = 2      ! isoneutral (   rotation)
191         ENDIF
192         IF ( ln_sco ) THEN             ! s-coordinate
193            IF ( ln_dynldf_level )   nldf = 2      ! iso-level  (no rotation)
194            IF ( ln_dynldf_hor   )   nldf = 3      ! horizontal (   rotation)
195            IF ( ln_dynldf_iso   )   ierr = 2      ! isoneutral (   rotation)
196         ENDIF
197      ENDIF
198     
199      IF( ln_dynldf_lap .AND. ln_dynldf_bilap ) THEN  ! mixed laplacian and bilaplacian operators
200         IF ( ln_zco ) THEN                ! z-coordinate
201            IF ( ln_dynldf_level )   nldf = 4      ! iso-level  (no rotation)
202            IF ( ln_dynldf_hor   )   nldf = 4      ! horizontal (no rotation)
203            IF ( ln_dynldf_iso   )   ierr = 2      ! isoneutral (   rotation)
204         ENDIF
205         IF ( ln_zps ) THEN             ! z-coordinate
206            IF ( ln_dynldf_level )   ierr = 1      ! iso-level not allowed
207            IF ( ln_dynldf_hor   )   nldf = 4      ! horizontal (no rotation)
208            IF ( ln_dynldf_iso   )   ierr = 2      ! isoneutral (   rotation)
209         ENDIF
210         IF ( ln_sco ) THEN             ! s-coordinate
211            IF ( ln_dynldf_level )   nldf = 4      ! iso-level  (no rotation)
212            IF ( ln_dynldf_hor   )   nldf = 5      ! horizontal (   rotation)
213            IF ( ln_dynldf_iso   )   ierr = 2      ! isoneutral (   rotation)
214         ENDIF
215      ENDIF
216
217      IF( lk_esopa )                 nldf = -1     ! esopa test
218
219      IF( ierr == 1 )   CALL ctl_stop( 'iso-level in z-coordinate - partial step, not allowed' )
220      IF( ierr == 2 )   CALL ctl_stop( 'isoneutral bilaplacian operator does not exist' )
221      IF( nldf == 1 .OR. nldf == 3 ) THEN      ! rotation
222         IF( .NOT.lk_ldfslp )   CALL ctl_stop( 'the rotation of the diffusive tensor require key_ldfslp' )
223      ENDIF
224
225      IF(lwp) THEN
226         WRITE(numout,*)
227         IF( nldf == -2 )   WRITE(numout,*) '              neither laplacian nor bilaplacian schemes used'
228         IF( nldf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used'
229         IF( nldf ==  0 )   WRITE(numout,*) '              laplacian operator'
230         IF( nldf ==  1 )   WRITE(numout,*) '              rotated laplacian operator'
231         IF( nldf ==  2 )   WRITE(numout,*) '              bilaplacian operator'
232         IF( nldf ==  3 )   WRITE(numout,*) '              rotated bilaplacian'
233         IF( nldf ==  4 )   WRITE(numout,*) '              laplacian and bilaplacian operators'
234         IF( nldf ==  5 )   WRITE(numout,*) '              rotated laplacian and bilaplacian operators'
235      ENDIF
236      !
237   END SUBROUTINE dyn_ldf_init
238
239   !!======================================================================
240END MODULE dynldf
Note: See TracBrowser for help on using the repository browser.