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

multi-element litter, mass checks and diagnostics #524

Merged
merged 136 commits into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from 126 commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
c9309d9
Added the allometric CNP parteh module.
rgknox Oct 30, 2018
103807f
Updated the ACNP allocation hypothesis to use correct parameter names…
rgknox Oct 30, 2018
c36317c
Merge branch 'master' into parteh-acnp
rgknox Feb 13, 2019
08b8290
Retro-fitted PARTEH CNP hypothesis to accomodate leaf age binning
rgknox Feb 14, 2019
aee6d82
Added the litter module
rgknox Feb 16, 2019
2b793ec
Intermediate progress towards multi-element litter pools
rgknox Feb 20, 2019
2378fd2
More incremental changes toward multi-element litter. Also, fixed spe…
rgknox Feb 22, 2019
27e7086
More incremental changes towards multi-element litter and mass balance
rgknox Feb 25, 2019
445b0c2
yet more incremental changes towards multi-element litter and mass ba…
rgknox Feb 25, 2019
564a88a
yet, again, more incremental changes towards multi-element litter and…
rgknox Feb 26, 2019
5f7b0b4
Incremental changes towards multi-element litter
rgknox Feb 26, 2019
3234d4a
Added cohort based rooting fraction, also refactored the fragmented l…
rgknox Mar 6, 2019
c2f359b
Updated litter FATES->BGC fluxes to handle nutrients
rgknox Mar 8, 2019
dd05814
adding nutrients to fire litter fluxes, and treefall disturbance litt…
rgknox Mar 8, 2019
d2016fa
staring to refactor mortality litter fluxes
rgknox Mar 8, 2019
8ecb38a
Adding multi-element litter flux to logging code
rgknox Mar 9, 2019
eeca26f
first pass at copying and fusing multi-element patches, various code …
rgknox Mar 21, 2019
056f2df
converted main fire code to multi-element litter, started restart cap…
rgknox Mar 22, 2019
76c7859
merged changes from different checkouts related to nutrient refactors
rgknox Mar 22, 2019
5d729ee
changed element indexing to el, added a litter flux zeroing call to E…
rgknox Mar 22, 2019
288a979
Part way through updating the litter flux diagnostics
rgknox Mar 22, 2019
baf3a96
Added a note to the to-do list for multi-element litter. The note was…
rgknox Mar 22, 2019
7aa6ef8
Updating the tracking of site level litter flux diagnostics, for mult…
rgknox Mar 23, 2019
cac8675
First pass at adding the element dimension in history, variables and …
rgknox Mar 25, 2019
3c4ad91
Working through build-time debugging of multi-element litter
rgknox Apr 9, 2019
bc570ea
bug fixing multi-element implementation
rgknox Apr 10, 2019
a9c02f8
More bug fixes and cleaning during first pass of multi-element litter'
rgknox Apr 16, 2019
cad0a30
mutlti-element fates, first pass at recruitment and initialization of…
rgknox Apr 16, 2019
9564a5d
multi-element work, first pass at re-organizing create_cohort and rec…
rgknox Apr 17, 2019
d55e3e7
multi-element fates, more work towards restructuring create_cohort
rgknox Apr 17, 2019
4b47c7e
multi-element, restart capabilities, also completed first pass on ini…
rgknox Apr 18, 2019
9945248
multi-element, cleaning code, changed seed_germ to a state with new f…
rgknox Apr 19, 2019
faa1285
multi-element, seed production stuff
rgknox Apr 19, 2019
d1b8f32
multi-element: more refactors on retsarting and coldstarting
rgknox Apr 22, 2019
a169858
multi-nutrient: general cleanup on the v0 first pass. First full comp…
rgknox Apr 23, 2019
5c883e6
multi-nutrient, pre-merge fixing of parameter files
rgknox Apr 23, 2019
b70486a
Resolved not-so trival conflicts with master and multi-element. Most …
rgknox Apr 23, 2019
49ec6ba
Removing the CNP allocation module, will re-introduce later.
rgknox Apr 23, 2019
cf1dc81
resolved updateds between multi-element and logging code
rgknox May 1, 2019
41dc750
Fixed typo on primaryforest and secondaryforest constants
rgknox May 1, 2019
9cf09c7
Moving rooting depths to be non-memory, on-demand style.
rgknox May 3, 2019
955f216
Removed patch level root profile data
rgknox May 3, 2019
5f24b04
Rehashing soil and root calculations. Created site level soil depths …
rgknox May 7, 2019
38799a5
Various fixes in multi-element to get simulations running.
rgknox May 7, 2019
fcdc3ae
Conflict resolutions betwen multi-element and phenology updates
rgknox May 7, 2019
4a79e17
More merge resolutions between multi-element and phenology updates
rgknox May 8, 2019
78cd4d3
Fixes towards getting fire-disturbance conserving mass with multi-ele…
rgknox May 9, 2019
481ec6b
Attempting to clean up mass balance errors associated with fire fluxes
rgknox May 10, 2019
c54823d
multi-element, getting closer to carbon conservation.
rgknox May 10, 2019
b5a8261
multi-nutrient: working through some mass checks during patch disturb…
rgknox May 14, 2019
f89f9b5
multi-element: mass balances seem fixed. Work on history variables
rgknox May 15, 2019
718569e
multi-element: restart and history fixes
rgknox May 16, 2019
7c49f33
multi-element: fixed initialization value for generic input flux on c…
rgknox May 16, 2019
4eeffc8
Multi-element: updated comments
rgknox May 17, 2019
b4fc68c
Fixed argument issue in multi-nutrient
rgknox May 17, 2019
53ff8e1
Removing redundant tally of extern seed input
rgknox May 17, 2019
3e6816f
multi-element: cleaning and syntax updates
rgknox May 19, 2019
2208296
Minor change to a filter during create cohort
rgknox May 20, 2019
8ca3eb4
multi-nutrient: modifications to get higher similarity with previous …
rgknox May 20, 2019
fcc310f
Removed some checks during litter disturbance
rgknox May 21, 2019
41f602a
Make cohort number density calcuation in main match master exactly (m…
rgknox May 21, 2019
c349553
multi-element: returned cap in germination
rgknox May 21, 2019
d9de6e1
multi-element: added info to termination reporting, added isnew check…
rgknox May 22, 2019
1254034
Multi-element: added gpp/ar mass tracking on prescribed physiology, r…
rgknox May 23, 2019
97c2e30
Added checks on patch counts
rgknox May 23, 2019
07769c3
Modified the cohort counting scheme so that it is not a function call
rgknox May 24, 2019
c8b2309
Merge branch 'parteh-acnp-merged-npchecks' into parteh-acnp-merged
rgknox May 24, 2019
349e2a4
multi-element: fixed a call to counting cohorts, removed some checks …
rgknox May 24, 2019
354b83d
multi-element: removed outdated local variables in physiology code
rgknox May 24, 2019
cd3294b
multi-element: unit fix on seed flux
rgknox May 28, 2019
9760635
Added seed-dispersal surboutine for storage-to-seed fluxes during dis…
rgknox Jun 1, 2019
b797f7a
Conflict resolutions between the spitfire/logging updates and multi-e…
rgknox Jun 1, 2019
66d8ab9
multi-element: added 4 new variables.
rgknox Jun 3, 2019
573b3be
multi-element: more conflict resolution fixes
rgknox Jun 3, 2019
f524343
multi-element: temprorarily reverting some history indices to not use…
rgknox Jun 3, 2019
c752da4
Multi-element: Added temporary patch to do old-way of burning leaves …
rgknox Jun 4, 2019
22cb47c
multi-element: removing temporary measures to match baseline behavior…
rgknox Jun 5, 2019
e946d1b
Conflict resolution between ME and treelai/sai removal fix
rgknox Jun 5, 2019
d97a688
Added some snazzy comments related to disturbance and grass.
rgknox Jun 5, 2019
a3d4cc5
Partial conversion of fine litter pools from pft to dcmpy indexing.
rgknox Jun 5, 2019
7eccb38
multi-element: moving to decomposability indexing on fine litter.
rgknox Jun 6, 2019
4db1984
multi-element: fixed redundant declaration of number of decomposabili…
rgknox Jun 6, 2019
6f2ed84
multi-element: fixes for restart capability
rgknox Jun 8, 2019
2129503
Updated logging litter flux code to assume equal distribution between…
rgknox Jun 10, 2019
1a87387
multi-element: fix on arrays for litter in SendCohortToLItter functio…
rgknox Jun 10, 2019
ab69534
multi-element: some fixes to fluxes into decomposability pools.
rgknox Jun 11, 2019
b2af5e7
multi-element: trivial changes to syntax, reverting area error fail (…
rgknox Jun 11, 2019
e893bc3
multi-element: Fixed output (to BGC) litter flux calculations.
rgknox Jun 11, 2019
fa42fef
multi-element: commenting code
rgknox Jun 11, 2019
5cfeb47
multi-element: litter flux bug-fix in logging. Applied Maoyis change…
rgknox Jun 12, 2019
49e9acc
multi-element: fixed a litter flux diagnostic in edphysiology
rgknox Jun 12, 2019
a3fc8da
multi-element: cleaning up some text on mortality litter fluxes.
rgknox Jun 14, 2019
2d2587d
multi-element: merge resolution with Gregs private module work.
rgknox Jun 18, 2019
4ce1b81
Fixed incorrect index for burning fractions of litter.
rgknox Jun 24, 2019
7ca0632
multi-element: added definition of dl_sf in patch dynamics
rgknox Jun 24, 2019
7511401
multi-element: fixed diagnostic on cwd output during non-dist logging
rgknox Jun 24, 2019
4946ea9
multi-element: added a check and extra initialization to disturbance …
rgknox Jun 25, 2019
6577594
Reverting patch spawn order in Multi-Element refactor to see if it fi…
rgknox Jun 26, 2019
1be80da
Removed commented code on logging export frac parameter
rgknox Jul 1, 2019
67dc841
removed unused variable definitions in spawn_patch
rgknox Jul 1, 2019
3c32c73
removed declaration of unused variable
rgknox Jul 2, 2019
446fa2f
Update fire/SFMainMod.F90
rgknox Jul 10, 2019
a4d86be
Apply suggestions from code review
rgknox Jul 10, 2019
fcec06e
Merge branch 'parteh-acnp-merged' of github.com:rgknox/fates into par…
rgknox Jul 24, 2019
ec600fb
Merge multi-element with master, resolve conflicts with fixes to logg…
rgknox Jul 25, 2019
15e6d1b
Removed redundant declation of burn fraction
rgknox Jul 25, 2019
741de67
Reverted spawn_patches to add patches before looping
rgknox Jul 26, 2019
5ab2503
Removed deprecated variables for leaf age initialization
rgknox Jul 26, 2019
dbc5641
Update biogeochem/EDPatchDynamicsMod.F90
rgknox Jul 26, 2019
5e52580
Update biogeochem/EDPatchDynamicsMod.F90
rgknox Jul 26, 2019
71b3214
Update biogeochem/EDPatchDynamicsMod.F90
rgknox Jul 26, 2019
066c1e5
reverted code in disturbance to get rid of round off errors
rgknox Jul 26, 2019
9382c47
Update biogeochem/EDPatchDynamicsMod.F90
rgknox Jul 26, 2019
38309d7
Update biogeochem/EDPatchDynamicsMod.F90
rgknox Jul 26, 2019
dbe17ce
Update biogeochem/EDPatchDynamicsMod.F90
rgknox Jul 26, 2019
7f1b1d2
Update biogeochem/EDPatchDynamicsMod.F90
rgknox Jul 26, 2019
2f9531e
Apply suggestions from code review
rgknox Jul 26, 2019
95a136c
Minor syntax updates to patch dynamics
rgknox Jul 26, 2019
a873b0b
Merge branch 'parteh-acnp-merged' of github.com:rgknox/fates into par…
rgknox Jul 26, 2019
33990ba
Trivial conflict resolution with head and online edits during ME.
rgknox Jul 26, 2019
3206063
Reverted changes that added new patches to spawn list before looping,…
rgknox Jul 26, 2019
aa45009
changed syntax on termination flag declaration
rgknox Jul 26, 2019
89e7701
added better description of the SendCohortToLitter procedure
rgknox Jul 26, 2019
f99dd1e
Apply suggestions from code review
rgknox Jul 26, 2019
1db2752
Merge branch 'parteh-acnp-merged' of github.com:rgknox/fates into par…
rgknox Jul 26, 2019
acfd8d7
Updated index names for decomposibility pools to be more verbose, per…
rgknox Jul 26, 2019
52cd5d4
Merge branch 'master' into parteh-acnp-merged
rgknox Jul 29, 2019
e9389cc
multi-element: final tweaks on history variable definitions.
rgknox Aug 1, 2019
3d56ddd
Multi-element: fixed matching arguments to values in litter intial co…
rgknox Aug 1, 2019
c47ede2
Merge branch 'parteh-acnp-merged' of github.com:rgknox/fates into par…
rgknox Aug 21, 2019
e3d75af
Minor cleanup of mass checking. Made decomposability function work on…
rgknox Aug 21, 2019
c3a5960
Reverting mass balance check to use relative error.
rgknox Aug 22, 2019
c416e64
Changed debug flag back to false.
rgknox Aug 22, 2019
0521d8a
Implemented fixes suggested by @glemieux to multi-element pr
rgknox Aug 23, 2019
d3752c6
Update biogeochem/EDPatchDynamicsMod.F90
rgknox Aug 23, 2019
63b95b5
Added improved logic to donating litter mass during disturbance per @…
rgknox Aug 23, 2019
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
97 changes: 27 additions & 70 deletions biogeochem/EDCanopyStructureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ module EDCanopyStructureMod
use EDPftvarcon , only : EDPftvarcon_inst
use FatesAllometryMod , only : carea_allom
use EDCohortDynamicsMod , only : copy_cohort, terminate_cohorts, fuse_cohorts
use EDCohortDynamicsMod , only : InitPRTCohort
use EDCohortDynamicsMod , only : InitPRTObject
use EDCohortDynamicsMod , only : InitPRTBoundaryConditions
use EDCohortDynamicsMod , only : SendCohortToLitter
use FatesAllometryMod , only : tree_lai
use FatesAllometryMod , only : tree_sai
use EDtypesMod , only : ed_site_type, ed_patch_type, ed_cohort_type, ncwd
use EDtypesMod , only : ed_site_type, ed_patch_type, ed_cohort_type
use EDTypesMod , only : nclmax
use EDTypesMod , only : nlevleaf
use EDtypesMod , only : AREA
Expand Down Expand Up @@ -117,7 +119,6 @@ subroutine canopy_structure( currentSite , bc_in )
! !USES:

use EDParamsMod, only : ED_val_comp_excln
use EDtypesMod , only : ncwd
use EDTypesMod , only : min_patch_area
use FatesInterfaceMod, only : bc_in_type
!
Expand Down Expand Up @@ -192,7 +193,7 @@ subroutine canopy_structure( currentSite , bc_in )

! Its possible that before we even enter this scheme
! some cohort numbers are very low. Terminate them.
call terminate_cohorts(currentSite, currentPatch, 1)
call terminate_cohorts(currentSite, currentPatch, 1, 12)

! Calculate how many layers we have in this canopy
! This also checks the understory to see if its crown
Expand All @@ -205,12 +206,12 @@ subroutine canopy_structure( currentSite , bc_in )

! After demotions, we may then again have cohorts that are very very
! very sparse, remove them
call terminate_cohorts(currentSite, currentPatch, 1)
call terminate_cohorts(currentSite, currentPatch, 1,13)

call fuse_cohorts(currentSite, currentPatch, bc_in)

! Remove cohorts for various other reasons
call terminate_cohorts(currentSite, currentPatch, 2)
call terminate_cohorts(currentSite, currentPatch, 2,13)


! ---------------------------------------------------------------------------------------
Expand All @@ -229,12 +230,12 @@ subroutine canopy_structure( currentSite , bc_in )
end do

! Remove cohorts that are incredibly sparse
call terminate_cohorts(currentSite, currentPatch, 1)
call terminate_cohorts(currentSite, currentPatch, 1,14)

call fuse_cohorts(currentSite, currentPatch, bc_in)

! Remove cohorts for various other reasons
call terminate_cohorts(currentSite, currentPatch, 2)
call terminate_cohorts(currentSite, currentPatch, 2,14)

end if

Expand Down Expand Up @@ -330,7 +331,6 @@ end subroutine canopy_structure
subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr)

use EDParamsMod, only : ED_val_comp_excln
use EDtypesMod , only : ncwd
use SFParamsMod, only : SF_val_CWD_frac

! !ARGUMENTS
Expand Down Expand Up @@ -657,11 +657,17 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr)

