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

parteh v1 #421

Merged
merged 46 commits into from
Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
857d873
Added parteh into FATES folder system. Functional unit tests for carb…
rgknox Sep 18, 2018
229dce0
Partial first pass on integrating new modular allocation system
rgknox Sep 19, 2018
9140338
Lots more conversion from old system to parteh v0
rgknox Sep 20, 2018
3aafcae
Minor syntax changes to describing main prt object
rgknox Sep 20, 2018
e7fedaa
minor syntax updates to prt generic
rgknox Sep 20, 2018
8b58a68
Converted biophysics routines into new allocation structure. First pass.
rgknox Sep 23, 2018
a3b68cb
Removed old CN parameters
rgknox Sep 23, 2018
39fbed2
Added the call to load the PRT instances
rgknox Sep 24, 2018
f987da9
First pass at code handling loss fluxes, updates to parameters.
rgknox Sep 25, 2018
d3f760f
Updating calls to loss-fluxes. Removed the cohort litter_flux variabl…
rgknox Sep 25, 2018
f6b47fd
Code fixes and tweaks to enable new turnover design into the parteh u…
rgknox Sep 26, 2018
22b62f8
Updated functional unit test build script to include external CNP module
rgknox Sep 26, 2018
efe38c2
Resolved merge conflicts with master.
rgknox Sep 26, 2018
9a34945
Bug fixes to maintenance losses, fixes/updates to the unit test to us…
rgknox Sep 26, 2018
fb39f3c
Added phenology events to the functional unit tests, however its mess…
rgknox Sep 27, 2018
b27fbee
Debugged phenology events in the unit testing framework
rgknox Sep 27, 2018
a40884f
Lots of debugging of parteh integration. This changeset compiles.
rgknox Sep 28, 2018
11c4855
Debugging parteh v1, model runs, crashes after several years due to c…
rgknox Sep 28, 2018
d1497bb
More debugging for parteh-fates. Added reproductive flux handler.
rgknox Sep 28, 2018
ec51801
bug fixes relevant to parteh v0. Fixed root litter accumulation and f…
rgknox Oct 1, 2018
33c8fa9
Enabled object oriented filling/retrieving of PRT variables from rest…
rgknox Oct 2, 2018
dcb9219
Some debugging for restarts on arbitrary prt variables.
rgknox Oct 2, 2018
f133b79
bug fixes in parteh v1
rgknox Oct 2, 2018
19f634d
Fixed some descriptions in the parameter file. Added the flush fracti…
rgknox Oct 3, 2018
43dcde8
Fixed type definition of prt objects during copy and fuse
rgknox Oct 8, 2018
707b0c9
Updated the default 14pft file to include parteh parameters. Added t…
rgknox Oct 11, 2018
2e96e19
parteh: Moved the allocation of the prt structure to be a non-overrid…
rgknox Oct 12, 2018
a3f91ec
Merge resolutions with fire fixes / debug fixes with parteh
rgknox Oct 12, 2018
e9b32b0
Connected phenology flush fraction to the actual process
rgknox Oct 12, 2018
fe69005
Updated unit testing scripts to reflect updates in core parteh code.
rgknox Oct 15, 2018
d397866
parteh syntax changes, renamed hlm_parteh_mode, added the named cases…
rgknox Oct 17, 2018
881b5fc
Update parteh/PRTAllometricCarbonMod.F90
rosiealice Oct 17, 2018
4808362
Update parteh/PRTAllometricCarbonMod.F90
rosiealice Oct 18, 2018
bfbe4b6
Many comments and cleanings for the parteh.
rgknox Oct 18, 2018
26f4c70
Merge branch 'rgknox-parteh' of github.com:rgknox/fates into rgknox-p…
rgknox Oct 18, 2018
9bf1ad7
Update parteh/PRTGenericMod.F90
ckoven Oct 18, 2018
ba3a24e
Update parteh/PRTGenericMod.F90
ckoven Oct 18, 2018
a2119ad
Update parteh/PRTLossFluxesMod.F90
ckoven Oct 18, 2018
ee39364
Update parteh/PRTAllometricCarbonMod.F90
ckoven Oct 18, 2018
ad301bc
Update biogeochem/EDPatchDynamicsMod.F90
jkshuman Oct 18, 2018
ef87e48
More updates to comments and variable naming conventions, like bl -> …
rgknox Oct 18, 2018
a2dd80d
unified the grperc parameters, only grperc is used in the parameter f…
rgknox Oct 19, 2018
4be98cc
Updated functional unit tests to conform to newly named variables.
rgknox Oct 19, 2018
daacfb2
parteh: Changed naming convention from species (chemical) to element.…
rgknox Oct 22, 2018
f20cd68
parteh: Updated species (chem) to element in functional unit test code
rgknox Oct 22, 2018
c8d2025
parteh: placed call to net_allocation query inside an isnew condition…
rgknox Oct 23, 2018
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
51 changes: 51 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.mod
*.pyc
*.pdf

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.nc

