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 @ 13683

Last change on this file since 13683 was 13683, checked in by jchanut, 3 years ago

#2385, AGRIF. Duplicate now r3x in after r3x arrays at initialization (as done with std vvl)

File size: 25.4 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      !              ! CAUTION COM A METTRE !!!
91!!st      CALL qco_rst_read2( nit000, Kbb, Kmm )  ! Read or initialize ssh_(Kbb/Kmm) and r3
92!!st CAUTION if read2 removed change restart.F90 !
93      !
94      CALL qco_rst_read( nit000, Kbb, Kmm )   ! Read or initialize ssh_(Kbb/Kmm)
95      !
96      CALL dom_qco_zgr( Kbb, Kmm, Kaa )       ! interpolation scale factor, depth and water column
97      !
98#if defined key_agrif
99      ! We need to define r3[tuv](Kaa) for AGRIF initialisation (should not be a
100      ! problem for the restartability...)
101      r3t(:,:,Kaa) = r3t(:,:,Kmm)
102      r3u(:,:,Kaa) = r3u(:,:,Kmm)
103      r3v(:,:,Kaa) = r3v(:,:,Kmm)
104#endif
105      !
106      IF(lwxios) THEN   ! define variables in restart file when writing with XIOS
107         CALL iom_set_rstw_var_active('sshb')
108         CALL iom_set_rstw_var_active('sshn')
109      ENDIF
110      !
111   END SUBROUTINE dom_qco_init
112
113
114   SUBROUTINE dom_qco_zgr( Kbb, Kmm, Kaa )
115      !!----------------------------------------------------------------------
116      !!                ***  ROUTINE dom_qco_init  ***
117      !!
118      !! ** Purpose :  Initialization of all ssh./h._0 ratio
119      !!
120      !! ** Method  :  - call domqco using Kbb and Kmm
121      !!
122      !! ** Action  : - r3(t/u/v)_b
123      !!              - r3(t/u/v/f)_n
124      !!----------------------------------------------------------------------
125      INTEGER, INTENT(in) ::   Kbb, Kmm, Kaa   ! time level indices
126      !!----------------------------------------------------------------------
127      !
128      !                    !== Set of all other vertical scale factors  ==!  (now and before)
129      !                                ! Horizontal interpolation of e3t
130      CALL dom_qco_r3c( ssh(:,:,Kbb), r3t(:,:,Kbb), r3u(:,:,Kbb), r3v(:,:,Kbb) )
131      CALL dom_qco_r3c( ssh(:,:,Kmm), r3t(:,:,Kmm), r3u(:,:,Kmm), r3v(:,:,Kmm), r3f(:,:) )
132      !
133      !
134   END SUBROUTINE dom_qco_zgr
135
136
137   SUBROUTINE dom_qco_r3c( pssh, pr3t, pr3u, pr3v, pr3f )
138      !!---------------------------------------------------------------------
139      !!                   ***  ROUTINE r3c  ***
140      !!
141      !! ** Purpose :   compute the filtered ratio ssh/h_0 at t-,u-,v-,f-points
142      !!
143      !! ** Method  : - compute the ssh at u- and v-points (f-point optional)
144      !!                   Vector Form : surface weighted averaging
145      !!                   Flux   Form : simple           averaging
146      !!              - compute the ratio ssh/h_0 at t-,u-,v-pts, (f-pt optional)
147      !!----------------------------------------------------------------------
148      REAL(wp), DIMENSION(:,:)          , INTENT(in   )  ::   pssh               ! sea surface height   [m]
149      REAL(wp), DIMENSION(:,:)          , INTENT(  out)  ::   pr3t, pr3u, pr3v   ! ssh/h0 ratio at t-, u-, v-,points  [-]
150      REAL(wp), DIMENSION(:,:), OPTIONAL, INTENT(  out)  ::   pr3f               ! ssh/h0 ratio at f-point   [-]
151      !
152      INTEGER ::   ji, jj   ! dummy loop indices
153      !!----------------------------------------------------------------------
154      !
155      !
156      pr3t(:,:) = pssh(:,:) * r1_ht_0(:,:)   !==  ratio at t-point  ==!
157      !
158      !
159      !                                      !==  ratio at u-,v-point  ==!
160      !
161!!st      IF( ln_dynadv_vec ) THEN                     !- Vector Form   (thickness weighted averaging)
162#if ! defined key_qcoTest_FluxForm
163      !                                ! no 'key_qcoTest_FluxForm' : surface weighted ssh average
164         DO_2D( 0, 0, 0, 0 )
165            pr3u(ji,jj) = 0.5_wp * (  e1e2t(ji  ,jj) * pssh(ji  ,jj)  &
166               &                    + e1e2t(ji+1,jj) * pssh(ji+1,jj)  ) * r1_hu_0(ji,jj) * r1_e1e2u(ji,jj)
167            pr3v(ji,jj) = 0.5_wp * (  e1e2t(ji,jj  ) * pssh(ji,jj  )  &
168               &                    + e1e2t(ji,jj+1) * pssh(ji,jj+1)  ) * r1_hv_0(ji,jj) * r1_e1e2v(ji,jj)
169         END_2D
170!!st      ELSE                                         !- Flux Form   (simple averaging)
171#else
172         DO_2D( 0, 0, 0, 0 )
173            pr3u(ji,jj) = 0.5_wp * (  pssh(ji,jj) + pssh(ji+1,jj  )  ) * r1_hu_0(ji,jj)
174            pr3v(ji,jj) = 0.5_wp * (  pssh(ji,jj) + pssh(ji  ,jj+1)  ) * r1_hv_0(ji,jj)
175         END_2D
176!!st      ENDIF
177#endif         
178      !
179      IF( .NOT.PRESENT( pr3f ) ) THEN              !- lbc on ratio at u-, v-points only
180         CALL lbc_lnk_multi( 'dom_qco_r3c', pr3u, 'U', 1._wp, pr3v, 'V', 1._wp )
181         !
182         !
183      ELSE                                   !==  ratio at f-point  ==!
184         !
185!!st         IF( ln_dynadv_vec )   THEN                !- Vector Form   (thickness weighted averaging)
186#if ! defined key_qcoTest_FluxForm
187         !                                ! no 'key_qcoTest_FluxForm' : surface weighted ssh average
188
189            DO_2D( 0, 0, 0, 0 )                               ! start from 1 since lbc_lnk('F') doesn't update the 1st row/line
190               pr3f(ji,jj) = 0.25_wp * (  e1e2t(ji  ,jj  ) * pssh(ji  ,jj  )  &
191                  &                     + e1e2t(ji+1,jj  ) * pssh(ji+1,jj  )  &
192                  &                     + e1e2t(ji  ,jj+1) * pssh(ji  ,jj+1)  &
193                  &                     + e1e2t(ji+1,jj+1) * pssh(ji+1,jj+1)  ) * r1_hf_0(ji,jj) * r1_e1e2f(ji,jj)
194            END_2D
195!!st         ELSE                                      !- Flux Form   (simple averaging)
196#else
197            DO_2D( 0, 0, 0, 0 )                               ! start from 1 since lbc_lnk('F') doesn't update the 1st row/line
198               pr3f(ji,jj) = 0.25_wp * (  pssh(ji,jj  ) + pssh(ji+1,jj  )  &
199                  &                     + pssh(ji,jj+1) + pssh(ji+1,jj+1)  ) * r1_hf_0(ji,jj)
200            END_2D
201!!st         ENDIF
202#endif
203         !                                                 ! lbc on ratio at u-,v-,f-points
204         CALL lbc_lnk_multi( 'dom_qco_r3c', pr3u, 'U', 1._wp, pr3v, 'V', 1._wp, pr3f, 'F', 1._wp )
205         !
206      ENDIF
207      !
208   END SUBROUTINE dom_qco_r3c
209
210
211   SUBROUTINE qco_rst_read( kt, Kbb, Kmm )
212      !!---------------------------------------------------------------------
213      !!                   ***  ROUTINE qco_rst_read  ***
214      !!
215      !! ** Purpose :   Read ssh in restart file
216      !!
217      !! ** Method  :   use of IOM library
218      !!                if the restart does not contain ssh,
219      !!                it is set to the _0 values.
220      !!----------------------------------------------------------------------
221      INTEGER, INTENT(in) ::   kt         ! ocean time-step
222      INTEGER, INTENT(in) ::   Kbb, Kmm   ! ocean time level indices
223      !
224      INTEGER ::   ji, jj, jk
225      INTEGER ::   id1, id2     ! local integers
226      !!----------------------------------------------------------------------
227      !
228      IF( ln_rstart ) THEN                   !* Read the restart file
229         CALL rst_read_open                  !  open the restart file if necessary
230         !
231         id1 = iom_varid( numror, 'sshb', ldstop = .FALSE. )
232         id2 = iom_varid( numror, 'sshn', ldstop = .FALSE. )
233         !
234         !                             ! --------- !
235         !                             ! all cases !
236         !                             ! --------- !
237         !
238         IF( MIN( id1, id2 ) > 0 ) THEN       ! all required arrays exist
239            CALL iom_get( numror, jpdom_auto, 'sshb'   , ssh(:,:,Kbb), ldxios = lrxios    )
240            CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios    )
241            ! needed to restart if land processor not computed
242            IF(lwp) write(numout,*) 'qco_rst_read : ssh(:,:,Kbb) and ssh(:,:,Kmm) found in restart files'
243            !!WHERE ( ssmask(:,:) == 0.0_wp )   !!gm/st ==> sm should not be necessary on ssh while it was required on e3
244            !!   ssh(:,:,Kmm) = 0._wp
245            !!   ssh(:,:,Kbb) = 0._wp
246            !!END WHERE
247            IF( l_1st_euler ) THEN
248               ssh(:,:,Kbb) = ssh(:,:,Kmm)
249            ENDIF
250         ELSE IF( id1 > 0 ) THEN
251            IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart files'
252            IF(lwp) write(numout,*) 'sshn set equal to sshb.'
253            IF(lwp) write(numout,*) 'neuler is forced to 0'
254            CALL iom_get( numror, jpdom_auto, 'sshb', ssh(:,:,Kbb), ldxios = lrxios )
255            ssh(:,:,Kmm) = ssh(:,:,Kbb)
256            l_1st_euler = .TRUE.
257         ELSE IF( id2 > 0 ) THEN
258            IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kbb) not found in restart files'
259            IF(lwp) write(numout,*) 'sshb set equal to sshn.'
260            IF(lwp) write(numout,*) 'neuler is forced to 0'
261            CALL iom_get( numror, jpdom_auto, 'sshn', ssh(:,:,Kmm), ldxios = lrxios )
262            ssh(:,:,Kbb) = ssh(:,:,Kmm)
263            l_1st_euler = .TRUE.
264         ELSE
265            IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart file'
266            IF(lwp) write(numout,*) 'ssh_b and ssh_n set to zero'
267            IF(lwp) write(numout,*) 'neuler is forced to 0'
268            ssh(:,:,:) = 0._wp
269            l_1st_euler = .TRUE.
270         ENDIF
271         !
272      ELSE                                   !* Initialize at "rest"
273         !
274         IF( ll_wd ) THEN   ! MJB ll_wd edits start here - these are essential
275            !
276            IF( cn_cfg == 'wad' ) THEN            ! Wetting and drying test case
277               CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )
278               ts (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)       ! set now values from to before ones
279               ssh(:,:    ,Kmm) = ssh(:,:    ,Kbb)
280               uu (:,:,:  ,Kmm) = uu (:,:,:  ,Kbb)
281               vv (:,:,:  ,Kmm) = vv (:,:,:  ,Kbb)
282            ELSE                                  ! if not test case
283               ssh(:,:,Kmm) = -ssh_ref
284               ssh(:,:,Kbb) = -ssh_ref
285               !
286               DO_2D( 1, 1, 1, 1 )
287                  IF( ht_0(ji,jj)-ssh_ref <  rn_wdmin1 ) THEN ! if total depth is less than min depth
288                     ssh(ji,jj,Kbb) = rn_wdmin1 - (ht_0(ji,jj) )
289                     ssh(ji,jj,Kmm) = rn_wdmin1 - (ht_0(ji,jj) )
290                  ENDIF
291               END_2D
292            ENDIF
293            !
294            DO ji = 1, jpi
295               DO jj = 1, jpj
296                  IF ( ht_0(ji,jj) .LE. 0.0 .AND. NINT( ssmask(ji,jj) ) .EQ. 1) THEN
297                    CALL ctl_stop( 'qco_rst_read: ht_0 must be positive at potentially wet points' )
298                  ENDIF
299               END DO
300            END DO
301            !
302         ELSE
303            !
304            ! Just to read set ssh in fact, called latter once vertical grid
305            ! is set up:
306!           CALL usr_def_istate( gdept_0, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )
307!           !
308            ssh(:,:,:) = 0._wp
309            !
310         ENDIF           ! end of ll_wd edits
311         !
312      ENDIF
313      !
314   END SUBROUTINE qco_rst_read
315
316   
317   SUBROUTINE qco_rst_read2( kt, Kbb, Kmm )
318      !!---------------------------------------------------------------------
319      !!                   ***  ROUTINE qco_rst_read  ***
320      !!
321      !! ** Purpose :   Read ssh in restart file
322      !!
323      !! ** Method  :   use of IOM library
324      !!                if the restart does not contain ssh,
325      !!                it is set to the _0 values.
326      !!----------------------------------------------------------------------
327      INTEGER, INTENT(in) ::   kt         ! ocean time-step
328      INTEGER, INTENT(in) ::   Kbb, Kmm   ! ocean time level indices
329      !
330      INTEGER ::   ji, jj, jk
331      INTEGER ::   id1, id2     ! local integers
332      !!----------------------------------------------------------------------
333      !
334      IF( ln_rstart ) THEN                   !* Read the restart file
335         CALL rst_read_open                  !  open the restart file if necessary
336         !
337         id1 = iom_varid( numror, 'sshb', ldstop = .FALSE. )
338         id2 = iom_varid( numror, 'sshn', ldstop = .FALSE. )
339         !
340         !                             ! --------- !
341         !                             ! all cases !
342         !                             ! --------- !
343         !
344         IF( MIN( id1, id2 ) > 0 ) THEN       ! all required arrays exist
345            CALL iom_get( numror, jpdom_auto, 'sshb'   , ssh(:,:,Kbb), ldxios = lrxios    )
346            CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios    )
347            CALL iom_get( numror, jpdom_auto, 'r3tb'   , r3t(:,:,Kbb), ldxios = lrxios    )
348            CALL iom_get( numror, jpdom_auto, 'r3tn'   , r3t(:,:,Kmm), ldxios = lrxios    )
349            CALL iom_get( numror, jpdom_auto, 'r3ub'   , r3u(:,:,Kbb), ldxios = lrxios, cd_type = 'U'    )
350            CALL iom_get( numror, jpdom_auto, 'r3un'   , r3u(:,:,Kmm), ldxios = lrxios, cd_type = 'U'    )
351            CALL iom_get( numror, jpdom_auto, 'r3vb'   , r3v(:,:,Kbb), ldxios = lrxios, cd_type = 'V'    )
352            CALL iom_get( numror, jpdom_auto, 'r3vn'   , r3v(:,:,Kmm), ldxios = lrxios, cd_type = 'V'    )
353            CALL iom_get( numror, jpdom_auto, 'r3f'    , r3f(:,:)    , ldxios = lrxios, cd_type = 'F'    )
354           
355            ! needed to restart if land processor not computed
356            IF(lwp) write(numout,*) 'qco_rst_read : ssh(:,:,Kbb) and ssh(:,:,Kmm) found in restart files'
357            !!WHERE ( ssmask(:,:) == 0.0_wp )   !!gm/st ==> sm should not be necessary on ssh while it was required on e3
358            !!   ssh(:,:,Kmm) = 0._wp
359            !!   ssh(:,:,Kbb) = 0._wp
360            !!END WHERE
361            IF( l_1st_euler ) THEN
362               ssh(:,:,Kbb) = ssh(:,:,Kmm)
363            ENDIF
364         ELSE IF( id1 > 0 ) THEN
365            IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart files'
366            IF(lwp) write(numout,*) 'sshn set equal to sshb.'
367            IF(lwp) write(numout,*) 'neuler is forced to 0'
368            CALL iom_get( numror, jpdom_auto, 'sshb', ssh(:,:,Kbb), ldxios = lrxios )
369            ssh(:,:,Kmm) = ssh(:,:,Kbb)
370            l_1st_euler = .TRUE.
371         ELSE IF( id2 > 0 ) THEN
372            IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kbb) not found in restart files'
373            IF(lwp) write(numout,*) 'sshb set equal to sshn.'
374            IF(lwp) write(numout,*) 'neuler is forced to 0'
375            CALL iom_get( numror, jpdom_auto, 'sshn', ssh(:,:,Kmm), ldxios = lrxios )
376            ssh(:,:,Kbb) = ssh(:,:,Kmm)
377            l_1st_euler = .TRUE.
378         ELSE
379            IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart file'
380            IF(lwp) write(numout,*) 'ssh_b and ssh_n set to zero'
381            IF(lwp) write(numout,*) 'neuler is forced to 0'
382            ssh(:,:,:) = 0._wp
383            l_1st_euler = .TRUE.
384         ENDIF
385         !
386      ELSE                                   !* Initialize at "rest"
387         !
388         IF( ll_wd ) THEN   ! MJB ll_wd edits start here - these are essential
389            !
390            IF( cn_cfg == 'wad' ) THEN            ! Wetting and drying test case
391               CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )
392               ts (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)       ! set now values from to before ones
393               ssh(:,:    ,Kmm) = ssh(:,:    ,Kbb)
394               uu (:,:,:  ,Kmm) = uu (:,:,:  ,Kbb)
395               vv (:,:,:  ,Kmm) = vv (:,:,:  ,Kbb)
396            ELSE                                  ! if not test case
397               ssh(:,:,Kmm) = -ssh_ref
398               ssh(:,:,Kbb) = -ssh_ref
399               !
400               DO_2D( 1, 1, 1, 1 )
401                  IF( ht_0(ji,jj)-ssh_ref <  rn_wdmin1 ) THEN ! if total depth is less than min depth
402                     ssh(ji,jj,Kbb) = rn_wdmin1 - (ht_0(ji,jj) )
403                     ssh(ji,jj,Kmm) = rn_wdmin1 - (ht_0(ji,jj) )
404                  ENDIF
405               END_2D
406            ENDIF
407            !
408            DO ji = 1, jpi
409               DO jj = 1, jpj
410                  IF ( ht_0(ji,jj) .LE. 0.0 .AND. NINT( ssmask(ji,jj) ) .EQ. 1) THEN
411                    CALL ctl_stop( 'qco_rst_read: ht_0 must be positive at potentially wet points' )
412                  ENDIF
413               END DO
414            END DO
415            !
416         ELSE
417            !
418            ! Just to read set ssh in fact, called latter once vertical grid
419            ! is set up:
420!           CALL usr_def_istate( gdept_0, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )
421!           !
422            ssh(:,:,:) = 0._wp
423            r3t(:,:,:) = 0._wp
424            r3u(:,:,:) = 0._wp
425            r3v(:,:,:) = 0._wp
426            r3f(:,:  ) = 0._wp
427            !
428         ENDIF           ! end of ll_wd edits
429         !
430      ENDIF
431      !
432   END SUBROUTINE qco_rst_read2
433
434
435   SUBROUTINE qco_ctl
436      !!---------------------------------------------------------------------
437      !!                  ***  ROUTINE qco_ctl  ***
438      !!
439      !! ** Purpose :   Control the consistency between namelist options
440      !!                for vertical coordinate
441      !!----------------------------------------------------------------------
442      INTEGER ::   ioptio, ios
443      !!
444      NAMELIST/nam_vvl/ ln_vvl_zstar, ln_vvl_ztilde, ln_vvl_layer, ln_vvl_ztilde_as_zstar, &
445         &              ln_vvl_zstar_at_eqtor      , rn_ahe3     , rn_rst_e3t            , &
446         &              rn_lf_cutoff               , rn_zdef_max , ln_vvl_dbg                ! not yet implemented: ln_vvl_kepe
447      !!----------------------------------------------------------------------
448      !
449      READ  ( numnam_ref, nam_vvl, IOSTAT = ios, ERR = 901)
450901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'nam_vvl in reference namelist' )
451      READ  ( numnam_cfg, nam_vvl, IOSTAT = ios, ERR = 902 )
452902   IF( ios >  0 ) CALL ctl_nam ( ios , 'nam_vvl in configuration namelist' )
453      IF(lwm) WRITE ( numond, nam_vvl )
454      !
455      IF(lwp) THEN                    ! Namelist print
456         WRITE(numout,*)
457         WRITE(numout,*) 'qco_ctl : choice/control of the variable vertical coordinate'
458         WRITE(numout,*) '~~~~~~~~'
459         WRITE(numout,*) '   Namelist nam_vvl : chose a vertical coordinate'
460         WRITE(numout,*) '      zstar                      ln_vvl_zstar   = ', ln_vvl_zstar
461         WRITE(numout,*) '      ztilde                     ln_vvl_ztilde  = ', ln_vvl_ztilde
462         WRITE(numout,*) '      layer                      ln_vvl_layer   = ', ln_vvl_layer
463         WRITE(numout,*) '      ztilde as zstar   ln_vvl_ztilde_as_zstar  = ', ln_vvl_ztilde_as_zstar
464         WRITE(numout,*) '      ztilde near the equator    ln_vvl_zstar_at_eqtor  = ', ln_vvl_zstar_at_eqtor
465         WRITE(numout,*) '      !'
466         WRITE(numout,*) '      thickness diffusion coefficient                      rn_ahe3      = ', rn_ahe3
467         WRITE(numout,*) '      maximum e3t deformation fractional change            rn_zdef_max  = ', rn_zdef_max
468         IF( ln_vvl_ztilde_as_zstar ) THEN
469            WRITE(numout,*) '      ztilde running in zstar emulation mode (ln_vvl_ztilde_as_zstar=T) '
470            WRITE(numout,*) '         ignoring namelist timescale parameters and using:'
471            WRITE(numout,*) '            hard-wired : z-tilde to zstar restoration timescale (days)'
472            WRITE(numout,*) '                         rn_rst_e3t     = 0.e0'
473            WRITE(numout,*) '            hard-wired : z-tilde cutoff frequency of low-pass filter (days)'
474            WRITE(numout,*) '                         rn_lf_cutoff   = 1.0/rn_Dt'
475         ELSE
476            WRITE(numout,*) '      z-tilde to zstar restoration timescale (days)        rn_rst_e3t   = ', rn_rst_e3t
477            WRITE(numout,*) '      z-tilde cutoff frequency of low-pass filter (days)   rn_lf_cutoff = ', rn_lf_cutoff
478         ENDIF
479         WRITE(numout,*) '         debug prints flag                                 ln_vvl_dbg   = ', ln_vvl_dbg
480      ENDIF
481      !
482      ioptio = 0                      ! Parameter control
483      IF( ln_vvl_ztilde_as_zstar )   ln_vvl_ztilde = .true.
484      IF( ln_vvl_zstar           )   ioptio = ioptio + 1
485      IF( ln_vvl_ztilde          )   ioptio = ioptio + 1
486      IF( ln_vvl_layer           )   ioptio = ioptio + 1
487      !
488      IF( ioptio /= 1 )   CALL ctl_stop( 'Choose ONE vertical coordinate in namelist nam_vvl' )
489      !
490      IF(lwp) THEN                   ! Print the choice
491         WRITE(numout,*)
492         IF( ln_vvl_zstar           ) WRITE(numout,*) '      ==>>>   zstar vertical coordinate is used'
493         IF( ln_vvl_ztilde          ) WRITE(numout,*) '      ==>>>   ztilde vertical coordinate is used'
494         IF( ln_vvl_layer           ) WRITE(numout,*) '      ==>>>   layer vertical coordinate is used'
495         IF( ln_vvl_ztilde_as_zstar ) WRITE(numout,*) '      ==>>>   to emulate a zstar coordinate'
496      ENDIF
497      !
498#if defined key_agrif
499      IF( (.NOT.Agrif_Root()).AND.(.NOT.ln_vvl_zstar) )   CALL ctl_stop( 'AGRIF is implemented with zstar coordinate only' )
500#endif
501      !
502   END SUBROUTINE qco_ctl
503
504   !!======================================================================
505END MODULE domqco
Note: See TracBrowser for help on using the repository browser.