From 843d3b69755c4f688c5fa39c6500b4e1a55158a7 Mon Sep 17 00:00:00 2001 From: Ian Grooms Date: Thu, 10 Oct 2024 14:26:14 -0600 Subject: [PATCH 1/6] Fix units and dimensional consistency --- src/ALE/MOM_ALE.F90 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/ALE/MOM_ALE.F90 b/src/ALE/MOM_ALE.F90 index 3a4934676d..4bbc3d4420 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 @@ -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 From bc3923df3cbebbec1a9ffcd27273a5301f6401d3 Mon Sep 17 00:00:00 2001 From: alperaltuntas Date: Wed, 16 Oct 2024 13:04:37 -0600 Subject: [PATCH 2/6] attempt answer change fix --- 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 4bbc3d4420..55dd9be913 100644 --- a/src/ALE/MOM_ALE.F90 +++ b/src/ALE/MOM_ALE.F90 @@ -1172,10 +1172,14 @@ 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 - if (ke_c_src < 1.5625 * ke_c_tgt) then - rescale_coef = sqrt(ke_c_src / ke_c_tgt) + if (answer_date >= 20241016) then + 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 else - rescale_coef = 1.25 + rescale_coef = min(1.25, sqrt(ke_c_src / (ke_c_tgt + 1.E-19))) endif do k=1,nz u_tgt(k) = u_bt + rescale_coef * (u_tgt(k) - u_bt) @@ -1244,10 +1248,14 @@ 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 - if (ke_c_src < 1.5625 * ke_c_tgt) then - rescale_coef = sqrt(ke_c_src / ke_c_tgt) + if (answer_date >= 20241016) then + 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 else - rescale_coef = 1.25 + rescale_coef = min(1.25, sqrt(ke_c_src / (ke_c_tgt + 1.E-19))) endif do k=1,nz v_tgt(k) = v_bt + rescale_coef * (v_tgt(k) - v_bt) From 4e833ff6f1b0ad0d7549759cad47b3bfb1c25a7b Mon Sep 17 00:00:00 2001 From: alperaltuntas Date: Wed, 16 Oct 2024 13:08:46 -0600 Subject: [PATCH 3/6] fix typo... --- src/ALE/MOM_ALE.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ALE/MOM_ALE.F90 b/src/ALE/MOM_ALE.F90 index 55dd9be913..bd78e932f7 100644 --- a/src/ALE/MOM_ALE.F90 +++ b/src/ALE/MOM_ALE.F90 @@ -1172,7 +1172,7 @@ 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 - if (answer_date >= 20241016) then + if (CS%answer_date >= 20241016) then if (ke_c_src < 1.5625 * ke_c_tgt) then rescale_coef = sqrt(ke_c_src / ke_c_tgt) else @@ -1248,7 +1248,7 @@ 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 - if (answer_date >= 20241016) then + if (CS%answer_date >= 20241016) then if (ke_c_src < 1.5625 * ke_c_tgt) then rescale_coef = sqrt(ke_c_src / ke_c_tgt) else From eb2bcca2abc56c5ba491461ac45565935489d484 Mon Sep 17 00:00:00 2001 From: alperaltuntas Date: Wed, 16 Oct 2024 14:42:23 -0600 Subject: [PATCH 4/6] Revert "fix typo..." This reverts commit 4e833ff6f1b0ad0d7549759cad47b3bfb1c25a7b. --- src/ALE/MOM_ALE.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ALE/MOM_ALE.F90 b/src/ALE/MOM_ALE.F90 index bd78e932f7..55dd9be913 100644 --- a/src/ALE/MOM_ALE.F90 +++ b/src/ALE/MOM_ALE.F90 @@ -1172,7 +1172,7 @@ 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 - if (CS%answer_date >= 20241016) then + if (answer_date >= 20241016) then if (ke_c_src < 1.5625 * ke_c_tgt) then rescale_coef = sqrt(ke_c_src / ke_c_tgt) else @@ -1248,7 +1248,7 @@ 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 - if (CS%answer_date >= 20241016) then + if (answer_date >= 20241016) then if (ke_c_src < 1.5625 * ke_c_tgt) then rescale_coef = sqrt(ke_c_src / ke_c_tgt) else From 9e96bd48de743d58bfcd4ff2f355e4fe68d9043e Mon Sep 17 00:00:00 2001 From: alperaltuntas Date: Wed, 16 Oct 2024 14:42:39 -0600 Subject: [PATCH 5/6] Revert "attempt answer change fix" This reverts commit bc3923df3cbebbec1a9ffcd27273a5301f6401d3. --- src/ALE/MOM_ALE.F90 | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/ALE/MOM_ALE.F90 b/src/ALE/MOM_ALE.F90 index 55dd9be913..4bbc3d4420 100644 --- a/src/ALE/MOM_ALE.F90 +++ b/src/ALE/MOM_ALE.F90 @@ -1172,14 +1172,10 @@ 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 - if (answer_date >= 20241016) then - 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 + if (ke_c_src < 1.5625 * ke_c_tgt) then + rescale_coef = sqrt(ke_c_src / ke_c_tgt) else - rescale_coef = min(1.25, sqrt(ke_c_src / (ke_c_tgt + 1.E-19))) + rescale_coef = 1.25 endif do k=1,nz u_tgt(k) = u_bt + rescale_coef * (u_tgt(k) - u_bt) @@ -1248,14 +1244,10 @@ 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 - if (answer_date >= 20241016) then - 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 + if (ke_c_src < 1.5625 * ke_c_tgt) then + rescale_coef = sqrt(ke_c_src / ke_c_tgt) else - rescale_coef = min(1.25, sqrt(ke_c_src / (ke_c_tgt + 1.E-19))) + rescale_coef = 1.25 endif do k=1,nz v_tgt(k) = v_bt + rescale_coef * (v_tgt(k) - v_bt) From a126d01e7653503cf8b9170ca146ee733a0a69a4 Mon Sep 17 00:00:00 2001 From: alperaltuntas Date: Wed, 16 Oct 2024 14:43:36 -0600 Subject: [PATCH 6/6] take 2 --- src/ALE/MOM_ALE.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ALE/MOM_ALE.F90 b/src/ALE/MOM_ALE.F90 index 4bbc3d4420..d63f966db0 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=GV%H_to_kg_m2 * US%L_T_to_m_s**2 * US%s_to_T) + 'W m-2', conversion=US%RZ3_T3_to_W_m2 * US%L_to_Z**2) 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=GV%H_to_kg_m2 * US%L_T_to_m_s**2 * US%s_to_T) + 'W m-2', conversion=US%RZ3_T3_to_W_m2 * US%L_to_Z**2) end subroutine ALE_register_diags