Skip to content

Commit

Permalink
add checks for sensible sason index and wesley vegetation type in drydep
Browse files Browse the repository at this point in the history
  • Loading branch information
rosiealice committed Oct 14, 2024
1 parent 2e2ec4e commit 2e4293d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/biogeochem/DryDepVelocity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,15 @@ subroutine depvel_compute( bounds, &
if(patch%is_fates(pi))then
wesveg = canopystate_inst%wesley_veg_index_patch(pi)
else
wesveg = 8
wesveg = 8 !make bare ground for non-fates patches. Some of these are overwritten below.
endif
endif

if(wesveg<0 .or. wesveg>1 )then
call endrun(subgrid_index=pi, subgrid_level=subgrid_level_patch, &
msg='ERROR: No sensible Wesley vegetation type'//&
errMsg(sourcefile, __LINE__))
endif
! create seasonality index used to index wesely data tables from LAI, Bascially
!if elai is between max lai from input data and half that max the index_season=1

Expand All @@ -385,11 +390,12 @@ subroutine depvel_compute( bounds, &
! 4 - Winter, snow on ground and subfreezing
! 5 - Transitional spring with partially green short annuals

if(.not. use_fates)then
if(.not. use_fates)then !for non-FATES runs we use satellite phenology to choose the season for the ressistance parameters.
!mlaidiff=jan-feb
minlai=minval(annlai(:,pi))
maxlai=maxval(annlai(:,pi))
endif
endif

index_season = -1

if ( lun%itype(l) /= istsoil )then
Expand All @@ -412,11 +418,11 @@ subroutine depvel_compute( bounds, &
index_season = 1
endif

if(use_fates.and.index_season<1)then
if(use_fates.and.index_season<1)then
if(patch%is_fates(pi))then
index_season = canopystate_inst%wesley_season_index_patch(pi)
else
index_season = 1 !set arbitrary seson for bare ground.
index_season = 2 !set intermediate spring seson for bare ground. (as for urban)
endif

else ! not fates
Expand All @@ -439,7 +445,7 @@ subroutine depvel_compute( bounds, &

endif ! use_fates

if (index_season<0) then
if (index_season<0.or.index_season>5) then
call endrun('ERROR: not able to determine season'//errmsg(sourcefile, __LINE__))
endif

Expand Down

0 comments on commit 2e4293d

Please sign in to comment.