From 929008764c78d2538c45a2b1aa88770129515fed Mon Sep 17 00:00:00 2001 From: Philippe Blain Date: Mon, 23 Oct 2023 09:17:19 -0400 Subject: [PATCH] ice_dyn_evp: pass 'grid_location' for LKD seabed stress on C grid When the C grid support was added in 078aab48 (Merge cgridDEV branch including C grid implementation and other fixes (#715), 2022-05-10), subroutine ice_dyn_shared::seabed_stress_factor_LKD gained a 'grid_location' optional argument to indicate where to compute intermediate quantities and the seabed stress itself (originally added in 0f9f48b9 (ice_dyn_shared: add optional 'grid_location' argument to seabed_stress_factor_LKD, 2021-11-17)). This argument was however forgotten in ice_dyn_evp::evp when this subroutine was adapted for the C grid in 48c07c66 (ice_dyn_evp: compute seabed stress factor at CD-grid locations, 2021-11-17), such that currently the seabed stress is not computed at the correct grid location for the C and CD grids. Fix that by correctly passing the 'grid_location' argument. Note that the dummy argument is incorrectly declared as 'intent(inout)' in the subroutine, so change that to 'intent(in)' so we can pass in character constants. Closes: https://github.com/CICE-Consortium/CICE/issues/891 --- cicecore/cicedyn/dynamics/ice_dyn_evp.F90 | 6 ++++-- cicecore/cicedyn/dynamics/ice_dyn_shared.F90 | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cicecore/cicedyn/dynamics/ice_dyn_evp.F90 b/cicecore/cicedyn/dynamics/ice_dyn_evp.F90 index cf111cccf..a24c8f57d 100644 --- a/cicecore/cicedyn/dynamics/ice_dyn_evp.F90 +++ b/cicecore/cicedyn/dynamics/ice_dyn_evp.F90 @@ -763,12 +763,14 @@ subroutine evp (dt) icellE (iblk), & indxEi (:,iblk), indxEj(:,iblk), & vice (:,:,iblk), aice(:,:,iblk), & - hwater(:,:,iblk), TbE (:,:,iblk)) + hwater(:,:,iblk), TbE (:,:,iblk), & + grid_location='E') call seabed_stress_factor_LKD (nx_block , ny_block, & icellN (iblk), & indxNi (:,iblk), indxNj(:,iblk), & vice (:,:,iblk), aice(:,:,iblk), & - hwater(:,:,iblk), TbN (:,:,iblk)) + hwater(:,:,iblk), TbN (:,:,iblk), & + grid_location='N') enddo !$OMP END PARALLEL DO diff --git a/cicecore/cicedyn/dynamics/ice_dyn_shared.F90 b/cicecore/cicedyn/dynamics/ice_dyn_shared.F90 index 50f1aae6e..69e552730 100644 --- a/cicecore/cicedyn/dynamics/ice_dyn_shared.F90 +++ b/cicecore/cicedyn/dynamics/ice_dyn_shared.F90 @@ -1289,7 +1289,7 @@ subroutine seabed_stress_factor_LKD (nx_block, ny_block, & real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: & TbU ! seabed stress factor at 'grid_location' (N/m^2) - character(len=*), optional, intent(inout) :: & + character(len=*), optional, intent(in) :: & grid_location ! grid location (U, E, N), U assumed if not present real (kind=dbl_kind) :: &