Skip to content

Commit

Permalink
added patch pointer protections in spitfire to accomodate instances w…
Browse files Browse the repository at this point in the history
…here only the bareground nocomp patch exists
  • Loading branch information
rgknox committed Dec 10, 2024
1 parent 6798251 commit 4bdf4c2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fire/SFMainMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ subroutine UpdateFireWeather(currentSite, bc_in)
currentPatch => currentSite%oldest_patch

! If the oldest patch is a bareground patch (i.e. nocomp mode is on) use the first vegetated patch
! for the iofp index (i.e. the next younger patch)
if (currentPatch%nocomp_pft_label == nocomp_bareground) then
! for the iofp index (i.e. the next younger patch). But, its possible that there is
! 100% bareground fraction and no other patches.
if (currentPatch%nocomp_pft_label == nocomp_bareground .and. associated(currentPatch%younger) ) then
currentPatch => currentPatch%younger
endif

Expand Down Expand Up @@ -501,7 +502,7 @@ subroutine area_burnt_intensity ( currentSite, bc_in )

! If the oldest patch is a bareground patch (i.e. nocomp mode is on) use the first vegetated patch
! for the iofp index (i.e. the next younger patch)
if(currentPatch%nocomp_pft_label .eq. nocomp_bareground)then
if(currentPatch%nocomp_pft_label .eq. nocomp_bareground .and. associated(currentPatch%younger))then
currentPatch => currentPatch%younger
endif

Expand Down

0 comments on commit 4bdf4c2

Please sign in to comment.