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.
sshwzv.F90 in NEMO/branches/2021/dev_r14273_HPC-02_Daley_Tiling/src/OCE/DYN – NEMO

source: NEMO/branches/2021/dev_r14273_HPC-02_Daley_Tiling/src/OCE/DYN/sshwzv.F90 @ 14680

Last change on this file since 14680 was 14680, checked in by hadcv, 3 years ago

#2600: Merge in dev_r14393_HPC-03_Mele_Comm_Cleanup [14667]

  • Property svn:keywords set to Id
File size: 22.2 KB
Line 
1MODULE sshwzv   
2   !!==============================================================================
3   !!                       ***  MODULE  sshwzv  ***
4   !! Ocean dynamics : sea surface height and vertical velocity
5   !!==============================================================================
6   !! History :  3.1  !  2009-02  (G. Madec, M. Leclair)  Original code
7   !!            3.3  !  2010-04  (M. Leclair, G. Madec)  modified LF-RA
8   !!             -   !  2010-05  (K. Mogensen, A. Weaver, M. Martin, D. Lea)  Assimilation interface
9   !!             -   !  2010-09  (D.Storkey and E.O'Dea)  bug fixes for BDY module
10   !!            3.3  !  2011-10  (M. Leclair)  split former ssh_wzv routine and remove all vvl related work
11   !!            4.0  !  2018-12  (A. Coward)  add mixed implicit/explicit advection
12   !!            4.1  !  2019-08  (A. Coward, D. Storkey)  Rename ssh_nxt -> ssh_atf. Now only does time filtering.
13   !!             -   !  2020-08  (S. Techene, G. Madec)  add here ssh initiatlisation
14   !!----------------------------------------------------------------------
15
16   !!----------------------------------------------------------------------
17   !!   ssh_nxt       : after ssh
18   !!   ssh_atf       : time filter the ssh arrays
19   !!   wzv           : compute now vertical velocity
20   !!----------------------------------------------------------------------
21   USE oce            ! ocean dynamics and tracers variables
22   USE isf_oce        ! ice shelf
23   USE dom_oce        ! ocean space and time domain variables
24   USE sbc_oce        ! surface boundary condition: ocean
25   USE domvvl         ! Variable volume
26   USE divhor         ! horizontal divergence
27   USE phycst         ! physical constants
28   USE bdy_oce , ONLY : ln_bdy, bdytmask   ! Open BounDarY
29   USE bdydyn2d       ! bdy_ssh routine
30   USE wet_dry        ! Wetting/Drying flux limiting
31#if defined key_agrif
32   USE agrif_oce
33   USE agrif_oce_interp
34#endif
35   !
36   USE iom 
37   USE in_out_manager ! I/O manager
38   USE restart        ! only for lrst_oce
39   USE prtctl         ! Print control
40   USE lbclnk         ! ocean lateral boundary condition (or mpp link)
41   USE lib_mpp        ! MPP library
42   USE timing         ! Timing
43   
44   IMPLICIT NONE
45   PRIVATE
46
47   PUBLIC   ssh_nxt        ! called by step.F90
48   PUBLIC   wzv            ! called by step.F90
49   PUBLIC   wAimp          ! called by step.F90
50   PUBLIC   ssh_atf        ! called by step.F90
51
52   !! * Substitutions
53#  include "do_loop_substitute.h90"
54#  include "domzgr_substitute.h90"
55   !!----------------------------------------------------------------------
56   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
57   !! $Id$
58   !! Software governed by the CeCILL license (see ./LICENSE)
59   !!----------------------------------------------------------------------
60CONTAINS
61
62   SUBROUTINE ssh_nxt( kt, Kbb, Kmm, pssh, Kaa )
63      !!----------------------------------------------------------------------
64      !!                ***  ROUTINE ssh_nxt  ***
65      !!                   
66      !! ** Purpose :   compute the after ssh (ssh(Kaa))
67      !!
68      !! ** Method  : - Using the incompressibility hypothesis, the ssh increment
69      !!      is computed by integrating the horizontal divergence and multiply by
70      !!      by the time step.
71      !!
72      !! ** action  :   ssh(:,:,Kaa), after sea surface height
73      !!
74      !! Reference  : Leclair, M., and G. Madec, 2009, Ocean Modelling.
75      !!----------------------------------------------------------------------
76      INTEGER                         , INTENT(in   ) ::   kt             ! time step
77      INTEGER                         , INTENT(in   ) ::   Kbb, Kmm, Kaa  ! time level index
78      REAL(wp), DIMENSION(jpi,jpj,jpt), INTENT(inout) ::   pssh           ! sea-surface height
79      !
80      INTEGER  ::   ji, jj, jk      ! dummy loop index
81      REAL(wp) ::   zcoef   ! local scalar
82      REAL(wp), DIMENSION(jpi,jpj) ::   zhdiv   ! 2D workspace
83      !!----------------------------------------------------------------------
84      !
85      IF( ln_timing )   CALL timing_start('ssh_nxt')
86      !
87      IF( kt == nit000 ) THEN
88         IF(lwp) WRITE(numout,*)
89         IF(lwp) WRITE(numout,*) 'ssh_nxt : after sea surface height'
90         IF(lwp) WRITE(numout,*) '~~~~~~~ '
91      ENDIF
92      !
93      zcoef = 0.5_wp * r1_rho0
94
95      !                                           !------------------------------!
96      !                                           !   After Sea Surface Height   !
97      !                                           !------------------------------!
98      IF(ln_wd_il) THEN
99         CALL wad_lmt(pssh(:,:,Kbb), zcoef * (emp_b(:,:) + emp(:,:)), rDt, Kmm, uu, vv )
100      ENDIF
101
102      CALL div_hor( kt, Kbb, Kmm )                     ! Horizontal divergence
103      !
104      zhdiv(:,:) = 0._wp
105      ! [comm_cleanup] ! DO jk = 1, jpkm1                                 ! Horizontal divergence of barotropic transports
106      DO_3D( nn_hls-1, nn_hls, nn_hls-1, nn_hls, 1, jpkm1 )                                 ! Horizontal divergence of barotropic transports
107        zhdiv(ji,jj) = zhdiv(ji,jj) + e3t(ji,jj,jk,Kmm) * hdiv(ji,jj,jk)
108      END_3D
109      !                                                ! Sea surface elevation time stepping
110      ! In time-split case we need a first guess of the ssh after (using the baroclinic timestep) in order to
111      ! compute the vertical velocity which can be used to compute the non-linear terms of the momentum equations.
112      !
113      ! [comm_cleanup]
114      DO_2D( nn_hls-1, nn_hls, nn_hls-1, nn_hls )
115         pssh(ji,jj,Kaa) = (  pssh(ji,jj,Kbb) - rDt * ( zcoef * ( emp_b(ji,jj) + emp(ji,jj) ) + zhdiv(ji,jj) )  ) * ssmask(ji,jj)
116      END_2D
117      !
118#if defined key_agrif
119      Kbb_a = Kbb   ;   Kmm_a = Kmm   ;   Krhs_a = Kaa
120      CALL agrif_ssh( kt )
121#endif
122      !
123      IF ( .NOT.ln_dynspg_ts ) THEN
124         IF( ln_bdy ) THEN
125            ! [comm_cleanup]
126            IF (nn_hls.eq.1) CALL lbc_lnk( 'sshwzv', pssh(:,:,Kaa), 'T', 1.0_wp )    ! Not sure that's necessary
127            CALL bdy_ssh( pssh(:,:,Kaa) )             ! Duplicate sea level across open boundaries
128         ENDIF
129      ENDIF
130      !                                           !------------------------------!
131      !                                           !           outputs            !
132      !                                           !------------------------------!
133      !
134      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab2d_1=pssh(:,:,Kaa), clinfo1=' pssh(:,:,Kaa)  - : ', mask1=tmask )
135      !
136      IF( ln_timing )   CALL timing_stop('ssh_nxt')
137      !
138   END SUBROUTINE ssh_nxt
139
140   
141   SUBROUTINE wzv( kt, Kbb, Kmm, Kaa, pww )
142      !!----------------------------------------------------------------------
143      !!                ***  ROUTINE wzv  ***
144      !!                   
145      !! ** Purpose :   compute the now vertical velocity
146      !!
147      !! ** Method  : - Using the incompressibility hypothesis, the vertical
148      !!      velocity is computed by integrating the horizontal divergence 
149      !!      from the bottom to the surface minus the scale factor evolution.
150      !!        The boundary conditions are w=0 at the bottom (no flux) and.
151      !!
152      !! ** action  :   pww      : now vertical velocity
153      !!
154      !! Reference  : Leclair, M., and G. Madec, 2009, Ocean Modelling.
155      !!----------------------------------------------------------------------
156      INTEGER                         , INTENT(in)    ::   kt             ! time step
157      INTEGER                         , INTENT(in)    ::   Kbb, Kmm, Kaa  ! time level indices
158      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pww            ! vertical velocity at Kmm
159      !
160      INTEGER  ::   ji, jj, jk   ! dummy loop indices
161      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zhdiv
162      !!----------------------------------------------------------------------
163      !
164      IF( ln_timing )   CALL timing_start('wzv')
165      !
166      IF( kt == nit000 ) THEN
167         IF(lwp) WRITE(numout,*)
168         IF(lwp) WRITE(numout,*) 'wzv : now vertical velocity '
169         IF(lwp) WRITE(numout,*) '~~~~~ '
170         !
171         pww(:,:,jpk) = 0._wp                  ! bottom boundary condition: w=0 (set once for all)
172      ENDIF
173      !                                           !------------------------------!
174      !                                           !     Now Vertical Velocity    !
175      !                                           !------------------------------!
176      !
177      !                                               !===============================!
178      IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN      !==  z_tilde and layer cases  ==!
179         !                                            !===============================!
180         ALLOCATE( zhdiv(jpi,jpj,jpk) ) 
181         !
182         DO jk = 1, jpkm1
183            ! horizontal divergence of thickness diffusion transport ( velocity multiplied by e3t)
184            ! - ML - note: computation already done in dom_vvl_sf_nxt. Could be optimized (not critical and clearer this way)
185            ! [comm_cleanup] ! DO_2D( 0, 0, 0, 0 )
186            DO_2D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )
187               zhdiv(ji,jj,jk) = r1_e1e2t(ji,jj) * ( un_td(ji,jj,jk) - un_td(ji-1,jj,jk) + vn_td(ji,jj,jk) - vn_td(ji,jj-1,jk) )
188            END_2D
189         END DO
190         IF (nn_hls.eq.1) CALL lbc_lnk('sshwzv', zhdiv, 'T', 1.0_wp)  ! - ML - Perhaps not necessary: not used for horizontal "connexions"
191         !                             ! Is it problematic to have a wrong vertical velocity in boundary cells?
192         !                             ! Same question holds for hdiv. Perhaps just for security
193         DO jk = jpkm1, 1, -1                       ! integrate from the bottom the hor. divergence
194            ! computation of w
195            pww(:,:,jk) = pww(:,:,jk+1) - (   e3t(:,:,jk,Kmm) * hdiv(:,:,jk)   &
196               &                            +                  zhdiv(:,:,jk)   &
197               &                            + r1_Dt * (  e3t(:,:,jk,Kaa)       &
198               &                                       - e3t(:,:,jk,Kbb) )   ) * tmask(:,:,jk)
199         END DO
200         !          IF( ln_vvl_layer ) pww(:,:,:) = 0.e0
201         DEALLOCATE( zhdiv ) 
202         !                                            !=================================!
203      ELSEIF( ln_linssh )   THEN                      !==  linear free surface cases  ==!
204         !                                            !=================================!
205         DO jk = jpkm1, 1, -1                               ! integrate from the bottom the hor. divergence
206            pww(:,:,jk) = pww(:,:,jk+1) - (  e3t(:,:,jk,Kmm) * hdiv(:,:,jk)  ) * tmask(:,:,jk)
207         END DO
208         !                                            !==========================================!
209      ELSE                                            !==  Quasi-Eulerian vertical coordinate  ==!   ('key_qco')
210         !                                            !==========================================!
211         DO jk = jpkm1, 1, -1                               ! integrate from the bottom the hor. divergence
212            pww(:,:,jk) = pww(:,:,jk+1) - (  e3t(:,:,jk,Kmm) * hdiv(:,:,jk)                 &
213               &                            + r1_Dt * (  e3t(:,:,jk,Kaa)        &
214               &                                       - e3t(:,:,jk,Kbb)  )   ) * tmask(:,:,jk)
215         END DO
216      ENDIF
217
218      IF( ln_bdy ) THEN
219         DO jk = 1, jpkm1
220            pww(:,:,jk) = pww(:,:,jk) * bdytmask(:,:)
221         END DO
222      ENDIF
223      !
224#if defined key_agrif
225      IF( .NOT. AGRIF_Root() ) THEN
226         !
227         ! Mask vertical velocity at first/last columns/row
228         ! inside computational domain (cosmetic)
229         DO jk = 1, jpkm1
230            IF( lk_west ) THEN                             ! --- West --- !
231               DO ji = mi0(2+nn_hls), mi1(2+nn_hls)
232                  DO jj = 1, jpj
233                     pww(ji,jj,jk) = 0._wp 
234                  END DO
235               END DO
236            ENDIF
237            IF( lk_east ) THEN                             ! --- East --- !
238               DO ji = mi0(jpiglo-1-nn_hls), mi1(jpiglo-1-nn_hls)
239                  DO jj = 1, jpj
240                     pww(ji,jj,jk) = 0._wp
241                  END DO
242               END DO
243            ENDIF
244            IF( lk_south ) THEN                            ! --- South --- !
245               DO jj = mj0(2+nn_hls), mj1(2+nn_hls)
246                  DO ji = 1, jpi
247                     pww(ji,jj,jk) = 0._wp
248                  END DO
249               END DO
250            ENDIF
251            IF( lk_north ) THEN                            ! --- North --- !
252               DO jj = mj0(jpjglo-1-nn_hls), mj1(jpjglo-1-nn_hls)
253                  DO ji = 1, jpi
254                     pww(ji,jj,jk) = 0._wp
255                  END DO
256               END DO
257            ENDIF
258            !
259         END DO
260         !
261      ENDIF 
262#endif
263      !
264      IF( ln_timing )   CALL timing_stop('wzv')
265      !
266   END SUBROUTINE wzv
267
268
269   SUBROUTINE ssh_atf( kt, Kbb, Kmm, Kaa, pssh )
270      !!----------------------------------------------------------------------
271      !!                    ***  ROUTINE ssh_atf  ***
272      !!
273      !! ** Purpose :   Apply Asselin time filter to now SSH.
274      !!
275      !! ** Method  : - apply Asselin time fiter to now ssh (excluding the forcing
276      !!              from the filter, see Leclair and Madec 2010) and swap :
277      !!                pssh(:,:,Kmm) = pssh(:,:,Kaa) + rn_atfp * ( pssh(:,:,Kbb) -2 pssh(:,:,Kmm) + pssh(:,:,Kaa) )
278      !!                            - rn_atfp * rn_Dt * ( emp_b - emp ) / rho0
279      !!
280      !! ** action  : - pssh(:,:,Kmm) time filtered
281      !!
282      !! Reference  : Leclair, M., and G. Madec, 2009, Ocean Modelling.
283      !!----------------------------------------------------------------------
284      INTEGER                         , INTENT(in   ) ::   kt             ! ocean time-step index
285      INTEGER                         , INTENT(in   ) ::   Kbb, Kmm, Kaa  ! ocean time level indices
286      REAL(wp), DIMENSION(jpi,jpj,jpt), INTENT(inout) ::   pssh           ! SSH field
287      !
288      REAL(wp) ::   zcoef   ! local scalar
289      !!----------------------------------------------------------------------
290      !
291      IF( ln_timing )   CALL timing_start('ssh_atf')
292      !
293      IF( kt == nit000 ) THEN
294         IF(lwp) WRITE(numout,*)
295         IF(lwp) WRITE(numout,*) 'ssh_atf : Asselin time filter of sea surface height'
296         IF(lwp) WRITE(numout,*) '~~~~~~~ '
297      ENDIF
298      !
299      IF( .NOT.l_1st_euler ) THEN   ! Apply Asselin time filter on Kmm field (not on euler 1st)
300         !
301         IF( ln_linssh ) THEN                ! filtered "now" field
302            pssh(:,:,Kmm) = pssh(:,:,Kmm) + rn_atfp * ( pssh(:,:,Kbb) - 2 * pssh(:,:,Kmm) + pssh(:,:,Kaa) )
303            !
304         ELSE                                ! filtered "now" field with forcing removed
305            zcoef = rn_atfp * rn_Dt * r1_rho0
306            pssh(:,:,Kmm) = pssh(:,:,Kmm) + rn_atfp * ( pssh(:,:,Kbb) - 2 * pssh(:,:,Kmm) + pssh(:,:,Kaa) )   &
307               &                          - zcoef   * (         emp_b(:,:) -        emp(:,:)   &
308               &                                              - rnf_b(:,:) +        rnf(:,:)   &
309               &                                       + fwfisf_cav_b(:,:) - fwfisf_cav(:,:)   &
310               &                                       + fwfisf_par_b(:,:) - fwfisf_par(:,:)   ) * ssmask(:,:)
311
312            ! ice sheet coupling
313            IF( ln_isf .AND. ln_isfcpl .AND. kt == nit000+1 )   &
314               &   pssh(:,:,Kbb) = pssh(:,:,Kbb) - rn_atfp * rn_Dt * ( risfcpl_ssh(:,:) - 0._wp ) * ssmask(:,:)
315
316         ENDIF
317      ENDIF
318      !
319      IF(sn_cfctl%l_prtctl)   CALL prt_ctl( tab2d_1=pssh(:,:,Kmm), clinfo1=' atf  - pssh(:,:,Kmm): ', mask1=tmask )
320      !
321      IF( ln_timing )   CALL timing_stop('ssh_atf')
322      !
323   END SUBROUTINE ssh_atf
324
325   
326   SUBROUTINE wAimp( kt, Kmm )
327      !!----------------------------------------------------------------------
328      !!                ***  ROUTINE wAimp  ***
329      !!                   
330      !! ** Purpose :   compute the Courant number and partition vertical velocity
331      !!                if a proportion needs to be treated implicitly
332      !!
333      !! ** Method  : -
334      !!
335      !! ** action  :   ww      : now vertical velocity (to be handled explicitly)
336      !!            :   wi      : now vertical velocity (for implicit treatment)
337      !!
338      !! Reference  : Shchepetkin, A. F. (2015): An adaptive, Courant-number-dependent
339      !!              implicit scheme for vertical advection in oceanic modeling.
340      !!              Ocean Modelling, 91, 38-69.
341      !!----------------------------------------------------------------------
342      INTEGER, INTENT(in) ::   kt   ! time step
343      INTEGER, INTENT(in) ::   Kmm  ! time level index
344      !
345      INTEGER  ::   ji, jj, jk   ! dummy loop indices
346      REAL(wp)             ::   zCu, zcff, z1_e3t, zdt                ! local scalars
347      REAL(wp) , PARAMETER ::   Cu_min = 0.15_wp                      ! local parameters
348      REAL(wp) , PARAMETER ::   Cu_max = 0.30_wp                      ! local parameters
349      REAL(wp) , PARAMETER ::   Cu_cut = 2._wp*Cu_max - Cu_min        ! local parameters
350      REAL(wp) , PARAMETER ::   Fcu    = 4._wp*Cu_max*(Cu_max-Cu_min) ! local parameters
351      !!----------------------------------------------------------------------
352      !
353      IF( ln_timing )   CALL timing_start('wAimp')
354      !
355      IF( kt == nit000 ) THEN
356         IF(lwp) WRITE(numout,*)
357         IF(lwp) WRITE(numout,*) 'wAimp : Courant number-based partitioning of now vertical velocity '
358         IF(lwp) WRITE(numout,*) '~~~~~ '
359         wi(:,:,:) = 0._wp
360      ENDIF
361      !
362      ! Calculate Courant numbers
363      zdt = 2._wp * rn_Dt                            ! 2*rn_Dt and not rDt (for restartability)
364      IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN
365         ! [comm_cleanup] ! DO_3D( 0, 0, 0, 0, 1, jpkm1 )
366         DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 1, jpkm1 )
367            z1_e3t = 1._wp / e3t(ji,jj,jk,Kmm)
368            Cu_adv(ji,jj,jk) =   zdt *                                                         &
369               &  ( ( MAX( ww(ji,jj,jk) , 0._wp ) - MIN( ww(ji,jj,jk+1) , 0._wp ) )            &
370               &  + ( MAX( e2u(ji  ,jj) * e3u(ji  ,jj,jk,Kmm)                                  &
371               &                        * uu (ji  ,jj,jk,Kmm) + un_td(ji  ,jj,jk), 0._wp ) -   &
372               &      MIN( e2u(ji-1,jj) * e3u(ji-1,jj,jk,Kmm)                                  &
373               &                        * uu (ji-1,jj,jk,Kmm) + un_td(ji-1,jj,jk), 0._wp ) )   &
374               &                               * r1_e1e2t(ji,jj)                                                                     &
375               &  + ( MAX( e1v(ji,jj  ) * e3v(ji,jj  ,jk,Kmm)                                  &
376               &                        * vv (ji,jj  ,jk,Kmm) + vn_td(ji,jj  ,jk), 0._wp ) -   &
377               &      MIN( e1v(ji,jj-1) * e3v(ji,jj-1,jk,Kmm)                                  &
378               &                        * vv (ji,jj-1,jk,Kmm) + vn_td(ji,jj-1,jk), 0._wp ) )   &
379               &                               * r1_e1e2t(ji,jj)                                                                     &
380               &                             ) * z1_e3t
381         END_3D
382      ELSE
383         ! [comm_cleanup] ! DO_3D( 0, 0, 0, 0, 1, jpkm1 )
384         DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 1, jpkm1 )
385            z1_e3t = 1._wp / e3t(ji,jj,jk,Kmm)
386            Cu_adv(ji,jj,jk) =   zdt *                                                      &
387               &  ( ( MAX( ww(ji,jj,jk) , 0._wp ) - MIN( ww(ji,jj,jk+1) , 0._wp ) )         &
388               &                             + ( MAX( e2u(ji  ,jj)*e3u(ji  ,jj,jk,Kmm)*uu(ji  ,jj,jk,Kmm), 0._wp ) -   &
389               &                                 MIN( e2u(ji-1,jj)*e3u(ji-1,jj,jk,Kmm)*uu(ji-1,jj,jk,Kmm), 0._wp ) )   &
390               &                               * r1_e1e2t(ji,jj)                                                 &
391               &                             + ( MAX( e1v(ji,jj  )*e3v(ji,jj  ,jk,Kmm)*vv(ji,jj  ,jk,Kmm), 0._wp ) -   &
392               &                                 MIN( e1v(ji,jj-1)*e3v(ji,jj-1,jk,Kmm)*vv(ji,jj-1,jk,Kmm), 0._wp ) )   &
393               &                               * r1_e1e2t(ji,jj)                                                 &
394               &                             ) * z1_e3t
395         END_3D
396      ENDIF
397      IF (nn_hls.eq.1) CALL lbc_lnk( 'sshwzv', Cu_adv, 'T', 1.0_wp )
398      !
399      CALL iom_put("Courant",Cu_adv)
400      !
401      IF( MAXVAL( Cu_adv(:,:,:) ) > Cu_min ) THEN       ! Quick check if any breaches anywhere
402         ! [comm_cleanup] ! DO_3DS( 1, 1, 1, 1, jpkm1, 2, -1 )             ! or scan Courant criterion and partition ! w where necessary
403         DO_3DS( nn_hls, nn_hls, nn_hls, nn_hls, jpkm1, 2, -1 )             ! or scan Courant criterion and partition ! w where necessary
404            !
405            zCu = MAX( Cu_adv(ji,jj,jk) , Cu_adv(ji,jj,jk-1) )
406! alt:
407!                  IF ( ww(ji,jj,jk) > 0._wp ) THEN
408!                     zCu =  Cu_adv(ji,jj,jk)
409!                  ELSE
410!                     zCu =  Cu_adv(ji,jj,jk-1)
411!                  ENDIF
412            !
413            IF( zCu <= Cu_min ) THEN              !<-- Fully explicit
414               zcff = 0._wp
415            ELSEIF( zCu < Cu_cut ) THEN           !<-- Mixed explicit
416               zcff = ( zCu - Cu_min )**2
417               zcff = zcff / ( Fcu + zcff )
418            ELSE                                  !<-- Mostly implicit
419               zcff = ( zCu - Cu_max )/ zCu
420            ENDIF
421            zcff = MIN(1._wp, zcff)
422            !
423            wi(ji,jj,jk) =           zcff   * ww(ji,jj,jk)
424            ww(ji,jj,jk) = ( 1._wp - zcff ) * ww(ji,jj,jk)
425            !
426            Cu_adv(ji,jj,jk) = zcff               ! Reuse array to output coefficient below and in stp_ctl
427         END_3D
428         Cu_adv(:,:,1) = 0._wp 
429      ELSE
430         ! Fully explicit everywhere
431         Cu_adv(:,:,:) = 0._wp                          ! Reuse array to output coefficient below and in stp_ctl
432         wi    (:,:,:) = 0._wp
433      ENDIF
434      CALL iom_put("wimp",wi) 
435      CALL iom_put("wi_cff",Cu_adv)
436      CALL iom_put("wexp",ww)
437      !
438      IF( ln_timing )   CALL timing_stop('wAimp')
439      !
440   END SUBROUTINE wAimp
441     
442   !!======================================================================
443END MODULE sshwzv
Note: See TracBrowser for help on using the repository browser.