From ed46c3cc085c6781d73b94ec4e1932ad24c5f22c Mon Sep 17 00:00:00 2001 From: Matthew Harrison Date: Tue, 23 Feb 2021 13:31:36 -0500 Subject: [PATCH 1/3] *Bugfix for ALE sponges (pass non-zero target thickness to remapping) - this addresses a bug in the apply_ALE_sponge routine which had been passing zero values to the remapping routine for the target grid thicknesses. --- src/parameterizations/vertical/MOM_ALE_sponge.F90 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/parameterizations/vertical/MOM_ALE_sponge.F90 b/src/parameterizations/vertical/MOM_ALE_sponge.F90 index fe6072681c..3f15101956 100644 --- a/src/parameterizations/vertical/MOM_ALE_sponge.F90 +++ b/src/parameterizations/vertical/MOM_ALE_sponge.F90 @@ -961,11 +961,14 @@ subroutine apply_ALE_sponge(h, dt, G, GV, US, CS, Time) I1pdamp = 1.0 / (1.0 + damp) tmp_val2(1:nz_data) = CS%Ref_val(m)%p(1:nz_data,c) if (CS%time_varying_sponges) then + call remapping_core_h(CS%remap_cs, nz_data, CS%Ref_val(m)%h(1:nz_data,c), tmp_val2, & - CS%nz, h_col, tmp_val1, h_neglect, h_neglect_edge) + CS%nz, h(i,j,:), tmp_val1, h_neglect, h_neglect_edge) + print *,'calling remapping_core_h',h(i,j,:),tmp_val2(:),tmp_val1(:) else call remapping_core_h(CS%remap_cs, nz_data, CS%Ref_h%p(1:nz_data,c), tmp_val2, & - CS%nz, h_col, tmp_val1, h_neglect, h_neglect_edge) + CS%nz, h(i,j,:), tmp_val1, h_neglect, h_neglect_edge) + print *,'Calling remapping_core_h',h(i,j,1),tmp_val1(1) endif !Backward Euler method if (CS%id_sp_tendency(m) > 0) tmp(i,j,1:nz) = CS%var(m)%p(i,j,1:nz) From 5e8289eced41005f817a0e79208fd195af319390 Mon Sep 17 00:00:00 2001 From: Matthew Harrison Date: Tue, 23 Feb 2021 13:46:41 -0500 Subject: [PATCH 2/3] cleanup --- src/parameterizations/vertical/MOM_ALE_sponge.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/parameterizations/vertical/MOM_ALE_sponge.F90 b/src/parameterizations/vertical/MOM_ALE_sponge.F90 index 3f15101956..14578acaeb 100644 --- a/src/parameterizations/vertical/MOM_ALE_sponge.F90 +++ b/src/parameterizations/vertical/MOM_ALE_sponge.F90 @@ -964,11 +964,9 @@ subroutine apply_ALE_sponge(h, dt, G, GV, US, CS, Time) call remapping_core_h(CS%remap_cs, nz_data, CS%Ref_val(m)%h(1:nz_data,c), tmp_val2, & CS%nz, h(i,j,:), tmp_val1, h_neglect, h_neglect_edge) - print *,'calling remapping_core_h',h(i,j,:),tmp_val2(:),tmp_val1(:) else call remapping_core_h(CS%remap_cs, nz_data, CS%Ref_h%p(1:nz_data,c), tmp_val2, & CS%nz, h(i,j,:), tmp_val1, h_neglect, h_neglect_edge) - print *,'Calling remapping_core_h',h(i,j,1),tmp_val1(1) endif !Backward Euler method if (CS%id_sp_tendency(m) > 0) tmp(i,j,1:nz) = CS%var(m)%p(i,j,1:nz) From 904896698f39ca35454412e37edf6da8daa6faca Mon Sep 17 00:00:00 2001 From: Matthew Harrison Date: Tue, 23 Feb 2021 14:03:23 -0500 Subject: [PATCH 3/3] avoid implicit copy of h in call to remapping --- src/parameterizations/vertical/MOM_ALE_sponge.F90 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/parameterizations/vertical/MOM_ALE_sponge.F90 b/src/parameterizations/vertical/MOM_ALE_sponge.F90 index 14578acaeb..ce6dab906f 100644 --- a/src/parameterizations/vertical/MOM_ALE_sponge.F90 +++ b/src/parameterizations/vertical/MOM_ALE_sponge.F90 @@ -960,13 +960,16 @@ subroutine apply_ALE_sponge(h, dt, G, GV, US, CS, Time) damp = dt * CS%Iresttime_col(c) I1pdamp = 1.0 / (1.0 + damp) tmp_val2(1:nz_data) = CS%Ref_val(m)%p(1:nz_data,c) + do k=1,nz + h_col(k)=h(i,j,k) + enddo if (CS%time_varying_sponges) then call remapping_core_h(CS%remap_cs, nz_data, CS%Ref_val(m)%h(1:nz_data,c), tmp_val2, & - CS%nz, h(i,j,:), tmp_val1, h_neglect, h_neglect_edge) + CS%nz, h_col, tmp_val1, h_neglect, h_neglect_edge) else call remapping_core_h(CS%remap_cs, nz_data, CS%Ref_h%p(1:nz_data,c), tmp_val2, & - CS%nz, h(i,j,:), tmp_val1, h_neglect, h_neglect_edge) + CS%nz, h_col, tmp_val1, h_neglect, h_neglect_edge) endif !Backward Euler method if (CS%id_sp_tendency(m) > 0) tmp(i,j,1:nz) = CS%var(m)%p(i,j,1:nz)