diff --git a/src/core/MOM.F90 b/src/core/MOM.F90 index 08b4977f3a..e8910f3928 100644 --- a/src/core/MOM.F90 +++ b/src/core/MOM.F90 @@ -103,6 +103,7 @@ module MOM use MOM_interface_filter, only : interface_filter, interface_filter_init, interface_filter_end use MOM_interface_filter, only : interface_filter_CS use MOM_internal_tides, only : int_tide_CS +use MOM_kappa_shear, only : kappa_shear_at_vertex use MOM_lateral_mixing_coeffs, only : calc_slope_functions, VarMix_init, VarMix_end use MOM_lateral_mixing_coeffs, only : calc_resoln_function, calc_depth_function, VarMix_CS use MOM_MEKE, only : MEKE_alloc_register_restart, step_forward_MEKE @@ -229,6 +230,7 @@ module MOM logical :: rotate_index = .false. !< True if index map is rotated logical :: homogenize_forcings = .false. !< True if all inputs are homogenized logical :: update_ustar = .false. !< True to update ustar from homogenized tau + logical :: vertex_shear = .false. !< True if vertex shear is on type(verticalGrid_type), pointer :: & GV => NULL() !< structure containing vertical grid info @@ -767,7 +769,10 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS if (therm_reset) then CS%time_in_thermo_cycle = 0.0 - if (associated(CS%tv%frazil)) CS%tv%frazil(:,:) = 0.0 + if (associated(CS%tv%frazil)) then + CS%tv%frazil(:,:) = 0.0 + CS%tv%frazil_was_reset = .true. + endif if (associated(CS%tv%salt_deficit)) CS%tv%salt_deficit(:,:) = 0.0 if (associated(CS%tv%TempxPmE)) CS%tv%TempxPmE(:,:) = 0.0 if (associated(CS%tv%internal_heat)) CS%tv%internal_heat(:,:) = 0.0 @@ -1964,6 +1969,8 @@ subroutine post_diabatic_halo_updates(CS, G, GV, US, u, v, h, tv) call create_group_pass(pass_uv_T_S_h, h, G%Domain, halo=dynamics_stencil) call do_group_pass(pass_uv_T_S_h, G%Domain, clock=id_clock_pass) + if ((.not.tv%frazil_was_reset) .and. CS%vertex_shear) call pass_var(tv%frazil, G%Domain, halo=1) + ! Update derived thermodynamic quantities. if (allocated(tv%SpV_avg)) then call calc_derived_thermo(tv, h, G, GV, US, halo=dynamics_stencil, debug=CS%debug) @@ -2985,7 +2992,10 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, & endif if (use_p_surf_in_EOS) allocate(CS%tv%p_surf(isd:ied,jsd:jed), source=0.0) - if (use_frazil) allocate(CS%tv%frazil(isd:ied,jsd:jed), source=0.0) + if (use_frazil) then + allocate(CS%tv%frazil(isd:ied,jsd:jed), source=0.0) + CS%tv%frazil_was_reset = .true. + endif if (bound_salinity) allocate(CS%tv%salt_deficit(isd:ied,jsd:jed), source=0.0) allocate(CS%Hml(isd:ied,jsd:jed), source=0.0) @@ -3601,6 +3611,8 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, & CS%sponge_CSp, CS%ALE_sponge_CSp, CS%oda_incupd_CSp, CS%int_tide_CSp) endif + CS%vertex_shear = kappa_shear_at_vertex(param_file) + ! GMM, the following is needed to get BLDs into the dynamics module if (CS%split .and. fpmix) then call init_dyn_split_RK2_diabatic(CS%diabatic_CSp, CS%dyn_split_RK2_CSp) diff --git a/src/core/MOM_variables.F90 b/src/core/MOM_variables.F90 index cc5059bd48..c6483f8cef 100644 --- a/src/core/MOM_variables.F90 +++ b/src/core/MOM_variables.F90 @@ -101,8 +101,9 @@ module MOM_variables ! These arrays are accumulated fluxes for communication with other components. real, dimension(:,:), pointer :: frazil => NULL() !< The energy needed to heat the ocean column to the - !! freezing point since calculate_surface_state was2 + !! freezing point since calculate_surface_state was !! last called [Q Z R ~> J m-2]. + logical :: frazil_was_reset !< If true, frazil has not accumulated since it was last reset. real, dimension(:,:), pointer :: salt_deficit => NULL() !< The salt needed to maintain the ocean column !! at a minimum salinity of MIN_SALINITY since the last time diff --git a/src/parameterizations/vertical/MOM_diabatic_aux.F90 b/src/parameterizations/vertical/MOM_diabatic_aux.F90 index b6d4dfa489..8dc8edd2b9 100644 --- a/src/parameterizations/vertical/MOM_diabatic_aux.F90 +++ b/src/parameterizations/vertical/MOM_diabatic_aux.F90 @@ -120,7 +120,6 @@ subroutine make_frazil(h, tv, G, GV, US, CS, p_surf, halo) real, dimension(SZI_(G),SZJ_(G)), & optional, intent(in) :: p_surf !< The pressure at the ocean surface [R L2 T-2 ~> Pa]. integer, optional, intent(in) :: halo !< Halo width over which to calculate frazil - ! Local variables real, dimension(SZI_(G)) :: & fraz_col, & ! The accumulated heat requirement due to frazil [Q R Z ~> J m-2]. @@ -223,6 +222,9 @@ subroutine make_frazil(h, tv, G, GV, US, CS, p_surf, halo) tv%frazil(i,j) = tv%frazil(i,j) + fraz_col(i) enddo enddo + + tv%frazil_was_reset = .false. + call cpu_clock_end(id_clock_frazil) end subroutine make_frazil