Initializes the variables mixing coefficients container.
937 type(time_type),
intent(in) :: Time
938 type(ocean_grid_type),
intent(in) :: G
939 type(verticalGrid_type),
intent(in) :: GV
940 type(unit_scale_type),
intent(in) :: US
941 type(param_file_type),
intent(in) :: param_file
942 type(diag_ctrl),
target,
intent(inout) :: diag
943 type(VarMix_CS),
pointer :: CS
945 real :: KhTr_Slope_Cff, KhTh_Slope_Cff, oneOrTwo
946 real :: N2_filter_depth
948 real :: KhTr_passivity_coeff
949 real :: absurdly_small_freq
951 logical :: Gill_equatorial_Ld, use_FGNV_streamfn, use_MEKE, in_use
952 logical :: default_2018_answers, remap_answers_2018
953 real :: MLE_front_length
954 real :: Leith_Lap_const
955 real :: grid_sp_u2, grid_sp_v2
956 real :: grid_sp_u3, grid_sp_v3
957 real :: wave_speed_min
958 real :: wave_speed_tol
959 logical :: better_speed_est
962 # include "version_variable.h"
963 character(len=40) :: mdl =
"MOM_lateral_mixing_coeffs"
964 integer :: is, ie, js, je, Isq, Ieq, Jsq, Jeq, i, j
965 integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB
966 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
967 isq = g%IscB ; ieq = g%IecB ; jsq = g%JscB ; jeq = g%JecB
968 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
969 isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
971 if (
associated(cs))
then
972 call mom_error(warning,
"VarMix_init called with an associated "// &
973 "control structure.")
980 cs%calculate_cg1 = .false.
981 cs%calculate_Rd_dx = .false.
982 cs%calculate_res_fns = .false.
983 cs%calculate_Eady_growth_rate = .false.
984 cs%calculate_depth_fns = .false.
986 call log_version(param_file, mdl, version,
"")
987 call get_param(param_file, mdl,
"USE_VARIABLE_MIXING", cs%use_variable_mixing,&
988 "If true, the variable mixing code will be called. This "//&
989 "allows diagnostics to be created even if the scheme is "//&
990 "not used. If KHTR_SLOPE_CFF>0 or KhTh_Slope_Cff>0, "//&
991 "this is set to true regardless of what is in the "//&
992 "parameter file.", default=.false.)
993 call get_param(param_file, mdl,
"USE_VISBECK", cs%use_Visbeck,&
994 "If true, use the Visbeck et al. (1997) formulation for \n"//&
995 "thickness diffusivity.", default=.false.)
996 call get_param(param_file, mdl,
"RESOLN_SCALED_KH", cs%Resoln_scaled_Kh, &
997 "If true, the Laplacian lateral viscosity is scaled away "//&
998 "when the first baroclinic deformation radius is well "//&
999 "resolved.", default=.false.)
1000 call get_param(param_file, mdl,
"DEPTH_SCALED_KHTH", cs%Depth_scaled_KhTh, &
1001 "If true, KHTH is scaled away when the depth is shallower"//&
1002 "than a reference depth: KHTH = MIN(1,H/H0)**N * KHTH, "//&
1003 "where H0 is a reference depth, controlled via DEPTH_SCALED_KHTH_H0, "//&
1004 "and the exponent (N) is controlled via DEPTH_SCALED_KHTH_EXP.",&
1006 call get_param(param_file, mdl,
"RESOLN_SCALED_KHTH", cs%Resoln_scaled_KhTh, &
1007 "If true, the interface depth diffusivity is scaled away "//&
1008 "when the first baroclinic deformation radius is well "//&
1009 "resolved.", default=.false.)
1010 call get_param(param_file, mdl,
"RESOLN_SCALED_KHTR", cs%Resoln_scaled_KhTr, &
1011 "If true, the epipycnal tracer diffusivity is scaled "//&
1012 "away when the first baroclinic deformation radius is "//&
1013 "well resolved.", default=.false.)
1014 call get_param(param_file, mdl,
"RESOLN_USE_EBT", cs%Resoln_use_ebt, &
1015 "If true, uses the equivalent barotropic wave speed instead "//&
1016 "of first baroclinic wave for calculating the resolution fn.",&
1018 call get_param(param_file, mdl,
"KHTH_USE_EBT_STRUCT", cs%khth_use_ebt_struct, &
1019 "If true, uses the equivalent barotropic structure "//&
1020 "as the vertical structure of thickness diffusivity.",&
1022 call get_param(param_file, mdl,
"KHTH_SLOPE_CFF", khth_slope_cff, &
1023 "The nondimensional coefficient in the Visbeck formula "//&
1024 "for the interface depth diffusivity", units=
"nondim", &
1026 call get_param(param_file, mdl,
"KHTR_SLOPE_CFF", khtr_slope_cff, &
1027 "The nondimensional coefficient in the Visbeck formula "//&
1028 "for the epipycnal tracer diffusivity", units=
"nondim", &
1030 call get_param(param_file, mdl,
"USE_STORED_SLOPES", cs%use_stored_slopes,&
1031 "If true, the isopycnal slopes are calculated once and "//&
1032 "stored for re-use. This uses more memory but avoids calling "//&
1033 "the equation of state more times than should be necessary.", &
1035 call get_param(param_file, mdl,
"VERY_SMALL_FREQUENCY", absurdly_small_freq, &
1036 "A miniscule frequency that is used to avoid division by 0. The default "//&
1037 "value is roughly (pi / (the age of the universe)).", &
1038 default=1.0e-17, units=
"s-1", scale=us%T_to_s)
1039 call get_param(param_file, mdl,
"KHTH_USE_FGNV_STREAMFUNCTION", use_fgnv_streamfn, &
1040 default=.false., do_not_log=.true.)
1041 cs%calculate_cg1 = cs%calculate_cg1 .or. use_fgnv_streamfn
1042 call get_param(param_file, mdl,
"USE_MEKE", use_meke, &
1043 default=.false., do_not_log=.true.)
1044 cs%calculate_Rd_dx = cs%calculate_Rd_dx .or. use_meke
1045 cs%calculate_Eady_growth_rate = cs%calculate_Eady_growth_rate .or. use_meke
1046 call get_param(param_file, mdl,
"KHTR_PASSIVITY_COEFF", khtr_passivity_coeff, &
1047 default=0., do_not_log=.true.)
1048 cs%calculate_Rd_dx = cs%calculate_Rd_dx .or. (khtr_passivity_coeff>0.)
1049 call get_param(param_file, mdl,
"MLE_FRONT_LENGTH", mle_front_length, &
1050 default=0., do_not_log=.true.)
1051 cs%calculate_Rd_dx = cs%calculate_Rd_dx .or. (mle_front_length>0.)
1053 call get_param(param_file, mdl,
"DEBUG", cs%debug, default=.false., do_not_log=.true.)
1056 if (cs%Resoln_use_ebt .or. cs%khth_use_ebt_struct)
then
1058 call get_param(param_file, mdl,
"RESOLN_N2_FILTER_DEPTH", n2_filter_depth, &
1059 "The depth below which N2 is monotonized to avoid stratification "//&
1060 "artifacts from altering the equivalent barotropic mode structure.",&
1061 units=
"m", default=2000., scale=us%m_to_Z)
1062 allocate(cs%ebt_struct(isd:ied,jsd:jed,g%ke)) ; cs%ebt_struct(:,:,:) = 0.0
1065 if (khtr_slope_cff>0. .or. khth_slope_cff>0.)
then
1066 cs%calculate_Eady_growth_rate = .true.
1067 call get_param(param_file, mdl,
"VISBECK_MAX_SLOPE", cs%Visbeck_S_max, &
1068 "If non-zero, is an upper bound on slopes used in the "//&
1069 "Visbeck formula for diffusivity. This does not affect the "//&
1070 "isopycnal slope calculation used within thickness diffusion.", &
1071 units=
"nondim", default=0.0)
1074 if (cs%use_stored_slopes)
then
1076 allocate(cs%slope_x(isdb:iedb,jsd:jed,g%ke+1)) ; cs%slope_x(:,:,:) = 0.0
1077 allocate(cs%slope_y(isd:ied,jsdb:jedb,g%ke+1)) ; cs%slope_y(:,:,:) = 0.0
1078 call get_param(param_file, mdl,
"KD_SMOOTH", cs%kappa_smooth, &
1079 "A diapycnal diffusivity that is used to interpolate "//&
1080 "more sensible values of T & S into thin layers.", &
1081 units=
"m2 s-1", default=1.0e-6, scale=us%m_to_Z**2*us%T_to_s)
1084 if (cs%calculate_Eady_growth_rate)
then
1086 allocate(cs%SN_u(isdb:iedb,jsd:jed)) ; cs%SN_u(:,:) = 0.0
1087 allocate(cs%SN_v(isd:ied,jsdb:jedb)) ; cs%SN_v(:,:) = 0.0
1088 cs%id_SN_u = register_diag_field(
'ocean_model',
'SN_u', diag%axesCu1, time, &
1089 'Inverse eddy time-scale, S*N, at u-points',
's-1', conversion=us%s_to_T)
1090 cs%id_SN_v = register_diag_field(
'ocean_model',
'SN_v', diag%axesCv1, time, &
1091 'Inverse eddy time-scale, S*N, at v-points',
's-1', conversion=us%s_to_T)
1092 call get_param(param_file, mdl,
"VARMIX_KTOP", cs%VarMix_Ktop, &
1093 "The layer number at which to start vertical integration "//&
1094 "of S*N for purposes of finding the Eady growth rate.", &
1095 units=
"nondim", default=2)
1098 if (khtr_slope_cff>0. .or. khth_slope_cff>0.)
then
1100 call get_param(param_file, mdl,
"VISBECK_L_SCALE", cs%Visbeck_L_scale, &
1101 "The fixed length scale in the Visbeck formula.", units=
"m", &
1103 allocate(cs%L2u(isdb:iedb,jsd:jed)) ; cs%L2u(:,:) = 0.0
1104 allocate(cs%L2v(isd:ied,jsdb:jedb)) ; cs%L2v(:,:) = 0.0
1105 if (cs%Visbeck_L_scale<0)
then
1106 do j=js,je ;
do i=is-1,ieq
1107 cs%L2u(i,j) = cs%Visbeck_L_scale**2 * g%areaCu(i,j)
1109 do j=js-1,jeq ;
do i=is,ie
1110 cs%L2v(i,j) = cs%Visbeck_L_scale**2 * g%areaCv(i,j)
1113 cs%L2u(:,:) = us%m_to_L**2*cs%Visbeck_L_scale**2
1114 cs%L2v(:,:) = us%m_to_L**2*cs%Visbeck_L_scale**2
1117 cs%id_L2u = register_diag_field(
'ocean_model',
'L2u', diag%axesCu1, time, &
1118 'Length scale squared for mixing coefficient, at u-points', &
1119 'm2', conversion=us%L_to_m**2)
1120 cs%id_L2v = register_diag_field(
'ocean_model',
'L2v', diag%axesCv1, time, &
1121 'Length scale squared for mixing coefficient, at v-points', &
1122 'm2', conversion=us%L_to_m**2)
1125 if (cs%calculate_Eady_growth_rate .and. cs%use_stored_slopes)
then
1126 cs%id_N2_u = register_diag_field(
'ocean_model',
'N2_u', diag%axesCui, time, &
1127 'Square of Brunt-Vaisala frequency, N^2, at u-points, as used in Visbeck et al.', &
1128 's-2', conversion=us%s_to_T**2)
1129 cs%id_N2_v = register_diag_field(
'ocean_model',
'N2_v', diag%axesCvi, time, &
1130 'Square of Brunt-Vaisala frequency, N^2, at v-points, as used in Visbeck et al.', &
1131 's-2', conversion=us%s_to_T**2)
1133 if (cs%use_stored_slopes)
then
1134 cs%id_S2_u = register_diag_field(
'ocean_model',
'S2_u', diag%axesCu1, time, &
1135 'Depth average square of slope magnitude, S^2, at u-points, as used in Visbeck et al.',
'nondim')
1136 cs%id_S2_v = register_diag_field(
'ocean_model',
'S2_v', diag%axesCv1, time, &
1137 'Depth average square of slope magnitude, S^2, at v-points, as used in Visbeck et al.',
'nondim')
1141 if (cs%Resoln_scaled_Kh .or. cs%Resoln_scaled_KhTh .or. cs%Resoln_scaled_KhTr)
then
1142 cs%calculate_Rd_dx = .true.
1143 cs%calculate_res_fns = .true.
1144 allocate(cs%Res_fn_h(isd:ied,jsd:jed)) ; cs%Res_fn_h(:,:) = 0.0
1145 allocate(cs%Res_fn_q(isdb:iedb,jsdb:jedb)) ; cs%Res_fn_q(:,:) = 0.0
1146 allocate(cs%Res_fn_u(isdb:iedb,jsd:jed)) ; cs%Res_fn_u(:,:) = 0.0
1147 allocate(cs%Res_fn_v(isd:ied,jsdb:jedb)) ; cs%Res_fn_v(:,:) = 0.0
1148 allocate(cs%beta_dx2_q(isdb:iedb,jsdb:jedb)) ; cs%beta_dx2_q(:,:) = 0.0
1149 allocate(cs%beta_dx2_u(isdb:iedb,jsd:jed)) ; cs%beta_dx2_u(:,:) = 0.0
1150 allocate(cs%beta_dx2_v(isd:ied,jsdb:jedb)) ; cs%beta_dx2_v(:,:) = 0.0
1151 allocate(cs%f2_dx2_q(isdb:iedb,jsdb:jedb)) ; cs%f2_dx2_q(:,:) = 0.0
1152 allocate(cs%f2_dx2_u(isdb:iedb,jsd:jed)) ; cs%f2_dx2_u(:,:) = 0.0
1153 allocate(cs%f2_dx2_v(isd:ied,jsdb:jedb)) ; cs%f2_dx2_v(:,:) = 0.0
1155 cs%id_Res_fn = register_diag_field(
'ocean_model',
'Res_fn', diag%axesT1, time, &
1156 'Resolution function for scaling diffusivities',
'nondim')
1158 call get_param(param_file, mdl,
"KH_RES_SCALE_COEF", cs%Res_coef_khth, &
1159 "A coefficient that determines how KhTh is scaled away if "//&
1160 "RESOLN_SCALED_... is true, as "//&
1161 "F = 1 / (1 + (KH_RES_SCALE_COEF*Rd/dx)^KH_RES_FN_POWER).", &
1162 units=
"nondim", default=1.0)
1163 call get_param(param_file, mdl,
"KH_RES_FN_POWER", cs%Res_fn_power_khth, &
1164 "The power of dx/Ld in the Kh resolution function. Any "//&
1165 "positive integer may be used, although even integers "//&
1166 "are more efficient to calculate. Setting this greater "//&
1167 "than 100 results in a step-function being used.", &
1168 units=
"nondim", default=2)
1169 call get_param(param_file, mdl,
"VISC_RES_SCALE_COEF", cs%Res_coef_visc, &
1170 "A coefficient that determines how Kh is scaled away if "//&
1171 "RESOLN_SCALED_... is true, as "//&
1172 "F = 1 / (1 + (KH_RES_SCALE_COEF*Rd/dx)^KH_RES_FN_POWER). "//&
1173 "This function affects lateral viscosity, Kh, and not KhTh.", &
1174 units=
"nondim", default=cs%Res_coef_khth)
1175 call get_param(param_file, mdl,
"VISC_RES_FN_POWER", cs%Res_fn_power_visc, &
1176 "The power of dx/Ld in the Kh resolution function. Any "//&
1177 "positive integer may be used, although even integers "//&
1178 "are more efficient to calculate. Setting this greater "//&
1179 "than 100 results in a step-function being used. "//&
1180 "This function affects lateral viscosity, Kh, and not KhTh.", &
1181 units=
"nondim", default=cs%Res_fn_power_khth)
1182 call get_param(param_file, mdl,
"INTERPOLATE_RES_FN", cs%interpolate_Res_fn, &
1183 "If true, interpolate the resolution function to the "//&
1184 "velocity points from the thickness points; otherwise "//&
1185 "interpolate the wave speed and calculate the resolution "//&
1186 "function independently at each point.", default=.false.)
1187 if (cs%interpolate_Res_fn)
then
1188 if (cs%Res_coef_visc /= cs%Res_coef_khth)
call mom_error(fatal, &
1189 "MOM_lateral_mixing_coeffs.F90, VarMix_init:"//&
1190 "When INTERPOLATE_RES_FN=True, VISC_RES_FN_POWER must equal KH_RES_SCALE_COEF.")
1191 if (cs%Res_fn_power_visc /= cs%Res_fn_power_khth)
call mom_error(fatal, &
1192 "MOM_lateral_mixing_coeffs.F90, VarMix_init:"//&
1193 "When INTERPOLATE_RES_FN=True, VISC_RES_FN_POWER must equal KH_RES_FN_POWER.")
1195 call get_param(param_file, mdl,
"GILL_EQUATORIAL_LD", gill_equatorial_ld, &
1196 "If true, uses Gill's definition of the baroclinic "//&
1197 "equatorial deformation radius, otherwise, if false, use "//&
1198 "Pedlosky's definition. These definitions differ by a factor "//&
1199 "of 2 in front of the beta term in the denominator. Gill's "//&
1200 "is the more appropriate definition.", default=.true.)
1201 if (gill_equatorial_ld)
then
1205 do j=js-1,jeq ;
do i=is-1,ieq
1206 cs%f2_dx2_q(i,j) = (g%dxBu(i,j)**2 + g%dyBu(i,j)**2) * &
1207 max(g%CoriolisBu(i,j)**2, absurdly_small_freq**2)
1208 cs%beta_dx2_q(i,j) = oneortwo * ((g%dxBu(i,j))**2 + (g%dyBu(i,j))**2) * (sqrt(0.5 * &
1209 ( (((g%CoriolisBu(i,j)-g%CoriolisBu(i-1,j)) * g%IdxCv(i,j))**2 + &
1210 ((g%CoriolisBu(i+1,j)-g%CoriolisBu(i,j)) * g%IdxCv(i+1,j))**2) + &
1211 (((g%CoriolisBu(i,j)-g%CoriolisBu(i,j-1)) * g%IdyCu(i,j))**2 + &
1212 ((g%CoriolisBu(i,j+1)-g%CoriolisBu(i,j)) * g%IdyCu(i,j+1))**2) ) ))
1215 do j=js,je ;
do i=is-1,ieq
1216 cs%f2_dx2_u(i,j) = (g%dxCu(i,j)**2 + g%dyCu(i,j)**2) * &
1217 max(0.5* (g%CoriolisBu(i,j)**2+g%CoriolisBu(i,j-1)**2), absurdly_small_freq**2)
1218 cs%beta_dx2_u(i,j) = oneortwo * ((g%dxCu(i,j))**2 + (g%dyCu(i,j))**2) * (sqrt( &
1219 0.25*( (((g%CoriolisBu(i,j-1)-g%CoriolisBu(i-1,j-1)) * g%IdxCv(i,j-1))**2 + &
1220 ((g%CoriolisBu(i+1,j)-g%CoriolisBu(i,j)) * g%IdxCv(i+1,j))**2) + &
1221 (((g%CoriolisBu(i+1,j-1)-g%CoriolisBu(i,j-1)) * g%IdxCv(i+1,j-1))**2 + &
1222 ((g%CoriolisBu(i,j)-g%CoriolisBu(i-1,j)) * g%IdxCv(i,j))**2) ) + &
1223 ((g%CoriolisBu(i,j)-g%CoriolisBu(i,j-1)) * g%IdyCu(i,j))**2 ))
1226 do j=js-1,jeq ;
do i=is,ie
1227 cs%f2_dx2_v(i,j) = ((g%dxCv(i,j))**2 + (g%dyCv(i,j))**2) * &
1228 max(0.5*(g%CoriolisBu(i,j)**2+g%CoriolisBu(i-1,j)**2), absurdly_small_freq**2)
1229 cs%beta_dx2_v(i,j) = oneortwo * ((g%dxCv(i,j))**2 + (g%dyCv(i,j))**2) * (sqrt( &
1230 ((g%CoriolisBu(i,j)-g%CoriolisBu(i-1,j)) * g%IdxCv(i,j))**2 + &
1231 0.25*( (((g%CoriolisBu(i,j)-g%CoriolisBu(i,j-1)) * g%IdyCu(i,j))**2 + &
1232 ((g%CoriolisBu(i-1,j+1)-g%CoriolisBu(i-1,j)) * g%IdyCu(i-1,j+1))**2) + &
1233 (((g%CoriolisBu(i,j+1)-g%CoriolisBu(i,j)) * g%IdyCu(i,j+1))**2 + &
1234 ((g%CoriolisBu(i-1,j)-g%CoriolisBu(i-1,j-1)) * g%IdyCu(i-1,j))**2) ) ))
1239 if (cs%Depth_scaled_KhTh)
then
1240 cs%calculate_depth_fns = .true.
1241 allocate(cs%Depth_fn_u(isdb:iedb,jsd:jed)) ; cs%Depth_fn_u(:,:) = 0.0
1242 allocate(cs%Depth_fn_v(isd:ied,jsdb:jedb)) ; cs%Depth_fn_v(:,:) = 0.0
1243 call get_param(param_file, mdl,
"DEPTH_SCALED_KHTH_H0", cs%depth_scaled_khth_h0, &
1244 "The depth above which KHTH is scaled away.",&
1245 units=
"m", default=1000.)
1246 call get_param(param_file, mdl,
"DEPTH_SCALED_KHTH_EXP", cs%depth_scaled_khth_exp, &
1247 "The exponent used in the depth dependent scaling function for KHTH.",&
1248 units=
"nondim", default=3.0)
1252 cs%id_Rd_dx = register_diag_field(
'ocean_model',
'Rd_dx', diag%axesT1, time, &
1253 'Ratio between deformation radius and grid spacing',
'm m-1')
1254 cs%calculate_Rd_dx = cs%calculate_Rd_dx .or. (cs%id_Rd_dx>0)
1256 if (cs%calculate_Rd_dx)
then
1257 cs%calculate_cg1 = .true.
1258 allocate(cs%Rd_dx_h(isd:ied,jsd:jed)) ; cs%Rd_dx_h(:,:) = 0.0
1259 allocate(cs%beta_dx2_h(isd:ied,jsd:jed)); cs%beta_dx2_h(:,:) = 0.0
1260 allocate(cs%f2_dx2_h(isd:ied,jsd:jed)) ; cs%f2_dx2_h(:,:) = 0.0
1261 do j=js-1,je+1 ;
do i=is-1,ie+1
1262 cs%f2_dx2_h(i,j) = (g%dxT(i,j)**2 + g%dyT(i,j)**2) * &
1263 max(0.25 * ((g%CoriolisBu(i,j)**2 + g%CoriolisBu(i-1,j-1)**2) + &
1264 (g%CoriolisBu(i-1,j)**2 + g%CoriolisBu(i,j-1)**2)), &
1265 absurdly_small_freq**2)
1266 cs%beta_dx2_h(i,j) = oneortwo * ((g%dxT(i,j))**2 + (g%dyT(i,j))**2) * (sqrt(0.5 * &
1267 ( (((g%CoriolisBu(i,j)-g%CoriolisBu(i-1,j)) * g%IdxCv(i,j))**2 + &
1268 ((g%CoriolisBu(i,j-1)-g%CoriolisBu(i-1,j-1)) * g%IdxCv(i,j-1))**2) + &
1269 (((g%CoriolisBu(i,j)-g%CoriolisBu(i,j-1)) * g%IdyCu(i,j))**2 + &
1270 ((g%CoriolisBu(i-1,j)-g%CoriolisBu(i-1,j-1)) * g%IdyCu(i-1,j))**2) ) ))
1274 if (cs%calculate_cg1)
then
1276 allocate(cs%cg1(isd:ied,jsd:jed)) ; cs%cg1(:,:) = 0.0
1277 call get_param(param_file, mdl,
"DEFAULT_2018_ANSWERS", default_2018_answers, &
1278 "This sets the default value for the various _2018_ANSWERS parameters.", &
1280 call get_param(param_file, mdl,
"REMAPPING_2018_ANSWERS", remap_answers_2018, &
1281 "If true, use the order of arithmetic and expressions that recover the "//&
1282 "answers from the end of 2018. Otherwise, use updated and more robust "//&
1283 "forms of the same expressions.", default=default_2018_answers)
1284 call get_param(param_file, mdl,
"INTERNAL_WAVE_SPEED_TOL", wave_speed_tol, &
1285 "The fractional tolerance for finding the wave speeds.", &
1286 units=
"nondim", default=0.001)
1288 call get_param(param_file, mdl,
"INTERNAL_WAVE_SPEED_MIN", wave_speed_min, &
1289 "A floor in the first mode speed below which 0 used instead.", &
1290 units=
"m s-1", default=0.0, scale=us%m_s_to_L_T)
1291 call get_param(param_file, mdl,
"INTERNAL_WAVE_SPEED_BETTER_EST", better_speed_est, &
1292 "If true, use a more robust estimate of the first mode wave speed as the "//&
1293 "starting point for iterations.", default=.false.)
1294 call wave_speed_init(cs%wave_speed_CSp, use_ebt_mode=cs%Resoln_use_ebt, &
1295 mono_n2_depth=n2_filter_depth, remap_answers_2018=remap_answers_2018, &
1296 better_speed_est=better_speed_est, min_speed=wave_speed_min, &
1297 wave_speed_tol=wave_speed_tol)
1301 call get_param(param_file, mdl,
"USE_QG_LEITH_GM", cs%use_QG_Leith_GM, &
1302 "If true, use the QG Leith viscosity as the GM coefficient.", &
1305 if (cs%Use_QG_Leith_GM)
then
1306 call get_param(param_file, mdl,
"LEITH_LAP_CONST", leith_lap_const, &
1307 "The nondimensional Laplacian Leith constant, \n"//&
1308 "often set to 1.0", units=
"nondim", default=0.0)
1310 call get_param(param_file, mdl,
"USE_BETA_IN_LEITH", cs%use_beta_in_QG_Leith, &
1311 "If true, include the beta term in the Leith nonlinear eddy viscosity.", &
1314 alloc_(cs%Laplac3_const_u(isdb:iedb,jsd:jed)) ; cs%Laplac3_const_u(:,:) = 0.0
1315 alloc_(cs%Laplac3_const_v(isd:ied,jsdb:jedb)) ; cs%Laplac3_const_v(:,:) = 0.0
1316 alloc_(cs%KH_u_QG(isdb:iedb,jsd:jed,g%ke)) ; cs%KH_u_QG(:,:,:) = 0.0
1317 alloc_(cs%KH_v_QG(isd:ied,jsdb:jedb,g%ke)) ; cs%KH_v_QG(:,:,:) = 0.0
1320 cs%id_KH_u_QG = register_diag_field(
'ocean_model',
'KH_u_QG', diag%axesCuL, time, &
1321 'Horizontal viscosity from Leith QG, at u-points',
'm2 s-1', conversion=us%L_to_m**2*us%s_to_T)
1322 cs%id_KH_v_QG = register_diag_field(
'ocean_model',
'KH_v_QG', diag%axesCvL, time, &
1323 'Horizontal viscosity from Leith QG, at v-points',
'm2 s-1', conversion=us%L_to_m**2*us%s_to_T)
1325 do j=jsq,jeq+1 ;
do i=is-1,ieq
1327 grid_sp_u2 = g%dyCu(i,j)*g%dxCu(i,j)
1328 grid_sp_u3 = grid_sp_u2*sqrt(grid_sp_u2)
1329 cs%Laplac3_const_u(i,j) = leith_lap_const * grid_sp_u3
1331 do j=js-1,jeq ;
do i=isq,ieq+1
1333 grid_sp_v2 = g%dyCv(i,j)*g%dxCv(i,j)
1334 grid_sp_v3 = grid_sp_v2*sqrt(grid_sp_v2)
1335 cs%Laplac3_const_v(i,j) = leith_lap_const * grid_sp_v3
1338 if (.not. cs%use_stored_slopes)
call mom_error(fatal, &
1339 "MOM_lateral_mixing_coeffs.F90, VarMix_init:"//&
1340 "USE_STORED_SLOPES must be True when using QG Leith.")
1345 cs%use_variable_mixing = .true.