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

Carbon allocation: bug fixes and simpler (optional) allocation approach #800

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
229b5dc
Added LAI by size class and PFT to the list of output variables.
mpaiao Aug 13, 2021
d44620c
A few bug fixes and updates in carbon allocation (see issue #784).
mpaiao Oct 30, 2021
3ebf2b9
Merge branch 'master' into carbon-alloc
mpaiao Oct 30, 2021
4eba25f
Added option (hlm_parteh_mode = 0) to use the simpler carbon allocati…
mpaiao Nov 3, 2021
40bb0cc
Merge branch 'carbon-alloc' of https://github.com/mpaiao/fates into c…
mpaiao Nov 3, 2021
089bf23
Resolved conflict that I had forgotten to resolve.
mpaiao Nov 3, 2021
944455a
Fixed ctrl-c ctrl-v mistake when resolving conflicts (sigh).
mpaiao Nov 3, 2021
0ad213d
Deleted if statement that was replaced with select case (sigh again).
mpaiao Nov 3, 2021
d653c83
Fixing another typo in PRTParamsFATESMod.F90 (forgot to replace end i…
mpaiao Nov 3, 2021
957df38
Merge branch 'master' into carbon-alloc
glemieux Jan 25, 2022
eb6f7a2
manually reinstating lai scpf history variables after poor merge
glemieux Jan 27, 2022
612f564
removing unused use call and changing woody from real to int
glemieux Jan 27, 2022
46462bb
Updated carbon allocation routines to remove unnecessary checks, and …
mpaiao Feb 17, 2022
f8e16e2
Merge branch 'carbon-alloc' of https://github.com/mpaiao/fates into c…
mpaiao Feb 17, 2022
cca0a00
Fixed parameter loading for "woody" based on @rgknox suggestion.
mpaiao Mar 7, 2022
9b68521
Trivial conflict resolution between simple allocation branch and pica…
rgknox Mar 7, 2022
202f7c8
Removing instances of %woody being converted to int, and completing r…
rgknox Mar 7, 2022
079fc12
Updated comments in PRTAllometricCarbonMod to not mention semi-decidu…
mpaiao Mar 7, 2022
eba3bb0
Merge branch 'carbon-alloc' into carbon-alloc-sci1.55.2
mpaiao Mar 7, 2022
3cef215
Merge pull request #1 from rgknox/carbon-alloc-sci1.55.2
mpaiao Mar 7, 2022
2f236df
Remove special cases for hydro-deciduous
mpaiao Apr 4, 2022
621b3b0
Fix hard-coded true/false flags
mpaiao Apr 4, 2022
bd558d8
Fix target leaf carbon when leaves are off
mpaiao Apr 6, 2022
4f58457
Minor edits to remove comments relevant to drought deciduous phenolog…
mpaiao Apr 25, 2022
b31086d
Added unsaved changes to PRTAllometricCarbonMod.F90
mpaiao Apr 25, 2022
baf2605
Updated the error message to not refer to the simpler carbon allocati…
mpaiao Apr 25, 2022
d8e90c7
Reference to simpler carbon allocation was not completely removed fro…
mpaiao Apr 25, 2022
2817291
Deleted one additional assignment in PRTAllometricCarbonMod.F90 that …
mpaiao Apr 25, 2022
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
38 changes: 23 additions & 15 deletions biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ module EDCohortDynamicsMod
use FatesAllometryMod , only : tree_lai, tree_sai
use FatesAllometryMod , only : set_root_fraction
use PRTGenericMod, only : prt_carbon_allom_hyp
use PRTGenericMod, only : prt_csimpler_allom_hyp
use PRTGenericMod, only : prt_cnp_flex_allom_hyp
use PRTGenericMod, only : prt_vartypes
use PRTGenericMod, only : all_carbon_elements
Expand All @@ -85,6 +86,7 @@ module EDCohortDynamicsMod
use PRTGenericMod, only : SetState

use PRTAllometricCarbonMod, only : callom_prt_vartypes
use PRTAllometricCarbonMod, only : csimpler_allom_prt_vartypes
use PRTAllometricCarbonMod, only : ac_bc_inout_id_netdc
use PRTAllometricCarbonMod, only : ac_bc_in_id_pft
use PRTAllometricCarbonMod, only : ac_bc_in_id_ctrim
Expand Down Expand Up @@ -146,7 +148,7 @@ module EDCohortDynamicsMod


subroutine create_cohort(currentSite, patchptr, pft, nn, hite, coage, dbh, &
prt, laimemory, sapwmemory, structmemory, &
prt, leafmemory, sapwmemory, structmemory, &
status, recruitstatus,ctrim, carea, clayer, spread, bc_in)
!
! !DESCRIPTION:
Expand Down Expand Up @@ -180,7 +182,7 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, coage, dbh, &
real(r8), intent(in) :: dbh ! dbh: cm
class(prt_vartypes),target :: prt ! The allocated PARTEH
! object
real(r8), intent(in) :: laimemory ! target leaf biomass- set from
real(r8), intent(in) :: leafmemory ! target leaf biomass- set from
mpaiao marked this conversation as resolved.
Show resolved Hide resolved
! previous year: kGC per indiv
real(r8), intent(in) :: sapwmemory ! target sapwood biomass- set from
! previous year: kGC per indiv
Expand Down Expand Up @@ -236,7 +238,7 @@ subroutine create_cohort(currentSite, patchptr, pft, nn, hite, coage, dbh, &
new_cohort%canopy_trim = ctrim
new_cohort%canopy_layer = clayer
new_cohort%canopy_layer_yesterday = real(clayer, r8)
new_cohort%laimemory = laimemory
new_cohort%leafmemory = leafmemory
new_cohort%sapwmemory = sapwmemory
new_cohort%structmemory = structmemory

Expand Down Expand Up @@ -399,7 +401,7 @@ subroutine InitPRTBoundaryConditions(new_cohort)


select case(hlm_parteh_mode)
case (prt_carbon_allom_hyp)
case (prt_csimpler_allom_hyp,prt_carbon_allom_hyp)

! Register boundary conditions for the Carbon Only Allometric Hypothesis

Expand Down Expand Up @@ -462,10 +464,16 @@ subroutine InitPRTObject(prt)

! Potential Extended types
class(callom_prt_vartypes), pointer :: c_allom_prt
class(csimpler_allom_prt_vartypes), pointer :: csimpler_allom_prt
class(cnp_allom_prt_vartypes), pointer :: cnp_allom_prt


select case(hlm_parteh_mode)
case (prt_csimpler_allom_hyp)

allocate(csimpler_allom_prt)
prt => csimpler_allom_prt

case (prt_carbon_allom_hyp)

allocate(c_allom_prt)
Expand Down Expand Up @@ -539,8 +547,8 @@ subroutine nan_cohort(cc_p)
currentCohort%n = nan ! number of individuals in cohort per 'area' (10000m2 default)
currentCohort%dbh = nan ! 'diameter at breast height' in cm
currentCohort%coage = nan ! age of the cohort in years
currentCohort%hite = nan ! height: meters
currentCohort%laimemory = nan ! target leaf biomass- set from previous year: kGC per indiv
currentCohort%hite = nan ! height: meters
currentCohort%leafmemory = nan ! target leaf biomass- set from previous year: kGC per indiv
currentCohort%sapwmemory = nan ! target sapwood biomass- set from previous year: kGC per indiv
currentCohort%structmemory = nan ! target structural biomass- set from previous year: kGC per indiv
currentCohort%lai = nan ! leaf area index of cohort m2/m2
Expand Down Expand Up @@ -767,7 +775,7 @@ subroutine terminate_cohorts( currentSite, currentPatch, level , call_index, bc_
if (currentcohort%n < min_n_safemath .and. level == 1) then
terminate = itrue
if ( debug ) then
write(fates_log(),*) 'terminating cohorts 0',currentCohort%n/currentPatch%area,currentCohort%dbh,call_index
write(fates_log(),*) 'terminating cohorts 0',currentCohort%n/currentPatch%area,currentCohort%dbh,currentCohort%pft,call_index
endif
endif

Expand All @@ -780,15 +788,15 @@ subroutine terminate_cohorts( currentSite, currentPatch, level , call_index, bc_
(currentCohort%dbh < 0.00001_r8 .and. store_c < 0._r8) ) then
terminate = itrue
if ( debug ) then
write(fates_log(),*) 'terminating cohorts 1',currentCohort%n/currentPatch%area,currentCohort%dbh,call_index
write(fates_log(),*) 'terminating cohorts 1',currentCohort%n/currentPatch%area,currentCohort%dbh,currentCohort%pft,call_index
endif
endif

! Outside the maximum canopy layer
if (currentCohort%canopy_layer > nclmax ) then
terminate = itrue
if ( debug ) then
write(fates_log(),*) 'terminating cohorts 2', currentCohort%canopy_layer,call_index
write(fates_log(),*) 'terminating cohorts 2', currentCohort%canopy_layer,currentCohort%pft,call_index
endif
endif

Expand All @@ -798,7 +806,7 @@ subroutine terminate_cohorts( currentSite, currentPatch, level , call_index, bc_
terminate = itrue
if ( debug ) then
write(fates_log(),*) 'terminating cohorts 3', &
sapw_c,leaf_c,fnrt_c,store_c,call_index
sapw_c,leaf_c,fnrt_c,store_c,currentCohort%pft,call_index
endif
endif

Expand All @@ -807,7 +815,7 @@ subroutine terminate_cohorts( currentSite, currentPatch, level , call_index, bc_
terminate = itrue
if ( debug ) then
write(fates_log(),*) 'terminating cohorts 4', &
struct_c,sapw_c,leaf_c,fnrt_c,store_c,call_index
struct_c,sapw_c,leaf_c,fnrt_c,store_c,currentCohort%pft,call_index
endif

endif
Expand Down Expand Up @@ -1160,7 +1168,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
write(fates_log(),*) 'Cohort I, Cohort II'
write(fates_log(),*) 'n:',currentCohort%n,nextc%n
write(fates_log(),*) 'isnew:',currentCohort%isnew,nextc%isnew
write(fates_log(),*) 'laimemory:',currentCohort%laimemory,nextc%laimemory
write(fates_log(),*) 'leafmemory:',currentCohort%leafmemory,nextc%leafmemory
write(fates_log(),*) 'hite:',currentCohort%hite,nextc%hite
write(fates_log(),*) 'coage:',currentCohort%coage,nextc%coage
write(fates_log(),*) 'dbh:',currentCohort%dbh,nextc%dbh
Expand Down Expand Up @@ -1198,8 +1206,8 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
! -----------------------------------------------------------------
call UpdateCohortBioPhysRates(currentCohort)

currentCohort%laimemory = (currentCohort%n*currentCohort%laimemory &
+ nextc%n*nextc%laimemory)/newn
currentCohort%leafmemory = (currentCohort%n*currentCohort%leafmemory &
+ nextc%n*nextc%leafmemory)/newn

currentCohort%sapwmemory = (currentCohort%n*currentCohort%sapwmemory &
+ nextc%n*nextc%sapwmemory)/newn
Expand Down Expand Up @@ -1792,7 +1800,7 @@ subroutine copy_cohort( currentCohort,copyc )
n%dbh = o%dbh
n%coage = o%coage
n%hite = o%hite
n%laimemory = o%laimemory
n%leafmemory = o%leafmemory
n%sapwmemory = o%sapwmemory
n%structmemory = o%structmemory
n%lai = o%lai
Expand Down
3 changes: 2 additions & 1 deletion biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ module EDPatchDynamicsMod
use PRTGenericMod, only : struct_organ
use PRTLossFluxesMod, only : PRTBurnLosses
use FatesInterfaceTypesMod, only : hlm_parteh_mode
use PRTGenericMod, only : prt_carbon_allom_hyp
use PRTGenericMod, only : prt_csimpler_allom_hyp
use PRTGenericMod, only : prt_carbon_allom_hyp
use PRTGenericMod, only : prt_cnp_flex_allom_hyp
use SFParamsMod, only : SF_VAL_CWD_FRAC
use EDParamsMod, only : logging_event_code
Expand Down
Loading