Skip to content

Commit

Permalink
add bounds checking on bendresist and vegshape parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
rfiorella committed Jun 15, 2024
1 parent 489ae8a commit 5252fa8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/elm/src/main/pftvarcon.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,15 @@ subroutine pftconrd
if (.not. readv ) bendresist(:) = 1._r8
call ncd_io('vegshape', vegshape, 'read', ncid, readvar=readv, posNOTonfile=.true.)
if (.not. readv ) vegshape(:) = 1._r8
! check validity
do i = 0, npft -1
if (bendresist(i) .gt. 1.0_r8 .or. bendresist(i) .le. 0._r8) then
call endrun(msg="Non-physical selection of bendresist parameter, set between 0 and 1"//errMsg(__FILE__, __LINE__))
end if
if (vegshape(i) .gt. 2.0_r8 .or. vegshape(i) .le. 0_r8) then
call endrun(msg="Non-physical selection of vegshape parameter, set between 0 and 2"//errMsg(__FILE__, __LINE__))
end if
end do
call ncd_io('stocking', stocking, 'read', ncid, readvar=readv, posNOTonfile=.true.)
if (.not. readv ) stocking(:) = 1000._r8
call ncd_io('taper', taper, 'read', ncid, readvar=readv, posNOTonfile=.true.)
Expand Down

0 comments on commit 5252fa8

Please sign in to comment.