From f8e65ba6e9bcfecdee3ab12c7de5d9bc11f723b6 Mon Sep 17 00:00:00 2001 From: Alan Wallcraft Date: Thu, 31 Jul 2025 10:54:41 -0400 Subject: [PATCH] Fix frazil halo update bug when unallocated (#949) If FRAZIL=False tv%frazil is not allocated but its halo might still be updated in post_diabatic_halo_updates, which will fail. If FRAZIL=True, no answers are changed. If FRAZIL=False, no answers from before this bug was introduced are changed. --- src/core/MOM.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/MOM.F90 b/src/core/MOM.F90 index 531845cfdd..6e5a4b43d4 100644 --- a/src/core/MOM.F90 +++ b/src/core/MOM.F90 @@ -1966,7 +1966,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) + if (associated(tv%frazil) .and. (.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