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 scaling fixes #716

Merged
merged 35 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9a9505f
Fixes to parteh scaling algorithm, particularly trivial boundary cond…
rgknox Nov 10, 2020
8fdb1d9
cnp boundary scaling fixes
rgknox Nov 10, 2020
54fc2d6
Condensing the N/P need diagnostics
rgknox Nov 11, 2020
60fb19c
Updated need algorithm to use storage deficit
rgknox Nov 11, 2020
8c3a99a
Updates to parteh and nutrient coupling. Mostly related to defining m…
rgknox Nov 16, 2020
3b0d8b1
Initial code prep for logistic function to affect the cn_scalar in FA…
rgknox Dec 3, 2020
e1bf0a3
Updated cn_scalar calculations and nutrient storage target
rgknox Dec 3, 2020
c8778be
Updates to CNP storage and cn_scalar
rgknox Dec 8, 2020
74c320b
Updated regulating function for N storage recovering
rgknox Jan 24, 2021
941bd8f
Refactored parameter file to remove reproductive and storage organs f…
rgknox Jan 27, 2021
e19ed47
scaling fixes fixes
rgknox Jan 28, 2021
e50d027
Tweaked some order of operations in CNP allocation module
rgknox Jan 29, 2021
d6ab00c
Placed cap on N/P storage fraction when calculating CN_scalar
rgknox Jan 29, 2021
8e10af7
Removed N+P efflux from CNP model, as uptake downregulation will now …
rgknox Jan 30, 2021
66f3d4c
parteh updates: 1) new downregulation (linear and CN) functions for E…
rgknox Feb 15, 2021
bd8632a
Updates to history variables, adding NH4 and NO3 uptake diagnostics. …
rgknox Feb 18, 2021
cf623b0
bug fix on calculation of cn_scalar and cp_scalar for eca
rgknox Feb 21, 2021
2bbe5f9
Updated some default parameters for parteh=2
rgknox Apr 2, 2021
26470bb
Merge branch 'master' into parteh-scaling-fixes
rgknox Apr 2, 2021
7b20839
Merged in updates to the cnscalar formulation, storage nutrient calcu…
rgknox Apr 6, 2021
ff0fee8
removing unused code for demand calculations in new plants
rgknox Apr 6, 2021
1d5a73c
Reverted to nclmax=2, as that would be a different feature to use >2
rgknox Apr 7, 2021
094a752
minor comment and cleanings to FatesSoilBGCFluxMod.F90
rgknox Apr 7, 2021
aeaca30
Moved storage nutrient calculation to PRTGeneric and call it from mor…
rgknox Apr 9, 2021
b9d43e3
Adding thaw-depth to root depth calculations
rgknox Apr 10, 2021
11d71eb
debugging issues with nutrient coupling
rgknox Apr 23, 2021
3e675e9
Cleaning of debugging during cnp coupling developments
rgknox Apr 30, 2021
e3a783a
Remove print statement
rgknox Apr 30, 2021
3bf95e1
Added output boundary conditions for communication with CH4 model. Ad…
rgknox May 3, 2021
554165b
Added woody fraction bc for ch4 coupling
rgknox May 4, 2021
593ee03
Updated CH4 coupling with ELM/CLM to utilize use_ch4 coupling flag, w…
rgknox May 4, 2021
936ebee
Merge branch 'master' into parteh-scaling-fixes-may05
rgknox May 5, 2021
cce7113
Fixes to litter generation and what organs are filtered
rgknox May 10, 2021
b77a0d5
Revereted canopy layer and max cohort counts to maintain consistency …
rgknox May 10, 2021
0f7b617
Reverting bc_in_ptr and bc_out_ptr, because nag.
rgknox May 25, 2021
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
68 changes: 30 additions & 38 deletions biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ module EDCohortDynamicsMod
use PRTAllometricCNPMod, only : acnp_bc_in_id_pft, acnp_bc_in_id_ctrim
use PRTAllometricCNPMod, only : acnp_bc_in_id_lstat, acnp_bc_inout_id_dbh
use PRTAllometricCNPMod, only : acnp_bc_inout_id_rmaint_def, acnp_bc_in_id_netdc
use PRTAllometricCNPMod, only : acnp_bc_in_id_netdn, acnp_bc_in_id_netdp
use PRTAllometricCNPMod, only : acnp_bc_in_id_netdnh4, acnp_bc_in_id_netdno3, acnp_bc_in_id_netdp
use PRTAllometricCNPMod, only : acnp_bc_out_id_cefflux, acnp_bc_out_id_nefflux
use PRTAllometricCNPMod, only : acnp_bc_out_id_pefflux
use PRTAllometricCNPMod, only : acnp_bc_out_id_ngrow,acnp_bc_out_id_nmax
use PRTAllometricCNPMod, only : acnp_bc_out_id_pgrow,acnp_bc_out_id_pmax
use PRTAllometricCNPMod, only : acnp_bc_out_id_nneed
use PRTAllometricCNPMod, only : acnp_bc_out_id_pneed


