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.
domqco.F90 in NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DOM – NEMO

source: NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DOM/domqco.F90 @ 13734

Last change on this file since 13734 was 13734, checked in by techene, 4 years ago

#2385 : cleaning comments and OFF/stpmlf

File size: 25.2 KB
Line 
1MODULE domqco
2   !!======================================================================
3   !!                       ***  MODULE domqco   ***
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: vvl option includes z_star and z_tilde coordinates
9   !!            3.6  !  2014-11  (P. Mathiot) add ice shelf capability
10   !!            4.1  !  2019-08  (A. Coward, D. Storkey) add time level indices for prognostic variables
11   !!            4.x  !  2020-02  (S. Techene, G. Madec) quasi-eulerian coordinate (z* or s*) from domvvl
12   !!----------------------------------------------------------------------
13
14   !!----------------------------------------------------------------------
15   !!   dom_qco_init   : define initial vertical scale factors, depths and column thickness
16   !!   dom_qco_zgr    : Set ssh/h_0 ratio at t
17   !!   dom_qco_r3c    : Compute ssh/h_0 ratio at t-, u-, v-, and optionally f-points
18   !!       qco_rst_read : read/write restart file
19   !!       qco_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   USE dynadv  , ONLY : ln_dynadv_vec
25   USE isf_oce        ! iceshelf cavities
26   USE sbc_oce        ! ocean surface boundary condition
27   USE wet_dry        ! wetting and drying
28   USE usrdef_istate  ! user defined initial state (wad only)
29   USE restart        ! ocean restart
30   !
31   USE in_out_manager ! I/O manager
32   USE iom            ! I/O manager library
33   USE lib_mpp        ! distributed memory computing library
34   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
35   USE timing         ! Timing
36
37   IMPLICIT NONE
38   PRIVATE
39
40   PUBLIC  dom_qco_init       ! called by domain.F90
41   PUBLIC  dom_qco_zgr        ! called by isfcpl.F90
42   PUBLIC  dom_qco_r3c        ! called by steplf.F90
43
44   !                                                      !!* Namelist nam_vvl
45   LOGICAL , PUBLIC :: ln_vvl_zstar           = .FALSE.    ! zstar  vertical coordinate
46   LOGICAL , PUBLIC :: ln_vvl_ztilde          = .FALSE.    ! ztilde vertical coordinate
47   LOGICAL , PUBLIC :: ln_vvl_layer           = .FALSE.    ! level  vertical coordinate
48   LOGICAL , PUBLIC :: ln_vvl_ztilde_as_zstar = .FALSE.    ! ztilde vertical coordinate
49   LOGICAL , PUBLIC :: ln_vvl_zstar_at_eqtor  = .FALSE.    ! ztilde vertical coordinate
50   LOGICAL , PUBLIC :: ln_vvl_kepe            = .FALSE.    ! kinetic/potential energy transfer
51   !                                                       ! conservation: not used yet
52   REAL(wp)         :: rn_ahe3                             ! thickness diffusion coefficient
53   REAL(wp)         :: rn_rst_e3t                          ! ztilde to zstar restoration timescale [days]
54   REAL(wp)         :: rn_lf_cutoff                        ! cutoff frequency for low-pass filter  [days]
55   REAL(wp)         :: rn_zdef_max                         ! maximum fractional e3t deformation
56   LOGICAL , PUBLIC :: ln_vvl_dbg = .FALSE.                ! debug control prints
57
58   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: un_td, vn_td                ! thickness diffusion transport
59
60   !! * Substitutions
61#  include "do_loop_substitute.h90"
62   !!----------------------------------------------------------------------
63   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
64   !! $Id: domvvl.F90 12377 2020-02-12 14:39:06Z acc $
65   !! Software governed by the CeCILL license (see ./LICENSE)
66   !!----------------------------------------------------------------------
67CONTAINS
68
69   SUBROUTINE dom_qco_init( Kbb, Kmm, Kaa )
70      !!----------------------------------------------------------------------
71      !!                ***  ROUTINE dom_qco_init  ***
72      !!
73      !! ** Purpose :  Initialization of all ssh. to h._0 ratio
74      !!
75      !! ** Method  :  - use restart file and/or initialize
76      !!               - compute ssh. to h._0 ratio
77      !!
78      !! ** Action  : - r3(t/u/v)_b
79      !!              - r3(t/u/v/f)_n
80      !!
81      !!----------------------------------------------------------------------
82      INTEGER, INTENT(in) ::   Kbb, Kmm, Kaa   ! time level indices
83      !!----------------------------------------------------------------------
84      !
85      IF(lwp) WRITE(numout,*)
86      IF(lwp) WRITE(numout,*) 'dom_qco_init : Variable volume activated'
87      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~'
88      !
89      CALL qco_ctl                            ! choose vertical coordinate (z_star, z_tilde or layer)
90      !
91      CALL qco_rst_read( nit000, Kbb, Kmm )   ! Read or initialize ssh_(Kbb/Kmm)
92      !
93      CALL dom_qco_zgr( Kbb, Kmm )            ! interpolation scale factor, depth and water column
94      !
95#if defined key_agrif
96      ! We need to define r3[tuv](Kaa) for AGRIF initialisation (should not be a
97      ! problem for the restartability...)
98      r3t(:,:,Kaa) = r3t(:,:,Kmm)
99      r3u(:,:,Kaa) = r3u(:,:,Kmm)
100      r3v(:,:,Kaa) = r3v(:,:,Kmm)
101#endif
102      !
103      IF(lwxios) THEN   ! define variables in restart file when writing with XIOS
104         CALL iom_set_rstw_var_active('sshb')
105         CALL iom_set_rstw_var_active('sshn')
106      ENDIF
107      !
108   END SUBROUTINE dom_qco_init
109
110
111   SUBROUTINE dom_qco_zgr( Kbb, Kmm )
112      !!----------------------------------------------------------------------
113      !!                ***  ROUTINE dom_qco_init  ***
114      !!
115      !! ** Purpose :  Initialization of all ssh./h._0 ratio
116      !!
117      !! ** Method  :  - call domqco using Kbb and Kmm
118      !!
119      !! ** Action  : - r3(t/u/v)_b
120      !!              - r3(t/u/v/f)_n
121      !!----------------------------------------------------------------------
122      INTEGER, INTENT(in) ::   Kbb, Kmm   ! time level indices
123      !!----------------------------------------------------------------------
124      !
125      !                    !== Set of all other vertical scale factors  ==!  (now and before)
126      !                                ! Horizontal interpolation of e3t
127      CALL dom_qco_r3c( ssh(:,:,Kbb), r3t(:,:,Kbb), r3u(:,:,Kbb), r3v(:,:,Kbb) )
128      CALL dom_qco_r3c( ssh(:,:,Kmm), r3t(:,:,Kmm), r3u(:,:,Kmm), r3v(:,:,Kmm), r3f(:,:) )
129      !
130      !
131   END SUBROUTINE dom_qco_zgr
132
133
134   SUBROUTINE dom_qco_r3c( pssh, pr3t, pr3u, pr3v, pr3f )
135      !!---------------------------------------------------------------------
136      !!                   ***  ROUTINE r3c  ***
137      !!
138      !! ** Purpose :   compute the filtered ratio ssh/h_0 at t-,u-,v-,f-points
139      !!
140      !! ** Method  : - compute the ssh at u- and v-points (f-point optional)
141      !!                   Vector Form : surface weighted averaging
142      !!                   Flux   Form : simple           averaging
143      !!              - compute the ratio ssh/h_0 at t-,u-,v-pts, (f-pt optional)
144      !!----------------------------------------------------------------------
145      REAL(wp), DIMENSION(:,:)          , INTENT(in   )  ::   pssh               ! sea surface height   [m]
146      REAL(wp), DIMENSION(:,:)          , INTENT(  out)  ::   pr3t, pr3u, pr3v   ! ssh/h0 ratio at t-, u-, v-,points  [-]
147      REAL(wp), DIMENSION(:,:), OPTIONAL, INTENT(  out)  ::   pr3f               ! ssh/h0 ratio at f-point   [-]
148      !
149      INTEGER ::   ji, jj   ! dummy loop indices
150      !!----------------------------------------------------------------------
151      !
152      !
153      pr3t(:,:) = pssh(:,:) * r1_ht_0(:,:)   !==  ratio at t-point  ==!
154      !
155      !
156      !                                      !==  ratio at u-,v-point  ==!
157      !
158!!st      IF( ln_dynadv_vec ) THEN                     !- Vector Form   (thickness weighted averaging)
159#if ! defined key_qcoTest_FluxForm
160      !                                ! no 'key_qcoTest_FluxForm' : surface weighted ssh average
161         DO_2D( 0, 0, 0, 0 )
162            pr3u(ji,jj) = 0.5_wp * (  e1e2t(ji  ,jj) * pssh(ji  ,jj)  &
163               &                    + e1e2t(ji+1,jj) * pssh(ji+1,jj)  ) * r1_hu_0(ji,jj) * r1_e1e2u(ji,jj)
164            pr3v(ji,jj) = 0.5_wp * (  e1e2t(ji,jj  ) * pssh(ji,jj  )  &
165               &                    + e1e2t(ji,jj+1) * pssh(ji,jj+1)  ) * r1_hv_0(ji,jj) * r1_e1e2v(ji,jj)
166         END_2D
167!!st      ELSE                                         !- Flux Form   (simple averaging)
168#else
169         DO_2D( 0, 0, 0, 0 )
170            pr3u(ji,jj) = 0.5_wp * (  pssh(ji,jj) + pssh(ji+1,jj  )  ) * r1_hu_0(ji,jj)
171            pr3v(ji,jj) = 0.5_wp * (  pssh(ji,jj) + pssh(ji  ,jj+1)  ) * r1_hv_0(ji,jj)
172         END_2D
173!!st      ENDIF
174#endif         
175      !
176      IF( .NOT.PRESENT( pr3f ) ) THEN              !- lbc on ratio at u-, v-points only
177         CALL lbc_lnk_multi( 'dom_qco_r3c', pr3u, 'U', 1._wp, pr3v, 'V', 1._wp )
178         !
179         !
180      ELSE                                   !==  ratio at f-point  ==!
181         !
182!!st         IF( ln_dynadv_vec )   THEN                !- Vector Form   (thickness weighted averaging)
183#if ! defined key_qcoTest_FluxForm
184         !                                ! no 'key_qcoTest_FluxForm' : surface weighted ssh average
185
186            DO_2D( 0, 0, 0, 0 )                               ! start from 1 since lbc_lnk('F') doesn't update the 1st row/line
187               pr3f(ji,jj) = 0.25_wp * (  e1e2t(ji  ,jj  ) * pssh(ji  ,jj  )  &
188                  &                     + e1e2t(ji+1,jj  ) * pssh(ji+1,jj  )  &
189                  &                     + e1e2t(ji  ,jj+1) * pssh(ji  ,jj+1)  &
190                  &                     + e1e2t(ji+1,jj+1) * pssh(ji+1,jj+1)  ) * r1_hf_0(ji,jj) * r1_e1e2f(ji,jj)
191            END_2D
192!!st         ELSE                                      !- Flux Form   (simple averaging)
193#else
194            DO_2D( 0, 0, 0, 0 )                               ! start from 1 since lbc_lnk('F') doesn't update the 1st row/line
195               pr3f(ji,jj) = 0.25_wp * (  pssh(ji,jj  ) + pssh(ji+1,jj  )  &
196                  &                     + pssh(ji,jj+1) + pssh(ji+1,jj+1)  ) * r1_hf_0(ji,jj)
197            END_2D
198!!st         ENDIF
199#endif
200         !                                                 ! lbc on ratio at u-,v-,f-points
201         CALL lbc_lnk_multi( 'dom_qco_r3c', pr3u, 'U', 1._wp, pr3v, 'V', 1._wp, pr3f, 'F', 1._wp )
202         !
203      ENDIF
204      !
205   END SUBROUTINE dom_qco_r3c
206
207
208   SUBROUTINE qco_rst_read( kt, Kbb, Kmm )
209      !!---------------------------------------------------------------------
210      !!                   ***  ROUTINE qco_rst_read  ***
211      !!
212      !! ** Purpose :   Read ssh in restart file
213      !!
214      !! ** Method  :   use of IOM library
215      !!                if the restart does not contain ssh,
216      !!                it is set to the _0 values.
217      !!----------------------------------------------------------------------
218      INTEGER, INTENT(in) ::   kt         ! ocean time-step
219      INTEGER, INTENT(in) ::   Kbb, Kmm   ! ocean time level indices
220      !
221      INTEGER ::   ji, jj, jk
222      INTEGER ::   id1, id2     ! local integers
223      !!----------------------------------------------------------------------
224      !
225      IF( ln_rstart ) THEN                   !* Read the restart file
226         CALL rst_read_open                  !  open the restart file if necessary
227         !
228         id1 = iom_varid( numror, 'sshb', ldstop = .FALSE. )
229         id2 = iom_varid( numror, 'sshn', ldstop = .FALSE. )
230         !
231         !                             ! --------- !
232         !                             ! all cases !
233         !                             ! --------- !
234         !
235         IF( MIN( id1, id2 ) > 0 ) THEN       ! all required arrays exist
236            CALL iom_get( numror, jpdom_auto, 'sshb'   , ssh(:,:,Kbb), ldxios = lrxios    )
237            CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios    )
238            ! needed to restart if land processor not computed
239            IF(lwp) write(numout,*) 'qco_rst_read : ssh(:,:,Kbb) and ssh(:,:,Kmm) found in restart files'
240            !!WHERE ( ssmask(:,:) == 0.0_wp )   !!gm/st ==> sm should not be necessary on ssh while it was required on e3
241            !!   ssh(:,:,Kmm) = 0._wp
242            !!   ssh(:,:,Kbb) = 0._wp
243            !!END WHERE
244            IF( l_1st_euler ) THEN
245               ssh(:,:,Kbb) = ssh(:,:,Kmm)
246            ENDIF
247         ELSE IF( id1 > 0 ) THEN
248            IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart files'
249            IF(lwp) write(numout,*) 'sshn set equal to sshb.'
250            IF(lwp) write(numout,*) 'neuler is forced to 0'
251            CALL iom_get( numror, jpdom_auto, 'sshb', ssh(:,:,Kbb), ldxios = lrxios )
252            ssh(:,:,Kmm) = ssh(:,:,Kbb)
253            l_1st_euler = .TRUE.
254         ELSE IF( id2 > 0 ) THEN
255            IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kbb) not found in restart files'
256            IF(lwp) write(numout,*) 'sshb set equal to sshn.'
257            IF(lwp) write(numout,*) 'neuler is forced to 0'
258            CALL iom_get( numror, jpdom_auto, 'sshn', ssh(:,:,Kmm), ldxios = lrxios )
259            ssh(:,:,Kbb) = ssh(:,:,Kmm)
260            l_1st_euler = .TRUE.
261         ELSE
262            IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart file'
263            IF(lwp) write(numout,*) 'ssh_b and ssh_n set to zero'
264            IF(lwp) write(numout,*) 'neuler is forced to 0'
265            ssh(:,:,:) = 0._wp
266            l_1st_euler = .TRUE.
267         ENDIF
268         !
269      ELSE                                   !* Initialize at "rest"
270         !
271         IF( ll_wd ) THEN   ! MJB ll_wd edits start here - these are essential
272            !
273            IF( cn_cfg == 'wad' ) THEN            ! Wetting and drying test case
274               CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )
275               ts (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)       ! set now values from to before ones
276               ssh(:,:    ,Kmm) = ssh(:,:    ,Kbb)
277               uu (:,:,:  ,Kmm) = uu (:,:,:  ,Kbb)
278               vv (:,:,:  ,Kmm) = vv (:,:,:  ,Kbb)
279            ELSE                                  ! if not test case
280               ssh(:,:,Kmm) = -ssh_ref
281               ssh(:,:,Kbb) = -ssh_ref
282               !
283               DO_2D( 1, 1, 1, 1 )
284                  IF( ht_0(ji,jj)-ssh_ref <  rn_wdmin1 ) THEN ! if total depth is less than min depth
285                     ssh(ji,jj,Kbb) = rn_wdmin1 - (ht_0(ji,jj) )
286                     ssh(ji,jj,Kmm) = rn_wdmin1 - (ht_0(ji,jj) )
287                  ENDIF
288               END_2D
289            ENDIF
290            !
291            DO ji = 1, jpi
292               DO jj = 1, jpj
293                  IF ( ht_0(ji,jj) .LE. 0.0 .AND. NINT( ssmask(ji,jj) ) .EQ. 1) THEN
294                    CALL ctl_stop( 'qco_rst_read: ht_0 must be positive at potentially wet points' )
295                  ENDIF
296               END DO
297            END DO
298            !
299         ELSE
300            !
301            ! Just to read set ssh in fact, called latter once vertical grid
302            ! is set up:
303!           CALL usr_def_istate( gdept_0, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )
304!           !
305            ssh(:,:,:) = 0._wp
306            !
307         ENDIF           ! end of ll_wd edits
308         !
309      ENDIF
310      !
311   END SUBROUTINE qco_rst_read
312
313   
314   SUBROUTINE qco_rst_read2( kt, Kbb, Kmm )
315      !!---------------------------------------------------------------------
316      !!                   ***  ROUTINE qco_rst_read  ***
317      !!
318      !! ** Purpose :   Read ssh in restart file
319      !!
320      !! ** Method  :   use of IOM library
321      !!                if the restart does not contain ssh,
322      !!                it is set to the _0 values.
323      !!----------------------------------------------------------------------
324      INTEGER, INTENT(in) ::   kt         ! ocean time-step
325      INTEGER, INTENT(in) ::   Kbb, Kmm   ! ocean time level indices
326      !
327      INTEGER ::   ji, jj, jk
328      INTEGER ::   id1, id2     ! local integers
329      !!----------------------------------------------------------------------
330      !
331      IF( ln_rstart ) THEN                   !* Read the restart file
332         CALL rst_read_open                  !  open the restart file if necessary
333         !
334         id1 = iom_varid( numror, 'sshb', ldstop = .FALSE. )
335         id2 = iom_varid( numror, 'sshn', ldstop = .FALSE. )
336         !
337         !                             ! --------- !
338         !                             ! all cases !
339         !                             ! --------- !
340         !
341         IF( MIN( id1, id2 ) > 0 ) THEN       ! all required arrays exist
342            CALL iom_get( numror, jpdom_auto, 'sshb'   , ssh(:,:,Kbb), ldxios = lrxios    )
343            CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios    )
344            CALL iom_get( numror, jpdom_auto, 'r3tb'   , r3t(:,:,Kbb), ldxios = lrxios    )
345            CALL iom_get( numror, jpdom_auto, 'r3tn'   , r3t(:,:,Kmm), ldxios = lrxios    )
346            CALL iom_get( numror, jpdom_auto, 'r3ub'   , r3u(:,:,Kbb), ldxios = lrxios, cd_type = 'U'    )
347            CALL iom_get( numror, jpdom_auto, 'r3un'   , r3u(:,:,Kmm), ldxios = lrxios, cd_type = 'U'    )
348            CALL iom_get( numror, jpdom_auto, 'r3vb'   , r3v(:,:,Kbb), ldxios = lrxios, cd_type = 'V'    )
349            CALL iom_get( numror, jpdom_auto, 'r3vn'   , r3v(:,:,Kmm), ldxios = lrxios, cd_type = 'V'    )
350            CALL iom_get( numror, jpdom_auto, 'r3f'    , r3f(:,:)    , ldxios = lrxios, cd_type = 'F'    )
351           
352            ! needed to restart if land processor not computed
353            IF(lwp) write(numout,*) 'qco_rst_read : ssh(:,:,Kbb) and ssh(:,:,Kmm) found in restart files'
354            !!WHERE ( ssmask(:,:) == 0.0_wp )   !!gm/st ==> sm should not be necessary on ssh while it was required on e3
355            !!   ssh(:,:,Kmm) = 0._wp
356            !!   ssh(:,:,Kbb) = 0._wp
357            !!END WHERE
358            IF( l_1st_euler ) THEN
359               ssh(:,:,Kbb) = ssh(:,:,Kmm)
360            ENDIF
361         ELSE IF( id1 > 0 ) THEN
362            IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart files'
363            IF(lwp) write(numout,*) 'sshn set equal to sshb.'
364            IF(lwp) write(numout,*) 'neuler is forced to 0'
365            CALL iom_get( numror, jpdom_auto, 'sshb', ssh(:,:,Kbb), ldxios = lrxios )
366            ssh(:,:,Kmm) = ssh(:,:,Kbb)
367            l_1st_euler = .TRUE.
368         ELSE IF( id2 > 0 ) THEN
369            IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kbb) not found in restart files'
370            IF(lwp) write(numout,*) 'sshb set equal to sshn.'
371            IF(lwp) write(numout,*) 'neuler is forced to 0'
372            CALL iom_get( numror, jpdom_auto, 'sshn', ssh(:,:,Kmm), ldxios = lrxios )
373            ssh(:,:,Kbb) = ssh(:,:,Kmm)
374            l_1st_euler = .TRUE.
375         ELSE
376            IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart file'
377            IF(lwp) write(numout,*) 'ssh_b and ssh_n set to zero'
378            IF(lwp) write(numout,*) 'neuler is forced to 0'
379            ssh(:,:,:) = 0._wp
380            l_1st_euler = .TRUE.
381         ENDIF
382         !
383      ELSE                                   !* Initialize at "rest"
384         !
385         IF( ll_wd ) THEN   ! MJB ll_wd edits start here - these are essential
386            !
387            IF( cn_cfg == 'wad' ) THEN            ! Wetting and drying test case
388               CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )
389               ts (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)       ! set now values from to before ones
390               ssh(:,:    ,Kmm) = ssh(:,:    ,Kbb)
391               uu (:,:,:  ,Kmm) = uu (:,:,:  ,Kbb)
392               vv (:,:,:  ,Kmm) = vv (:,:,:  ,Kbb)
393            ELSE                                  ! if not test case
394               ssh(:,:,Kmm) = -ssh_ref
395               ssh(:,:,Kbb) = -ssh_ref
396               !
397               DO_2D( 1, 1, 1, 1 )
398                  IF( ht_0(ji,jj)-ssh_ref <  rn_wdmin1 ) THEN ! if total depth is less than min depth
399                     ssh(ji,jj,Kbb) = rn_wdmin1 - (ht_0(ji,jj) )
400                     ssh(ji,jj,Kmm) = rn_wdmin1 - (ht_0(ji,jj) )
401                  ENDIF
402               END_2D
403            ENDIF
404            !
405            DO ji = 1, jpi
406               DO jj = 1, jpj
407                  IF ( ht_0(ji,jj) .LE. 0.0 .AND. NINT( ssmask(ji,jj) ) .EQ. 1) THEN
408                    CALL ctl_stop( 'qco_rst_read: ht_0 must be positive at potentially wet points' )
409                  ENDIF
410               END DO
411            END DO
412            !
413         ELSE
414            !
415            ! Just to read set ssh in fact, called latter once vertical grid
416            ! is set up:
417!           CALL usr_def_istate( gdept_0, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )
418!           !
419            ssh(:,:,:) = 0._wp
420            r3t(:,:,:) = 0._wp
421            r3u(:,:,:) = 0._wp
422            r3v(:,:,:) = 0._wp
423            r3f(:,:  ) = 0._wp
424            !
425         ENDIF           ! end of ll_wd edits
426         !
427      ENDIF
428      !
429   END SUBROUTINE qco_rst_read2
430
431
432   SUBROUTINE qco_ctl
433      !!---------------------------------------------------------------------
434      !!                  ***  ROUTINE qco_ctl  ***
435      !!
436      !! ** Purpose :   Control the consistency between namelist options
437      !!                for vertical coordinate
438      !!----------------------------------------------------------------------
439      INTEGER ::   ioptio, ios
440      !!
441      NAMELIST/nam_vvl/ ln_vvl_zstar, ln_vvl_ztilde, ln_vvl_layer, ln_vvl_ztilde_as_zstar, &
442         &              ln_vvl_zstar_at_eqtor      , rn_ahe3     , rn_rst_e3t            , &
443         &              rn_lf_cutoff               , rn_zdef_max , ln_vvl_dbg                ! not yet implemented: ln_vvl_kepe
444      !!----------------------------------------------------------------------
445      !
446      READ  ( numnam_ref, nam_vvl, IOSTAT = ios, ERR = 901)
447901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_vvl in reference namelist' )
448      READ  ( numnam_cfg, nam_vvl, IOSTAT = ios, ERR = 902 )
449902   IF( ios >  0 ) CALL ctl_nam ( ios , 'nam_vvl in configuration namelist' )
450      IF(lwm) WRITE ( numond, nam_vvl )
451      !
452      IF(lwp) THEN                    ! Namelist print
453         WRITE(numout,*)
454         WRITE(numout,*) 'qco_ctl : choice/control of the variable vertical coordinate'
455         WRITE(numout,*) '~~~~~~~~'
456         WRITE(numout,*) '   Namelist nam_vvl : chose a vertical coordinate'
457         WRITE(numout,*) '      zstar                      ln_vvl_zstar   = ', ln_vvl_zstar
458         WRITE(numout,*) '      ztilde                     ln_vvl_ztilde  = ', ln_vvl_ztilde
459         WRITE(numout,*) '      layer                      ln_vvl_layer   = ', ln_vvl_layer
460         WRITE(numout,*) '      ztilde as zstar   ln_vvl_ztilde_as_zstar  = ', ln_vvl_ztilde_as_zstar
461         WRITE(numout,*) '      ztilde near the equator    ln_vvl_zstar_at_eqtor  = ', ln_vvl_zstar_at_eqtor
462         WRITE(numout,*) '      !'
463         WRITE(numout,*) '      thickness diffusion coefficient                      rn_ahe3      = ', rn_ahe3
464         WRITE(numout,*) '      maximum e3t deformation fractional change            rn_zdef_max  = ', rn_zdef_max
465         IF( ln_vvl_ztilde_as_zstar ) THEN
466            WRITE(numout,*) '      ztilde running in zstar emulation mode (ln_vvl_ztilde_as_zstar=T) '
467            WRITE(numout,*) '         ignoring namelist timescale parameters and using:'
468            WRITE(numout,*) '            hard-wired : z-tilde to zstar restoration timescale (days)'
469            WRITE(numout,*) '                         rn_rst_e3t     = 0.e0'
470            WRITE(numout,*) '            hard-wired : z-tilde cutoff frequency of low-pass filter (days)'
471            WRITE(numout,*) '                         rn_lf_cutoff   = 1.0/rn_Dt'
472         ELSE
473            WRITE(numout,*) '      z-tilde to zstar restoration timescale (days)        rn_rst_e3t   = ', rn_rst_e3t
474            WRITE(numout,*) '      z-tilde cutoff frequency of low-pass filter (days)   rn_lf_cutoff = ', rn_lf_cutoff
475         ENDIF
476         WRITE(numout,*) '         debug prints flag                                 ln_vvl_dbg   = ', ln_vvl_dbg
477      ENDIF
478      !
479      ioptio = 0                      ! Parameter control
480      IF( ln_vvl_ztilde_as_zstar )   ln_vvl_ztilde = .true.
481      IF( ln_vvl_zstar           )   ioptio = ioptio + 1
482      IF( ln_vvl_ztilde          )   ioptio = ioptio + 1
483      IF( ln_vvl_layer           )   ioptio = ioptio + 1
484      !
485      IF( ioptio /= 1 )   CALL ctl_stop( 'Choose ONE vertical coordinate in namelist nam_vvl' )
486      !
487      IF(lwp) THEN                   ! Print the choice
488         WRITE(numout,*)
489         IF( ln_vvl_zstar           ) WRITE(numout,*) '      ==>>>   zstar vertical coordinate is used'
490         IF( ln_vvl_ztilde          ) WRITE(numout,*) '      ==>>>   ztilde vertical coordinate is used'
491         IF( ln_vvl_layer           ) WRITE(numout,*) '      ==>>>   layer vertical coordinate is used'
492         IF( ln_vvl_ztilde_as_zstar ) WRITE(numout,*) '      ==>>>   to emulate a zstar coordinate'
493      ENDIF
494      !
495#if defined key_agrif
496      IF( (.NOT.Agrif_Root()).AND.(.NOT.ln_vvl_zstar) )   CALL ctl_stop( 'AGRIF is implemented with zstar coordinate only' )
497#endif
498      !
499   END SUBROUTINE qco_ctl
500
501   !!======================================================================
502END MODULE domqco
Note: See TracBrowser for help on using the repository browser.