Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't zero out patch%fuel%frac_burnt() before we use it #1302

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -767,13 +767,9 @@ subroutine spawn_patches( currentSite, bc_in)
! and burned litter to atmosphere. Thus it is important to zero fuel%frac_burnt when
! fire is not the current disturbance regime.

if(i_disturbance_type .ne. dtype_ifire) then
currentPatch%fuel%frac_burnt(:) = 0._r8
end if

call CopyPatchMeansTimers(currentPatch, newPatch)

call TransLitterNewPatch( currentSite, currentPatch, newPatch, patch_site_areadis)
call TransLitterNewPatch( currentSite, currentPatch, newPatch, patch_site_areadis, i_disturbance_type)

! Transfer in litter fluxes from plants in various contexts of death and destruction
select case(i_disturbance_type)
Expand Down Expand Up @@ -1045,7 +1041,6 @@ subroutine spawn_patches( currentSite, bc_in)
! Some of of the leaf mass from living plants has been
! burned off. Here, we remove that mass, and
! tally it in the flux we sent to the atmosphere

if(prt_params%woody(currentCohort%pft) == itrue)then
leaf_burn_frac = currentCohort%fraction_crown_burned
else
Expand Down Expand Up @@ -1724,7 +1719,7 @@ subroutine split_patch(currentSite, currentPatch, new_patch, fraction_to_keep, a

call CopyPatchMeansTimers(currentPatch, new_patch)

call TransLitterNewPatch( currentSite, currentPatch, new_patch, temp_area)
call TransLitterNewPatch( currentSite, currentPatch, new_patch, temp_area, 0)

currentPatch%fuel%frac_burnt(:) = 0._r8

Expand Down Expand Up @@ -1922,7 +1917,8 @@ end subroutine set_patchno
subroutine TransLitterNewPatch(currentSite, &
currentPatch, &
newPatch, &
patch_site_areadis)
patch_site_areadis, &
dist_type)

! -----------------------------------------------------------------------------------
!
Expand Down Expand Up @@ -1971,6 +1967,7 @@ subroutine TransLitterNewPatch(currentSite, &
type(fates_patch_type) , intent(inout) :: newPatch ! New patch
real(r8) , intent(in) :: patch_site_areadis ! Area being donated
! by current patch
integer, intent(in) :: dist_type ! disturbance type


! locals
Expand All @@ -1993,6 +1990,7 @@ subroutine TransLitterNewPatch(currentSite, &
real(r8) :: litter_stock0,litter_stock1
real(r8) :: burn_flux0,burn_flux1
real(r8) :: error
real(r8) :: frac_burnt ! fraction burnt of current fuel type [0-1]

do el = 1,num_elements

Expand Down Expand Up @@ -2078,13 +2076,19 @@ subroutine TransLitterNewPatch(currentSite, &
end if

do c = 1,ncwd

if (dist_type == dtype_ifire .and. currentPatch%fire == 1) then
frac_burnt = currentPatch%fuel%frac_burnt(c)
else
frac_burnt = 0.0_r8
end if
adrifoster marked this conversation as resolved.
Show resolved Hide resolved

! Transfer above ground CWD
donatable_mass = curr_litt%ag_cwd(c) * patch_site_areadis * &
(1._r8 - currentPatch%fuel%frac_burnt(c))
(1._r8 - frac_burnt)

burned_mass = curr_litt%ag_cwd(c) * patch_site_areadis * &
currentPatch%fuel%frac_burnt(c)
frac_burnt

new_litt%ag_cwd(c) = new_litt%ag_cwd(c) + donatable_mass*donate_m2
curr_litt%ag_cwd(c) = curr_litt%ag_cwd(c) + donatable_mass*retain_m2
Expand All @@ -2100,15 +2104,22 @@ subroutine TransLitterNewPatch(currentSite, &
end do

enddo

if (dist_type == dtype_ifire .and. currentPatch%fire == 1) then
frac_burnt = currentPatch%fuel%frac_burnt(fuel_classes%dead_leaves())
else
frac_burnt = 0.0_r8
end if
adrifoster marked this conversation as resolved.
Show resolved Hide resolved


do dcmpy=1,ndcmpy

! Transfer leaf fines
donatable_mass = curr_litt%leaf_fines(dcmpy) * patch_site_areadis * &
(1._r8 - currentPatch%fuel%frac_burnt(fuel_classes%dead_leaves()))
(1._r8 - frac_burnt)

burned_mass = curr_litt%leaf_fines(dcmpy) * patch_site_areadis * &
currentPatch%fuel%frac_burnt(fuel_classes%dead_leaves())
frac_burnt

new_litt%leaf_fines(dcmpy) = new_litt%leaf_fines(dcmpy) + donatable_mass*donate_m2
curr_litt%leaf_fines(dcmpy) = curr_litt%leaf_fines(dcmpy) + donatable_mass*retain_m2
Expand Down