Skip to content

Commit f5a16d1

Browse files
Use ieee intrinsics to avoid trapping ieee_inexact signals
1 parent 9cfdf01 commit f5a16d1

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

components/elm/src/biogeophys/SoilStateType.F90

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ subroutine InitCold(this, bounds)
331331
use SharedParamsMod , only : ParamsShareInst
332332
use FuncPedotransferMod , only : pedotransf, get_ipedof
333333
use RootBiophysMod , only : init_vegrootfr
334+
use, intrinsic :: ieee_exceptions
334335
!
335336
! !ARGUMENTS:
336337
class(soilstate_type) :: this
@@ -468,10 +469,11 @@ subroutine InitCold(this, bounds)
468469
! Try to read soil information from the file.
469470
call ncd_io(ncid=ncid, varname='ZSOI', flag='read', data=zsoifl, dim1name=grlnd, readvar=readvar)
470471
if (.not. readvar ) then
471-
! Variable ZSOI not found, use the ELM parameters.
472-
do j = 1, nlevsoifl
473-
zsoifl(j) = scalez*(exp(zecoeff*(j-0.5_r8))-1._r8) !node depths
474-
end do
472+
call ieee_set_flag(ieee_all,.false.)
473+
call ieee_set_halting_mode(ieee_inexact, .false.)
474+
do j = 1, nlevgrnd
475+
zsoi(j) = scalez*(exp(zecoeff*(dble(j)-0.5_r8))-1._r8) !node depths
476+
enddo
475477
end if
476478

477479
dzsoifl(1) = 0.5_r8*(zsoifl(1)+zsoifl(2)) !thickness b/n two interfaces

components/elm/src/main/initVerticalMod.F90

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module initVerticalMod
4444

4545
!------------------------------------------------------------------------
4646
subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
47+
use, intrinsic :: ieee_exceptions
4748
!
4849
! !ARGUMENTS:
4950
type(bounds_type) , intent(in) :: bounds
@@ -170,8 +171,11 @@ subroutine initVertical(bounds, snow_depth, thick_wall, thick_roof)
170171
! Soil layers not available from the input, and no additional layers needed. Use the
171172
! default soil thickness settings.
172173
! -----------------------------------------------------------------
174+
call ieee_set_flag(ieee_all,.false.)
175+
call ieee_set_halting_mode(ieee_inexact, .false.)
176+
173177
do j = 1, nlevgrnd
174-
zsoi(j) = scalez*(exp(zecoeff*(j-0.5_r8))-1._r8) !node depths
178+
zsoi(j) = scalez*(exp(zecoeff*(dble(j)-0.5_r8))-1._r8) !node depths
175179
enddo
176180
end if
177181
deallocate(zsoi_in)

0 commit comments

Comments
 (0)