allocate(copyc)

call InitPRTCohort(copyc)
! Initialize the PARTEH object and point to the
! correct boundary condition fields
copyc%prt => null()
call InitPRTObject(copyc%prt)
call InitPRTBoundaryConditions(copyc)

if( hlm_use_planthydro.eq.itrue ) then
call InitHydrCohort(currentSite,copyc)
endif
call copy_cohort(currentCohort, copyc)

call copy_cohort(currentCohort, copyc)

newarea = currentCohort%c_area - cc_loss
copyc%n = currentCohort%n*newarea/currentCohort%c_area
Expand Down Expand Up @@ -707,50 +713,10 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr)

if(currentCohort%canopy_layer>nclmax )then

! put the litter from the terminated cohorts into the fragmenting pools
do i_cwd=1,ncwd

currentPatch%CWD_AG(i_cwd) = currentPatch%CWD_AG(i_cwd) + &
(struct_c + sapw_c ) * &
EDPftvarcon_inst%allom_agb_frac(currentCohort%pft) * &
SF_val_CWD_frac(i_cwd)*currentCohort%n/currentPatch%area

currentPatch%CWD_BG(i_cwd) = currentPatch%CWD_BG(i_cwd) + &
(struct_c + sapw_c) * &
(1.0_r8-EDPftvarcon_inst%allom_agb_frac(currentCohort%pft)) * &
SF_val_CWD_frac(i_cwd)*currentCohort%n/currentPatch%area !litter flux per m2.

