From 29d944db60f3422442a004efed6b4487f58a89f1 Mon Sep 17 00:00:00 2001 From: Robert Hallberg Date: Thu, 6 Jun 2024 18:42:20 -0400 Subject: [PATCH] (*)Fix bug in rotate_ALE_sponge for fixed sponges Corrected a bug in rotate_ALE_sponge that incorrectly set the starting number of sponge fields that prevented any cases with fixed ALE sponges from working when ROTATE_INDEX is true, even if INDEX_TURNS is 0. With this correction, the code is now working (and giving identical answers) with rotation enabled for cases with fixed ALE_sponges. All answers are bitwise identical in cases that worked before, but some cases that did not work at all are now working both with and without grid rotation. --- src/parameterizations/vertical/MOM_ALE_sponge.F90 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/parameterizations/vertical/MOM_ALE_sponge.F90 b/src/parameterizations/vertical/MOM_ALE_sponge.F90 index f1739485d6..5e041a6739 100644 --- a/src/parameterizations/vertical/MOM_ALE_sponge.F90 +++ b/src/parameterizations/vertical/MOM_ALE_sponge.F90 @@ -1303,11 +1303,13 @@ subroutine rotate_ALE_sponge(sponge_in, G_in, sponge, G, GV, US, turns, param_fi ! Second part: Provide rotated fields for which relaxation is applied - sponge%fldno = sponge_in%fldno - if (fixed_sponge) then allocate(sp_val_in(G_in%isd:G_in%ied, G_in%jsd:G_in%jed, nz_data)) allocate(sp_val(G%isd:G%ied, G%jsd:G%jed, nz_data)) + ! For a fixed sponge, sponge%fldno is incremented from 0 in the calls to set_up_ALE_sponge_field. + sponge%fldno = 0 + else + sponge%fldno = sponge_in%fldno endif do n=1,sponge_in%fldno @@ -1360,8 +1362,7 @@ subroutine rotate_ALE_sponge(sponge_in, G_in, sponge, G, GV, US, turns, param_fi ! TODO: var_u and var_v sponge damping is not yet supported. if (associated(sponge_in%var_u%p) .or. associated(sponge_in%var_v%p)) & - call MOM_error(FATAL, "Rotation of ALE sponge velocities is not yet " & - // "implemented.") + call MOM_error(FATAL, "Rotation of ALE sponge velocities is not yet implemented.") ! Transfer any existing diag_CS reference pointer sponge%diag => sponge_in%diag