From a8cb1d8c9ffe76b67e995fdc680d742e5a84c825 Mon Sep 17 00:00:00 2001 From: Ian Grooms Date: Thu, 17 Oct 2024 19:55:26 -0600 Subject: [PATCH] Velocity remap dimensional consistency (#308) * Fix units and dimensional consistency * Remove offending dimensional factor --- src/ALE/MOM_ALE.F90 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/ALE/MOM_ALE.F90 b/src/ALE/MOM_ALE.F90 index 3a4934676d..d1aeffddea 100644 --- a/src/ALE/MOM_ALE.F90 +++ b/src/ALE/MOM_ALE.F90 @@ -380,12 +380,12 @@ subroutine ALE_register_diags(Time, G, GV, US, diag, CS) 'Rate of change in half rho0 times depth integral of squared zonal'//& ' velocity by remapping. If REMAP_VEL_CONSERVE_KE is .true. then '//& ' this measures the change before the KE-conserving correction is applied.', & - 'W m-2', conversion=US%RZ3_T3_to_W_m2 * US%L_to_Z**2) + 'W m-2', conversion=GV%H_to_kg_m2 * US%L_T_to_m_s**2 * US%s_to_T) CS%id_remap_delta_integ_v2 = register_diag_field('ocean_model', 'ale_v2', diag%axesCv1, Time, & 'Rate of change in half rho0 times depth integral of squared meridional'//& ' velocity by remapping. If REMAP_VEL_CONSERVE_KE is .true. then '//& ' this measures the change before the KE-conserving correction is applied.', & - 'W m-2', conversion=US%RZ3_T3_to_W_m2 * US%L_to_Z**2) + 'W m-2', conversion=GV%H_to_kg_m2 * US%L_T_to_m_s**2 * US%s_to_T) end subroutine ALE_register_diags @@ -1172,7 +1172,11 @@ subroutine ALE_remap_velocities(CS, G, GV, h_old_u, h_old_v, h_new_u, h_new_v, u ke_c_tgt = ke_c_tgt + h2(k) * (u_tgt(k) - u_bt)**2 enddo ! Next rescale baroclinic component on target grid to conserve ke - rescale_coef = min(1.25, sqrt(ke_c_src / (ke_c_tgt + 1.E-19))) + if (ke_c_src < 1.5625 * ke_c_tgt) then + rescale_coef = sqrt(ke_c_src / ke_c_tgt) + else + rescale_coef = 1.25 + endif do k=1,nz u_tgt(k) = u_bt + rescale_coef * (u_tgt(k) - u_bt) enddo @@ -1182,7 +1186,7 @@ subroutine ALE_remap_velocities(CS, G, GV, h_old_u, h_old_v, h_new_u, h_new_v, u do k=1,nz u2h_tot = u2h_tot + h2(k) * (u_tgt(k)**2) enddo - du2h_tot(I,j) = GV%H_to_RZ * u2h_tot * I_dt + du2h_tot(I,j) = u2h_tot * I_dt endif if ((CS%BBL_h_vel_mask > 0.0) .and. (CS%h_vel_mask > 0.0)) & @@ -1240,7 +1244,11 @@ subroutine ALE_remap_velocities(CS, G, GV, h_old_u, h_old_v, h_new_u, h_new_v, u ke_c_tgt = ke_c_tgt + h2(k) * (v_tgt(k) - v_bt)**2 enddo ! Next rescale baroclinic component on target grid to conserve ke - rescale_coef = min(1.25, sqrt(ke_c_src / (ke_c_tgt + 1.E-19))) + if (ke_c_src < 1.5625 * ke_c_tgt) then + rescale_coef = sqrt(ke_c_src / ke_c_tgt) + else + rescale_coef = 1.25 + endif do k=1,nz v_tgt(k) = v_bt + rescale_coef * (v_tgt(k) - v_bt) enddo @@ -1250,7 +1258,7 @@ subroutine ALE_remap_velocities(CS, G, GV, h_old_u, h_old_v, h_new_u, h_new_v, u do k=1,nz v2h_tot = v2h_tot + h2(k) * (v_tgt(k)**2) enddo - dv2h_tot(I,j) = GV%H_to_RZ * v2h_tot * I_dt + dv2h_tot(I,j) = v2h_tot * I_dt endif if ((CS%BBL_h_vel_mask > 0.0) .and. (CS%h_vel_mask > 0.0)) then