enddo

currentPatch%leaf_litter(currentCohort%pft) = &
currentPatch%leaf_litter(currentCohort%pft) + &
leaf_c * currentCohort%n/currentPatch%area ! leaf litter flux per m2.

currentPatch%root_litter(currentCohort%pft) = &
currentPatch%root_litter(currentCohort%pft) + &
(fnrt_c + store_c) * currentCohort%n/currentPatch%area

! keep track of the above fluxes at the site level as a
! CWD/litter input flux (in kg / site-m2 / yr)
do i_cwd=1,ncwd
currentSite%CWD_AG_diagnostic_input_carbonflux(i_cwd) = &
currentSite%CWD_AG_diagnostic_input_carbonflux(i_cwd) &
+ currentCohort%n * (struct_c + sapw_c) * &
SF_val_CWD_frac(i_cwd) * EDPftvarcon_inst%allom_agb_frac(currentCohort%pft) &
* hlm_days_per_year / AREA
currentSite%CWD_BG_diagnostic_input_carbonflux(i_cwd) = &
currentSite%CWD_BG_diagnostic_input_carbonflux(i_cwd) &
+ currentCohort%n * (struct_c + sapw_c) * &
SF_val_CWD_frac(i_cwd) * (1.0_r8 - &
EDPftvarcon_inst%allom_agb_frac(currentCohort%pft)) * hlm_days_per_year / AREA
enddo

