From ad7d186f30b0b68670feceb4f0acd882441d2983 Mon Sep 17 00:00:00 2001 From: Denise Worthen Date: Mon, 13 Jan 2020 16:00:24 -0500 Subject: [PATCH] Allow debug mode in coupled app * remove divide by zero in cap for both CMEPS and NEMS * update Macros.Linux.NEMS.cheyenne and Macros.Linux.NEMS.hera to optionally set DEBUG=Y * add -link_mpi=dbg to FFLAGS_DEBUG for hera and cheyenne --- lanl_cice/bld/Macros.Linux.NEMS.cheyenne | 12 ++++++++++-- lanl_cice/bld/Macros.Linux.NEMS.hera | 12 ++++++++++-- lanl_cice/source/ice_therm_itd.F90 | 4 ++-- lanl_cice_cap/cice_cap.F90 | 2 ++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/lanl_cice/bld/Macros.Linux.NEMS.cheyenne b/lanl_cice/bld/Macros.Linux.NEMS.cheyenne index 6e928b7..1145144 100644 --- a/lanl_cice/bld/Macros.Linux.NEMS.cheyenne +++ b/lanl_cice/bld/Macros.Linux.NEMS.cheyenne @@ -4,16 +4,24 @@ # For use with intel compiler with MPT #============================================================================== +DEBUG = + CPP := fpp CPPDEFS := -DFORTRANUNDERSCORE -DNO_R16 -DHAVE_F2008_CONTIGUOUS -DLINUX -DCPRINTEL -DCICE_NEMS CFLAGS := -c -O2 -fp-model precise -xHost FIXEDFLAGS := -132 FREEFLAGS := -FR -#FFLAGS := -g -O0 -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost -I$(NETCDF)/include -FFLAGS := -O2 -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost -I$(NETCDF)/include +FFLAGS_DEBUG := -g -O0 -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -link_mpi=dbg -xHost -I$(NETCDF)/include +FFLAGS_OPT := -O2 -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost -I$(NETCDF)/include FFLAGS_NOOPT:= -O0 +ifdef DEBUG +FFLAGS += $(FFLAGS_DEBUG) +else +FFLAGS += $(FFLAGS_OPT) +endif + ifeq ($(COMMDIR), mpi) FC := mpif90 -f90=ifort else diff --git a/lanl_cice/bld/Macros.Linux.NEMS.hera b/lanl_cice/bld/Macros.Linux.NEMS.hera index ab03276..5dab64c 100644 --- a/lanl_cice/bld/Macros.Linux.NEMS.hera +++ b/lanl_cice/bld/Macros.Linux.NEMS.hera @@ -4,14 +4,16 @@ # For use with intel compiler with IntelMPI #============================================================================== +DEBUG= + CPP := fpp CPPDEFS := -DFORTRANUNDERSCORE -DNO_R16 -DHAVE_F2008_CONTIGUOUS -DLINUX -DCPRINTEL -DCICE_NEMS CFLAGS := -c -O2 -fp-model precise -xHost FIXEDFLAGS := -132 FREEFLAGS := -FR -#FFLAGS := -g -O0 -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost -I$(NETCDF)/include -FFLAGS := -O2 -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost -I$(NETCDF)/include +FFLAGS_DEBUG := -g -O0 -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -link_mpi=dbg -xHost -I$(NETCDF)/include +FFLAGS_OPT := -O2 -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost -I$(NETCDF)/include FFLAGS_NOOPT:= -O0 ifeq ($(COMMDIR), mpi) @@ -20,6 +22,12 @@ else FC := ifort endif +ifdef DEBUG +FFLAGS += $(FFLAGS_DEBUG) +else +FFLAGS += $(FFLAGS_OPT) +endif + MPICC:= mpiicc MPIFC:= mpiifort diff --git a/lanl_cice/source/ice_therm_itd.F90 b/lanl_cice/source/ice_therm_itd.F90 index fa762a4..d9fd5e0 100644 --- a/lanl_cice/source/ice_therm_itd.F90 +++ b/lanl_cice/source/ice_therm_itd.F90 @@ -346,7 +346,8 @@ subroutine linear_itd (nx_block, ny_block, & j = indxj(ij) if (hicen_init(ij,n) > puny .and. & - hicen_init(ij,n+1) > puny) then + hicen_init(ij,n+1) > puny .and. & + hicen_init(ij,n+1) - hicen_init(ij,n) > puny) then ! interpolate between adjacent category growth rates slope = (dhicen(ij,n+1) - dhicen(ij,n)) / & (hicen_init(ij,n+1) - hicen_init(ij,n)) @@ -677,7 +678,6 @@ subroutine linear_itd (nx_block, ny_block, & l_stop, & istop, jstop) - ! maintain qsno negative definiteness do n = 1, ncat do k = nt_qsno, nt_qsno+nslyr-1 diff --git a/lanl_cice_cap/cice_cap.F90 b/lanl_cice_cap/cice_cap.F90 index dce4f86..a8304f1 100644 --- a/lanl_cice_cap/cice_cap.F90 +++ b/lanl_cice_cap/cice_cap.F90 @@ -1072,6 +1072,7 @@ subroutine ModelAdvance_slow(gcomp, rc) j1 = j - jlo + 1 #ifdef CMEPS rhoa (i,j,iblk) = dataPtr_rhoabot(i1,j1) ! import directly from mediator + if(dataPtr_pbot(i1,j1) .gt. 0.0) & potT (i,j,iblk) = dataPtr_Tbot (i1,j1) * (100000./dataPtr_pbot(i1,j1))**0.286 ! Potential temperature (K) Tair (i,j,iblk) = dataPtr_Tbot (i1,j1) ! near surface temp, maybe lowest level (K) Qa (i,j,iblk) = dataPtr_qbot (i1,j1) ! near surface humidity, maybe lowest level (kg/kg) @@ -1096,6 +1097,7 @@ subroutine ModelAdvance_slow(gcomp, rc) ss_tlty(i,j,iblk) = dataPtr_sssm (i1,j1) #else rhoa (i,j,iblk) = dataPtr_rhoabot(i1,j1,iblk) ! import directly from mediator + if(dataPtr_pbot(i1,j1,iblk) .gt. 0.0) & potT (i,j,iblk) = dataPtr_Tbot (i1,j1,iblk) * (100000./dataPtr_pbot(i1,j1,iblk))**0.286 ! Potential temperature (K) Tair (i,j,iblk) = dataPtr_Tbot (i1,j1,iblk) ! near surface temp, maybe lowest level (K) Qa (i,j,iblk) = dataPtr_qbot (i1,j1,iblk) ! near surface humidity, maybe lowest level (kg/kg)