# Logs and databases #
######################
*.log
*.sql
*.out
*.sqlite

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Latex/Tex files #
*.aux
*.dvi
*.toc


# Old Files
*~
112 changes: 89 additions & 23 deletions biogeochem/EDCanopyStructureMod.F90

Large diffs are not rendered by default.

412 changes: 239 additions & 173 deletions biogeochem/EDCohortDynamicsMod.F90

Large diffs are not rendered by default.

33 changes: 24 additions & 9 deletions biogeochem/EDLoggingMortalityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ module EDLoggingMortalityMod
use FatesGlobals , only : fates_log
use shr_log_mod , only : errMsg => shr_log_errMsg
use FatesPlantHydraulicsMod, only : AccumulateMortalityWaterStorage


use PRTGenericMod , only : all_carbon_species
use PRTGenericMod , only : sapw_organ, struct_organ, leaf_organ
use PRTGenericMod , only : fnrt_organ, store_organ, repro_organ


implicit none
private

Expand Down Expand Up @@ -260,6 +265,11 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
real(r8) :: leaf_litter ! Leafy biomass transferred through mortality [kgC/site]
real(r8) :: root_litter ! Rooty + storage biomass transferred through mort [kgC/site]
real(r8) :: agb_frac ! local copy of the above ground biomass fraction [fraction]
real(r8) :: leaf_c ! leaf carbon [kg]
real(r8) :: fnrt_c ! fineroot carbon [kg]
real(r8) :: sapw_c ! sapwood carbon [kg]
real(r8) :: store_c ! storage carbon [kg]
real(r8) :: struct_c ! structure carbon [kg]
integer :: p ! pft index
integer :: c ! cwd index

Expand All @@ -274,8 +284,13 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
currentCohort => currentPatch%shortest
do while(associated(currentCohort))
p = currentCohort%pft

sapw_c = currentCohort%prt%GetState(sapw_organ, all_carbon_species)
struct_c = currentCohort%prt%GetState(struct_organ, all_carbon_species)
leaf_c = currentCohort%prt%GetState(leaf_organ, all_carbon_species)
fnrt_c = currentCohort%prt%GetState(fnrt_organ, all_carbon_species)
store_c = currentCohort%prt%GetState(store_organ, all_carbon_species)


if(currentCohort%canopy_layer == 1)then
direct_dead = currentCohort%n * currentCohort%lmort_direct
indirect_dead = currentCohort%n * &
Expand Down Expand Up @@ -315,7 +330,7 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site

do c = 1,ncwd-1
woody_litter = (direct_dead+indirect_dead) * &
(currentCohort%bdead+currentCohort%bsw)
(struct_c + sapw_c )
cwd_litter_density = SF_val_CWD_frac(c) * woody_litter / litter_area

newPatch%cwd_ag(c) = newPatch%cwd_ag(c) + agb_frac * cwd_litter_density * np_mult
Expand Down Expand Up @@ -344,7 +359,7 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
! collateral damange and infrastructure logging is applied to bole litter
! ----------------------------------------------------------------------------------------

woody_litter = indirect_dead * (currentCohort%bdead+currentCohort%bsw)
woody_litter = indirect_dead * (struct_c + sapw_c)

cwd_litter_density = SF_val_CWD_frac(ncwd) * woody_litter / litter_area

Expand All @@ -368,7 +383,7 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
! Handle litter flux for the belowground portion of directly logged boles
! ----------------------------------------------------------------------------------------

woody_litter = direct_dead * (currentCohort%bdead+currentCohort%bsw)
woody_litter = direct_dead * (struct_c + sapw_c)
cwd_litter_density = SF_val_CWD_frac(ncwd) * woody_litter / litter_area

newPatch%cwd_bg(ncwd) = newPatch%cwd_bg(ncwd) + &
Expand All @@ -393,16 +408,16 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
! ----------------------------------------------------------------------------------------

trunk_product_site = trunk_product_site + &
SF_val_CWD_frac(ncwd) * agb_frac * direct_dead * (currentCohort%bdead+currentCohort%bsw)
SF_val_CWD_frac(ncwd) * agb_frac * direct_dead * (struct_c + sapw_c)


