@@ -73,7 +73,6 @@ module cvmix_kpp
7373 public :: cvmix_kpp_compute_shape_function_coeffs
7474 public :: cvmix_kpp_compute_kOBL_depth
7575 public :: cvmix_kpp_compute_enhanced_diff
76- public :: cvmix_kpp_compute_nonlocal
7776 public :: cvmix_kpp_compute_nu_at_OBL_depth_LMD94
7877
7978 interface cvmix_coeffs_kpp
@@ -116,6 +115,9 @@ module cvmix_kpp
116115 real (cvmix_r8 ) :: vonkarman ! von Karman constant
117116
118117 real (cvmix_r8 ) :: Cstar ! coefficient for nonlinear transport
118+ real (cvmix_r8 ) :: nonlocal_coeff ! Cs from Eq (20) in LMD94
119+ ! Default value comes from paper, but
120+ ! some users may set it = 1.
119121
120122 ! For velocity scale function, _m => momentum and _s => scalar (tracer)
121123 real (cvmix_r8 ) :: zeta_m ! parameter for computing vel scale func
@@ -190,7 +192,7 @@ subroutine cvmix_init_kpp(ri_crit, minOBLdepth, maxOBLdepth, minVtsqr, &
190192 Cv , interp_type , interp_type2 , MatchTechnique , &
191193 old_vals , lEkman , lMonOb , lnoDGat1 , &
192194 lavg_N_or_Nsqr , lenhanced_diff , &
193- CVmix_kpp_params_user )
195+ lnonzero_surf_nonlocal , CVmix_kpp_params_user )
194196
195197! !DESCRIPTION:
196198! Initialization routine for KPP mixing.
@@ -219,7 +221,8 @@ subroutine cvmix_init_kpp(ri_crit, minOBLdepth, maxOBLdepth, minVtsqr, &
219221 lMonOb, &
220222 lnoDGat1, &
221223 lavg_N_or_Nsqr, &
222- lenhanced_diff
224+ lenhanced_diff, &
225+ lnonzero_surf_nonlocal
223226
224227! !OUTPUT PARAMETERS:
225228 type (cvmix_kpp_params_type), intent (inout ), target , optional :: &
@@ -229,6 +232,9 @@ subroutine cvmix_init_kpp(ri_crit, minOBLdepth, maxOBLdepth, minVtsqr, &
229232! BOC
230233
231234 real (cvmix_r8 ) :: zm, zs, a_m, a_s, c_m, c_s
235+ real (cvmix_r8 ) :: Cstar_loc, vonkar_loc, surf_layer_ext_loc
236+ real (cvmix_r8 ) :: nonlocal_coeff
237+
232238
233239 if (present (ri_crit)) then
234240 if (ri_crit.lt. cvmix_zero) then
@@ -275,16 +281,18 @@ subroutine cvmix_init_kpp(ri_crit, minOBLdepth, maxOBLdepth, minVtsqr, &
275281 print * , " ERROR: vonkarman can not be negative."
276282 stop 1
277283 end if
278- call cvmix_put_kpp( ' vonkarman ' , vonkarman, CVmix_kpp_params_user)
284+ vonkar_loc = vonkarman
279285 else
280- call cvmix_put_kpp( ' vonkarman ' , 0.4_cvmix_r8 , CVmix_kpp_params_user)
286+ vonkar_loc = 0.4_cvmix_r8
281287 end if
288+ call cvmix_put_kpp(' vonkarman' , vonkar_loc, CVmix_kpp_params_user)
282289
283290 if (present (Cstar)) then
284- call cvmix_put_kpp( ' Cstar ' , Cstar, CVmix_kpp_params_user)
291+ Cstar_loc = Cstar
285292 else
286- call cvmix_put_kpp( ' Cstar ' , 10 , CVmix_kpp_params_user )
293+ Cstar_loc = real ( 10 ,cvmix_ r8 )
287294 end if
295+ call cvmix_put_kpp(' Cstar' , Cstar_loc, CVmix_kpp_params_user)
288296
289297 if (present (zeta_m)) then
290298 if (zeta_m.ge. cvmix_zero) then
@@ -332,11 +340,12 @@ subroutine cvmix_init_kpp(ri_crit, minOBLdepth, maxOBLdepth, minVtsqr, &
332340 print * , " surf_layer_ext must be between 0 and 1, inclusive."
333341 stop 1
334342 end if
335- call cvmix_put_kpp(' surf_layer_ext' , surf_layer_ext, &
336- CVmix_kpp_params_user)
343+ surf_layer_ext_loc = surf_layer_ext
337344 else
338- call cvmix_put_kpp( ' surf_layer_ext ' , 0.1_cvmix_r8 , CVmix_kpp_params_user)
345+ surf_layer_ext_loc = 0.1_cvmix_r8
339346 end if
347+ call cvmix_put_kpp(' surf_layer_ext' , surf_layer_ext_loc, &
348+ CVmix_kpp_params_user)
340349
341350 if (present (Cv)) then
342351 ! Use scalar Cv parameter
@@ -469,6 +478,17 @@ subroutine cvmix_init_kpp(ri_crit, minOBLdepth, maxOBLdepth, minVtsqr, &
469478 call cvmix_put_kpp(' lenhanced_diff' , .true. , CVmix_kpp_params_user)
470479 end if
471480
481+ ! By default, assume that G(0) = 0 for nonlocal term
482+ nonlocal_coeff = (Cstar_loc* vonkar_loc* &
483+ (vonkar_loc* surf_layer_ext_loc* c_s)** &
484+ (cvmix_one/ real (3 ,cvmix_r8 )))
485+ if (present (lnonzero_surf_nonlocal)) then
486+ if (lnonzero_surf_nonlocal) then
487+ nonlocal_coeff = real (1 ,cvmix_r8 )
488+ end if
489+ end if
490+ call cvmix_put_kpp(' nonlocal_coeff' ,nonlocal_coeff,CVmix_kpp_params_user)
491+
472492! EOC
473493
474494 end subroutine cvmix_init_kpp
@@ -618,7 +638,7 @@ subroutine cvmix_coeffs_kpp_low(Mdiff_out, Tdiff_out, Sdiff_out, zw, zt, &
618638 real (cvmix_r8 ) :: dMshapeAt1, dTshapeAt1, dSshapeAt1
619639
620640 ! [MTS]shapeAtS is value of shape function at sigma = S
621- real (cvmix_r8 ) :: MshapeAtS, TshapeAtS, SshapeAtS
641+ real (cvmix_r8 ) :: MshapeAtS, TshapeAtS, SshapeAtS, GAtS
622642
623643 ! [MTS]diff_OBL is value of diffusivity at OBL depth
624644 ! d[MTS]diff_OBL is value of derivative of diffusivity at OBL depth
@@ -897,10 +917,10 @@ subroutine cvmix_coeffs_kpp_low(Mdiff_out, Tdiff_out, Sdiff_out, zw, zt, &
897917
898918 ! (3c) Compute nonlocal term at each cell interface
899919 if ((.not. lstable).and. (kw.le. kwup)) then
900- call cvmix_kpp_compute_nonlocal (Tshape2, sigma(kw), Tnonlocal(kw), &
901- CVmix_kpp_params_user)
902- call cvmix_kpp_compute_nonlocal (Sshape2, sigma(kw), Snonlocal(kw), &
903- CVmix_kpp_params_user)
920+ GAtS = cvmix_math_evaluate_cubic (Tshape2, sigma(kw))
921+ Tnonlocal(kw) = CVmix_kpp_params_user% nonlocal_coeff * GAtS
922+ GAtS = cvmix_math_evaluate_cubic (Sshape2, sigma(kw))
923+ Snonlocal(kw) = CVmix_kpp_params_user% nonlocal_coeff * GAtS
904924 end if
905925
906926 ! (3d) Diffusivity = OBL_depth * (turbulent scale) * G(sigma)
@@ -1015,6 +1035,8 @@ subroutine cvmix_put_kpp_real(varname, val, CVmix_kpp_params_user)
10151035 CVmix_kpp_params_out% surf_layer_ext = val
10161036 case (' Cv' )
10171037 CVmix_kpp_params_out% Cv = val
1038+ case (' nonlocal_coeff' )
1039+ CVmix_kpp_params_out% nonlocal_coeff = val
10181040 case DEFAULT
10191041 print * , " ERROR: " , trim (varname), " not a valid choice!"
10201042 stop 1
@@ -1530,57 +1552,6 @@ end subroutine cvmix_kpp_compute_enhanced_diff
15301552
15311553! BOP
15321554
1533- ! !IROUTINE: cvmix_kpp_compute_nonlocal
1534- ! !INTERFACE:
1535-
1536- subroutine cvmix_kpp_compute_nonlocal (shape_fun , sigma , nonlocal , &
1537- CVmix_kpp_params_user )
1538-
1539- ! !DESCRIPTION:
1540- ! Compute the nonlocal transport contribution to vertical turbulent fluxes.
1541- ! Note that Large, et al., refer to $\gamma_x$ as the non-local term, while
1542- ! this routine computes $K_x\gamma_x/$[surface forcing]
1543- ! \\
1544- !\\
1545-
1546- ! !INPUT PARAMETERS:
1547- type (cvmix_kpp_params_type), intent (in ), optional , target :: &
1548- CVmix_kpp_params_user
1549- real (cvmix_r8 ), dimension (4 ), intent (in ) :: shape_fun
1550- real (cvmix_r8 ), intent (in ) :: sigma
1551-
1552- ! !OUTPUT PARAMETERS:
1553- real (cvmix_r8 ), intent (out ) :: nonlocal
1554-
1555- ! Local variables
1556- type (cvmix_kpp_params_type), pointer :: CVmix_kpp_params_in
1557-
1558- ! Constants from params
1559- real (cvmix_r8 ) :: Cstar, vonkar, c_s, surf_layer_ext
1560-
1561- real (cvmix_r8 ) :: GatS
1562- ! EOP
1563- ! BOC
1564-
1565- CVmix_kpp_params_in = > CVmix_kpp_params_saved
1566- if (present (CVmix_kpp_params_user)) then
1567- CVmix_kpp_params_in = > CVmix_kpp_params_user
1568- end if
1569- vonkar = cvmix_get_kpp_real(' vonkarman' , CVmix_kpp_params_in)
1570- Cstar = cvmix_get_kpp_real(' Cstar' , CVmix_kpp_params_in)
1571- surf_layer_ext = cvmix_get_kpp_real(' surf_layer_ext' , CVmix_kpp_params_in)
1572- c_s = cvmix_get_kpp_real(' c_s' , CVmix_kpp_params_in)
1573-
1574- GatS = cvmix_math_evaluate_cubic(shape_fun, sigma)
1575-
1576- nonlocal = GatS* (Cstar* vonkar* (vonkar* surf_layer_ext* c_s)** &
1577- (cvmix_one/ real (3 ,cvmix_r8 )))
1578- ! EOC
1579-
1580- end subroutine cvmix_kpp_compute_nonlocal
1581-
1582- ! BOP
1583-
15841555! !IROUTINE: cvmix_kpp_compute_OBL_depth_wrap
15851556! !INTERFACE:
15861557
0 commit comments