Index: NEMO/branches/2021/dev_r14122_HPC-08_Mueller_OSMOSIS_streamlining/src/OCE/ZDF/zdfosm.F90
===================================================================
--- NEMO/branches/2021/dev_r14122_HPC-08_Mueller_OSMOSIS_streamlining/src/OCE/ZDF/zdfosm.F90	(revision 14911)
+++ NEMO/branches/2021/dev_r14122_HPC-08_Mueller_OSMOSIS_streamlining/src/OCE/ZDF/zdfosm.F90	(revision 14912)
@@ -34,9 +34,9 @@
    !! 16/05/2019 (19) Fox-Kemper parametrization of restratification through mixed layer eddies added to revised code.
    !! 23/05/19   (20) Old code where key_osmldpth1` is *not* set removed, together with the key key_osmldpth1
-   !!             4.2  !  2021-05  (S. Mueller)  Efficiency and source-code clarity enhancements, adaptation for tiling
+   !!             4.2  !  2021-05  (S. Mueller)  Efficiency improvements, source-code clarity enhancements, and adaptation to tiling
    !!----------------------------------------------------------------------
 
    !!----------------------------------------------------------------------
-   !!   'ln_zdfosm'                                             OSMOSIS scheme
+   !!   'ln_zdfosm'                                          OSMOSIS scheme
    !!----------------------------------------------------------------------
    !!   zdf_osm        : update momentum and tracer Kz from osm scheme
@@ -66,27 +66,27 @@
    !!      zdf_osm_iomput_3d                    : iom_put wrapper for 3D fields
    !!----------------------------------------------------------------------
-   USE oce                                        ! Ocean dynamics and active tracers
-                                                  ! Uses ww from previous time step (which is now wb) to calculate hbl
-   USE dom_oce                                    ! Ocean space and time domain
-   USE zdf_oce                                    ! Ocean vertical physics
-   USE sbc_oce                                    ! Surface boundary condition: ocean
-   USE sbcwave                                    ! Surface wave parameters
-   USE phycst                                     ! Physical constants
-   USE eosbn2                                     ! Equation of state
-   USE traqsr                                     ! Details of solar radiation absorption
-   USE zdfdrg, ONLY : rCdU_bot                    ! Bottom friction velocity
-   USE zdfddm                                     ! Double diffusion mixing (avs array)
-   USE iom                                        ! I/O library
-   USE lib_mpp                                    ! MPP library
-   USE trd_oce                                    ! Ocean trends definition
-   USE trdtra                                     ! Tracers trends
-   USE in_out_manager                             ! I/O manager
-   USE lbclnk                                     ! Ocean lateral boundary conditions (or mpp link)
-   USE prtctl                                     ! Print control
-   USE lib_fortran                                ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
-   !
+   USE oce                       ! Ocean dynamics and active tracers
+   !                             ! Uses ww from previous time step (which is now wb) to calculate hbl
+   USE dom_oce                   ! Ocean space and time domain
+   USE zdf_oce                   ! Ocean vertical physics
+   USE sbc_oce                   ! Surface boundary condition: ocean
+   USE sbcwave                   ! Surface wave parameters
+   USE phycst                    ! Physical constants
+   USE eosbn2                    ! Equation of state
+   USE traqsr                    ! Details of solar radiation absorption
+   USE zdfdrg, ONLY : rCdU_bot   ! Bottom friction velocity
+   USE zdfddm                    ! Double diffusion mixing (avs array)
+   USE iom                       ! I/O library
+   USE lib_mpp                   ! MPP library
+   USE trd_oce                   ! Ocean trends definition
+   USE trdtra                    ! Tracers trends
+   USE in_out_manager            ! I/O manager
+   USE lbclnk                    ! Ocean lateral boundary conditions (or mpp link)
+   USE prtctl                    ! Print control
+   USE lib_fortran               ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
+
    IMPLICIT NONE
    PRIVATE
-   !
+
    ! Public subroutines
    PUBLIC zdf_osm        ! Routine called by step.F90
@@ -96,5 +96,5 @@
    PUBLIC trc_osm        ! Routine called by trcstp.F90
    PUBLIC dyn_osm        ! Routine called by step.F90
-   !
+
    ! Public variables
    LOGICAL,  PUBLIC                                      ::   ln_osm_mle   !: Flag to activate the Mixed Layer Eddy (MLE)
@@ -111,5 +111,5 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   dbdy_mle     !: Meridional buoyancy gradient in ML
    INTEGER,  PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   mld_prof     !: Level of base of MLE layer
-   !
+
    INTERFACE zdf_osm_velocity_rotation
       !!---------------------------------------------------------------------
@@ -127,86 +127,78 @@
       MODULE PROCEDURE zdf_osm_iomput_3d
    END INTERFACE
-   !
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   etmean   ! Averaging operator for avt
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   dh       ! Depth of pycnocline
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   r1_ft    ! Inverse of the modified Coriolis parameter at t-pts
-   !
+
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   etmean      ! Averaging operator for avt
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   dh          ! Depth of pycnocline
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   r1_ft       ! Inverse of the modified Coriolis parameter at t-pts
    ! Layer indices
-   INTEGER,  ALLOCATABLE, SAVE, DIMENSION(:,:) ::   nbld   ! Level of boundary layer base
-   INTEGER,  ALLOCATABLE, SAVE, DIMENSION(:,:) ::   nmld   ! Level of mixed-layer depth (pycnocline top)
-   !
+   INTEGER,  ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   nbld        ! Level of boundary layer base
+   INTEGER,  ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   nmld        ! Level of mixed-layer depth (pycnocline top)
    ! Layer type
-   INTEGER,  ALLOCATABLE, SAVE, DIMENSION(:,:) ::   n_ddh   ! Type of shear layer
-   !                                                        !    n_ddh=0: active shear layer
-   !                                                        !    n_ddh=1: shear layer not active
-   !                                                        !    n_ddh=2: shear production low
-   !
+   INTEGER,  ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   n_ddh       ! Type of shear layer
+   !                                                              !    n_ddh=0: active shear layer
+   !                                                              !    n_ddh=1: shear layer not active
+   !                                                              !    n_ddh=2: shear production low
    ! Layer flags
-   LOGICAL,  ALLOCATABLE, SAVE, DIMENSION(:,:) ::   l_conv    ! Unstable/stable bl
-   LOGICAL,  ALLOCATABLE, SAVE, DIMENSION(:,:) ::   l_shear   ! Shear layers
-   LOGICAL,  ALLOCATABLE, SAVE, DIMENSION(:,:) ::   l_coup    ! Coupling to bottom
-   LOGICAL,  ALLOCATABLE, SAVE, DIMENSION(:,:) ::   l_pyc     ! OSBL pycnocline present
-   LOGICAL,  ALLOCATABLE, SAVE, DIMENSION(:,:) ::   l_flux    ! Surface flux extends below OSBL into MLE layer
-   LOGICAL,  ALLOCATABLE, SAVE, DIMENSION(:,:) ::   l_mle     ! MLE layer increases in hickness.
-   !
+   LOGICAL,  ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   l_conv      ! Unstable/stable bl
+   LOGICAL,  ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   l_shear     ! Shear layers
+   LOGICAL,  ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   l_coup      ! Coupling to bottom
+   LOGICAL,  ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   l_pyc       ! OSBL pycnocline present
+   LOGICAL,  ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   l_flux      ! Surface flux extends below OSBL into MLE layer
+   LOGICAL,  ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   l_mle       ! MLE layer increases in hickness.
    ! Scales
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   swth0       ! Surface heat flux (Kinematic)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sws0        ! Surface freshwater flux
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   swb0        ! Surface buoyancy flux
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   suw0        ! Surface u-momentum flux
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sustar      ! Friction velocity
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   scos_wind   ! Cos angle of surface stress
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ssin_wind   ! Sin angle of surface stress
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   swthav      ! Heat flux - bl average
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   swsav       ! Freshwater flux - bl average
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   swbav       ! Buoyancy flux - bl average
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sustke      ! Surface Stokes drift
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   dstokes     ! Penetration depth of the Stokes drift
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   swstrl      ! Langmuir velocity scale
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   swstrc      ! Convective velocity scale
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sla         ! Trubulent Langmuir number
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   svstr       ! Velocity scale that tends to sustar for large Langmuir number
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   shol        ! Stability parameter for boundary layer
-   !
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   swth0       ! Surface heat flux (Kinematic)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   sws0        ! Surface freshwater flux
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   swb0        ! Surface buoyancy flux
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   suw0        ! Surface u-momentum flux
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   sustar      ! Friction velocity
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   scos_wind   ! Cos angle of surface stress
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   ssin_wind   ! Sin angle of surface stress
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   swthav      ! Heat flux - bl average
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   swsav       ! Freshwater flux - bl average
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   swbav       ! Buoyancy flux - bl average
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   sustke      ! Surface Stokes drift
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   dstokes     ! Penetration depth of the Stokes drift
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   swstrl      ! Langmuir velocity scale
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   swstrc      ! Convective velocity scale
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   sla         ! Trubulent Langmuir number
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   svstr       ! Velocity scale that tends to sustar for large Langmuir number
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   shol        ! Stability parameter for boundary layer
    ! Layer averages: BL
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_t_bl   ! Temperature average
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_s_bl   ! Salinity average
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_u_bl   ! Velocity average (u)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_v_bl   ! Velocity average (v)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_b_bl   ! Buoyancy average
-   !
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_t_bl     ! Temperature average
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_s_bl     ! Salinity average
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_u_bl     ! Velocity average (u)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_v_bl     ! Velocity average (v)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_b_bl     ! Buoyancy average
    ! Difference between layer average and parameter at the base of the layer: BL
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_dt_bl   ! Temperature difference
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_ds_bl   ! Salinity difference
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_du_bl   ! Velocity difference (u)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_dv_bl   ! Velocity difference (v)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_db_bl   ! Buoyancy difference
-   !
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_dt_bl    ! Temperature difference
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_ds_bl    ! Salinity difference
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_du_bl    ! Velocity difference (u)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_dv_bl    ! Velocity difference (v)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_db_bl    ! Buoyancy difference
    ! Layer averages: ML
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_t_ml   ! Temperature average
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_s_ml   ! Salinity average
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_u_ml   ! Velocity average (u)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_v_ml   ! Velocity average (v)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_b_ml   ! Buoyancy average
-   !
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_t_ml     ! Temperature average
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_s_ml     ! Salinity average
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_u_ml     ! Velocity average (u)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_v_ml     ! Velocity average (v)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_b_ml     ! Buoyancy average
    ! Difference between layer average and parameter at the base of the layer: ML
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_dt_ml   ! Temperature difference
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_ds_ml   ! Salinity difference
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_du_ml   ! Velocity difference (u)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_dv_ml   ! Velocity difference (v)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_db_ml   ! Buoyancy difference
-   !
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_dt_ml    ! Temperature difference
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_ds_ml    ! Salinity difference
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_du_ml    ! Velocity difference (u)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_dv_ml    ! Velocity difference (v)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_db_ml    ! Buoyancy difference
    ! Layer averages: MLE
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_t_mle  ! Temperature average
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_s_mle  ! Salinity average
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_u_mle  ! Velocity average (u)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_v_mle  ! Velocity average (v)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   av_b_mle  ! Buoyancy average
-   !
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_t_mle    ! Temperature average
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_s_mle    ! Salinity average
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_u_mle    ! Velocity average (u)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_v_mle    ! Velocity average (v)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   av_b_mle    ! Buoyancy average
    ! Diagnostic output
-   REAL(WP), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   osmdia2d   ! Auxiliary array for diagnostic output
-   REAL(WP), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   osmdia3d   ! Auxiliary array for diagnostic output
-   !
-   !            ** Namelist  namzdf_osm  **
+   REAL(WP), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   osmdia2d    ! Auxiliary array for diagnostic output
+   REAL(WP), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   osmdia3d    ! Auxiliary array for diagnostic output
+   LOGICAL  ::   ln_dia_pyc_scl = .FALSE.                         ! Output of pycnocline scalar-gradient profiles
+   LOGICAL  ::   ln_dia_pyc_shr = .FALSE.                         ! Output of pycnocline velocity-shear  profiles
+
+   !                                               !!* namelist namzdf_osm *
    LOGICAL  ::   ln_use_osm_la                      ! Use namelist rn_osm_la
    REAL(wp) ::   rn_osm_la                          ! Turbulent Langmuir number
@@ -221,6 +213,4 @@
    INTEGER  ::   nn_osm_SD_reduce                   ! = 0/1/2 flag for getting effective stokes drift from surface value
    LOGICAL  ::   ln_dia_osm                         ! Use namelist  rn_osm_la
-   LOGICAL  ::   ln_dia_pyc_scl        = .FALSE.    ! Output of pycnocline scalar-gradient profiles
-   LOGICAL  ::   ln_dia_pyc_shr        = .FALSE.    ! Output of pycnocline velocity-shear  profiles
    LOGICAL  ::   ln_kpprimix           = .TRUE.     ! Shear instability mixing
    REAL(wp) ::   rn_riinfty            = 0.7_wp     ! Local Richardson Number limit for shear instability
@@ -228,28 +218,27 @@
    LOGICAL  ::   ln_convmix            = .TRUE.     ! Convective instability mixing
    REAL(wp) ::   rn_difconv            = 1.0_wp     ! Diffusivity when unstable below BL  (m2/s)
-   !
    ! OSMOSIS mixed layer eddy parametrization constants
-   INTEGER  ::   nn_osm_mle          ! = 0/1 flag for horizontal average on avt
-   REAL(wp) ::   rn_osm_mle_ce       ! MLE coefficient
-   !   ! Parameters used in nn_osm_mle = 0 case
-   REAL(wp) ::   rn_osm_mle_lf       ! Typical scale of mixed layer front
-   REAL(wp) ::   rn_osm_mle_time     ! Time scale for mixing momentum across the mixed layer
-   !   ! Parameters used in nn_osm_mle = 1 case
-   REAL(wp) ::   rn_osm_mle_lat      ! Reference latitude for a 5 km scale of ML front
-   LOGICAL  ::   ln_osm_hmle_limit   ! If true arbitrarily restrict hmle to rn_osm_hmle_limit*zmld
-   REAL(wp) ::   rn_osm_hmle_limit   ! If ln_osm_hmle_limit true arbitrarily restrict hmle to rn_osm_hmle_limit*zmld
-   REAL(wp) ::   rn_osm_mle_rho_c    ! Density criterion for definition of MLD used by FK
-   REAL(wp) ::   rb_c                ! ML buoyancy criteria = g rho_c /rho0 where rho_c is defined in zdfmld
-   REAL(wp) ::   rc_f                ! MLE coefficient (= rn_ce / (5 km * fo) ) in nn_osm_mle=1 case
-   REAL(wp) ::   rn_osm_mle_thresh   ! Threshold buoyancy for deepening of MLE layer below OSBL base
-   REAL(wp) ::   rn_osm_bl_thresh    ! Threshold buoyancy for deepening of OSBL base
-   REAL(wp) ::   rn_osm_mle_tau      ! Adjustment timescale for MLE
-   !
-   !             ** General constants  **
+   INTEGER  ::   nn_osm_mle                         ! = 0/1 flag for horizontal average on avt
+   REAL(wp) ::   rn_osm_mle_ce                      ! MLE coefficient
+   !    Parameters used in nn_osm_mle = 0 case
+   REAL(wp) ::   rn_osm_mle_lf                      ! Typical scale of mixed layer front
+   REAL(wp) ::   rn_osm_mle_time                    ! Time scale for mixing momentum across the mixed layer
+   !    Parameters used in nn_osm_mle = 1 case
+   REAL(wp) ::   rn_osm_mle_lat                     ! Reference latitude for a 5 km scale of ML front
+   LOGICAL  ::   ln_osm_hmle_limit                  ! If true arbitrarily restrict hmle to rn_osm_hmle_limit*zmld
+   REAL(wp) ::   rn_osm_hmle_limit                  ! If ln_osm_hmle_limit true arbitrarily restrict hmle to rn_osm_hmle_limit*zmld
+   REAL(wp) ::   rn_osm_mle_rho_c                   ! Density criterion for definition of MLD used by FK
+   REAL(wp) ::   rb_c                               ! ML buoyancy criteria = g rho_c /rho0 where rho_c is defined in zdfmld
+   REAL(wp) ::   rc_f                               ! MLE coefficient (= rn_ce / (5 km * fo) ) in nn_osm_mle=1 case
+   REAL(wp) ::   rn_osm_mle_thresh                  ! Threshold buoyancy for deepening of MLE layer below OSBL base
+   REAL(wp) ::   rn_osm_bl_thresh                   ! Threshold buoyancy for deepening of OSBL base
+   REAL(wp) ::   rn_osm_mle_tau                     ! Adjustment timescale for MLE
+
+   ! General constants
    REAL(wp) ::   epsln     = 1.0e-20_wp      ! A small positive number to ensure no div by zero
    REAL(wp) ::   depth_tol = 1.0e-6_wp       ! A small-ish positive number to give a hbl slightly shallower than gdepw
    REAL(wp) ::   pthird    = 1.0_wp/3.0_wp   ! 1/3
    REAL(wp) ::   p2third   = 2.0_wp/3.0_wp   ! 2/3
-   !
+
    !! * Substitutions
 #  include "do_loop_substitute.h90"
@@ -267,4 +256,5 @@
       !!----------------------------------------------------------------------
       INTEGER ::   ierr
+      !!----------------------------------------------------------------------
       !
       zdf_osm_alloc = 0
@@ -363,12 +353,10 @@
       INTEGER                   , INTENT(in   ) ::  Kbb, Kmm, Krhs   ! Ocean time level indices
       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::  p_avm, p_avt     ! Momentum and tracer Kz (w-points)
-      !
-      ! Local variables
+      !!
       INTEGER ::   ji, jj, jk, jl, jm, jkflt   ! Dummy loop indices
-      !
+      !!
       REAL(wp) ::   zthermal, zbeta
       REAL(wp) ::   zesh2, zri, zfri   ! Interior Richardson mixing
-      !
-      ! Scales
+      !! Scales
       REAL(wp), DIMENSION(A2D((nn_hls-1)))  ::   zrad0       ! Surface solar temperature flux (deg m/s)
       REAL(wp), DIMENSION(A2D((nn_hls-1)))  ::   zradh       ! Radiative flux at bl base (Buoyancy units)
@@ -382,15 +370,14 @@
       REAL(wp), DIMENSION(A2D((nn_hls-1)))  ::   zdiff_mle   ! Extra MLE vertical diff
       REAL(wp), DIMENSION(A2D((nn_hls-1)))  ::   zvel_mle    ! Velocity scale for dhdt with stable ML and FK
-      !
-      ! mixed-layer variables
+      !! Mixed-layer variables
       INTEGER,  DIMENSION(A2D((nn_hls-1))) ::   jk_nlev   ! Number of levels
       INTEGER,  DIMENSION(A2D((nn_hls-1))) ::   jk_ext   ! Offset for external level
-      !
+      !!
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zhbl   ! BL depth - grid
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zhml   ! ML depth - grid
-      !
+      !!
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zhmle   ! MLE depth - grid
       REAL(wp), DIMENSION(A2D(nn_hls))     ::   zmld    ! ML depth on grid
-      !
+      !!
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zdh                          ! Pycnocline depth - grid
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zdhdt                        ! BL depth tendency
@@ -398,17 +385,15 @@
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zdbdz_bl_ext                 ! External buoyancy gradients
       REAL(wp), DIMENSION(A2D(nn_hls))     ::   zdtdx, zdtdy, zdsdx, zdsdy   ! Horizontal gradients for Fox-Kemper parametrization
-      !
+      !!
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zdbds_mle   ! Magnitude of horizontal buoyancy gradient
-      ! Flux-gradient relationship variables
+      !! Flux-gradient relationship variables
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zshear   ! Shear production
-      !
+      !!
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zhbl_t   ! Holds boundary layer depth updated by full timestep
-      !
-      ! For calculating Ri#-dependent mixing
+      !! For calculating Ri#-dependent mixing
       REAL(wp), DIMENSION(A2D(nn_hls)) ::   z2du     ! u-shear^2
       REAL(wp), DIMENSION(A2D(nn_hls)) ::   z2dv     ! v-shear^2
       REAL(wp)                         ::   zrimix   ! Spatial form of ri#-induced diffusion
-      !
-      ! Temporary variables
+      !! Temporary variables
       REAL(wp)                                 ::   znd              ! Temporary non-dimensional depth
       REAL(wp)                                 ::   zz0, zz1, zfac
@@ -419,7 +404,7 @@
       REAL(wp)                                 ::   zsqrtpi, z_two_thirds, zthickness
       REAL(wp)                                 ::   z2k_times_thickness, zsqrt_depth, zexp_depth, zf, zexperfc
-      !
-      ! For debugging
+      !! For debugging
       REAL(wp), PARAMETER ::   pp_large = -1e10_wp
+      !!----------------------------------------------------------------------
       !
       DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )
@@ -1160,7 +1145,8 @@
       REAL(wp),           INTENT(inout), DIMENSION(jpi,jpj) ::   pu, pv   ! Components of current
       LOGICAL,  OPTIONAL, INTENT(in   )                     ::   fwd      ! Forward (default) or reverse rotation
-      !
+      !!
       INTEGER  ::   ji, jj       ! Loop indices
       REAL(wp) ::   ztmp, zfwd   ! Auxiliary variables
+      !!----------------------------------------------------------------------      
       !
       zfwd = 1.0_wp
@@ -1192,8 +1178,9 @@
       INTEGER,  OPTIONAL, INTENT(in   )                             ::   ktop     ! Minimum depth index
       INTEGER,  OPTIONAL, INTENT(in   ), DIMENSION(A2D((nn_hls-1))) ::   knlev    ! Array of maximum depth indices
-      !
+      !!
       INTEGER  ::   ji, jj, jk, jktop, jkmax   ! Loop indices
       REAL(wp) ::   ztmp, zfwd                 ! Auxiliary variables
       LOGICAL  ::   llkbot                     ! Auxiliary variable
+      !!----------------------------------------------------------------------      
       !
       zfwd = 1.0_wp
@@ -1241,13 +1228,12 @@
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in   ) ::   phml      ! ML depth
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in   ) ::   pdh       ! Pycnocline depth
-      !
-      ! Local variables
+      !!
       INTEGER :: jj, ji   ! Loop indices
-      !
+      !!
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zekman
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zri_p, zri_b   ! Richardson numbers
       REAL(wp)                             ::   zshear_u, zshear_v, zwb_shr
       REAL(wp)                             ::   zwcor, zrf_conv, zrf_shear, zrf_langmuir, zr_stokes
-      !
+      !!
       REAL(wp), PARAMETER ::   pp_a_shr         = 0.4_wp,  pp_b_shr    = 6.5_wp,  pp_a_wb_s = 0.8_wp
       REAL(wp), PARAMETER ::   pp_alpha_c       = 0.2_wp,  pp_alpha_lc = 0.03_wp
@@ -1257,4 +1243,5 @@
       REAL(wp), PARAMETER ::   pp_ek            = 4.0_wp
       REAL(wp), PARAMETER ::   pp_large         = -1e10_wp
+      !!----------------------------------------------------------------------
       !
       ! Initialise arrays
@@ -1401,10 +1388,10 @@
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(  out) ::   pdtdz, pdsdz   ! External gradients of temperature, salinity
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(  out) ::   pdbdz          !    and buoyancy
-      !
-      ! Local variables
+      !!
       INTEGER  ::   ji, jj, jkb, jkb1
       REAL(wp) ::   zthermal, zbeta
-      !
+      !!
       REAL(wp), PARAMETER ::   pp_large = -1e10_wp
+      !!----------------------------------------------------------------------   
       !
       DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )
@@ -1451,13 +1438,13 @@
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in   ) ::   pwb_fk         ! Max MLE buoyancy flux
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in   ) ::   pvel_mle       ! Vvelocity scale for dhdt with stable ML and FK
-      !
-      ! Local variables
+      !!
       INTEGER  ::   jj, ji
       REAL(wp) ::   zgamma_b_nd, zgamma_dh_nd, zpert, zpsi, zari
       REAL(wp) ::   zvel_max, zddhdt
-      !
+      !!
       REAL(wp), PARAMETER ::   pp_alpha_b = 0.3_wp
       REAL(wp), PARAMETER ::   pp_ddh     = 2.5_wp, pp_ddh_2 = 3.5_wp   ! Also in pycnocline_depth
       REAL(wp), PARAMETER ::   pp_large   = -1e10_wp
+      !!----------------------------------------------------------------------
       !
       DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )
@@ -1617,9 +1604,9 @@
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in   ) ::   pwb_ent    ! Buoyancy entrainment flux
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in   ) ::   pwb_fk_b   ! MLE buoyancy flux averaged over OSBL
-      !
-      ! Local variables
+      !!
       INTEGER  ::   jk, jj, ji, jm
       REAL(wp) ::   zhbl_s, zvel_max, zdb
       REAL(wp) ::   zthermal, zbeta
+      !!----------------------------------------------------------------------
       !
       DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )
@@ -1719,13 +1706,12 @@
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in   ) ::   pdbdz_bl_ext   ! External buoyancy gradients
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in   ) ::   pwb_fk_b       ! MLE buoyancy flux averaged over OSBL
-
-      !
-      ! Local variables
+      !!
       INTEGER  ::   jj, ji
       INTEGER  ::   inhml
       REAL(wp) ::   zari, ztau, zdh_ref, zddhdt, zvel_max
       REAL(wp) ::   ztmp   ! Auxiliary variable
-      !
+      !!
       REAL, PARAMETER ::   pp_ddh = 2.5_wp, pp_ddh_2 = 3.5_wp   ! Also in pycnocline_depth
+      !!----------------------------------------------------------------------
       !
       DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )
@@ -1881,6 +1867,5 @@
       REAL(wp), DIMENSION(A2D((nn_hls-1))),      INTENT(in   ) ::   phml           ! ML depth
       REAL(wp), DIMENSION(A2D((nn_hls-1))),      INTENT(in   ) ::   pdhdt          ! Rates of change of hbl
-      !
-      ! Local variables
+      !!
       INTEGER  ::   jk, jj, ji
       REAL(wp) ::   zbgrad
@@ -1888,7 +1873,8 @@
       REAL(wp) ::   zzeta_m
       REAL(wp) ::   ztmp   ! Auxiliary variable
-      !
+      !!
       REAL(wp), PARAMETER ::   pp_gamma_b = 2.25_wp
       REAL(wp), PARAMETER ::   pp_large   = -1e10_wp
+      !!----------------------------------------------------------------------
       !
       DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )      
@@ -1993,9 +1979,7 @@
       REAL(wp), DIMENSION(A2D((nn_hls-1))),      INTENT(in   ) ::   pwb_ent        ! Buoyancy entrainment flux
       REAL(wp), DIMENSION(A2D((nn_hls-1))),      INTENT(in   ) ::   pwb_min
-      !
-      ! Local variables
+      !!
       INTEGER ::   ji, jj, jk   ! Loop indices
-      !
-      ! Scales used to calculate eddy diffusivity and viscosity profiles
+      !! Scales used to calculate eddy diffusivity and viscosity profiles
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zdifml_sc,    zvisml_sc
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zdifpyc_n_sc, zdifpyc_s_sc
@@ -2003,5 +1987,5 @@
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zbeta_d_sc,   zbeta_v_sc
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   zb_coup,      zc_coup_vis,  zc_coup_dif
-      !
+      !!
       REAL(wp) ::   zvel_sc_pyc, zvel_sc_ml, zstab_fac, zz_b
       REAL(wp) ::   za_cubic, zb_d_cubic, zc_d_cubic, zd_d_cubic,   &   ! Coefficients in cubic polynomial specifying diffusivity
@@ -2009,8 +1993,9 @@
       REAL(wp) ::   zznd_ml, zznd_pyc, ztmp
       REAL(wp) ::   zmsku, zmskv
-      !
+      !!
       REAL(wp), PARAMETER ::   pp_dif_ml     = 0.8_wp,  pp_vis_ml  = 0.375_wp
       REAL(wp), PARAMETER ::   pp_dif_pyc    = 0.15_wp, pp_vis_pyc = 0.142_wp
       REAL(wp), PARAMETER ::   pp_vispyc_shr = 0.15_wp
+      !!----------------------------------------------------------------------
       !
       zb_coup(:,:) = 0.0_wp
@@ -2191,9 +2176,9 @@
       REAL(wp), DIMENSION(A2D((nn_hls-1)),jpk),  INTENT(in   ) ::   pdiffut        ! t-diffusivity
       REAL(wp), DIMENSION(A2D((nn_hls-1)),jpk),  INTENT(in   ) ::   pviscos        ! Viscosity
-      !
+      !!
       REAL(wp), DIMENSION(A2D((nn_hls-1)))     ::   zalpha_pyc   !
       REAL(wp), DIMENSION(A2D((nn_hls-1)),jpk) ::   zdbdz_pyc    ! Parametrised gradient of buoyancy in the pycnocline
       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   z3ddz_pyc_1, z3ddz_pyc_2   ! Pycnocline gradient/shear profiles
-      !
+      !!
       INTEGER                              ::   ji, jj, jk, jkm_bld, jkf_mld, jkm_mld   ! Loop indices
       INTEGER                              ::   istat                                   ! Memory allocation status
@@ -2215,12 +2200,13 @@
       REAL(wp)                             ::   ztmp                                    !
       REAL(wp)                             ::   ztgrad, zsgrad, zbgrad                  ! Variables used to calculate pycnocline
-      !                                                                                 !    gradients
+      !!                                                                                !    gradients
       REAL(wp)                             ::   zugrad, zvgrad                          ! Variables for calculating pycnocline shear
       REAL(wp)                             ::   zdtdz_pyc                               ! Parametrized gradient of temperature in
-      !                                                                                 !    pycnocline
+      !!                                                                                !    pycnocline
       REAL(wp)                             ::   zdsdz_pyc                               ! Parametrised gradient of salinity in
-      !                                                                                 !    pycnocline
+      !!                                                                                !    pycnocline
       REAL(wp)                             ::   zdudz_pyc                               ! u-shear across the pycnocline
       REAL(wp)                             ::   zdvdz_pyc                               ! v-shear across the pycnocline
+      !!----------------------------------------------------------------------
       !
       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@@ -2723,6 +2709,5 @@
       REAL(wp), DIMENSION(A2D(nn_hls)),     INTENT(inout) ::   pdsdy        ! Horizontal gradient for Fox-Kemper parametrization
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(inout) ::   pdbds_mle    ! Magnitude of horizontal buoyancy gradient
-      !
-      ! Local variables
+      !!
       INTEGER                               ::   ji, jj, jk   ! Dummy loop indices
       INTEGER,  DIMENSION(A2D(nn_hls))      ::   jk_mld_prof  ! Base level of MLE layer
@@ -2738,4 +2723,5 @@
       REAL(wp), DIMENSION(A2D(nn_hls))      ::   zmld_midu
       REAL(wp), DIMENSION(A2D(nn_hls))      ::   zmld_midv
+      !!----------------------------------------------------------------------
       !
       ! ==  MLD used for MLE  ==!
@@ -2823,5 +2809,4 @@
       !!
       !!----------------------------------------------------------------------      
-      ! Outputs
       INTEGER,                              INTENT(in   ) ::   Kmm         ! Time-level index
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(inout) ::   pwb_fk
@@ -2830,6 +2815,5 @@
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in   ) ::   pwb_ent     ! Buoyancy entrainment flux
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in   ) ::   pdbds_mle   ! Magnitude of horizontal buoyancy gradient
-      !
-      ! Local variables
+      !!
       INTEGER                              ::   ji, jj, jk        ! Dummy loop indices
       REAL(wp), DIMENSION(A2D((nn_hls-1))) ::   znd_param
@@ -2840,4 +2824,5 @@
       REAL(wp)                             ::   zpe_mle_ref
       REAL(wp)                             ::   zdbdz_mle_int
+      !!----------------------------------------------------------------------      
       !
       znd_param(:,:) = 0.0_wp
@@ -2944,6 +2929,5 @@
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in   ) ::   phbl        ! BL depth
       REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in   ) ::   pwb0tot     ! Total surface buoyancy flux including insolation
-      !
-      ! Local variables
+      !!
       INTEGER  ::   ji, jj, jk   ! Dummy loop indices
       REAL(wp) ::   ztmp
@@ -2955,4 +2939,5 @@
       REAL(wp) ::   zbuoy
       REAL(wp) ::   zdb_mle
+      !!----------------------------------------------------------------------
       !
       ! Calculate vertical buoyancy, heat and salinity fluxes due to MLE
@@ -3011,19 +2996,19 @@
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in   ) ::   Kmm   ! Time level
-      !
-      ! Local variables
+      !!
       INTEGER  ::   ios            ! Local integer
       INTEGER  ::   ji, jj, jk     ! Dummy loop indices
       REAL(wp) ::   z1_t2
-      !
+      !!
       REAL(wp), PARAMETER ::   pp_large = -1e10_wp
-      !
+      !!
       NAMELIST/namzdf_osm/ ln_use_osm_la,    rn_osm_la,      rn_osm_dstokes,      nn_ave,                nn_osm_wave,        &
          &                 ln_dia_osm,       rn_osm_hbl0,    rn_zdfosm_adjust_sd, ln_kpprimix,           rn_riinfty,         &
          &                 rn_difri,         ln_convmix,     rn_difconv,          nn_osm_wave,           nn_osm_SD_reduce,   &
          &                 ln_osm_mle,       rn_osm_hblfrac, rn_osm_bl_thresh,    ln_zdfosm_ice_shelter
-      ! Namelist for Fox-Kemper parametrization
+      !! Namelist for Fox-Kemper parametrization
       NAMELIST/namosm_mle/ nn_osm_mle,       rn_osm_mle_ce,     rn_osm_mle_lf,  rn_osm_mle_time,  rn_osm_mle_lat,   &
          &                 rn_osm_mle_rho_c, rn_osm_mle_thresh, rn_osm_mle_tau, ln_osm_hmle_limit, rn_osm_hmle_limit
+      !!----------------------------------------------------------------------
       !
       READ  ( numnam_ref, namzdf_osm, IOSTAT = ios, ERR = 901)
@@ -3241,6 +3226,5 @@
       INTEGER         , INTENT(in   ) ::   Kmm    ! Ocean time level index (middle)
       CHARACTER(len=*), INTENT(in   ) ::   cdrw   ! "READ"/"WRITE" flag
-      !
-      ! Local variables
+      !!
       INTEGER  ::   id1, id2, id3                 ! iom enquiry index
       INTEGER  ::   ji, jj, jk                    ! Dummy loop indices
@@ -3250,4 +3234,5 @@
       REAL(wp) ::   rho_c = 0.01_wp               ! Density criterion for mixed layer depth
       INTEGER, DIMENSION(jpi,jpj) ::   imld_rst   ! Level of mixed-layer depth (pycnocline top)
+      !!----------------------------------------------------------------------
       !
       !!-----------------------------------------------------------------------------
@@ -3350,8 +3335,8 @@
       INTEGER                                  , INTENT(in   ) ::   Kmm, Krhs   ! Time level indices
       REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) ::   pts         ! Active tracers and RHS of tracer equation
-      !
-      ! Local variables
+      !!
       INTEGER                                 ::   ji, jj, jk
       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdt, ztrds   ! 3D workspace
+      !!----------------------------------------------------------------------
       !
       IF ( kt == nit000 ) THEN
@@ -3405,4 +3390,5 @@
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in) :: kt
+      !!----------------------------------------------------------------------
       !
       WRITE(*,*) 'trc_osm: Not written yet', kt
@@ -3423,5 +3409,5 @@
       INTEGER                             , INTENT(in   ) ::   Kmm, Krhs   ! Ocean time level indices
       REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) ::   puu, pvv    ! Ocean velocities and RHS of momentum equation
-      !
+      !!
       INTEGER :: ji, jj, jk   ! dummy loop indices
       !!----------------------------------------------------------------------
@@ -3456,4 +3442,5 @@
       CHARACTER(LEN=*),         INTENT(in   ) ::   cdname
       REAL(wp), DIMENSION(:,:), INTENT(in   ) ::   posmdia2d
+      !!----------------------------------------------------------------------
       !
       IF ( ln_dia_osm .AND. iom_use( cdname ) ) THEN
@@ -3478,4 +3465,5 @@
       CHARACTER(LEN=*),           INTENT(in   ) ::   cdname
       REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   posmdia3d
+      !!----------------------------------------------------------------------
       !
       IF ( ln_dia_osm .AND. iom_use( cdname ) ) THEN