use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=)
Expand Down Expand Up @@ -400,7 +400,8 @@ subroutine InitPRTBoundaryConditions(new_cohort)
call new_cohort%prt%RegisterBCIn(acnp_bc_in_id_ctrim,bc_rval = new_cohort%canopy_trim)
call new_cohort%prt%RegisterBCIn(acnp_bc_in_id_lstat,bc_ival = new_cohort%status_coh)
call new_cohort%prt%RegisterBCIn(acnp_bc_in_id_netdc, bc_rval = new_cohort%npp_acc)
call new_cohort%prt%RegisterBCIn(acnp_bc_in_id_netdn, bc_rval = new_cohort%daily_n_uptake)
call new_cohort%prt%RegisterBCIn(acnp_bc_in_id_netdnh4, bc_rval = new_cohort%daily_nh4_uptake)
call new_cohort%prt%RegisterBCIn(acnp_bc_in_id_netdno3, bc_rval = new_cohort%daily_no3_uptake)
call new_cohort%prt%RegisterBCIn(acnp_bc_in_id_netdp, bc_rval = new_cohort%daily_p_uptake)

call new_cohort%prt%RegisterBCInOut(acnp_bc_inout_id_dbh,bc_rval = new_cohort%dbh)
Expand All @@ -409,10 +410,8 @@ subroutine InitPRTBoundaryConditions(new_cohort)
call new_cohort%prt%RegisterBCOut(acnp_bc_out_id_cefflux, bc_rval = new_cohort%daily_c_efflux)
call new_cohort%prt%RegisterBCOut(acnp_bc_out_id_nefflux, bc_rval = new_cohort%daily_n_efflux)
call new_cohort%prt%RegisterBCOut(acnp_bc_out_id_pefflux, bc_rval = new_cohort%daily_p_efflux)
call new_cohort%prt%RegisterBCOut(acnp_bc_out_id_ngrow, bc_rval = new_cohort%daily_n_need1)
call new_cohort%prt%RegisterBCOut(acnp_bc_out_id_nmax, bc_rval = new_cohort%daily_n_need2)
call new_cohort%prt%RegisterBCOut(acnp_bc_out_id_pgrow, bc_rval = new_cohort%daily_p_need1)
call new_cohort%prt%RegisterBCOut(acnp_bc_out_id_pmax, bc_rval = new_cohort%daily_p_need2)
call new_cohort%prt%RegisterBCOut(acnp_bc_out_id_nneed, bc_rval = new_cohort%daily_n_need)
call new_cohort%prt%RegisterBCOut(acnp_bc_out_id_pneed, bc_rval = new_cohort%daily_p_need)


case DEFAULT
Expand Down Expand Up @@ -559,15 +558,14 @@ subroutine nan_cohort(cc_p)
currentCohort%resp_acc = nan ! RESP: kGC/cohort/day

! Fluxes from nutrient allocation
currentCohort%daily_n_uptake = nan
currentCohort%daily_nh4_uptake = nan
currentCohort%daily_no3_uptake = nan
currentCohort%daily_p_uptake = nan
currentCohort%daily_c_efflux = nan
currentCohort%daily_n_efflux = nan
currentCohort%daily_p_efflux = nan
currentCohort%daily_n_need1 = nan
currentCohort%daily_n_need2 = nan
currentCohort%daily_p_need1 = nan
currentCohort%daily_p_need2 = nan
currentCohort%daily_n_need = nan
currentCohort%daily_p_need = nan
currentCohort%daily_n_demand = nan
currentCohort%daily_p_demand = nan

Expand Down Expand Up @@ -678,17 +676,16 @@ subroutine zero_cohort(cc_p)
! after allocation. These variables exist in
! carbon-only mode but are not used.

currentCohort%daily_n_uptake = 0._r8
currentCohort%daily_nh4_uptake = 0._r8
currentCohort%daily_no3_uptake = 0._r8
currentCohort%daily_p_uptake = 0._r8

currentCohort%daily_c_efflux = 0._r8
currentCohort%daily_n_efflux = 0._r8
currentCohort%daily_p_efflux = 0._r8

currentCohort%daily_n_need1 = 0._r8
currentCohort%daily_n_need2 = 0._r8
currentCohort%daily_p_need1 = 0._r8
currentCohort%daily_p_need2 = 0._r8
currentCohort%daily_n_need = 0._r8
currentCohort%daily_p_need = 0._r8

