Changeset 14912
- Timestamp:
- 2021-05-27T12:51:04+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2021/dev_r14122_HPC-08_Mueller_OSMOSIS_streamlining/src/OCE/ZDF/zdfosm.F90
r14911 r14912 34 34 !! 16/05/2019 (19) Fox-Kemper parametrization of restratification through mixed layer eddies added to revised code. 35 35 !! 23/05/19 (20) Old code where key_osmldpth1` is *not* set removed, together with the key key_osmldpth1 36 !! 4.2 ! 2021-05 (S. Mueller) Efficiency and source-code clarity enhancements, adaptation fortiling36 !! 4.2 ! 2021-05 (S. Mueller) Efficiency improvements, source-code clarity enhancements, and adaptation to tiling 37 37 !!---------------------------------------------------------------------- 38 38 39 39 !!---------------------------------------------------------------------- 40 !! 'ln_zdfosm' 40 !! 'ln_zdfosm' OSMOSIS scheme 41 41 !!---------------------------------------------------------------------- 42 42 !! zdf_osm : update momentum and tracer Kz from osm scheme … … 66 66 !! zdf_osm_iomput_3d : iom_put wrapper for 3D fields 67 67 !!---------------------------------------------------------------------- 68 USE oce 69 70 USE dom_oce 71 USE zdf_oce 72 USE sbc_oce 73 USE sbcwave 74 USE phycst 75 USE eosbn2 76 USE traqsr 77 USE zdfdrg, ONLY : rCdU_bot 78 USE zdfddm 79 USE iom 80 USE lib_mpp 81 USE trd_oce 82 USE trdtra 83 USE in_out_manager 84 USE lbclnk 85 USE prtctl 86 USE lib_fortran 87 ! 68 USE oce ! Ocean dynamics and active tracers 69 ! ! Uses ww from previous time step (which is now wb) to calculate hbl 70 USE dom_oce ! Ocean space and time domain 71 USE zdf_oce ! Ocean vertical physics 72 USE sbc_oce ! Surface boundary condition: ocean 73 USE sbcwave ! Surface wave parameters 74 USE phycst ! Physical constants 75 USE eosbn2 ! Equation of state 76 USE traqsr ! Details of solar radiation absorption 77 USE zdfdrg, ONLY : rCdU_bot ! Bottom friction velocity 78 USE zdfddm ! Double diffusion mixing (avs array) 79 USE iom ! I/O library 80 USE lib_mpp ! MPP library 81 USE trd_oce ! Ocean trends definition 82 USE trdtra ! Tracers trends 83 USE in_out_manager ! I/O manager 84 USE lbclnk ! Ocean lateral boundary conditions (or mpp link) 85 USE prtctl ! Print control 86 USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 87 88 88 IMPLICIT NONE 89 89 PRIVATE 90 ! 90 91 91 ! Public subroutines 92 92 PUBLIC zdf_osm ! Routine called by step.F90 … … 96 96 PUBLIC trc_osm ! Routine called by trcstp.F90 97 97 PUBLIC dyn_osm ! Routine called by step.F90 98 ! 98 99 99 ! Public variables 100 100 LOGICAL, PUBLIC :: ln_osm_mle !: Flag to activate the Mixed Layer Eddy (MLE) … … 111 111 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: dbdy_mle !: Meridional buoyancy gradient in ML 112 112 INTEGER, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: mld_prof !: Level of base of MLE layer 113 ! 113 114 114 INTERFACE zdf_osm_velocity_rotation 115 115 !!--------------------------------------------------------------------- … … 127 127 MODULE PROCEDURE zdf_osm_iomput_3d 128 128 END INTERFACE 129 ! 130 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: etmean ! Averaging operator for avt 131 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: dh ! Depth of pycnocline 132 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: r1_ft ! Inverse of the modified Coriolis parameter at t-pts 133 ! 129 130 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: etmean ! Averaging operator for avt 131 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: dh ! Depth of pycnocline 132 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: r1_ft ! Inverse of the modified Coriolis parameter at t-pts 134 133 ! Layer indices 135 INTEGER, ALLOCATABLE, SAVE, DIMENSION(:,:) :: nbld ! Level of boundary layer base 136 INTEGER, ALLOCATABLE, SAVE, DIMENSION(:,:) :: nmld ! Level of mixed-layer depth (pycnocline top) 137 ! 134 INTEGER, ALLOCATABLE, SAVE, DIMENSION(:,:) :: nbld ! Level of boundary layer base 135 INTEGER, ALLOCATABLE, SAVE, DIMENSION(:,:) :: nmld ! Level of mixed-layer depth (pycnocline top) 138 136 ! Layer type 139 INTEGER, ALLOCATABLE, SAVE, DIMENSION(:,:) :: n_ddh ! Type of shear layer 140 ! ! n_ddh=0: active shear layer 141 ! ! n_ddh=1: shear layer not active 142 ! ! n_ddh=2: shear production low 143 ! 137 INTEGER, ALLOCATABLE, SAVE, DIMENSION(:,:) :: n_ddh ! Type of shear layer 138 ! ! n_ddh=0: active shear layer 139 ! ! n_ddh=1: shear layer not active 140 ! ! n_ddh=2: shear production low 144 141 ! Layer flags 145 LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: l_conv ! Unstable/stable bl 146 LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: l_shear ! Shear layers 147 LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: l_coup ! Coupling to bottom 148 LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: l_pyc ! OSBL pycnocline present 149 LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: l_flux ! Surface flux extends below OSBL into MLE layer 150 LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: l_mle ! MLE layer increases in hickness. 151 ! 142 LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: l_conv ! Unstable/stable bl 143 LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: l_shear ! Shear layers 144 LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: l_coup ! Coupling to bottom 145 LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: l_pyc ! OSBL pycnocline present 146 LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: l_flux ! Surface flux extends below OSBL into MLE layer 147 LOGICAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: l_mle ! MLE layer increases in hickness. 152 148 ! Scales 153 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swth0 ! Surface heat flux (Kinematic) 154 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: sws0 ! Surface freshwater flux 155 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swb0 ! Surface buoyancy flux 156 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: suw0 ! Surface u-momentum flux 157 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: sustar ! Friction velocity 158 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: scos_wind ! Cos angle of surface stress 159 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: ssin_wind ! Sin angle of surface stress 160 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swthav ! Heat flux - bl average 161 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swsav ! Freshwater flux - bl average 162 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swbav ! Buoyancy flux - bl average 163 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: sustke ! Surface Stokes drift 164 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: dstokes ! Penetration depth of the Stokes drift 165 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swstrl ! Langmuir velocity scale 166 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swstrc ! Convective velocity scale 167 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: sla ! Trubulent Langmuir number 168 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: svstr ! Velocity scale that tends to sustar for large Langmuir number 169 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: shol ! Stability parameter for boundary layer 170 ! 149 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swth0 ! Surface heat flux (Kinematic) 150 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: sws0 ! Surface freshwater flux 151 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swb0 ! Surface buoyancy flux 152 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: suw0 ! Surface u-momentum flux 153 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: sustar ! Friction velocity 154 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: scos_wind ! Cos angle of surface stress 155 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: ssin_wind ! Sin angle of surface stress 156 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swthav ! Heat flux - bl average 157 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swsav ! Freshwater flux - bl average 158 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swbav ! Buoyancy flux - bl average 159 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: sustke ! Surface Stokes drift 160 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: dstokes ! Penetration depth of the Stokes drift 161 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swstrl ! Langmuir velocity scale 162 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: swstrc ! Convective velocity scale 163 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: sla ! Trubulent Langmuir number 164 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: svstr ! Velocity scale that tends to sustar for large Langmuir number 165 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: shol ! Stability parameter for boundary layer 171 166 ! Layer averages: BL 172 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_t_bl ! Temperature average 173 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_s_bl ! Salinity average 174 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_u_bl ! Velocity average (u) 175 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_v_bl ! Velocity average (v) 176 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_b_bl ! Buoyancy average 177 ! 167 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_t_bl ! Temperature average 168 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_s_bl ! Salinity average 169 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_u_bl ! Velocity average (u) 170 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_v_bl ! Velocity average (v) 171 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_b_bl ! Buoyancy average 178 172 ! Difference between layer average and parameter at the base of the layer: BL 179 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_dt_bl ! Temperature difference 180 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_ds_bl ! Salinity difference 181 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_du_bl ! Velocity difference (u) 182 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_dv_bl ! Velocity difference (v) 183 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_db_bl ! Buoyancy difference 184 ! 173 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_dt_bl ! Temperature difference 174 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_ds_bl ! Salinity difference 175 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_du_bl ! Velocity difference (u) 176 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_dv_bl ! Velocity difference (v) 177 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_db_bl ! Buoyancy difference 185 178 ! Layer averages: ML 186 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_t_ml ! Temperature average 187 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_s_ml ! Salinity average 188 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_u_ml ! Velocity average (u) 189 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_v_ml ! Velocity average (v) 190 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_b_ml ! Buoyancy average 191 ! 179 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_t_ml ! Temperature average 180 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_s_ml ! Salinity average 181 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_u_ml ! Velocity average (u) 182 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_v_ml ! Velocity average (v) 183 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_b_ml ! Buoyancy average 192 184 ! Difference between layer average and parameter at the base of the layer: ML 193 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_dt_ml ! Temperature difference 194 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_ds_ml ! Salinity difference 195 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_du_ml ! Velocity difference (u) 196 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_dv_ml ! Velocity difference (v) 197 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_db_ml ! Buoyancy difference 198 ! 185 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_dt_ml ! Temperature difference 186 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_ds_ml ! Salinity difference 187 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_du_ml ! Velocity difference (u) 188 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_dv_ml ! Velocity difference (v) 189 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_db_ml ! Buoyancy difference 199 190 ! Layer averages: MLE 200 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_t_mle ! Temperature average 201 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_s_mle ! Salinity average 202 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_u_mle ! Velocity average (u) 203 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_v_mle ! Velocity average (v) 204 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_b_mle ! Buoyancy average 205 ! 191 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_t_mle ! Temperature average 192 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_s_mle ! Salinity average 193 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_u_mle ! Velocity average (u) 194 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_v_mle ! Velocity average (v) 195 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: av_b_mle ! Buoyancy average 206 196 ! Diagnostic output 207 REAL(WP), ALLOCATABLE, SAVE, DIMENSION(:,:) :: osmdia2d ! Auxiliary array for diagnostic output 208 REAL(WP), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: osmdia3d ! Auxiliary array for diagnostic output 209 ! 210 ! ** Namelist namzdf_osm ** 197 REAL(WP), ALLOCATABLE, SAVE, DIMENSION(:,:) :: osmdia2d ! Auxiliary array for diagnostic output 198 REAL(WP), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: osmdia3d ! Auxiliary array for diagnostic output 199 LOGICAL :: ln_dia_pyc_scl = .FALSE. ! Output of pycnocline scalar-gradient profiles 200 LOGICAL :: ln_dia_pyc_shr = .FALSE. ! Output of pycnocline velocity-shear profiles 201 202 ! !!* namelist namzdf_osm * 211 203 LOGICAL :: ln_use_osm_la ! Use namelist rn_osm_la 212 204 REAL(wp) :: rn_osm_la ! Turbulent Langmuir number … … 221 213 INTEGER :: nn_osm_SD_reduce ! = 0/1/2 flag for getting effective stokes drift from surface value 222 214 LOGICAL :: ln_dia_osm ! Use namelist rn_osm_la 223 LOGICAL :: ln_dia_pyc_scl = .FALSE. ! Output of pycnocline scalar-gradient profiles224 LOGICAL :: ln_dia_pyc_shr = .FALSE. ! Output of pycnocline velocity-shear profiles225 215 LOGICAL :: ln_kpprimix = .TRUE. ! Shear instability mixing 226 216 REAL(wp) :: rn_riinfty = 0.7_wp ! Local Richardson Number limit for shear instability … … 228 218 LOGICAL :: ln_convmix = .TRUE. ! Convective instability mixing 229 219 REAL(wp) :: rn_difconv = 1.0_wp ! Diffusivity when unstable below BL (m2/s) 230 !231 220 ! OSMOSIS mixed layer eddy parametrization constants 232 INTEGER :: nn_osm_mle ! = 0/1 flag for horizontal average on avt233 REAL(wp) :: rn_osm_mle_ce ! MLE coefficient234 ! !Parameters used in nn_osm_mle = 0 case235 REAL(wp) :: rn_osm_mle_lf ! Typical scale of mixed layer front236 REAL(wp) :: rn_osm_mle_time ! Time scale for mixing momentum across the mixed layer237 ! !Parameters used in nn_osm_mle = 1 case238 REAL(wp) :: rn_osm_mle_lat ! Reference latitude for a 5 km scale of ML front239 LOGICAL :: ln_osm_hmle_limit ! If true arbitrarily restrict hmle to rn_osm_hmle_limit*zmld240 REAL(wp) :: rn_osm_hmle_limit ! If ln_osm_hmle_limit true arbitrarily restrict hmle to rn_osm_hmle_limit*zmld241 REAL(wp) :: rn_osm_mle_rho_c ! Density criterion for definition of MLD used by FK242 REAL(wp) :: rb_c ! ML buoyancy criteria = g rho_c /rho0 where rho_c is defined in zdfmld243 REAL(wp) :: rc_f ! MLE coefficient (= rn_ce / (5 km * fo) ) in nn_osm_mle=1 case244 REAL(wp) :: rn_osm_mle_thresh ! Threshold buoyancy for deepening of MLE layer below OSBL base245 REAL(wp) :: rn_osm_bl_thresh ! Threshold buoyancy for deepening of OSBL base246 REAL(wp) :: rn_osm_mle_tau ! Adjustment timescale for MLE247 ! 248 ! ** General constants **221 INTEGER :: nn_osm_mle ! = 0/1 flag for horizontal average on avt 222 REAL(wp) :: rn_osm_mle_ce ! MLE coefficient 223 ! Parameters used in nn_osm_mle = 0 case 224 REAL(wp) :: rn_osm_mle_lf ! Typical scale of mixed layer front 225 REAL(wp) :: rn_osm_mle_time ! Time scale for mixing momentum across the mixed layer 226 ! Parameters used in nn_osm_mle = 1 case 227 REAL(wp) :: rn_osm_mle_lat ! Reference latitude for a 5 km scale of ML front 228 LOGICAL :: ln_osm_hmle_limit ! If true arbitrarily restrict hmle to rn_osm_hmle_limit*zmld 229 REAL(wp) :: rn_osm_hmle_limit ! If ln_osm_hmle_limit true arbitrarily restrict hmle to rn_osm_hmle_limit*zmld 230 REAL(wp) :: rn_osm_mle_rho_c ! Density criterion for definition of MLD used by FK 231 REAL(wp) :: rb_c ! ML buoyancy criteria = g rho_c /rho0 where rho_c is defined in zdfmld 232 REAL(wp) :: rc_f ! MLE coefficient (= rn_ce / (5 km * fo) ) in nn_osm_mle=1 case 233 REAL(wp) :: rn_osm_mle_thresh ! Threshold buoyancy for deepening of MLE layer below OSBL base 234 REAL(wp) :: rn_osm_bl_thresh ! Threshold buoyancy for deepening of OSBL base 235 REAL(wp) :: rn_osm_mle_tau ! Adjustment timescale for MLE 236 237 ! General constants 249 238 REAL(wp) :: epsln = 1.0e-20_wp ! A small positive number to ensure no div by zero 250 239 REAL(wp) :: depth_tol = 1.0e-6_wp ! A small-ish positive number to give a hbl slightly shallower than gdepw 251 240 REAL(wp) :: pthird = 1.0_wp/3.0_wp ! 1/3 252 241 REAL(wp) :: p2third = 2.0_wp/3.0_wp ! 2/3 253 ! 242 254 243 !! * Substitutions 255 244 # include "do_loop_substitute.h90" … … 267 256 !!---------------------------------------------------------------------- 268 257 INTEGER :: ierr 258 !!---------------------------------------------------------------------- 269 259 ! 270 260 zdf_osm_alloc = 0 … … 363 353 INTEGER , INTENT(in ) :: Kbb, Kmm, Krhs ! Ocean time level indices 364 354 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: p_avm, p_avt ! Momentum and tracer Kz (w-points) 365 ! 366 ! Local variables 355 !! 367 356 INTEGER :: ji, jj, jk, jl, jm, jkflt ! Dummy loop indices 368 ! 357 !! 369 358 REAL(wp) :: zthermal, zbeta 370 359 REAL(wp) :: zesh2, zri, zfri ! Interior Richardson mixing 371 ! 372 ! Scales 360 !! Scales 373 361 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zrad0 ! Surface solar temperature flux (deg m/s) 374 362 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zradh ! Radiative flux at bl base (Buoyancy units) … … 382 370 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zdiff_mle ! Extra MLE vertical diff 383 371 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zvel_mle ! Velocity scale for dhdt with stable ML and FK 384 ! 385 ! mixed-layer variables 372 !! Mixed-layer variables 386 373 INTEGER, DIMENSION(A2D((nn_hls-1))) :: jk_nlev ! Number of levels 387 374 INTEGER, DIMENSION(A2D((nn_hls-1))) :: jk_ext ! Offset for external level 388 ! 375 !! 389 376 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zhbl ! BL depth - grid 390 377 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zhml ! ML depth - grid 391 ! 378 !! 392 379 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zhmle ! MLE depth - grid 393 380 REAL(wp), DIMENSION(A2D(nn_hls)) :: zmld ! ML depth on grid 394 ! 381 !! 395 382 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zdh ! Pycnocline depth - grid 396 383 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zdhdt ! BL depth tendency … … 398 385 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zdbdz_bl_ext ! External buoyancy gradients 399 386 REAL(wp), DIMENSION(A2D(nn_hls)) :: zdtdx, zdtdy, zdsdx, zdsdy ! Horizontal gradients for Fox-Kemper parametrization 400 ! 387 !! 401 388 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zdbds_mle ! Magnitude of horizontal buoyancy gradient 402 ! Flux-gradient relationship variables389 !! Flux-gradient relationship variables 403 390 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zshear ! Shear production 404 ! 391 !! 405 392 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zhbl_t ! Holds boundary layer depth updated by full timestep 406 ! 407 ! For calculating Ri#-dependent mixing 393 !! For calculating Ri#-dependent mixing 408 394 REAL(wp), DIMENSION(A2D(nn_hls)) :: z2du ! u-shear^2 409 395 REAL(wp), DIMENSION(A2D(nn_hls)) :: z2dv ! v-shear^2 410 396 REAL(wp) :: zrimix ! Spatial form of ri#-induced diffusion 411 ! 412 ! Temporary variables 397 !! Temporary variables 413 398 REAL(wp) :: znd ! Temporary non-dimensional depth 414 399 REAL(wp) :: zz0, zz1, zfac … … 419 404 REAL(wp) :: zsqrtpi, z_two_thirds, zthickness 420 405 REAL(wp) :: z2k_times_thickness, zsqrt_depth, zexp_depth, zf, zexperfc 421 ! 422 ! For debugging 406 !! For debugging 423 407 REAL(wp), PARAMETER :: pp_large = -1e10_wp 408 !!---------------------------------------------------------------------- 424 409 ! 425 410 DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 ) … … 1160 1145 REAL(wp), INTENT(inout), DIMENSION(jpi,jpj) :: pu, pv ! Components of current 1161 1146 LOGICAL, OPTIONAL, INTENT(in ) :: fwd ! Forward (default) or reverse rotation 1162 ! 1147 !! 1163 1148 INTEGER :: ji, jj ! Loop indices 1164 1149 REAL(wp) :: ztmp, zfwd ! Auxiliary variables 1150 !!---------------------------------------------------------------------- 1165 1151 ! 1166 1152 zfwd = 1.0_wp … … 1192 1178 INTEGER, OPTIONAL, INTENT(in ) :: ktop ! Minimum depth index 1193 1179 INTEGER, OPTIONAL, INTENT(in ), DIMENSION(A2D((nn_hls-1))) :: knlev ! Array of maximum depth indices 1194 ! 1180 !! 1195 1181 INTEGER :: ji, jj, jk, jktop, jkmax ! Loop indices 1196 1182 REAL(wp) :: ztmp, zfwd ! Auxiliary variables 1197 1183 LOGICAL :: llkbot ! Auxiliary variable 1184 !!---------------------------------------------------------------------- 1198 1185 ! 1199 1186 zfwd = 1.0_wp … … 1241 1228 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: phml ! ML depth 1242 1229 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: pdh ! Pycnocline depth 1243 ! 1244 ! Local variables 1230 !! 1245 1231 INTEGER :: jj, ji ! Loop indices 1246 ! 1232 !! 1247 1233 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zekman 1248 1234 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zri_p, zri_b ! Richardson numbers 1249 1235 REAL(wp) :: zshear_u, zshear_v, zwb_shr 1250 1236 REAL(wp) :: zwcor, zrf_conv, zrf_shear, zrf_langmuir, zr_stokes 1251 ! 1237 !! 1252 1238 REAL(wp), PARAMETER :: pp_a_shr = 0.4_wp, pp_b_shr = 6.5_wp, pp_a_wb_s = 0.8_wp 1253 1239 REAL(wp), PARAMETER :: pp_alpha_c = 0.2_wp, pp_alpha_lc = 0.03_wp … … 1257 1243 REAL(wp), PARAMETER :: pp_ek = 4.0_wp 1258 1244 REAL(wp), PARAMETER :: pp_large = -1e10_wp 1245 !!---------------------------------------------------------------------- 1259 1246 ! 1260 1247 ! Initialise arrays … … 1401 1388 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT( out) :: pdtdz, pdsdz ! External gradients of temperature, salinity 1402 1389 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT( out) :: pdbdz ! and buoyancy 1403 ! 1404 ! Local variables 1390 !! 1405 1391 INTEGER :: ji, jj, jkb, jkb1 1406 1392 REAL(wp) :: zthermal, zbeta 1407 ! 1393 !! 1408 1394 REAL(wp), PARAMETER :: pp_large = -1e10_wp 1395 !!---------------------------------------------------------------------- 1409 1396 ! 1410 1397 DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 ) … … 1451 1438 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: pwb_fk ! Max MLE buoyancy flux 1452 1439 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: pvel_mle ! Vvelocity scale for dhdt with stable ML and FK 1453 ! 1454 ! Local variables 1440 !! 1455 1441 INTEGER :: jj, ji 1456 1442 REAL(wp) :: zgamma_b_nd, zgamma_dh_nd, zpert, zpsi, zari 1457 1443 REAL(wp) :: zvel_max, zddhdt 1458 ! 1444 !! 1459 1445 REAL(wp), PARAMETER :: pp_alpha_b = 0.3_wp 1460 1446 REAL(wp), PARAMETER :: pp_ddh = 2.5_wp, pp_ddh_2 = 3.5_wp ! Also in pycnocline_depth 1461 1447 REAL(wp), PARAMETER :: pp_large = -1e10_wp 1448 !!---------------------------------------------------------------------- 1462 1449 ! 1463 1450 DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 ) … … 1617 1604 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: pwb_ent ! Buoyancy entrainment flux 1618 1605 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: pwb_fk_b ! MLE buoyancy flux averaged over OSBL 1619 ! 1620 ! Local variables 1606 !! 1621 1607 INTEGER :: jk, jj, ji, jm 1622 1608 REAL(wp) :: zhbl_s, zvel_max, zdb 1623 1609 REAL(wp) :: zthermal, zbeta 1610 !!---------------------------------------------------------------------- 1624 1611 ! 1625 1612 DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 ) … … 1719 1706 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: pdbdz_bl_ext ! External buoyancy gradients 1720 1707 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: pwb_fk_b ! MLE buoyancy flux averaged over OSBL 1721 1722 ! 1723 ! Local variables 1708 !! 1724 1709 INTEGER :: jj, ji 1725 1710 INTEGER :: inhml 1726 1711 REAL(wp) :: zari, ztau, zdh_ref, zddhdt, zvel_max 1727 1712 REAL(wp) :: ztmp ! Auxiliary variable 1728 ! 1713 !! 1729 1714 REAL, PARAMETER :: pp_ddh = 2.5_wp, pp_ddh_2 = 3.5_wp ! Also in pycnocline_depth 1715 !!---------------------------------------------------------------------- 1730 1716 ! 1731 1717 DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 ) … … 1881 1867 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: phml ! ML depth 1882 1868 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: pdhdt ! Rates of change of hbl 1883 ! 1884 ! Local variables 1869 !! 1885 1870 INTEGER :: jk, jj, ji 1886 1871 REAL(wp) :: zbgrad … … 1888 1873 REAL(wp) :: zzeta_m 1889 1874 REAL(wp) :: ztmp ! Auxiliary variable 1890 ! 1875 !! 1891 1876 REAL(wp), PARAMETER :: pp_gamma_b = 2.25_wp 1892 1877 REAL(wp), PARAMETER :: pp_large = -1e10_wp 1878 !!---------------------------------------------------------------------- 1893 1879 ! 1894 1880 DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 ) … … 1993 1979 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: pwb_ent ! Buoyancy entrainment flux 1994 1980 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: pwb_min 1995 ! 1996 ! Local variables 1981 !! 1997 1982 INTEGER :: ji, jj, jk ! Loop indices 1998 ! 1999 ! Scales used to calculate eddy diffusivity and viscosity profiles 1983 !! Scales used to calculate eddy diffusivity and viscosity profiles 2000 1984 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zdifml_sc, zvisml_sc 2001 1985 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zdifpyc_n_sc, zdifpyc_s_sc … … 2003 1987 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zbeta_d_sc, zbeta_v_sc 2004 1988 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zb_coup, zc_coup_vis, zc_coup_dif 2005 ! 1989 !! 2006 1990 REAL(wp) :: zvel_sc_pyc, zvel_sc_ml, zstab_fac, zz_b 2007 1991 REAL(wp) :: za_cubic, zb_d_cubic, zc_d_cubic, zd_d_cubic, & ! Coefficients in cubic polynomial specifying diffusivity … … 2009 1993 REAL(wp) :: zznd_ml, zznd_pyc, ztmp 2010 1994 REAL(wp) :: zmsku, zmskv 2011 ! 1995 !! 2012 1996 REAL(wp), PARAMETER :: pp_dif_ml = 0.8_wp, pp_vis_ml = 0.375_wp 2013 1997 REAL(wp), PARAMETER :: pp_dif_pyc = 0.15_wp, pp_vis_pyc = 0.142_wp 2014 1998 REAL(wp), PARAMETER :: pp_vispyc_shr = 0.15_wp 1999 !!---------------------------------------------------------------------- 2015 2000 ! 2016 2001 zb_coup(:,:) = 0.0_wp … … 2191 2176 REAL(wp), DIMENSION(A2D((nn_hls-1)),jpk), INTENT(in ) :: pdiffut ! t-diffusivity 2192 2177 REAL(wp), DIMENSION(A2D((nn_hls-1)),jpk), INTENT(in ) :: pviscos ! Viscosity 2193 ! 2178 !! 2194 2179 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: zalpha_pyc ! 2195 2180 REAL(wp), DIMENSION(A2D((nn_hls-1)),jpk) :: zdbdz_pyc ! Parametrised gradient of buoyancy in the pycnocline 2196 2181 REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: z3ddz_pyc_1, z3ddz_pyc_2 ! Pycnocline gradient/shear profiles 2197 ! 2182 !! 2198 2183 INTEGER :: ji, jj, jk, jkm_bld, jkf_mld, jkm_mld ! Loop indices 2199 2184 INTEGER :: istat ! Memory allocation status … … 2215 2200 REAL(wp) :: ztmp ! 2216 2201 REAL(wp) :: ztgrad, zsgrad, zbgrad ! Variables used to calculate pycnocline 2217 ! 2202 !! ! gradients 2218 2203 REAL(wp) :: zugrad, zvgrad ! Variables for calculating pycnocline shear 2219 2204 REAL(wp) :: zdtdz_pyc ! Parametrized gradient of temperature in 2220 ! 2205 !! ! pycnocline 2221 2206 REAL(wp) :: zdsdz_pyc ! Parametrised gradient of salinity in 2222 ! 2207 !! ! pycnocline 2223 2208 REAL(wp) :: zdudz_pyc ! u-shear across the pycnocline 2224 2209 REAL(wp) :: zdvdz_pyc ! v-shear across the pycnocline 2210 !!---------------------------------------------------------------------- 2225 2211 ! 2226 2212 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> … … 2723 2709 REAL(wp), DIMENSION(A2D(nn_hls)), INTENT(inout) :: pdsdy ! Horizontal gradient for Fox-Kemper parametrization 2724 2710 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(inout) :: pdbds_mle ! Magnitude of horizontal buoyancy gradient 2725 ! 2726 ! Local variables 2711 !! 2727 2712 INTEGER :: ji, jj, jk ! Dummy loop indices 2728 2713 INTEGER, DIMENSION(A2D(nn_hls)) :: jk_mld_prof ! Base level of MLE layer … … 2738 2723 REAL(wp), DIMENSION(A2D(nn_hls)) :: zmld_midu 2739 2724 REAL(wp), DIMENSION(A2D(nn_hls)) :: zmld_midv 2725 !!---------------------------------------------------------------------- 2740 2726 ! 2741 2727 ! == MLD used for MLE ==! … … 2823 2809 !! 2824 2810 !!---------------------------------------------------------------------- 2825 ! Outputs2826 2811 INTEGER, INTENT(in ) :: Kmm ! Time-level index 2827 2812 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(inout) :: pwb_fk … … 2830 2815 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: pwb_ent ! Buoyancy entrainment flux 2831 2816 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: pdbds_mle ! Magnitude of horizontal buoyancy gradient 2832 ! 2833 ! Local variables 2817 !! 2834 2818 INTEGER :: ji, jj, jk ! Dummy loop indices 2835 2819 REAL(wp), DIMENSION(A2D((nn_hls-1))) :: znd_param … … 2840 2824 REAL(wp) :: zpe_mle_ref 2841 2825 REAL(wp) :: zdbdz_mle_int 2826 !!---------------------------------------------------------------------- 2842 2827 ! 2843 2828 znd_param(:,:) = 0.0_wp … … 2944 2929 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: phbl ! BL depth 2945 2930 REAL(wp), DIMENSION(A2D((nn_hls-1))), INTENT(in ) :: pwb0tot ! Total surface buoyancy flux including insolation 2946 ! 2947 ! Local variables 2931 !! 2948 2932 INTEGER :: ji, jj, jk ! Dummy loop indices 2949 2933 REAL(wp) :: ztmp … … 2955 2939 REAL(wp) :: zbuoy 2956 2940 REAL(wp) :: zdb_mle 2941 !!---------------------------------------------------------------------- 2957 2942 ! 2958 2943 ! Calculate vertical buoyancy, heat and salinity fluxes due to MLE … … 3011 2996 !!---------------------------------------------------------------------- 3012 2997 INTEGER, INTENT(in ) :: Kmm ! Time level 3013 ! 3014 ! Local variables 2998 !! 3015 2999 INTEGER :: ios ! Local integer 3016 3000 INTEGER :: ji, jj, jk ! Dummy loop indices 3017 3001 REAL(wp) :: z1_t2 3018 ! 3002 !! 3019 3003 REAL(wp), PARAMETER :: pp_large = -1e10_wp 3020 ! 3004 !! 3021 3005 NAMELIST/namzdf_osm/ ln_use_osm_la, rn_osm_la, rn_osm_dstokes, nn_ave, nn_osm_wave, & 3022 3006 & ln_dia_osm, rn_osm_hbl0, rn_zdfosm_adjust_sd, ln_kpprimix, rn_riinfty, & 3023 3007 & rn_difri, ln_convmix, rn_difconv, nn_osm_wave, nn_osm_SD_reduce, & 3024 3008 & ln_osm_mle, rn_osm_hblfrac, rn_osm_bl_thresh, ln_zdfosm_ice_shelter 3025 ! Namelist for Fox-Kemper parametrization3009 !! Namelist for Fox-Kemper parametrization 3026 3010 NAMELIST/namosm_mle/ nn_osm_mle, rn_osm_mle_ce, rn_osm_mle_lf, rn_osm_mle_time, rn_osm_mle_lat, & 3027 3011 & rn_osm_mle_rho_c, rn_osm_mle_thresh, rn_osm_mle_tau, ln_osm_hmle_limit, rn_osm_hmle_limit 3012 !!---------------------------------------------------------------------- 3028 3013 ! 3029 3014 READ ( numnam_ref, namzdf_osm, IOSTAT = ios, ERR = 901) … … 3241 3226 INTEGER , INTENT(in ) :: Kmm ! Ocean time level index (middle) 3242 3227 CHARACTER(len=*), INTENT(in ) :: cdrw ! "READ"/"WRITE" flag 3243 ! 3244 ! Local variables 3228 !! 3245 3229 INTEGER :: id1, id2, id3 ! iom enquiry index 3246 3230 INTEGER :: ji, jj, jk ! Dummy loop indices … … 3250 3234 REAL(wp) :: rho_c = 0.01_wp ! Density criterion for mixed layer depth 3251 3235 INTEGER, DIMENSION(jpi,jpj) :: imld_rst ! Level of mixed-layer depth (pycnocline top) 3236 !!---------------------------------------------------------------------- 3252 3237 ! 3253 3238 !!----------------------------------------------------------------------------- … … 3350 3335 INTEGER , INTENT(in ) :: Kmm, Krhs ! Time level indices 3351 3336 REAL(wp), DIMENSION(jpi,jpj,jpk,jpts,jpt), INTENT(inout) :: pts ! Active tracers and RHS of tracer equation 3352 ! 3353 ! Local variables 3337 !! 3354 3338 INTEGER :: ji, jj, jk 3355 3339 REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: ztrdt, ztrds ! 3D workspace 3340 !!---------------------------------------------------------------------- 3356 3341 ! 3357 3342 IF ( kt == nit000 ) THEN … … 3405 3390 !!---------------------------------------------------------------------- 3406 3391 INTEGER, INTENT(in) :: kt 3392 !!---------------------------------------------------------------------- 3407 3393 ! 3408 3394 WRITE(*,*) 'trc_osm: Not written yet', kt … … 3423 3409 INTEGER , INTENT(in ) :: Kmm, Krhs ! Ocean time level indices 3424 3410 REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: puu, pvv ! Ocean velocities and RHS of momentum equation 3425 ! 3411 !! 3426 3412 INTEGER :: ji, jj, jk ! dummy loop indices 3427 3413 !!---------------------------------------------------------------------- … … 3456 3442 CHARACTER(LEN=*), INTENT(in ) :: cdname 3457 3443 REAL(wp), DIMENSION(:,:), INTENT(in ) :: posmdia2d 3444 !!---------------------------------------------------------------------- 3458 3445 ! 3459 3446 IF ( ln_dia_osm .AND. iom_use( cdname ) ) THEN … … 3478 3465 CHARACTER(LEN=*), INTENT(in ) :: cdname 3479 3466 REAL(wp), DIMENSION(:,:,:), INTENT(in ) :: posmdia3d 3467 !!---------------------------------------------------------------------- 3480 3468 ! 3481 3469 IF ( ln_dia_osm .AND. iom_use( cdname ) ) THEN
Note: See TracChangeset
for help on using the changeset viewer.