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.
zdfiwm.F90 in NEMO/branches/2021/dev_r15388_updated_zdfiwm/src/OCE/ZDF – NEMO

source: NEMO/branches/2021/dev_r15388_updated_zdfiwm/src/OCE/ZDF/zdfiwm.F90 @ 15466

Last change on this file since 15466 was 15466, checked in by cdllod, 3 years ago

updated and simplified zdfiwm routine

  • Property svn:keywords set to Id
File size: 25.8 KB
Line 
1MODULE zdfiwm
2   !!========================================================================
3   !!                       ***  MODULE  zdfiwm  ***
4   !! Ocean physics: Internal gravity wave-driven vertical mixing
5   !!========================================================================
6   !! History :  1.0  !  2004-04  (L. Bessieres, G. Madec)  Original code
7   !!             -   !  2006-08  (A. Koch-Larrouy)  Indonesian strait
8   !!            3.3  !  2010-10  (C. Ethe, G. Madec)  reorganisation of initialisation phase
9   !!            3.6  !  2016-03  (C. de Lavergne)  New param: internal wave-driven mixing
10   !!            4.0  !  2017-04  (G. Madec)  renamed module, remove the old param. and the CPP keys
11   !!            4.0  !  2020-12  (C. de Lavergne)  Update param to match published one
12   !!            4.0  !  2021-09  (C. de Lavergne)  Add energy from trapped and shallow internal tides
13   !!----------------------------------------------------------------------
14
15   !!----------------------------------------------------------------------
16   !!   zdf_iwm       : global     momentum & tracer Kz with wave induced Kz
17   !!   zdf_iwm_init  : global     momentum & tracer Kz with wave induced Kz
18   !!----------------------------------------------------------------------
19   USE oce            ! ocean dynamics and tracers variables
20   USE dom_oce        ! ocean space and time domain variables
21   USE zdf_oce        ! ocean vertical physics variables
22   USE zdfddm         ! ocean vertical physics: double diffusive mixing
23   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
24   USE eosbn2         ! ocean equation of state
25   USE phycst         ! physical constants
26   !
27   USE fldread        ! field read
28   USE prtctl         ! Print control
29   USE in_out_manager ! I/O manager
30   USE iom            ! I/O Manager
31   USE lib_mpp        ! MPP library
32   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
33
34   IMPLICIT NONE
35   PRIVATE
36
37   PUBLIC   zdf_iwm        ! called in step module
38   PUBLIC   zdf_iwm_init   ! called in nemogcm module
39
40   !                      !!* Namelist  namzdf_iwm : internal wave-driven mixing *
41   LOGICAL ::  ln_mevar    ! variable (=T) or constant (=F) mixing efficiency
42   LOGICAL ::  ln_tsdiff   ! account for differential T/S wave-driven mixing (=T) or not (=F)
43
44   REAL(wp)::  r1_6 = 1._wp / 6._wp
45   REAL(wp)::  rnu  = 1.4e-6_wp   ! molecular kinematic viscosity
46
47   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ebot_iwm   ! bottom-intensified dissipation above abyssal hills (W/m2)
48   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ecri_iwm   ! bottom-intensified dissipation at topographic slopes (W/m2)
49   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ensq_iwm   ! dissipation scaling with squared buoyancy frequency (W/m2)
50   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   esho_iwm   ! dissipation due to shoaling internal tides (W/m2)
51   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hbot_iwm   ! decay scale for abyssal hill dissipation (m)
52   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hcri_iwm   ! inverse decay scale for topographic slope dissipation (m-1)
53
54   !! * Substitutions
55#  include "do_loop_substitute.h90"
56#  include "domzgr_substitute.h90"
57   !!----------------------------------------------------------------------
58   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
59   !! $Id$
60   !! Software governed by the CeCILL license (see ./LICENSE)
61   !!----------------------------------------------------------------------
62CONTAINS
63
64   INTEGER FUNCTION zdf_iwm_alloc()
65      !!----------------------------------------------------------------------
66      !!                ***  FUNCTION zdf_iwm_alloc  ***
67      !!----------------------------------------------------------------------
68      ALLOCATE( ebot_iwm(jpi,jpj),  ecri_iwm(jpi,jpj),  ensq_iwm(jpi,jpj) ,     &
69      &         esho_iwm(jpi,jpj),  hbot_iwm(jpi,jpj),  hcri_iwm(jpi,jpj) , STAT=zdf_iwm_alloc )
70      !
71      CALL mpp_sum ( 'zdfiwm', zdf_iwm_alloc )
72      IF( zdf_iwm_alloc /= 0 )   CALL ctl_stop( 'STOP', 'zdf_iwm_alloc: failed to allocate arrays' )
73   END FUNCTION zdf_iwm_alloc
74
75
76   SUBROUTINE zdf_iwm( kt, Kmm, p_avm, p_avt, p_avs )
77      !!----------------------------------------------------------------------
78      !!                  ***  ROUTINE zdf_iwm  ***
79      !!                   
80      !! ** Purpose :   add to the vertical mixing coefficients the effect of
81      !!              breaking internal waves.
82      !!
83      !! ** Method  : - internal wave-driven vertical mixing is given by:
84      !!                  Kz_wave = min( f( Reb = zemx_iwm / (Nu * N^2) ), 100 cm2/s  )
85      !!              where zemx_iwm is the 3D space distribution of the wave-breaking
86      !!              energy and Nu the molecular kinematic viscosity.
87      !!              The function f(Reb) is linear (constant mixing efficiency)
88      !!              if the namelist parameter ln_mevar = F and nonlinear if ln_mevar = T.
89      !!
90      !!              - Compute zemx_iwm, the 3D power density that allows to compute
91      !!              Reb and therefrom the wave-induced vertical diffusivity.
92      !!              This is divided into four components:
93      !!                 1. Bottom-intensified dissipation at topographic slopes, expressed
94      !!              as an exponential decay above the bottom.
95      !!                     zemx_iwm(z) = ( ecri_iwm / rho0 ) * EXP( -(H-z)/hcri_iwm )
96      !!                                   / ( 1. - EXP( - H/hcri_iwm ) ) * hcri_iwm
97      !!              where hcri_iwm is the characteristic length scale of the bottom
98      !!              intensification, ecri_iwm a static 2D map of available power, and
99      !!              H the ocean depth.
100      !!                 2. Bottom-intensified dissipation above abyssal hills, expressed
101      !!              as an algebraic decay above bottom.
102      !!                     zemx_iwm(z) = ( ebot_iwm / rho0 ) * ( 1 + hbot_iwm/H )
103      !!                                   / ( 1 + (H-z)/hbot_iwm )^2                               
104      !!              where hbot_iwm is the characteristic length scale of the bottom
105      !!              intensification and ebot_iwm is a static 2D map of available power.
106      !!                 3. Dissipation scaling in the vertical with the squared buoyancy
107      !!              frequency (N^2).
108      !!                     zemx_iwm(z) = ( ensq_iwm / rho0 ) * rn2(z)
109      !!                                   / ZSUM( rn2 * e3w )
110      !!              where ensq_iwm is a static 2D map of available power.
111      !!                 4. Dissipation due to shoaling internal tides, scaling in the
112      !!              vertical with the buoyancy frequency (N).
113      !!                     zemx_iwm(z) = ( esho_iwm / rho0 ) * sqrt(rn2(z))
114      !!                                   / ZSUM( sqrt(rn2) * e3w )
115      !!              where esho_iwm is a static 2D map of available power.
116      !!
117      !!              - update the model vertical eddy viscosity and diffusivity:
118      !!                     avt  = avt  +    av_wave
119      !!                     avs  = avs  +    av_wave
120      !!                     avm  = avm  +    av_wave
121      !!
122      !!              - if namelist parameter ln_tsdiff = T, account for differential mixing:
123      !!                     avs  = avs  +    av_wave * diffusivity_ratio(Reb)
124      !!
125      !! ** Action  : - avt, avs, avm, increased by tide internal wave-driven mixing   
126      !!
127      !! References :  de Lavergne et al. JAMES 2020, https://doi.org/10.1029/2020MS002065
128      !!               de Lavergne et al. JPO 2016, https://doi.org/10.1175/JPO-D-14-0259.1
129      !!----------------------------------------------------------------------
130      INTEGER                    , INTENT(in   ) ::   kt             ! ocean time step
131      INTEGER                    , INTENT(in   ) ::   Kmm            ! time level index     
132      REAL(wp), DIMENSION(:,:,:) , INTENT(inout) ::   p_avm          ! momentum Kz (w-points)
133      REAL(wp), DIMENSION(:,:,:) , INTENT(inout) ::   p_avt, p_avs   ! tracer   Kz (w-points)
134      !
135      INTEGER  ::   ji, jj, jk   ! dummy loop indices
136      REAL(wp), SAVE :: zztmp
137      REAL(wp)       :: ztmp1, ztmp2        ! scalar workspace
138      REAL(wp), DIMENSION(A2D(nn_hls))     ::   zfact       ! Used for vertical structure
139      REAL(wp), DIMENSION(A2D(nn_hls),jpk) ::   zReb        ! Turbulence intensity parameter
140      REAL(wp), DIMENSION(A2D(nn_hls),jpk) ::   zemx_iwm    ! local energy density available for mixing (W/kg)
141      REAL(wp), DIMENSION(A2D(nn_hls),jpk) ::   zav_ratio   ! S/T diffusivity ratio (only for ln_tsdiff=T)
142      REAL(wp), DIMENSION(A2D(nn_hls),jpk) ::   zav_wave    ! Internal wave-induced diffusivity
143      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   z3d  ! 3D workspace used for iom_put
144      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   z2d  ! 2D     -      -    -     -
145      !!----------------------------------------------------------------------
146      !
147      !                       !* Set to zero the 1st and last vertical levels of appropriate variables
148      IF( iom_use("emix_iwm") ) THEN
149         zemx_iwm(:,:,:) = 0._wp
150      ENDIF
151      IF( iom_use("av_ratio") ) THEN
152         zav_ratio(:,:,:) = 0._wp
153      ENDIF
154      IF( iom_use("av_wave") .OR. sn_cfctl%l_prtctl ) THEN
155         zav_wave(:,:,:) = 0._wp
156      ENDIF
157      !
158      !                       ! ----------------------------- !
159      !                       !  Internal wave-driven mixing  !  (compute zav_wave)
160      !                       ! ----------------------------- !
161      !                             
162      !                       !* 'cri' component: distribute energy over the time-varying
163      !                       !* ocean depth using an exponential decay from the seafloor.
164      DO_2D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )                ! part independent of the level
165         zfact(ji,jj) = rho0 * (  1._wp - EXP( -ht(ji,jj) * hcri_iwm(ji,jj) )  )
166         IF( zfact(ji,jj) /= 0._wp )   zfact(ji,jj) = ecri_iwm(ji,jj) / zfact(ji,jj)
167      END_2D
168
169      DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 )      ! complete with the level-dependent part
170         IF ( zfact(ji,jj) == 0._wp .OR. wmask(ji,jj,jk) == 0._wp ) THEN   ! optimization
171            zemx_iwm(ji,jj,jk) = 0._wp
172         ELSE
173            zemx_iwm(ji,jj,jk) = zfact(ji,jj) * (  EXP( ( gdept(ji,jj,jk  ,Kmm) - ht(ji,jj) ) * hcri_iwm(ji,jj) )     &
174                 &                               - EXP( ( gdept(ji,jj,jk-1,Kmm) - ht(ji,jj) ) * hcri_iwm(ji,jj) ) )   &
175                 &                            / e3w(ji,jj,jk,Kmm)
176         ENDIF
177      END_3D
178
179                               !* 'bot' component: distribute energy over the time-varying
180                               !* ocean depth using an algebraic decay above the seafloor.
181      DO_2D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )
182         zfact(ji,jj) = 0._wp
183      END_2D
184      DO_2D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )               ! part independent of the level
185         IF( ht(ji,jj) /= 0._wp )  zfact(ji,jj) = ebot_iwm(ji,jj) * (  1._wp +  hbot_iwm(ji,jj) / ht(ji,jj)  ) / rho0
186      END_2D
187
188      DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 )     ! complete with the level-dependent part
189         zemx_iwm(ji,jj,jk) = zemx_iwm(ji,jj,jk) +                                                                                          & 
190            &         zfact(ji,jj) * (   1._wp / ( 1._wp + ( ht(ji,jj) - gdept(ji,jj,jk  ,Kmm) ) / hbot_iwm(ji,jj) )                        &
191            &                         -  1._wp / ( 1._wp + ( ht(ji,jj) - gdept(ji,jj,jk-1,Kmm) ) / hbot_iwm(ji,jj) )   ) * wmask(ji,jj,jk)  &
192            &                      / e3w(ji,jj,jk,Kmm)
193      END_3D
194
195                               !* 'nsq' component: distribute energy over the time-varying
196                               !* ocean depth as proportional to rn2
197      DO_2D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )
198         zfact(ji,jj) = 0._wp
199      END_2D
200      DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 )     ! part independent of the level
201         zfact(ji,jj) = zfact(ji,jj) + e3w(ji,jj,jk,Kmm) * MAX( 0._wp, rn2(ji,jj,jk) )
202      END_3D
203      !
204      DO_2D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )
205         IF( zfact(ji,jj) /= 0._wp )   zfact(ji,jj) = ensq_iwm(ji,jj) / ( rho0 * zfact(ji,jj) )
206      END_2D
207      !
208      DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 )     ! complete with the level-dependent part
209         zemx_iwm(ji,jj,jk) = zemx_iwm(ji,jj,jk) + zfact(ji,jj) * MAX( 0._wp, rn2(ji,jj,jk) )
210      END_3D
211
212                               !* 'sho' component: distribute energy over the time-varying
213                               !* ocean depth as proportional to sqrt(rn2)
214      DO_2D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )
215         zfact(ji,jj) = 0._wp
216      END_2D
217      DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 )     ! part independent of the level
218         zfact(ji,jj) = zfact(ji,jj) + e3w(ji,jj,jk,Kmm) * SQRT(  MAX( 0._wp, rn2(ji,jj,jk) )  )
219      END_3D
220      !
221      DO_2D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )
222         IF( zfact(ji,jj) /= 0._wp )   zfact(ji,jj) = esho_iwm(ji,jj) / ( rho0 * zfact(ji,jj) )
223      END_2D
224      !
225      DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 )     ! complete with the level-dependent part
226         zemx_iwm(ji,jj,jk) = zemx_iwm(ji,jj,jk) + zfact(ji,jj) * SQRT(  MAX( 0._wp, rn2(ji,jj,jk) )  )
227      END_3D
228
229      ! Calculate turbulence intensity parameter Reb
230      DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 )
231         zReb(ji,jj,jk) = zemx_iwm(ji,jj,jk) / MAX( 1.e-20_wp, rnu * rn2(ji,jj,jk) )
232      END_3D
233      !
234      ! Define internal wave-induced diffusivity
235      DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 )
236         zav_wave(ji,jj,jk) = zReb(ji,jj,jk) * r1_6 * rnu  ! This corresponds to a constant mixing efficiency of 1/6
237      END_3D
238      !
239      IF( ln_mevar ) THEN                                          ! Variable mixing efficiency case : modify zav_wave in the
240         DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 ) ! energetic (Reb > 480) and buoyancy-controlled (Reb <10.224) regimes
241            IF( zReb(ji,jj,jk) > 480.00_wp ) THEN
242               zav_wave(ji,jj,jk) = 3.6515_wp * rnu * SQRT( zReb(ji,jj,jk) )
243            ELSEIF( zReb(ji,jj,jk) < 10.224_wp ) THEN
244               zav_wave(ji,jj,jk) = 0.052125_wp * rnu * zReb(ji,jj,jk) * SQRT( zReb(ji,jj,jk) )
245            ENDIF
246         END_3D
247      ENDIF
248      !
249      DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 )    ! Bound diffusivity by molecular value and 100 cm2/s
250         zav_wave(ji,jj,jk) = MIN(  MAX( 1.4e-7_wp, zav_wave(ji,jj,jk) ), 1.e-2_wp  ) * wmask(ji,jj,jk)
251      END_3D
252      !
253      IF( kt == nit000 ) THEN        !* Control print at first time-step: diagnose the energy consumed by zav_wave
254         IF( .NOT. l_istiled .OR. ntile == 1 ) zztmp = 0._wp                    ! Do only on the first tile
255         DO_3D( 0, 0, 0, 0, 2, jpkm1 )
256            zztmp = zztmp + e3w(ji,jj,jk,Kmm) * e1e2t(ji,jj)   &
257               &          * MAX( 0._wp, rn2(ji,jj,jk) ) * zav_wave(ji,jj,jk) * wmask(ji,jj,jk) * tmask_i(ji,jj)
258         END_3D
259
260         IF( .NOT. l_istiled .OR. ntile == nijtile ) THEN                       ! Do only on the last tile
261            CALL mpp_sum( 'zdfiwm', zztmp )
262            zztmp = rho0 * zztmp ! Global integral of rauo * Kz * N^2 = power contributing to mixing
263            !
264            IF(lwp) THEN
265               WRITE(numout,*)
266               WRITE(numout,*) 'zdf_iwm : Internal wave-driven mixing (iwm)'
267               WRITE(numout,*) '~~~~~~~ '
268               WRITE(numout,*)
269               WRITE(numout,*) '      Total power consumption by av_wave =  ', zztmp * 1.e-12_wp, 'TW'
270            ENDIF
271         ENDIF
272      ENDIF
273
274      !                          ! ----------------------- !
275      !                          !   Update  mixing coefs  !                         
276      !                          ! ----------------------- !
277      !
278      IF( ln_tsdiff ) THEN                !* Option for differential mixing of salinity and temperature
279         ztmp1 = 0.505_wp + 0.495_wp * TANH( 0.92_wp * ( LOG10( 1.e-20_wp ) - 0.60_wp ) )
280         DO_3D( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 )       ! Calculate S/T diffusivity ratio as a function of Reb
281            ztmp2 = zReb(ji,jj,jk) * 5._wp * r1_6
282            IF ( ztmp2 > 1.e-20_wp .AND. wmask(ji,jj,jk) == 1._wp ) THEN
283               zav_ratio(ji,jj,jk) = 0.505_wp + 0.495_wp * TANH( 0.92_wp * ( LOG10(ztmp2) - 0.60_wp ) )
284            ELSE
285               zav_ratio(ji,jj,jk) = ztmp1 * wmask(ji,jj,jk)
286            ENDIF
287         END_3D
288         CALL iom_put( "av_ratio", zav_ratio )
289         DO_3D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 ) !* update momentum & tracer diffusivity with wave-driven mixing
290            p_avs(ji,jj,jk) = p_avs(ji,jj,jk) + zav_wave(ji,jj,jk) * zav_ratio(ji,jj,jk)
291            p_avt(ji,jj,jk) = p_avt(ji,jj,jk) + zav_wave(ji,jj,jk)
292            p_avm(ji,jj,jk) = p_avm(ji,jj,jk) + zav_wave(ji,jj,jk)
293         END_3D
294         !
295      ELSE                                !* update momentum & tracer diffusivity with wave-driven mixing
296         DO_3D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1, 2, jpkm1 )
297            p_avs(ji,jj,jk) = p_avs(ji,jj,jk) + zav_wave(ji,jj,jk)
298            p_avt(ji,jj,jk) = p_avt(ji,jj,jk) + zav_wave(ji,jj,jk)
299            p_avm(ji,jj,jk) = p_avm(ji,jj,jk) + zav_wave(ji,jj,jk)
300         END_3D
301      ENDIF
302      !                             !* output internal wave-driven mixing coefficient
303      CALL iom_put( "av_wave", zav_wave )
304                                    !* output useful diagnostics: Kz*N^2 ,
305                                    !  vertical integral of rho0 * Kz * N^2 , energy density (zemx_iwm)
306      IF( iom_use("bflx_iwm") .OR. iom_use("pcmap_iwm") ) THEN
307         ALLOCATE( z2d(A2D(nn_hls)) , z3d(A2D(nn_hls),jpk) )
308         ! Initialisation for iom_put
309         z2d(:,:) = 0._wp ; z3d(:,:,:) = 0._wp
310
311         DO_3D( 0, 0, 0, 0, 2, jpkm1 )
312            z3d(ji,jj,jk) = MAX( 0._wp, rn2(ji,jj,jk) ) * zav_wave(ji,jj,jk)
313            z2d(ji,jj) = z2d(ji,jj) + e3w(ji,jj,jk,Kmm) * z3d(ji,jj,jk) * wmask(ji,jj,jk)
314         END_3D
315         DO_2D( 0, 0, 0, 0 )
316            z2d(ji,jj) = rho0 * z2d(ji,jj)
317         END_2D
318         CALL iom_put(  "bflx_iwm", z3d )
319         CALL iom_put( "pcmap_iwm", z2d )
320         DEALLOCATE( z2d , z3d )
321      ENDIF
322      CALL iom_put( "emix_iwm", zemx_iwm )
323
324      IF(sn_cfctl%l_prtctl)   CALL prt_ctl(tab3d_1=zav_wave , clinfo1=' iwm - av_wave: ', tab3d_2=avt, clinfo2=' avt: ', kdim=jpk)
325      !
326   END SUBROUTINE zdf_iwm
327
328
329   SUBROUTINE zdf_iwm_init
330      !!----------------------------------------------------------------------
331      !!                  ***  ROUTINE zdf_iwm_init  ***
332      !!                     
333      !! ** Purpose :   Initialization of the wave-driven vertical mixing, reading
334      !!              of input power maps and decay length scales in netcdf files.
335      !!
336      !! ** Method  : - Read the namzdf_iwm namelist and check the parameters
337      !!
338      !!              - Read the input data in NetCDF files :
339      !!              bottom-intensified dissipation above abyssal hills (mixing_power_bot.nc)
340      !!              bottom-intensified dissipation at topographic slopes (mixing_power_cri.nc)
341      !!              dissipation scaling with squared buoyancy frequency (mixing_power_nsq.nc)
342      !!              dissipation due to shoaling internal tides (mixing_power_sho.nc)
343      !!              decay scale for abyssal hill dissipation (decay_scale_bot.nc)
344      !!              decay scale for topographic-slope dissipation (decay_scale_cri.nc)
345      !!
346      !! ** input   : - Namlist namzdf_iwm
347      !!              - NetCDF files : mixing_power_bot.nc, mixing_power_cri.nc, mixing_power_nsq.nc,
348      !!              mixing_power_sho.nc, decay_scale_bot.nc, decay_scale_cri.nc
349      !!
350      !! ** Action  : - Increase by 1 the nstop flag is setting problem encounter
351      !!              - Define ebot_iwm, ecri_iwm, ensq_iwm, esho_iwm, hbot_iwm, hcri_iwm
352      !!
353      !! References : de Lavergne et al. JAMES 2020, https://doi.org/10.1029/2020MS002065
354      !!----------------------------------------------------------------------
355      INTEGER  ::   ifpr               ! dummy loop indices
356      INTEGER  ::   inum               ! local integer
357      INTEGER  ::   ios
358      REAL(wp) ::   zbot, zcri, znsq, zsho   ! local scalars
359      !
360      CHARACTER(len=256)            ::   cn_dir                 ! Root directory for location of ssr files
361      INTEGER, PARAMETER            ::   jpiwm  = 6             ! maximum number of files to read
362      INTEGER, PARAMETER            ::   jp_mpb = 1
363      INTEGER, PARAMETER            ::   jp_mpc = 2
364      INTEGER, PARAMETER            ::   jp_mpn = 3
365      INTEGER, PARAMETER            ::   jp_mps = 4
366      INTEGER, PARAMETER            ::   jp_dsb = 5
367      INTEGER, PARAMETER            ::   jp_dsc = 6
368      !
369      TYPE(FLD_N), DIMENSION(jpiwm) ::   slf_iwm                        ! array of namelist informations
370      TYPE(FLD_N)                   ::   sn_mpb, sn_mpc, sn_mpn, sn_mps ! information about Mixing Power field to be read
371      TYPE(FLD_N)                   ::   sn_dsb, sn_dsc                 ! information about Decay Scale field to be read
372      TYPE(FLD  ), DIMENSION(jpiwm) ::   sf_iwm                         ! structure of input fields (file informations, fields read)
373      !
374      NAMELIST/namzdf_iwm/ ln_mevar, ln_tsdiff, &
375          &                cn_dir, sn_mpb, sn_mpc, sn_mpn, sn_mps, sn_dsb, sn_dsc
376      !!----------------------------------------------------------------------
377      !
378      READ  ( numnam_ref, namzdf_iwm, IOSTAT = ios, ERR = 901)
379901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namzdf_iwm in reference namelist' )
380      !
381      READ  ( numnam_cfg, namzdf_iwm, IOSTAT = ios, ERR = 902 )
382902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namzdf_iwm in configuration namelist' )
383      IF(lwm) WRITE ( numond, namzdf_iwm )
384      !
385      IF(lwp) THEN                  ! Control print
386         WRITE(numout,*)
387         WRITE(numout,*) 'zdf_iwm_init : internal wave-driven mixing'
388         WRITE(numout,*) '~~~~~~~~~~~~'
389         WRITE(numout,*) '   Namelist namzdf_iwm : set wave-driven mixing parameters'
390         WRITE(numout,*) '      Variable (T) or constant (F) mixing efficiency            = ', ln_mevar
391         WRITE(numout,*) '      Differential internal wave-driven mixing (T) or not (F)   = ', ln_tsdiff
392      ENDIF
393     
394      ! This internal-wave-driven mixing parameterization elevates avt and avm in the interior, and
395      ! ensures that avt remains larger than its molecular value (=1.4e-7). Therefore, avtb should
396      ! be set here to a very small value, and avmb to its (uniform) molecular value (=1.4e-6).
397      avmb(:) = rnu              ! molecular value
398      avtb(:) = 1.e-10_wp        ! very small diffusive minimum (background avt is specified in zdf_iwm)   
399      avtb_2d(:,:) = 1._wp     ! uniform
400      IF(lwp) THEN                  ! Control print
401         WRITE(numout,*)
402         WRITE(numout,*) '   Force the background value applied to avm & avt in TKE to be everywhere ',   &
403            &               'the viscous molecular value & a very small diffusive value, resp.'
404      ENDIF
405           
406      !                             ! allocate iwm arrays
407      IF( zdf_iwm_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'zdf_iwm_init : unable to allocate iwm arrays' )
408      !
409      ! store namelist information in an array
410      slf_iwm(jp_mpb) = sn_mpb ; slf_iwm(jp_mpc) = sn_mpc ; slf_iwm(jp_mpn) = sn_mpn ; slf_iwm(jp_mps) = sn_mps
411      slf_iwm(jp_dsb) = sn_dsb ; slf_iwm(jp_dsc) = sn_dsc
412      !
413      DO ifpr= 1, jpiwm
414         ALLOCATE( sf_iwm(ifpr)%fnow(jpi,jpj,1)   )
415         IF( slf_iwm(ifpr)%ln_tint )ALLOCATE( sf_iwm(ifpr)%fdta(jpi,jpj,1,2) )
416      END DO
417
418      ! fill sf_iwm with sf_iwm and control print
419      CALL fld_fill( sf_iwm, slf_iwm , cn_dir, 'zdfiwm_init', 'iwm input file', 'namiwm' )
420
421      !                             ! hard-coded default values
422      sf_iwm(jp_mpb)%fnow(:,:,1) = 1.e-10_wp
423      sf_iwm(jp_mpc)%fnow(:,:,1) = 1.e-10_wp
424      sf_iwm(jp_mpn)%fnow(:,:,1) = 1.e-6_wp
425      sf_iwm(jp_mps)%fnow(:,:,1) = 1.e-10_wp
426      sf_iwm(jp_dsb)%fnow(:,:,1) = 100._wp
427      sf_iwm(jp_dsc)%fnow(:,:,1) = 100._wp
428
429      !                             ! read necessary fields
430      CALL fld_read( nit000, 1, sf_iwm )
431
432      ebot_iwm(:,:) = sf_iwm(1)%fnow(:,:,1) * ssmask(:,:) ! energy flux for dissipation above abyssal hills [W/m2]
433      ecri_iwm(:,:) = sf_iwm(2)%fnow(:,:,1) * ssmask(:,:) ! energy flux for dissipation at topographic slopes [W/m2]
434      ensq_iwm(:,:) = sf_iwm(3)%fnow(:,:,1) * ssmask(:,:) ! energy flux for dissipation scaling with N^2 [W/m2]
435      esho_iwm(:,:) = sf_iwm(4)%fnow(:,:,1) * ssmask(:,:) ! energy flux for dissipation due to shoaling [W/m2]
436      hbot_iwm(:,:) = sf_iwm(5)%fnow(:,:,1)               ! spatially variable decay scale for abyssal hill dissipation [m]
437      hcri_iwm(:,:) = sf_iwm(6)%fnow(:,:,1)               ! spatially variable decay scale for topographic-slope [m]
438
439      hcri_iwm(:,:) = 1._wp / hcri_iwm(:,:) ! only the inverse height is used, hence calculated here once for all
440
441      zbot = glob_sum( 'zdfiwm', e1e2t(:,:) * ebot_iwm(:,:) )
442      zcri = glob_sum( 'zdfiwm', e1e2t(:,:) * ecri_iwm(:,:) )
443      znsq = glob_sum( 'zdfiwm', e1e2t(:,:) * ensq_iwm(:,:) )
444      zsho = glob_sum( 'zdfiwm', e1e2t(:,:) * esho_iwm(:,:) )
445
446      IF(lwp) THEN
447         WRITE(numout,*) '      Dissipation above abyssal hills:        ', zbot * 1.e-12_wp, 'TW'
448         WRITE(numout,*) '      Dissipation along topographic slopes:   ', zcri * 1.e-12_wp, 'TW'
449         WRITE(numout,*) '      Dissipation scaling with N^2:           ', znsq * 1.e-12_wp, 'TW'
450         WRITE(numout,*) '      Dissipation due to shoaling:            ', zsho * 1.e-12_wp, 'TW'
451      ENDIF
452      !
453   END SUBROUTINE zdf_iwm_init
454
455   !!======================================================================
456END MODULE zdfiwm
Note: See TracBrowser for help on using the repository browser.