! Initialize these as negative
currentCohort%daily_p_demand = -9._r8
Expand All @@ -711,7 +708,7 @@ subroutine terminate_cohorts( currentSite, currentPatch, level , call_index)
type (ed_patch_type), intent(inout), target :: currentPatch
integer , intent(in) :: level
integer :: call_index

! Important point regarding termination levels. Termination is typically
! called after fusion. We do this so that we can re-capture the biomass that would
! otherwise be lost from termination. The biomass of a fused plant remains in the
Expand Down Expand Up @@ -885,8 +882,6 @@ subroutine SendCohortToLitter(csite,cpatch,ccohort,nplant)
type (ed_cohort_type) , target :: ccohort
real(r8) :: nplant ! Number (absolute)
! of plants to transfer

!
type(litter_type), pointer :: litt ! Litter object for each element
type(site_fluxdiags_type),pointer :: flux_diags

Expand All @@ -910,7 +905,8 @@ subroutine SendCohortToLitter(csite,cpatch,ccohort,nplant)

plant_dens = nplant/cpatch%area

call set_root_fraction(csite%rootfrac_scr, pft, csite%zi_soil)
call set_root_fraction(csite%rootfrac_scr, pft, csite%zi_soil, &
csite%bc_in_ptr%max_rooting_depth_index_col)

do el=1,num_elements

Expand Down Expand Up @@ -1396,8 +1392,10 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
currentCohort%frmort = (currentCohort%n*currentCohort%frmort + nextc%n*nextc%frmort)/newn

! Nutrient fluxes
currentCohort%daily_n_uptake = (currentCohort%n*currentCohort%daily_n_uptake + &
nextc%n*nextc%daily_n_uptake)/newn
currentCohort%daily_nh4_uptake = (currentCohort%n*currentCohort%daily_nh4_uptake + &
nextc%n*nextc%daily_nh4_uptake)/newn
currentCohort%daily_no3_uptake = (currentCohort%n*currentCohort%daily_no3_uptake + &
nextc%n*nextc%daily_no3_uptake)/newn
currentCohort%daily_p_uptake = (currentCohort%n*currentCohort%daily_p_uptake + &
nextc%n*nextc%daily_p_uptake)/newn

Expand All @@ -1413,15 +1411,10 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
currentCohort%daily_p_efflux = (currentCohort%n*currentCohort%daily_p_efflux + &
nextc%n*nextc%daily_p_efflux)/newn

currentCohort%daily_n_need1 = (currentCohort%n*currentCohort%daily_n_need1 + &
nextc%n*nextc%daily_n_need1)/newn
currentCohort%daily_n_need2 = (currentCohort%n*currentCohort%daily_n_need2 + &
nextc%n*nextc%daily_n_need2)/newn
currentCohort%daily_p_need1 = (currentCohort%n*currentCohort%daily_p_need1 + &
nextc%n*nextc%daily_p_need1)/newn
currentCohort%daily_p_need2 = (currentCohort%n*currentCohort%daily_p_need2 + &
nextc%n*nextc%daily_p_need2)/newn

currentCohort%daily_n_need = (currentCohort%n*currentCohort%daily_n_need + &
nextc%n*nextc%daily_n_need)/newn
currentCohort%daily_p_need = (currentCohort%n*currentCohort%daily_p_need + &
nextc%n*nextc%daily_p_need)/newn


! logging mortality, Yi Xu
Expand Down Expand Up @@ -1817,15 +1810,14 @@ subroutine copy_cohort( currentCohort,copyc )
n%year_net_uptake = o%year_net_uptake
n%ts_net_uptake = o%ts_net_uptake

n%daily_n_uptake = o%daily_n_uptake
n%daily_nh4_uptake = o%daily_nh4_uptake
n%daily_no3_uptake = o%daily_no3_uptake
n%daily_p_uptake = o%daily_p_uptake
n%daily_c_efflux = o%daily_c_efflux
n%daily_n_efflux = o%daily_n_efflux
n%daily_p_efflux = o%daily_p_efflux
n%daily_n_need1 = o%daily_n_need1
n%daily_n_need2 = o%daily_n_need2
n%daily_p_need1 = o%daily_p_need1
n%daily_p_need2 = o%daily_p_need2
n%daily_n_need = o%daily_n_need
n%daily_p_need = o%daily_p_need
n%daily_n_demand = o%daily_n_demand
n%daily_p_demand = o%daily_p_demand

Expand Down
5 changes: 4 additions & 1 deletion biogeochem/EDLoggingMortalityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
type(ed_patch_type) , intent(inout), target :: newPatch
real(r8) , intent(in) :: patch_site_areadis


