From 79fb219b1f0882d098aeff5e6364398fcdcc6ef6 Mon Sep 17 00:00:00 2001 From: Adrianna Foster Date: Wed, 11 Dec 2024 09:30:12 -0700 Subject: [PATCH 1/6] initial fix --- biogeochem/EDPatchDynamicsMod.F90 | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index 9b02c9e14a..a9734a0a56 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -767,10 +767,6 @@ 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) @@ -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 @@ -1922,7 +1917,8 @@ end subroutine set_patchno subroutine TransLitterNewPatch(currentSite, & currentPatch, & newPatch, & - patch_site_areadis) + patch_site_areadis, & + dist_type) ! ----------------------------------------------------------------------------------- ! @@ -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 @@ -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 @@ -2078,13 +2076,19 @@ subroutine TransLitterNewPatch(currentSite, & end if do c = 1,ncwd + + if (dist_type == dtype_ifall .and. currentPatch%fire == 1) then + frac_burnt = currentPatch%fuel%frac_burnt(c) + else + frac_burnt = 0.0_r8 + end if ! 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 @@ -2100,15 +2104,22 @@ subroutine TransLitterNewPatch(currentSite, & end do enddo + + if (dist_type == dtype_ifall .and. currentPatch%fire == 1) then + frac_burnt = currentPatch%fuel%frac_burnt(fuel_classes%dead_leaves()) + else + frac_burnt = 0.0_r8 + end if + 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 From e04e140cc4527fb8e60cc34558f05c728dbd2339 Mon Sep 17 00:00:00 2001 From: Adrianna Foster Date: Wed, 11 Dec 2024 09:57:40 -0700 Subject: [PATCH 2/6] add idisttype --- biogeochem/EDPatchDynamicsMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index a9734a0a56..b7df2fb413 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -769,7 +769,7 @@ subroutine spawn_patches( currentSite, bc_in) 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) @@ -1719,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 From f5119a37e88edea4b33d1a1c2257e13bc1f81cb4 Mon Sep 17 00:00:00 2001 From: Adrianna Foster Date: Wed, 11 Dec 2024 10:02:56 -0700 Subject: [PATCH 3/6] fix typo --- biogeochem/EDPatchDynamicsMod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index b7df2fb413..38b9eba45e 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -2077,7 +2077,7 @@ subroutine TransLitterNewPatch(currentSite, & do c = 1,ncwd - if (dist_type == dtype_ifall .and. currentPatch%fire == 1) then + if (dist_type == dtype_ifire .and. currentPatch%fire == 1) then frac_burnt = currentPatch%fuel%frac_burnt(c) else frac_burnt = 0.0_r8 @@ -2105,7 +2105,7 @@ subroutine TransLitterNewPatch(currentSite, & enddo - if (dist_type == dtype_ifall .and. currentPatch%fire == 1) then + 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 From 8e919983bdc807700374d497d44f6afdef6aec6a Mon Sep 17 00:00:00 2001 From: Adrianna Foster Date: Wed, 11 Dec 2024 11:54:25 -0700 Subject: [PATCH 4/6] zero frac_burnt at top of fire mod --- fire/SFMainMod.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/fire/SFMainMod.F90 b/fire/SFMainMod.F90 index 97bbcb6d54..03b06aaba5 100644 --- a/fire/SFMainMod.F90 +++ b/fire/SFMainMod.F90 @@ -71,6 +71,7 @@ subroutine fire_model(currentSite, bc_in) do while(associated(currentPatch)) currentPatch%frac_burnt = 0.0_r8 currentPatch%fire = 0 + currentPatch%fuel%frac_burnt(:) = 0.0_r8 currentPatch => currentPatch%older end do From 4c565cc1ceba6b1a9d26372d22de8cddd7800689 Mon Sep 17 00:00:00 2001 From: Adrianna Foster Date: Wed, 11 Dec 2024 13:52:40 -0700 Subject: [PATCH 5/6] suggested changes --- biogeochem/EDPatchDynamicsMod.F90 | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index 38b9eba45e..75173d200d 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -2074,13 +2074,11 @@ subroutine TransLitterNewPatch(currentSite, & litter_stock0 = curr_litt%GetTotalLitterMass()*currentPatch%area + & new_litt%GetTotalLitterMass()*newPatch%area end if - + do c = 1,ncwd - + frac_burnt = 0.0_r8 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 ! Transfer above ground CWD @@ -2105,13 +2103,11 @@ subroutine TransLitterNewPatch(currentSite, & enddo + frac_burnt = 0.0_r8 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 - - + do dcmpy=1,ndcmpy ! Transfer leaf fines From f11b673837aecdec614f7a1a38c55666cda25d16 Mon Sep 17 00:00:00 2001 From: Adrianna Foster Date: Mon, 16 Dec 2024 14:54:38 -0700 Subject: [PATCH 6/6] remove zero of frac_burnt in split_patch --- biogeochem/EDPatchDynamicsMod.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/biogeochem/EDPatchDynamicsMod.F90 b/biogeochem/EDPatchDynamicsMod.F90 index 75173d200d..da979d87cc 100644 --- a/biogeochem/EDPatchDynamicsMod.F90 +++ b/biogeochem/EDPatchDynamicsMod.F90 @@ -1721,8 +1721,6 @@ subroutine split_patch(currentSite, currentPatch, new_patch, fraction_to_keep, a call TransLitterNewPatch( currentSite, currentPatch, new_patch, temp_area, 0) - currentPatch%fuel%frac_burnt(:) = 0._r8 - ! Next, we loop through the cohorts in the donor patch, copy them with ! area modified number density into the new-patch, and apply survivorship. ! -------------------------------------------------------------------------