Skip to content

Commit

Permalink
Added provisions in parteh to only set non-zero leaf targets when lea…
Browse files Browse the repository at this point in the history
…ves are in a on status.
  • Loading branch information
rgknox committed Sep 17, 2019
1 parent 393b905 commit 8e0b059
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
4 changes: 3 additions & 1 deletion biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ module EDCohortDynamicsMod
use PRTAllometricCarbonMod, only : ac_bc_in_id_pft
use PRTAllometricCarbonMod, only : ac_bc_in_id_ctrim
use PRTAllometricCarbonMod, only : ac_bc_inout_id_dbh
use PRTAllometricCarbonMod, only : ac_bc_in_id_lstat

! use PRTAllometricCNPMod, only : cnp_allom_prt_vartypes

Expand Down Expand Up @@ -354,7 +355,8 @@ subroutine InitPRTBoundaryConditions(new_cohort)
call new_cohort%prt%RegisterBCInOut(ac_bc_inout_id_netdc,bc_rval = new_cohort%npp_acc)
call new_cohort%prt%RegisterBCIn(ac_bc_in_id_pft,bc_ival = new_cohort%pft)
call new_cohort%prt%RegisterBCIn(ac_bc_in_id_ctrim,bc_rval = new_cohort%canopy_trim)

call new_cohort%prt%RegisterBCIn(ac_bc_in_id_lstat,bc_ival = new_cohort%status_coh)

case (prt_cnp_flex_allom_hyp)

write(fates_log(),*) 'You have not specified the boundary conditions for the'
Expand Down
21 changes: 17 additions & 4 deletions parteh/PRTAllometricCarbonMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ module PRTAllometricCarbonMod

integer, public, parameter :: ac_bc_in_id_pft = 1 ! Index for the PFT input BC
integer, public, parameter :: ac_bc_in_id_ctrim = 2 ! Index for the canopy trim function
integer, parameter :: num_bc_in = 2 ! Number of input boundary condition
integer, public, parameter :: ac_bc_in_id_lstat = 3 ! Leaf status (on or off)
integer, parameter :: num_bc_in = 3 ! Number of input boundary condition

! THere are no purely output boundary conditions
integer, parameter :: num_bc_out = 0 ! Number of purely output boundary condtions
Expand Down Expand Up @@ -353,6 +354,7 @@ subroutine DailyPRTAllometricCarbon(this)
integer :: i_var ! index for iterating state variables
integer :: i_age ! index for iterating leaf ages
integer :: nleafage ! number of leaf age classifications
integer :: leaf_status ! are leaves on (2) or off (1)
real(r8) :: leaf_age_flux ! carbon mass flux between leaf age classification pools


Expand Down Expand Up @@ -398,6 +400,7 @@ subroutine DailyPRTAllometricCarbon(this)

canopy_trim = this%bc_in(ac_bc_in_id_ctrim)%rval
ipft = this%bc_in(ac_bc_in_id_pft)%ival
leaf_status = this%bc_in(ac_bc_in_id_lstat)%ival

intgr_params(:) = un_initialized
intgr_params(ac_bc_in_id_ctrim) = this%bc_in(ac_bc_in_id_ctrim)%rval
Expand Down Expand Up @@ -456,7 +459,11 @@ subroutine DailyPRTAllometricCarbon(this)
call bdead_allom( target_agw_c, target_bgw_c, target_sapw_c, ipft, target_struct_c)

! Target leaf biomass according to allometry and trimming
call bleaf(dbh,ipft,canopy_trim,target_leaf_c)
if(leaf_status==2) then
call bleaf(dbh,ipft,canopy_trim,target_leaf_c)
else
target_leaf_c = 0._r8
end if

! Target fine-root biomass and deriv. according to allometry and trimming [kgC, kgC/cm]
call bfineroot(dbh,ipft,canopy_trim,target_fnrt_c)
Expand Down Expand Up @@ -689,8 +696,13 @@ subroutine DailyPRTAllometricCarbon(this)
c_pool(struct_c_id) = struct_c
c_pool(repro_c_id) = repro_c
c_pool(dbh_id) = dbh

c_mask(leaf_c_id) = grow_leaf

! Only grow leaves if we are in a "leaf-on" status
if(leaf_status==2) then
c_mask(leaf_c_id) = grow_leaf
else
c_mask(leaf_c_id) = .false.
end if
c_mask(fnrt_c_id) = grow_fnrt
c_mask(sapw_c_id) = grow_sapw
c_mask(store_c_id) = grow_store
Expand Down Expand Up @@ -928,6 +940,7 @@ function AllomCGrowthDeriv(c_pools,c_mask,cbalance,intgr_params) result(dCdx)

canopy_trim = intgr_params(ac_bc_in_id_ctrim)
ipft = int(intgr_params(ac_bc_in_id_pft))


call bleaf(dbh,ipft,canopy_trim,ct_leaf,ct_dleafdd)
call bfineroot(dbh,ipft,canopy_trim,ct_fnrt,ct_dfnrtdd)
Expand Down

0 comments on commit 8e0b059

Please sign in to comment.