From f6ff8f7c4d4cb6feabe3651b13204cf43fc948e3 Mon Sep 17 00:00:00 2001 From: Tony Craig Date: Fri, 17 Nov 2023 09:22:49 -0800 Subject: [PATCH] Update logical for optional argument wlat, caught with debug by gnu compiler (#477) --- columnphysics/icepack_therm_itd.F90 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/columnphysics/icepack_therm_itd.F90 b/columnphysics/icepack_therm_itd.F90 index 0606747a..047b921b 100644 --- a/columnphysics/icepack_therm_itd.F90 +++ b/columnphysics/icepack_therm_itd.F90 @@ -964,6 +964,7 @@ subroutine lateral_melt (dt, ncat, & bin1_arealoss, tmp ! logical (kind=log_kind) :: & + fsd_wlat, & ! .true. if wlat present and wlat > puny flag ! .true. if there could be lateral melting real (kind=dbl_kind), dimension (ncat) :: & @@ -1024,7 +1025,14 @@ subroutine lateral_melt (dt, ncat, & f_flx = c0 end if - if (tr_fsd .and. wlat > puny) then + ! fsd_wlat == if (tr_fsd .and. wlat > puny) + ! need fsd_wlat because wlat is optional + fsd_wlat = .false. + if (tr_fsd .and. present(wlat)) then + if (wlat > puny) fsd_wlat = .true. + endif + + if (fsd_wlat) then flag = .true. ! for FSD rside and fside not yet computed correctly, redo here