Skip to content

Commit

Permalink
Merge pull request #598 from rgknox/parteh-acnp-withlive
Browse files Browse the repository at this point in the history
Nutrient Enabled Aquisition (parteh pt 3)
  • Loading branch information
glemieux authored Sep 25, 2020
2 parents 61a751c + 2250857 commit 03a17bf
Show file tree
Hide file tree
Showing 45 changed files with 9,004 additions and 3,710 deletions.
22 changes: 10 additions & 12 deletions biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module EDCanopyStructureMod
use FatesConstantsMod , only : rsnbl_math_prec
use FatesGlobals , only : fates_log
use EDPftvarcon , only : EDPftvarcon_inst
use PRTParametersMod , only : prt_params
use FatesAllometryMod , only : carea_allom
use EDCohortDynamicsMod , only : copy_cohort, terminate_cohorts, fuse_cohorts
use EDCohortDynamicsMod , only : InitPRTObject
Expand Down Expand Up @@ -280,12 +281,12 @@ subroutine canopy_structure( currentSite , bc_in )
write(fates_log(),*) 'coh n:',currentCohort%n
write(fates_log(),*) 'coh carea:',currentCohort%c_area
ipft=currentCohort%pft
write(fates_log(),*) 'maxh:',EDPftvarcon_inst%allom_dbh_maxheight(ipft)
write(fates_log(),*) 'lmode: ',EDPftvarcon_inst%allom_lmode(ipft)
write(fates_log(),*) 'd2bl2: ',EDPftvarcon_inst%allom_d2bl2(ipft)
write(fates_log(),*) 'd2bl_ediff: ',EDPftvarcon_inst%allom_blca_expnt_diff(ipft)
write(fates_log(),*) 'd2ca_min: ',EDPftvarcon_inst%allom_d2ca_coefficient_min(ipft)
write(fates_log(),*) 'd2ca_max: ',EDPftvarcon_inst%allom_d2ca_coefficient_max(ipft)
write(fates_log(),*) 'maxh:',prt_params%allom_dbh_maxheight(ipft)
write(fates_log(),*) 'lmode: ',prt_params%allom_lmode(ipft)
write(fates_log(),*) 'd2bl2: ',prt_params%allom_d2bl2(ipft)
write(fates_log(),*) 'd2bl_ediff: ',prt_params%allom_blca_expnt_diff(ipft)
write(fates_log(),*) 'd2ca_min: ',prt_params%allom_d2ca_coefficient_min(ipft)
write(fates_log(),*) 'd2ca_max: ',prt_params%allom_d2ca_coefficient_max(ipft)
currentCohort => currentCohort%shorter
enddo
call endrun(msg=errMsg(sourcefile, __LINE__))
Expand Down Expand Up @@ -1223,7 +1224,7 @@ subroutine canopy_spread( currentSite )
do while (associated(currentCohort))
call carea_allom(currentCohort%dbh,currentCohort%n, &
currentSite%spread,currentCohort%pft,currentCohort%c_area)
if( (EDPftvarcon_inst%woody(currentCohort%pft) .eq. 1 ) .and. &
if( ( int(prt_params%woody(currentCohort%pft)) .eq. itrue ) .and. &
(currentCohort%canopy_layer .eq. 1 ) ) then
sitelevel_canopyarea = sitelevel_canopyarea + currentCohort%c_area
endif
Expand Down Expand Up @@ -1262,9 +1263,8 @@ subroutine canopy_summarization( nsites, sites, bc_in )
use FatesSizeAgeTypeIndicesMod, only : sizetype_class_index
use FatesSizeAgeTypeIndicesMod, only : coagetype_class_index
use EDtypesMod , only : area
use EDPftvarcon , only : EDPftvarcon_inst
use FatesConstantsMod , only : itrue

! !ARGUMENTS
integer , intent(in) :: nsites
type(ed_site_type) , intent(inout), target :: sites(nsites)
Expand Down Expand Up @@ -1342,7 +1342,7 @@ subroutine canopy_summarization( nsites, sites, bc_in )

if(currentCohort%canopy_layer==1)then
currentPatch%total_canopy_area = currentPatch%total_canopy_area + currentCohort%c_area
if(EDPftvarcon_inst%woody(ft)==1)then
if( int(prt_params%woody(ft))==itrue)then
currentPatch%total_tree_area = currentPatch%total_tree_area + currentCohort%c_area
endif
endif
Expand Down Expand Up @@ -1875,8 +1875,6 @@ subroutine update_hlm_dynamics(nsites,sites,fcolumn,bc_out)
use EDTypesMod , only : ed_patch_type, ed_cohort_type, &
ed_site_type, AREA
use FatesInterfaceTypesMod , only : bc_out_type
use EDPftvarcon , only : EDPftvarcon_inst


!
! !ARGUMENTS
Expand Down
174 changes: 143 additions & 31 deletions biogeochem/EDCohortDynamicsMod.F90

Large diffs are not rendered by default.

22 changes: 12 additions & 10 deletions biogeochem/EDLoggingMortalityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ module EDLoggingMortalityMod
use EDTypesMod , only : dtype_ifire
use EDPftvarcon , only : EDPftvarcon_inst
use EDPftvarcon , only : GetDecompyFrac
use EDTypesMod , only : num_elements
use EDTypesMod , only : element_list
use PRTParametersMod , only : prt_params
use PRTGenericMod , only : num_elements
use PRTGenericMod , only : element_list
use EDParamsMod , only : logging_export_frac
use EDParamsMod , only : logging_event_code
use EDParamsMod , only : logging_dbhmin
Expand Down Expand Up @@ -220,6 +221,7 @@ subroutine LoggingMortality_frac( pft_i, dbh, canopy_layer, lmort_direct, &
! todo: implement harvested carbon inputs

if (logging_time) then

! Pass logging rates to cohort level

if (hlm_use_lu_harvest == ifalse) then
Expand Down Expand Up @@ -255,7 +257,7 @@ subroutine LoggingMortality_frac( pft_i, dbh, canopy_layer, lmort_direct, &

! transfer of area to secondary land is based on overall area affected, not just logged crown area
! l_degrad accounts for the affected area between logged crowns
if(EDPftvarcon_inst%woody(pft_i) == 1)then ! only set logging rates for trees
if(int(prt_params%woody(pft_i)) == 1)then ! only set logging rates for trees

! direct logging rates, based on dbh min and max criteria
if (dbh >= logging_dbhmin .and. .not. &
Expand Down Expand Up @@ -534,7 +536,7 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
! plants that were impacted. Thus, no direct dead can occur
! here, and indirect are impacts.

if(EDPftvarcon_inst%woody(currentCohort%pft) == 1)then
if(int(prt_params%woody(pft)) == itrue) then
direct_dead = 0.0_r8
indirect_dead = logging_coll_under_frac * &
(1._r8-currentPatch%fract_ldist_not_harvested) * currentCohort%n * &
Expand Down Expand Up @@ -565,9 +567,9 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
call set_root_fraction(currentSite%rootfrac_scr, pft, currentSite%zi_soil)

ag_wood = (direct_dead+indirect_dead) * (struct_m + sapw_m ) * &
EDPftvarcon_inst%allom_agb_frac(currentCohort%pft)
prt_params%allom_agb_frac(currentCohort%pft)
bg_wood = (direct_dead+indirect_dead) * (struct_m + sapw_m ) * &
(1._r8 - EDPftvarcon_inst%allom_agb_frac(currentCohort%pft))
(1._r8 - prt_params%allom_agb_frac(currentCohort%pft))

do c = 1,ncwd-1

Expand Down Expand Up @@ -608,9 +610,9 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
! ----------------------------------------------------------------------------------------

ag_wood = indirect_dead * (struct_m + sapw_m ) * &
EDPftvarcon_inst%allom_agb_frac(currentCohort%pft)
prt_params%allom_agb_frac(currentCohort%pft)
bg_wood = indirect_dead * (struct_m + sapw_m ) * &
(1._r8 - EDPftvarcon_inst%allom_agb_frac(currentCohort%pft))
(1._r8 - prt_params%allom_agb_frac(currentCohort%pft))

new_litt%ag_cwd(ncwd) = new_litt%ag_cwd(ncwd) + ag_wood * &
SF_val_CWD_frac(ncwd) * donate_frac/newPatch%area
Expand Down Expand Up @@ -646,7 +648,7 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
! ----------------------------------------------------------------------------------------

bg_wood = direct_dead * (struct_m + sapw_m ) * SF_val_CWD_frac(ncwd) * &
(1._r8 - EDPftvarcon_inst%allom_agb_frac(currentCohort%pft))
(1._r8 - prt_params%allom_agb_frac(currentCohort%pft))

do ilyr = 1,nlevsoil
new_litt%bg_cwd(ncwd,ilyr) = new_litt%bg_cwd(ncwd,ilyr) + &
Expand All @@ -671,7 +673,7 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
! ----------------------------------------------------------------------------------------

ag_wood = direct_dead * (struct_m + sapw_m ) * &
EDPftvarcon_inst%allom_agb_frac(currentCohort%pft) * &
prt_params%allom_agb_frac(currentCohort%pft) * &
SF_val_CWD_frac(ncwd)

trunk_product_site = trunk_product_site + &
Expand Down
26 changes: 13 additions & 13 deletions biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module EDPatchDynamicsMod
use FatesInterfaceTypesMod , only : hlm_freq_day
use EDPftvarcon , only : EDPftvarcon_inst
use EDPftvarcon , only : GetDecompyFrac
use PRTParametersMod , only : prt_params
use EDCohortDynamicsMod , only : fuse_cohorts, sort_cohorts, insert_cohort
use EDCohortDynamicsMod , only : DeallocateCohort
use EDTypesMod , only : area_site => area
Expand All @@ -30,9 +31,8 @@ module EDPatchDynamicsMod
use EDTypesMod , only : dtype_ilog
use EDTypesMod , only : dtype_ifire
use EDTypesMod , only : ican_upper
use EDTypesMod , only : num_elements
use EDTypesMod , only : element_list
use EDTypesMod , only : element_pos
use PRTGenericMod , only : num_elements
use PRTGenericMod , only : element_list
use EDTypesMod , only : lg_sf
use EDTypesMod , only : dl_sf
use EDTypesMod , only : dump_patch
Expand Down Expand Up @@ -231,7 +231,7 @@ subroutine disturbance_rates( site_in, bc_in)
currentCohort%lmort_direct * currentCohort%n * &
( currentCohort%prt%GetState(sapw_organ, all_carbon_elements) + &
currentCohort%prt%GetState(struct_organ, all_carbon_elements)) * &
EDPftvarcon_inst%allom_agb_frac(currentCohort%pft) * &
prt_params%allom_agb_frac(currentCohort%pft) * &
SF_val_CWD_frac(ncwd) * logging_export_frac
endif

Expand Down Expand Up @@ -733,7 +733,7 @@ subroutine spawn_patches( currentSite, bc_in)

else
! small trees
if(EDPftvarcon_inst%woody(currentCohort%pft) == 1)then
if( int(prt_params%woody(currentCohort%pft)) == itrue)then


! Survivorship of undestory woody plants. Two step process.
Expand Down Expand Up @@ -873,7 +873,7 @@ subroutine spawn_patches( currentSite, bc_in)
! burned off. Here, we remove that mass, and
! tally it in the flux we sent to the atmosphere

if(EDPftvarcon_inst%woody(currentCohort%pft) == 1)then
if(int(prt_params%woody(currentCohort%pft)) == itrue)then
leaf_burn_frac = currentCohort%fraction_crown_burned
else

Expand All @@ -890,7 +890,7 @@ subroutine spawn_patches( currentSite, bc_in)
(currentCohort%fire_mort < 0._r8) .or. &
(currentCohort%fire_mort > 1._r8)) then
write(fates_log(),*) 'unexpected fire fractions'
write(fates_log(),*) EDPftvarcon_inst%woody(currentCohort%pft)
write(fates_log(),*) prt_params%woody(currentCohort%pft)
write(fates_log(),*) leaf_burn_frac
write(fates_log(),*) currentCohort%fire_mort
call endrun(msg=errMsg(sourcefile, __LINE__))
Expand Down Expand Up @@ -951,7 +951,7 @@ subroutine spawn_patches( currentSite, bc_in)
! WHat to do with cohorts in the understory of a logging generated
! disturbance patch?

if(EDPftvarcon_inst%woody(currentCohort%pft) == 1)then
if(int(prt_params%woody(currentCohort%pft)) == itrue)then


! Survivorship of undestory woody plants. Two step process.
Expand Down Expand Up @@ -1682,7 +1682,7 @@ subroutine fire_litter_fluxes(currentSite, currentPatch, newPatch, patch_site_ar
(fnrt_m + store_m) * num_dead_trees

! coarse root biomass per tree
bcroot = (sapw_m + struct_m) * (1.0_r8 - EDPftvarcon_inst%allom_agb_frac(pft) )
bcroot = (sapw_m + struct_m) * (1.0_r8 - prt_params%allom_agb_frac(pft) )

! below ground coarse woody debris from burned trees
do c = 1,ncwd
Expand All @@ -1703,7 +1703,7 @@ subroutine fire_litter_fluxes(currentSite, currentPatch, newPatch, patch_site_ar
end do

! stem biomass per tree
bstem = (sapw_m + struct_m) * EDPftvarcon_inst%allom_agb_frac(pft)
bstem = (sapw_m + struct_m) * prt_params%allom_agb_frac(pft)

! Above ground coarse woody debris from twigs and small branches
! a portion of this pool may burn
Expand Down Expand Up @@ -1829,7 +1829,7 @@ subroutine mortality_litter_fluxes(currentSite, currentPatch, newPatch, patch_si
num_dead = currentCohort%n * min(1.0_r8,currentCohort%dmort * &
hlm_freq_day * fates_mortality_disturbance_fraction)

elseif(EDPftvarcon_inst%woody(pft) == itrue) then
elseif(int(prt_params%woody(pft)) == itrue) then

! Understorey trees. The total dead is based on their survivorship
! function, and the total area of disturbance.
Expand Down Expand Up @@ -1864,8 +1864,8 @@ subroutine mortality_litter_fluxes(currentSite, currentPatch, newPatch, patch_si
end do

! Pre-calculate Structural and sapwood, below and above ground, total mass [kg]
ag_wood = num_dead * (struct_m + sapw_m) * EDPftvarcon_inst%allom_agb_frac(pft)
bg_wood = num_dead * (struct_m + sapw_m) * (1.0_r8-EDPftvarcon_inst%allom_agb_frac(pft))
ag_wood = num_dead * (struct_m + sapw_m) * prt_params%allom_agb_frac(pft)
bg_wood = num_dead * (struct_m + sapw_m) * (1.0_r8-prt_params%allom_agb_frac(pft))

call set_root_fraction(currentSite%rootfrac_scr, pft, currentSite%zi_soil)

Expand Down
Loading

0 comments on commit 03a17bf

Please sign in to comment.