!LOCAL VARIABLES:
type(ed_cohort_type), pointer :: currentCohort
type(site_massbal_type), pointer :: site_mass
Expand Down Expand Up @@ -567,7 +568,9 @@ subroutine logging_litter_fluxes(currentSite, currentPatch, newPatch, patch_site
! derived from the current patch, so we need to multiply by patch_areadis/np%area
! ----------------------------------------------------------------------------------------

call set_root_fraction(currentSite%rootfrac_scr, pft, currentSite%zi_soil)
call set_root_fraction(currentSite%rootfrac_scr, pft, &
currentSite%zi_soil, &
currentSite%bc_in_ptr%max_rooting_depth_index_col)

ag_wood = (direct_dead+indirect_dead) * (struct_m + sapw_m ) * &
prt_params%allom_agb_frac(currentCohort%pft)
Expand Down
23 changes: 14 additions & 9 deletions biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,14 @@ subroutine spawn_patches( currentSite, bc_in)
! Transfer in litter fluxes from plants in various contexts of death and destruction

if(currentPatch%disturbance_mode .eq. dtype_ilog) then
call logging_litter_fluxes(currentSite, currentPatch, new_patch, patch_site_areadis)
call logging_litter_fluxes(currentSite, currentPatch, &
new_patch, patch_site_areadis)
elseif(currentPatch%disturbance_mode .eq. dtype_ifire) then
call fire_litter_fluxes(currentSite, currentPatch, new_patch, patch_site_areadis)
call fire_litter_fluxes(currentSite, currentPatch, &
new_patch, patch_site_areadis)
else
call mortality_litter_fluxes(currentSite, currentPatch, new_patch, patch_site_areadis)
call mortality_litter_fluxes(currentSite, currentPatch, &
new_patch, patch_site_areadis)
endif

! --------------------------------------------------------------------------
Expand Down Expand Up @@ -1510,7 +1513,8 @@ end subroutine TransLitterNewPatch

! ============================================================================

subroutine fire_litter_fluxes(currentSite, currentPatch, newPatch, patch_site_areadis)
subroutine fire_litter_fluxes(currentSite, currentPatch, &
newPatch, patch_site_areadis)
!
! !DESCRIPTION:
! CWD pool burned by a fire.
Expand All @@ -1529,7 +1533,6 @@ subroutine fire_litter_fluxes(currentSite, currentPatch, newPatch, patch_site_ar
type(ed_patch_type) , intent(inout), target :: currentPatch ! Donor Patch
type(ed_patch_type) , intent(inout), target :: newPatch ! New Patch
real(r8) , intent(in) :: patch_site_areadis ! Area being donated
! by current patch
!
! !LOCAL VARIABLES:

Expand Down Expand Up @@ -1658,7 +1661,8 @@ subroutine fire_litter_fluxes(currentSite, currentPatch, newPatch, patch_site_ar

site_mass%burn_flux_to_atm = site_mass%burn_flux_to_atm + burned_mass

call set_root_fraction(currentSite%rootfrac_scr, pft, currentSite%zi_soil)
call set_root_fraction(currentSite%rootfrac_scr, pft, currentSite%zi_soil, &
currentSite%bc_in_ptr%max_rooting_depth_index_col)

! Contribution of dead trees to root litter (no root burn flux to atm)
do dcmpy=1,ndcmpy
Expand Down Expand Up @@ -1730,7 +1734,8 @@ end subroutine fire_litter_fluxes

! ============================================================================

subroutine mortality_litter_fluxes(currentSite, currentPatch, newPatch, patch_site_areadis)
subroutine mortality_litter_fluxes(currentSite, currentPatch, &
newPatch, patch_site_areadis)
!
! !DESCRIPTION:
! Carbon going from mortality associated with disturbance into CWD pools.
Expand All @@ -1752,7 +1757,6 @@ subroutine mortality_litter_fluxes(currentSite, currentPatch, newPatch, patch_si
type(ed_patch_type) , intent(inout), target :: currentPatch
type(ed_patch_type) , intent(inout), target :: newPatch
real(r8) , intent(in) :: patch_site_areadis

!
! !LOCAL VARIABLES:
type(ed_cohort_type), pointer :: currentCohort
Expand Down Expand Up @@ -1867,7 +1871,8 @@ subroutine mortality_litter_fluxes(currentSite, currentPatch, newPatch, patch_si
ag_wood = num_dead * (struct_m + sapw_m) * prt_params%allom_agb_frac(pft)
bg_wood = num_dead * (struct_m + sapw_m) * (1.0_r8-prt_params%allom_agb_frac(pft))

call set_root_fraction(currentSite%rootfrac_scr, pft, currentSite%zi_soil)
call set_root_fraction(currentSite%rootfrac_scr, pft, currentSite%zi_soil, &
currentSite%bc_in_ptr%max_rooting_depth_index_col)


do c=1,ncwd
Expand Down
Loading