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/trunk/src/OCE/DYN – NEMO

source: NEMO/trunk/src/OCE/DYN/sshwzv.F90 @ 12395

Last change on this file since 12395 was 12377, checked in by acc, 4 years ago

The big one. Merging all 2019 developments from the option 1 branch back onto the trunk.

This changeset reproduces 2019/dev_r11943_MERGE_2019 on the trunk using a 2-URL merge
onto a working copy of the trunk. I.e.:

svn merge --ignore-ancestry \

svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/trunk \
svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/branches/2019/dev_r11943_MERGE_2019 ./

The --ignore-ancestry flag avoids problems that may otherwise arise from the fact that
the merge history been trunk and branch may have been applied in a different order but
care has been taken before this step to ensure that all applicable fixes and updates
are present in the merge branch.

The trunk state just before this step has been branched to releases/release-4.0-HEAD
and that branch has been immediately tagged as releases/release-4.0.2. Any fixes
or additions in response to tickets on 4.0, 4.0.1 or 4.0.2 should be done on
releases/release-4.0-HEAD. From now on future 'point' releases (e.g. 4.0.2) will
remain unchanged with periodic releases as needs demand. Note release-4.0-HEAD is a
transitional naming convention. Future full releases, say 4.2, will have a release-4.2
branch which fulfills this role and the first point release (e.g. 4.2.0) will be made
immediately following the release branch creation.

2020 developments can be started from any trunk revision later than this one.

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