Skip to content

Commit

Permalink
Merge pull request #421 from rgknox/rgknox-parteh
Browse files Browse the repository at this point in the history
parteh v1
  • Loading branch information
rgknox authored Oct 24, 2018
2 parents 44d45f5 + c8d2025 commit 5a9b1d6
Show file tree
Hide file tree
Showing 42 changed files with 8,589 additions and 1,877 deletions.
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
*~
109 changes: 86 additions & 23 deletions biogeochem/EDCanopyStructureMod.F90

Large diffs are not rendered by default.

411 changes: 238 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_elements
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_elements)
struct_c = currentCohort%prt%GetState(struct_organ, all_carbon_elements)
leaf_c = currentCohort%prt%GetState(leaf_organ, all_carbon_elements)
fnrt_c = currentCohort%prt%GetState(fnrt_organ, all_carbon_elements)
store_c = currentCohort%prt%GetState(store_organ, all_carbon_elements)


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 : all_carbon_elements
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
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)
store_c = cohort_in%prt%GetState(store_organ,all_carbon_elements)

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

0 comments on commit 5a9b1d6

Please sign in to comment.