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.
domvvl.F90 in branches/2016/dev_r6409_SIMPLIF_2_usrdef_tools/NEMOGCM/NEMO/OPA_SRC/DOM – NEMO

source: branches/2016/dev_r6409_SIMPLIF_2_usrdef_tools/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90 @ 6827

Last change on this file since 6827 was 6827, checked in by flavoni, 8 years ago

#1692 - branch SIMPLIF_2_usrdef: commit routines Fortran to create domain_cfg.nc file, to have domain (input) files for new simplification branch. To be moved in TOOLS directory

  • Property svn:keywords set to Id
File size: 25.3 KB
Line 
1MODULE domvvl
2   !!======================================================================
3   !!                       ***  MODULE domvvl   ***
4   !! Ocean :
5   !!======================================================================
6   !! History :  2.0  !  2006-06  (B. Levier, L. Marie)  original code
7   !!            3.1  !  2009-02  (G. Madec, M. Leclair, R. Benshila)  pure z* coordinate
8   !!            3.3  !  2011-10  (M. Leclair) totally rewrote domvvl:
9   !!                                          vvl option includes z_star and z_tilde coordinates
10   !!            3.6  !  2014-11  (P. Mathiot) add ice shelf capability
11   !!----------------------------------------------------------------------
12
13   !!----------------------------------------------------------------------
14   !!   dom_vvl_init     : define initial vertical scale factors, depths and column thickness
15   !!   dom_vvl_sf_nxt   : Compute next vertical scale factors
16   !!   dom_vvl_sf_swp   : Swap vertical scale factors and update the vertical grid
17   !!   dom_vvl_interpol : Interpolate vertical scale factors from one grid point to another
18   !!   dom_vvl_rst      : read/write restart file
19   !!   dom_vvl_ctl      : Check the vvl options
20   !!----------------------------------------------------------------------
21   USE oce             ! ocean dynamics and tracers
22   USE phycst          ! physical constant
23   USE dom_oce         ! ocean space and time domain
24   !
25   USE in_out_manager  ! I/O manager
26   USE iom             ! I/O manager library
27   USE lib_mpp         ! distributed memory computing library
28   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
29   USE wrk_nemo        ! Memory allocation
30   USE timing          ! Timing
31
32   IMPLICIT NONE
33   PRIVATE
34
35   PUBLIC  dom_vvl_init       ! called by domain.F90
36
37   !                                                      !!* Namelist nam_vvl
38   LOGICAL , PUBLIC :: ln_vvl_zstar           = .FALSE.    ! zstar  vertical coordinate
39   LOGICAL , PUBLIC :: ln_vvl_ztilde          = .FALSE.    ! ztilde vertical coordinate
40   LOGICAL , PUBLIC :: ln_vvl_layer           = .FALSE.    ! level  vertical coordinate
41   LOGICAL , PUBLIC :: ln_vvl_ztilde_as_zstar = .FALSE.    ! ztilde vertical coordinate
42   LOGICAL , PUBLIC :: ln_vvl_zstar_at_eqtor  = .FALSE.    ! ztilde vertical coordinate
43   LOGICAL , PUBLIC :: ln_vvl_kepe            = .FALSE.    ! kinetic/potential energy transfer
44   !                                                       ! conservation: not used yet
45   REAL(wp)         :: rn_ahe3                             ! thickness diffusion coefficient
46   REAL(wp)         :: rn_rst_e3t                          ! ztilde to zstar restoration timescale [days]
47   REAL(wp)         :: rn_lf_cutoff                        ! cutoff frequency for low-pass filter  [days]
48   REAL(wp)         :: rn_zdef_max                         ! maximum fractional e3t deformation
49   LOGICAL , PUBLIC :: ln_vvl_dbg = .FALSE.                ! debug control prints
50
51   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: un_td, vn_td                ! thickness diffusion transport
52   REAL(wp)        , ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: hdiv_lf                     ! low frequency part of hz divergence
53   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: tilde_e3t_b, tilde_e3t_n    ! baroclinic scale factors
54   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: tilde_e3t_a, dtilde_e3t_a   ! baroclinic scale factors
55   REAL(wp)        , ALLOCATABLE, SAVE, DIMENSION(:,:)   :: frq_rst_e3t                 ! retoring period for scale factors
56   REAL(wp)        , ALLOCATABLE, SAVE, DIMENSION(:,:)   :: frq_rst_hdv                 ! retoring period for low freq. divergence
57
58   !! * Substitutions
59#  include "vectopt_loop_substitute.h90"
60   !!----------------------------------------------------------------------
61   !! NEMO/OPA 3.7 , NEMO-Consortium (2015)
62   !! $Id$
63   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
64   !!----------------------------------------------------------------------
65CONTAINS
66
67   INTEGER FUNCTION dom_vvl_alloc()
68      !!----------------------------------------------------------------------
69      !!                ***  FUNCTION dom_vvl_alloc  ***
70      !!----------------------------------------------------------------------
71      IF( ln_vvl_zstar )   dom_vvl_alloc = 0
72      IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN
73         ALLOCATE( tilde_e3t_b(jpi,jpj,jpk)  , tilde_e3t_n(jpi,jpj,jpk) , tilde_e3t_a(jpi,jpj,jpk) ,   &
74            &      dtilde_e3t_a(jpi,jpj,jpk) , un_td  (jpi,jpj,jpk)     , vn_td  (jpi,jpj,jpk)     ,   &
75            &      STAT = dom_vvl_alloc        )
76         IF( lk_mpp             )   CALL mpp_sum ( dom_vvl_alloc )
77         IF( dom_vvl_alloc /= 0 )   CALL ctl_warn('dom_vvl_alloc: failed to allocate arrays')
78         un_td = 0._wp
79         vn_td = 0._wp
80      ENDIF
81      IF( ln_vvl_ztilde ) THEN
82         ALLOCATE( frq_rst_e3t(jpi,jpj) , frq_rst_hdv(jpi,jpj) , hdiv_lf(jpi,jpj,jpk) , STAT= dom_vvl_alloc )
83         IF( lk_mpp             )   CALL mpp_sum ( dom_vvl_alloc )
84         IF( dom_vvl_alloc /= 0 )   CALL ctl_warn('dom_vvl_alloc: failed to allocate arrays')
85      ENDIF
86      !
87   END FUNCTION dom_vvl_alloc
88
89
90   SUBROUTINE dom_vvl_init
91      !!----------------------------------------------------------------------
92      !!                ***  ROUTINE dom_vvl_init  ***
93      !!                   
94      !! ** Purpose :  Initialization of all scale factors, depths
95      !!               and water column heights
96      !!
97      !! ** Method  :  - use restart file and/or initialize
98      !!               - interpolate scale factors
99      !!
100      !! ** Action  : - e3t_(n/b) and tilde_e3t_(n/b)
101      !!              - Regrid: e3(u/v)_n
102      !!                        e3(u/v)_b       
103      !!                        e3w_n           
104      !!                        e3(u/v)w_b     
105      !!                        e3(u/v)w_n     
106      !!                        gdept_n, gdepw_n and gde3w_n
107      !!              - h(t/u/v)_0
108      !!              - frq_rst_e3t and frq_rst_hdv
109      !!
110      !! Reference  : Leclair, M., and G. Madec, 2011, Ocean Modelling.
111      !!----------------------------------------------------------------------
112      INTEGER ::   ji, jj, jk
113      INTEGER ::   ii0, ii1, ij0, ij1
114      REAL(wp)::   zcoef
115      !!----------------------------------------------------------------------
116      !
117      IF( nn_timing == 1 )   CALL timing_start('dom_vvl_init')
118      !
119      IF(lwp) WRITE(numout,*)
120      IF(lwp) WRITE(numout,*) 'dom_vvl_init : Variable volume activated'
121      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~'
122      !
123      CALL dom_vvl_ctl     ! choose vertical coordinate (z_star, z_tilde or layer)
124      !
125      !                    ! Allocate module arrays
126      IF( dom_vvl_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'dom_vvl_init : unable to allocate arrays' )
127      !
128      !                    ! Read or initialize e3t_(b/n), tilde_e3t_(b/n) and hdiv_lf
129      e3t_a(:,:,jpk) = e3t_0(:,:,jpk)  ! last level always inside the sea floor set one for all
130      !
131      !                    !== Set of all other vertical scale factors  ==!  (now and before)
132      !                                ! Horizontal interpolation of e3t
133      CALL dom_vvl_interpol( e3t_b(:,:,:), e3u_b(:,:,:), 'U' )    ! from T to U
134      CALL dom_vvl_interpol( e3t_n(:,:,:), e3u_n(:,:,:), 'U' )
135      CALL dom_vvl_interpol( e3t_b(:,:,:), e3v_b(:,:,:), 'V' )    ! from T to V
136      CALL dom_vvl_interpol( e3t_n(:,:,:), e3v_n(:,:,:), 'V' )
137      CALL dom_vvl_interpol( e3u_n(:,:,:), e3f_n(:,:,:), 'F' )    ! from U to F
138      !                                ! Vertical interpolation of e3t,u,v
139      CALL dom_vvl_interpol( e3t_n(:,:,:), e3w_n (:,:,:), 'W'  )  ! from T to W
140      CALL dom_vvl_interpol( e3t_b(:,:,:), e3w_b (:,:,:), 'W'  )
141      CALL dom_vvl_interpol( e3u_n(:,:,:), e3uw_n(:,:,:), 'UW' )  ! from U to UW
142      CALL dom_vvl_interpol( e3u_b(:,:,:), e3uw_b(:,:,:), 'UW' )
143      CALL dom_vvl_interpol( e3v_n(:,:,:), e3vw_n(:,:,:), 'VW' )  ! from V to UW
144      CALL dom_vvl_interpol( e3v_b(:,:,:), e3vw_b(:,:,:), 'VW' )
145      !
146      !                    !==  depth of t and w-point  ==!   (set the isf depth as it is in the initial timestep)
147      gdept_n(:,:,1) = 0.5_wp * e3w_n(:,:,1)       ! reference to the ocean surface (used for MLD and light penetration)
148      gdepw_n(:,:,1) = 0.0_wp
149      gde3w_n(:,:,1) = gdept_n(:,:,1) - sshn(:,:)  ! reference to a common level z=0 for hpg
150      gdept_b(:,:,1) = 0.5_wp * e3w_b(:,:,1)
151      gdepw_b(:,:,1) = 0.0_wp
152      DO jk = 2, jpk                               ! vertical sum
153         DO jj = 1,jpj
154            DO ji = 1,jpi
155               !    zcoef = tmask - wmask    ! 0 everywhere tmask = wmask, ie everywhere expect at jk = mikt
156               !                             ! 1 everywhere from mbkt to mikt + 1 or 1 (if no isf)
157               !                             ! 0.5 where jk = mikt     
158!!gm ???????   BUG ?  gdept_n as well as gde3w_n  does not include the thickness of ISF ??
159               zcoef = ( tmask(ji,jj,jk) - wmask(ji,jj,jk) )
160               gdepw_n(ji,jj,jk) = gdepw_n(ji,jj,jk-1) + e3t_n(ji,jj,jk-1)
161               gdept_n(ji,jj,jk) =      zcoef  * ( gdepw_n(ji,jj,jk  ) + 0.5 * e3w_n(ji,jj,jk))  &
162                  &                + (1-zcoef) * ( gdept_n(ji,jj,jk-1) +       e3w_n(ji,jj,jk)) 
163               gde3w_n(ji,jj,jk) = gdept_n(ji,jj,jk) - sshn(ji,jj)
164               gdepw_b(ji,jj,jk) = gdepw_b(ji,jj,jk-1) + e3t_b(ji,jj,jk-1)
165               gdept_b(ji,jj,jk) =      zcoef  * ( gdepw_b(ji,jj,jk  ) + 0.5 * e3w_b(ji,jj,jk))  &
166                  &                + (1-zcoef) * ( gdept_b(ji,jj,jk-1) +       e3w_b(ji,jj,jk)) 
167            END DO
168         END DO
169      END DO
170      !
171      !                    !==  thickness of the water column  !!   (ocean portion only)
172      ht_n(:,:) = e3t_n(:,:,1) * tmask(:,:,1)   !!gm  BUG  :  this should be 1/2 * e3w(k=1) ....
173      hu_b(:,:) = e3u_b(:,:,1) * umask(:,:,1)
174      hu_n(:,:) = e3u_n(:,:,1) * umask(:,:,1)
175      hv_b(:,:) = e3v_b(:,:,1) * vmask(:,:,1)
176      hv_n(:,:) = e3v_n(:,:,1) * vmask(:,:,1)
177      DO jk = 2, jpkm1
178         ht_n(:,:) = ht_n(:,:) + e3t_n(:,:,jk) * tmask(:,:,jk)
179         hu_b(:,:) = hu_b(:,:) + e3u_b(:,:,jk) * umask(:,:,jk)
180         hu_n(:,:) = hu_n(:,:) + e3u_n(:,:,jk) * umask(:,:,jk)
181         hv_b(:,:) = hv_b(:,:) + e3v_b(:,:,jk) * vmask(:,:,jk)
182         hv_n(:,:) = hv_n(:,:) + e3v_n(:,:,jk) * vmask(:,:,jk)
183      END DO
184      !
185      !                    !==  inverse of water column thickness   ==!   (u- and v- points)
186      r1_hu_b(:,:) = ssumask(:,:) / ( hu_b(:,:) + 1._wp - ssumask(:,:) )    ! _i mask due to ISF
187      r1_hu_n(:,:) = ssumask(:,:) / ( hu_n(:,:) + 1._wp - ssumask(:,:) )
188      r1_hv_b(:,:) = ssvmask(:,:) / ( hv_b(:,:) + 1._wp - ssvmask(:,:) )
189      r1_hv_n(:,:) = ssvmask(:,:) / ( hv_n(:,:) + 1._wp - ssvmask(:,:) )
190
191      !                    !==   z_tilde coordinate case  ==!   (Restoring frequencies)
192      IF( ln_vvl_ztilde ) THEN
193!!gm : idea: add here a READ in a file of custumized restoring frequency
194         !                                   ! Values in days provided via the namelist
195         !                                   ! use rsmall to avoid possible division by zero errors with faulty settings
196         frq_rst_e3t(:,:) = 2._wp * rpi / ( MAX( rn_rst_e3t  , rsmall ) * 86400.0_wp )
197         frq_rst_hdv(:,:) = 2._wp * rpi / ( MAX( rn_lf_cutoff, rsmall ) * 86400.0_wp )
198         !
199         IF( ln_vvl_ztilde_as_zstar ) THEN   ! z-star emulation using z-tile
200            frq_rst_e3t(:,:) = 0._wp               !Ignore namelist settings
201            frq_rst_hdv(:,:) = 1._wp / rdt
202         ENDIF
203         IF ( ln_vvl_zstar_at_eqtor ) THEN   ! use z-star in vicinity of the Equator
204            DO jj = 1, jpj
205               DO ji = 1, jpi
206!!gm  case |gphi| >= 6 degrees is useless   initialized just above by default
207                  IF( ABS(gphit(ji,jj)) >= 6.) THEN
208                     ! values outside the equatorial band and transition zone (ztilde)
209                     frq_rst_e3t(ji,jj) =  2.0_wp * rpi / ( MAX( rn_rst_e3t  , rsmall ) * 86400.e0_wp )
210                     frq_rst_hdv(ji,jj) =  2.0_wp * rpi / ( MAX( rn_lf_cutoff, rsmall ) * 86400.e0_wp )
211                  ELSEIF( ABS(gphit(ji,jj)) <= 2.5) THEN    ! Equator strip ==> z-star
212                     ! values inside the equatorial band (ztilde as zstar)
213                     frq_rst_e3t(ji,jj) =  0.0_wp
214                     frq_rst_hdv(ji,jj) =  1.0_wp / rdt
215                  ELSE                                      ! transition band (2.5 to 6 degrees N/S)
216                     !                                      ! (linearly transition from z-tilde to z-star)
217                     frq_rst_e3t(ji,jj) = 0.0_wp + (frq_rst_e3t(ji,jj)-0.0_wp)*0.5_wp   &
218                        &            * (  1.0_wp - COS( rad*(ABS(gphit(ji,jj))-2.5_wp)  &
219                        &                                          * 180._wp / 3.5_wp ) )
220                     frq_rst_hdv(ji,jj) = (1.0_wp / rdt)                                &
221                        &            + (  frq_rst_hdv(ji,jj)-(1.e0_wp / rdt) )*0.5_wp   &
222                        &            * (  1._wp  - COS( rad*(ABS(gphit(ji,jj))-2.5_wp)  &
223                        &                                          * 180._wp / 3.5_wp ) )
224                  ENDIF
225               END DO
226            END DO
227            IF( cp_cfg == "orca" .AND. jp_cfg == 3 ) THEN   ! ORCA2: Suppress ztilde in the Foxe Basin for ORCA2
228               ii0 = 103   ;   ii1 = 111       
229               ij0 = 128   ;   ij1 = 135   ;   
230               frq_rst_e3t( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  0.0_wp
231               frq_rst_hdv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) =  1.e0_wp / rdt
232            ENDIF
233         ENDIF
234      ENDIF
235      !
236      IF( nn_timing == 1 )  CALL timing_stop('dom_vvl_init')
237      !
238   END SUBROUTINE dom_vvl_init
239
240
241   SUBROUTINE dom_vvl_interpol( pe3_in, pe3_out, pout )
242      !!---------------------------------------------------------------------
243      !!                  ***  ROUTINE dom_vvl__interpol  ***
244      !!
245      !! ** Purpose :   interpolate scale factors from one grid point to another
246      !!
247      !! ** Method  :   e3_out = e3_0 + interpolation(e3_in - e3_0)
248      !!                - horizontal interpolation: grid cell surface averaging
249      !!                - vertical interpolation: simple averaging
250      !!----------------------------------------------------------------------
251      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::  pe3_in    ! input e3 to be interpolated
252      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::  pe3_out   ! output interpolated e3
253      CHARACTER(LEN=*)                , INTENT(in   ) ::  pout      ! grid point of out scale factors
254      !                                                             !   =  'U', 'V', 'W, 'F', 'UW' or 'VW'
255      !
256      INTEGER ::   ji, jj, jk                                       ! dummy loop indices
257      REAL(wp) ::  zlnwd                                            ! =1./0. when ln_wd = T/F
258      !!----------------------------------------------------------------------
259      !
260      IF( nn_timing == 1 )   CALL timing_start('dom_vvl_interpol')
261      !
262      zlnwd = 0.0_wp
263      !
264      SELECT CASE ( pout )    !==  type of interpolation  ==!
265         !
266      CASE( 'U' )                   !* from T- to U-point : hor. surface weighted mean
267         DO jk = 1, jpk
268            DO jj = 1, jpjm1
269               DO ji = 1, fs_jpim1   ! vector opt.
270                  pe3_out(ji,jj,jk) = 0.5_wp * (  umask(ji,jj,jk) * (1.0_wp - zlnwd) + zlnwd ) * r1_e1e2u(ji,jj)   &
271                     &                       * (   e1e2t(ji  ,jj) * ( pe3_in(ji  ,jj,jk) - e3t_0(ji  ,jj,jk) )     &
272                     &                           + e1e2t(ji+1,jj) * ( pe3_in(ji+1,jj,jk) - e3t_0(ji+1,jj,jk) ) )
273               END DO
274            END DO
275         END DO
276         CALL lbc_lnk( pe3_out(:,:,:), 'U', 1._wp )
277         pe3_out(:,:,:) = pe3_out(:,:,:) + e3u_0(:,:,:)
278         !
279      CASE( 'V' )                   !* from T- to V-point : hor. surface weighted mean
280         DO jk = 1, jpk
281            DO jj = 1, jpjm1
282               DO ji = 1, fs_jpim1   ! vector opt.
283                  pe3_out(ji,jj,jk) = 0.5_wp * ( vmask(ji,jj,jk)  * (1.0_wp - zlnwd) + zlnwd ) * r1_e1e2v(ji,jj)   &
284                     &                       * (   e1e2t(ji,jj  ) * ( pe3_in(ji,jj  ,jk) - e3t_0(ji,jj  ,jk) )     &
285                     &                           + e1e2t(ji,jj+1) * ( pe3_in(ji,jj+1,jk) - e3t_0(ji,jj+1,jk) ) )
286               END DO
287            END DO
288         END DO
289         CALL lbc_lnk( pe3_out(:,:,:), 'V', 1._wp )
290         pe3_out(:,:,:) = pe3_out(:,:,:) + e3v_0(:,:,:)
291         !
292      CASE( 'F' )                   !* from U-point to F-point : hor. surface weighted mean
293         DO jk = 1, jpk
294            DO jj = 1, jpjm1
295               DO ji = 1, fs_jpim1   ! vector opt.
296                  pe3_out(ji,jj,jk) = 0.5_wp * (  umask(ji,jj,jk) * umask(ji,jj+1,jk) * (1.0_wp - zlnwd) + zlnwd ) &
297                     &                       *    r1_e1e2f(ji,jj)                                                  &
298                     &                       * (   e1e2u(ji,jj  ) * ( pe3_in(ji,jj  ,jk) - e3u_0(ji,jj  ,jk) )     &
299                     &                           + e1e2u(ji,jj+1) * ( pe3_in(ji,jj+1,jk) - e3u_0(ji,jj+1,jk) ) )
300               END DO
301            END DO
302         END DO
303         CALL lbc_lnk( pe3_out(:,:,:), 'F', 1._wp )
304         pe3_out(:,:,:) = pe3_out(:,:,:) + e3f_0(:,:,:)
305         !
306      CASE( 'W' )                   !* from T- to W-point : vertical simple mean
307         !
308         pe3_out(:,:,1) = e3w_0(:,:,1) + pe3_in(:,:,1) - e3t_0(:,:,1)
309         ! - ML - The use of mask in this formulea enables the special treatment of the last w-point without indirect adressing
310!!gm BUG? use here wmask in case of ISF ?  to be checked
311         DO jk = 2, jpk
312            pe3_out(:,:,jk) = e3w_0(:,:,jk) + ( 1.0_wp - 0.5_wp * ( tmask(:,:,jk) * (1.0_wp - zlnwd) + zlnwd ) )   &
313               &                            * ( pe3_in(:,:,jk-1) - e3t_0(:,:,jk-1) )                               &
314               &                            +            0.5_wp * ( tmask(:,:,jk) * (1.0_wp - zlnwd) + zlnwd )     &
315               &                            * ( pe3_in(:,:,jk  ) - e3t_0(:,:,jk  ) )
316         END DO
317         !
318      CASE( 'UW' )                  !* from U- to UW-point : vertical simple mean
319         !
320         pe3_out(:,:,1) = e3uw_0(:,:,1) + pe3_in(:,:,1) - e3u_0(:,:,1)
321         ! - ML - The use of mask in this formaula enables the special treatment of the last w- point without indirect adressing
322!!gm BUG? use here wumask in case of ISF ?  to be checked
323         DO jk = 2, jpk
324            pe3_out(:,:,jk) = e3uw_0(:,:,jk) + ( 1.0_wp - 0.5_wp * ( umask(:,:,jk) * (1.0_wp - zlnwd) + zlnwd ) )  &
325               &                             * ( pe3_in(:,:,jk-1) - e3u_0(:,:,jk-1) )                              &
326               &                             +            0.5_wp * ( umask(:,:,jk) * (1.0_wp - zlnwd) + zlnwd )    &
327               &                             * ( pe3_in(:,:,jk  ) - e3u_0(:,:,jk  ) )
328         END DO
329         !
330      CASE( 'VW' )                  !* from V- to VW-point : vertical simple mean
331         !
332         pe3_out(:,:,1) = e3vw_0(:,:,1) + pe3_in(:,:,1) - e3v_0(:,:,1)
333         ! - ML - The use of mask in this formaula enables the special treatment of the last w- point without indirect adressing
334!!gm BUG? use here wvmask in case of ISF ?  to be checked
335         DO jk = 2, jpk
336            pe3_out(:,:,jk) = e3vw_0(:,:,jk) + ( 1.0_wp - 0.5_wp * ( vmask(:,:,jk) * (1.0_wp - zlnwd) + zlnwd ) )  &
337               &                             * ( pe3_in(:,:,jk-1) - e3v_0(:,:,jk-1) )                              &
338               &                             +            0.5_wp * ( vmask(:,:,jk) * (1.0_wp - zlnwd) + zlnwd )    &
339               &                             * ( pe3_in(:,:,jk  ) - e3v_0(:,:,jk  ) )
340         END DO
341      END SELECT
342      !
343      IF( nn_timing == 1 )   CALL timing_stop('dom_vvl_interpol')
344      !
345   END SUBROUTINE dom_vvl_interpol
346
347
348   SUBROUTINE dom_vvl_ctl
349      !!---------------------------------------------------------------------
350      !!                  ***  ROUTINE dom_vvl_ctl  ***
351      !!               
352      !! ** Purpose :   Control the consistency between namelist options
353      !!                for vertical coordinate
354      !!----------------------------------------------------------------------
355      INTEGER ::   ioptio, ios
356      !!
357      NAMELIST/nam_vvl/ ln_vvl_zstar, ln_vvl_ztilde, ln_vvl_layer, ln_vvl_ztilde_as_zstar, &
358         &              ln_vvl_zstar_at_eqtor      , rn_ahe3     , rn_rst_e3t            , &
359         &              rn_lf_cutoff               , rn_zdef_max , ln_vvl_dbg                ! not yet implemented: ln_vvl_kepe
360      !!----------------------------------------------------------------------
361      !
362      REWIND( numnam_ref )              ! Namelist nam_vvl in reference namelist :
363      READ  ( numnam_ref, nam_vvl, IOSTAT = ios, ERR = 901)
364901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_vvl in reference namelist', lwp )
365      !
366      REWIND( numnam_cfg )              ! Namelist nam_vvl in configuration namelist : Parameters of the run
367      READ  ( numnam_cfg, nam_vvl, IOSTAT = ios, ERR = 902 )
368902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_vvl in configuration namelist', lwp )
369      IF(lwm) WRITE ( numond, nam_vvl )
370      !
371      IF(lwp) THEN                    ! Namelist print
372         WRITE(numout,*)
373         WRITE(numout,*) 'dom_vvl_ctl : choice/control of the variable vertical coordinate'
374         WRITE(numout,*) '~~~~~~~~~~~'
375         WRITE(numout,*) '           Namelist nam_vvl : chose a vertical coordinate'
376         WRITE(numout,*) '              zstar                      ln_vvl_zstar   = ', ln_vvl_zstar
377         WRITE(numout,*) '              ztilde                     ln_vvl_ztilde  = ', ln_vvl_ztilde
378         WRITE(numout,*) '              layer                      ln_vvl_layer   = ', ln_vvl_layer
379         WRITE(numout,*) '              ztilde as zstar   ln_vvl_ztilde_as_zstar  = ', ln_vvl_ztilde_as_zstar
380         WRITE(numout,*) '      ztilde near the equator    ln_vvl_zstar_at_eqtor  = ', ln_vvl_zstar_at_eqtor
381         ! WRITE(numout,*) '           Namelist nam_vvl : chose kinetic-to-potential energy conservation'
382         ! WRITE(numout,*) '                                         ln_vvl_kepe    = ', ln_vvl_kepe
383         WRITE(numout,*) '           Namelist nam_vvl : thickness diffusion coefficient'
384         WRITE(numout,*) '                                         rn_ahe3        = ', rn_ahe3
385         WRITE(numout,*) '           Namelist nam_vvl : maximum e3t deformation fractional change'
386         WRITE(numout,*) '                                         rn_zdef_max    = ', rn_zdef_max
387         IF( ln_vvl_ztilde_as_zstar ) THEN
388            WRITE(numout,*) '           ztilde running in zstar emulation mode; '
389            WRITE(numout,*) '           ignoring namelist timescale parameters and using:'
390            WRITE(numout,*) '                 hard-wired : z-tilde to zstar restoration timescale (days)'
391            WRITE(numout,*) '                                         rn_rst_e3t     =    0.0'
392            WRITE(numout,*) '                 hard-wired : z-tilde cutoff frequency of low-pass filter (days)'
393            WRITE(numout,*) '                                         rn_lf_cutoff   =    1.0/rdt'
394         ELSE
395            WRITE(numout,*) '           Namelist nam_vvl : z-tilde to zstar restoration timescale (days)'
396            WRITE(numout,*) '                                         rn_rst_e3t     = ', rn_rst_e3t
397            WRITE(numout,*) '           Namelist nam_vvl : z-tilde cutoff frequency of low-pass filter (days)'
398            WRITE(numout,*) '                                         rn_lf_cutoff   = ', rn_lf_cutoff
399         ENDIF
400         WRITE(numout,*) '           Namelist nam_vvl : debug prints'
401         WRITE(numout,*) '                                         ln_vvl_dbg     = ', ln_vvl_dbg
402      ENDIF
403      !
404      ioptio = 0                      ! Parameter control
405      IF( ln_vvl_ztilde_as_zstar )   ln_vvl_ztilde = .true.
406      IF( ln_vvl_zstar           )   ioptio = ioptio + 1
407      IF( ln_vvl_ztilde          )   ioptio = ioptio + 1
408      IF( ln_vvl_layer           )   ioptio = ioptio + 1
409      !
410      IF( ioptio /= 1 )   CALL ctl_stop( 'Choose ONE vertical coordinate in namelist nam_vvl' )
411      !
412      IF(lwp) THEN                   ! Print the choice
413         WRITE(numout,*)
414         IF( ln_vvl_zstar           ) WRITE(numout,*) '              zstar vertical coordinate is used'
415         IF( ln_vvl_ztilde          ) WRITE(numout,*) '              ztilde vertical coordinate is used'
416         IF( ln_vvl_layer           ) WRITE(numout,*) '              layer vertical coordinate is used'
417         IF( ln_vvl_ztilde_as_zstar ) WRITE(numout,*) '              to emulate a zstar coordinate'
418         ! - ML - Option not developed yet
419         ! IF(       ln_vvl_kepe ) WRITE(numout,*) '              kinetic to potential energy transfer : option used'
420         ! IF( .NOT. ln_vvl_kepe ) WRITE(numout,*) '              kinetic to potential energy transfer : option not used'
421      ENDIF
422      !
423#if defined key_agrif
424      IF(.NOT.Agrif_Root() )   CALL ctl_stop( 'AGRIF not implemented with non-linear free surface' )
425#endif
426      !
427   END SUBROUTINE dom_vvl_ctl
428
429   !!======================================================================
430END MODULE domvvl
Note: See TracBrowser for help on using the repository browser.