currentSite%leaf_litter_diagnostic_input_carbonflux(currentCohort%pft) = &
currentSite%leaf_litter_diagnostic_input_carbonflux(currentCohort%pft) + &
currentCohort%n * leaf_c * hlm_days_per_year / AREA
currentSite%root_litter_diagnostic_input_carbonflux(currentCohort%pft) = &
currentSite%root_litter_diagnostic_input_carbonflux(currentCohort%pft) + &
currentCohort%n * (fnrt_c + store_c) * hlm_days_per_year / AREA
! put the litter from the terminated cohorts
! straight into the fragmenting pools
call SendCohortToLitter(currentSite,currentPatch, &
currentCohort,currentCohort%n)

currentCohort%n = 0.0_r8
currentCohort%c_area = 0.0_r8
Expand Down Expand Up @@ -1144,7 +1110,12 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)

allocate(copyc)

call InitPRTCohort(copyc)
! Initialize the PARTEH object and point to the
! correct boundary condition fields
copyc%prt => null()
call InitPRTObject(copyc%prt)
call InitPRTBoundaryConditions(copyc)

if( hlm_use_planthydro.eq.itrue ) then
call InitHydrCohort(CurrentSite,copyc)
endif
Expand Down Expand Up @@ -1286,8 +1257,6 @@ subroutine canopy_summarization( nsites, sites, bc_in )

use FatesInterfaceMod , only : bc_in_type
use EDPatchDynamicsMod , only : set_patchno
use FatesAllometryMod , only : set_root_fraction
use FatesAllometryMod , only : i_hydro_rootprof_context
use FatesSizeAgeTypeIndicesMod, only : sizetype_class_index
use EDtypesMod , only : area
use EDPftvarcon , only : EDPftvarcon_inst
Expand Down Expand Up @@ -1329,18 +1298,6 @@ subroutine canopy_summarization( nsites, sites, bc_in )

do while(associated(currentPatch))

! Calculate rooting depth fractions for the patch x pft
! Note that we are calling for the root fractions in the hydrologic context.
! See explanation in FatesAllometryMod. In other locations, this
! function is called to return the profile of biomass as used for litter

do ft = 1, numpft
call set_root_fraction(currentPatch%rootfr_ft(ft,1:bc_in(s)%nlevsoil), ft, &
bc_in(s)%zi_sisl,lowerb=lbound(bc_in(s)%zi_sisl,1), &
icontext=i_hydro_rootprof_context)
end do


!zero cohort-summed variables.
currentPatch%total_canopy_area = 0.0_r8
currentPatch%total_tree_area = 0.0_r8
Expand Down
Loading