! ----------------------------------------------------------------------------------------
! Handle fluxes of leaf, root and storage carbon into litter pools.
! (none of these are exported)
! ----------------------------------------------------------------------------------------

leaf_litter = (direct_dead+indirect_dead)*currentCohort%bl
root_litter = (direct_dead+indirect_dead)*(currentCohort%br+currentCohort%bstore)
leaf_litter = (direct_dead+indirect_dead) * leaf_c
root_litter = (direct_dead+indirect_dead) * (fnrt_c + store_c)

newPatch%leaf_litter(p) = newPatch%leaf_litter(p) + leaf_litter / litter_area * np_mult
newPatch%root_litter(p) = newPatch%root_litter(p) + root_litter / litter_area * np_mult
Expand Down Expand Up @@ -431,7 +446,7 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
delta_biomass_stock = delta_biomass_stock + &
leaf_litter + &
root_litter + &
(direct_dead+indirect_dead) * (currentCohort%bdead+currentCohort%bsw)
(direct_dead+indirect_dead) * (struct_c + sapw_c)

delta_individual = delta_individual + &
direct_dead + &
Expand Down
12 changes: 9 additions & 3 deletions biogeochem/EDMortalityFunctionsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ module EDMortalityFunctionsMod
use EDParamsMod , only : fates_mortality_disturbance_fraction
use FatesInterfaceMod , only : bc_in_type

use PRTGenericMod, only : carbon12_species
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is is 'carbon12_species' here and 'all_carbon_species' in the logging mortality function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been a tricky bit. I tried to make it so PARTEH would be ready to handle carbon isotopes. However, there are no specific PARTEH methods that use isotopic carbon. And as we all know, there aren't any methods in FATES master that use isotopic carbon. carbon12 indicates that the state variable of interest is just the single species of carbon, carbon 12; whereas all_carbon_species is a flag that specifies the sum of all carbon isotopes for the organ of interest should be returned. Since we only have carbon12 used in current hypotheses, the two are currently equivalent.

The process of deciding which of these two should be passed between different parts of the code has been a little murky, and this might be a sign of me not being able to make up my mind or finish thinking it through.

In the example you bring up @rosiealice , I agree these should definitely be the same.

I suppose that as a default, we could just use "all_carbon_species" to specify all carbon fluxes in and out of PARTEH until an isotope model is introduced.

use PRTGenericMod, only : store_organ

implicit none
private
Expand Down Expand Up @@ -57,7 +59,8 @@ subroutine mortality_rates( cohort_in,bc_in,cmort,hmort,bmort,frmort )
real(r8),intent(out) :: frmort ! freezing stress mortality

real(r8) :: frac ! relativised stored carbohydrate
real(r8) :: b_leaf ! target leaf biomass kgC
real(r8) :: leaf_c_target ! target leaf biomass kgC

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so again to clear up some possible confusion, we seem to still be interchanging b_leaf with leaf_c in some places, is that correct? Or should we replace all previous b_leaf with leaf_c to represent leaf biomass?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these naming conventions should definitely be cleared up. I'm pretty sure that anywhere in the code you see "b_leaf", it actually is referring to the target leaf biomass, ie the value of the pool when it is on allometry and fully flushed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK got it

real(r8) :: store_c
real(r8) :: hf_sm_threshold ! hydraulic failure soil moisture threshold
real(r8) :: temp_dep_fraction ! Temp. function (freezing mortality)
real(r8) :: temp_in_C ! Daily averaged temperature in Celcius
Expand All @@ -83,8 +86,11 @@ subroutine mortality_rates( cohort_in,bc_in,cmort,hmort,bmort,frmort )

! Carbon Starvation induced mortality.
if ( cohort_in%dbh > 0._r8 ) then
call bleaf(cohort_in%dbh,cohort_in%pft,cohort_in%canopy_trim,b_leaf)
call storage_fraction_of_target(b_leaf, cohort_in%bstore, frac)
call bleaf(cohort_in%dbh,cohort_in%pft,cohort_in%canopy_trim,leaf_c_target)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe I am accidentally conflating things since I also see this sub is called bleaf.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that subroutine should be renamed to convey that it is returning the allometric target leaf carbon

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha! that makes sense then. I agree renaming would reduce confusion


store_c = cohort_in%prt%GetState(store_organ,carbon12_species)

call storage_fraction_of_target(leaf_c_target, store_c, frac)
if( frac .lt. 1._r8) then
cmort = max(0.0_r8,EDPftvarcon_inst%mort_scalar_cstarvation(cohort_in%pft) * &
(1.0_r8 - frac))
Expand Down
Loading