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

Move growth respiration to daily timestep #1197

Merged
merged 13 commits into from
Nov 14, 2024
Merged
18 changes: 11 additions & 7 deletions biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1067,20 +1067,24 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
nextc%n*nextc%gpp_acc)/newn
currentCohort%npp_acc = (currentCohort%n*currentCohort%npp_acc + &
nextc%n*nextc%npp_acc)/newn
currentCohort%resp_acc = (currentCohort%n*currentCohort%resp_acc + &
nextc%n*nextc%resp_acc)/newn
currentCohort%resp_acc_hold = &
(currentCohort%n*currentCohort%resp_acc_hold + &
nextc%n*nextc%resp_acc_hold)/newn
currentCohort%resp_m_acc = (currentCohort%n*currentCohort%resp_m_acc + &
nextc%n*nextc%resp_m_acc)/newn
currentCohort%resp_m_acc_hold = &
(currentCohort%n*currentCohort%resp_m_acc_hold + &
nextc%n*nextc%resp_m_acc_hold)/newn
currentCohort%resp_g_acc_hold = &
(currentCohort%n*currentCohort%resp_g_acc_hold + &
nextc%n*nextc%resp_g_acc_hold)/newn
currentCohort%npp_acc_hold = &
(currentCohort%n*currentCohort%npp_acc_hold + &
nextc%n*nextc%npp_acc_hold)/newn
currentCohort%gpp_acc_hold = &
(currentCohort%n*currentCohort%gpp_acc_hold + &
nextc%n*nextc%gpp_acc_hold)/newn

currentCohort%resp_excess = (currentCohort%n*currentCohort%resp_excess + &
nextc%n*nextc%resp_excess)/newn
currentCohort%resp_excess_hold = &
(currentCohort%n*currentCohort%resp_excess_hold + &
nextc%n*nextc%resp_excess_hold)/newn

currentCohort%dmort = (currentCohort%n*currentCohort%dmort + &
nextc%n*nextc%dmort)/newn
Expand Down
73 changes: 36 additions & 37 deletions biogeochem/FatesCohortMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,24 @@ module FatesCohortMod
! after the dynamics call-sequence is completed. [kgC/indiv/day]
! _acc_hold: While _acc is zero'd after the dynamics call sequence and then integrated,
! _acc_hold "holds" the integrated value until the next time dynamics is
! called. This is necessary for restarts. This variable also has units
! converted to a useful rate [kgC/indiv/yr]
! called. This is useful because growth and excess respiration
! are calculated once daily, but we want to remove the average
! flux from the daily NEP signal, so we remove it from the next day.
! The hold variables are also useful for rebuilding history on restart.
! Units converted to a useful rate [kgC/indiv/yr]
! --------------------------------------------------------------------------

real(r8) :: gpp_tstep ! Gross Primary Production (see above *)
real(r8) :: gpp_acc
real(r8) :: gpp_acc_hold

real(r8) :: npp_tstep ! Net Primary Production (see above *)
real(r8) :: npp_acc
real(r8) :: npp_acc_hold

real(r8) :: resp_tstep ! Autotrophic respiration (see above *)
real(r8) :: resp_acc
real(r8) :: resp_acc_hold
real(r8) :: resp_m_tstep ! Maintenance respiration (see above *)
real(r8) :: resp_m_acc
real(r8) :: resp_m_acc_hold
real(r8) :: resp_g_acc_hold

real(r8) :: c13disc_clm ! carbon 13 discrimination in new synthesized carbon at each indiv/timestep [ppm]
real(r8) :: c13disc_acc ! carbon 13 discrimination in new synthesized carbon at each indiv/day
Expand Down Expand Up @@ -202,11 +205,15 @@ module FatesCohortMod
integer :: twostr_col ! The column index in the two-stream solution that this cohort is part of

! RESPIRATION COMPONENTS
real(r8) :: resp_excess_hold ! respiration of excess carbon [kgC/indiv/yr]
! note: this is flagged "hold" because it is calculated
! at the end of the day (dynamics) but is used
! on the following day (like growth respiration)
! to aid in reporting a more accurate sub-daily
! NEP

real(r8) :: rdark ! dark respiration [kgC/indiv/s]
real(r8) :: resp_g_tstep ! growth respiration [kgC/indiv/timestep]
real(r8) :: resp_m ! maintenance respiration [kgC/indiv/timestep]
real(r8) :: resp_m_unreduced ! diagnostic-only unreduced maintenance respiration [kgC/indiv/timestep]
real(r8) :: resp_excess ! respiration of excess carbon [kgC/indiv/day]
real(r8) :: livestem_mr ! aboveground live stem maintenance respiration [kgC/indiv/s]
real(r8) :: livecroot_mr ! belowground live stem maintenance respiration [kgC/indiv/s]
real(r8) :: froot_mr ! live fine root maintenance respiration [kgC/indiv/s]
Expand Down Expand Up @@ -375,12 +382,12 @@ subroutine NanValues(this)
this%gpp_tstep = nan
this%gpp_acc = nan
this%gpp_acc_hold = nan
this%npp_tstep = nan
this%npp_acc = nan
this%npp_acc_hold = nan
this%resp_tstep = nan
this%resp_acc = nan
this%resp_acc_hold = nan
this%resp_m_tstep = nan
this%resp_m_acc = nan
this%resp_m_acc_hold = nan
this%resp_g_acc_hold = nan
this%c13disc_clm = nan
this%c13disc_acc = nan
this%vcmax25top = nan
Expand Down Expand Up @@ -410,10 +417,8 @@ subroutine NanValues(this)

! RESPIRATION COMPONENTS
this%rdark = nan
this%resp_g_tstep = nan
this%resp_m = nan
this%resp_m_unreduced = nan
this%resp_excess = nan
this%resp_excess_hold = nan
this%livestem_mr = nan
this%livecroot_mr = nan
this%froot_mr = nan
Expand Down Expand Up @@ -477,17 +482,18 @@ subroutine ZeroValues(this)
this%size_class_lasttimestep = 0
this%gpp_tstep = 0._r8
this%gpp_acc = 0._r8
this%npp_tstep = 0._r8
this%npp_acc = 0._r8
this%resp_tstep = 0._r8
this%resp_acc = 0._r8
this%resp_m_tstep = 0._r8
this%resp_m_acc = 0._r8

! do not zero these, they are not built
! so more appropriate to leave unzerod
! to prevent uninitialized use
! this%gpp_acc_hold = nan
! this%npp_acc_hold = nan
! this%resp_acc_hold = nan
! this%resp_m_acc_hold = nan
! this%resp_g_acc_hold = nan
! this%resp_excess_hold = nan

this%c13disc_clm = 0._r8
this%c13disc_acc = 0._r8
Expand Down Expand Up @@ -516,10 +522,7 @@ subroutine ZeroValues(this)
this%daily_p_demand = -9._r8
this%seed_prod = 0._r8
this%rdark = 0._r8
this%resp_g_tstep = 0._r8
this%resp_m = 0._r8
this%resp_m_unreduced = 0._r8
this%resp_excess = 0._r8
this%livestem_mr = 0._r8
this%livecroot_mr = 0._r8
this%froot_mr = 0._r8
Expand Down Expand Up @@ -706,12 +709,12 @@ subroutine Copy(this, copyCohort)
copyCohort%gpp_tstep = this%gpp_tstep
copyCohort%gpp_acc = this%gpp_acc
copyCohort%gpp_acc_hold = this%gpp_acc_hold
copyCohort%npp_tstep = this%npp_tstep
copyCohort%npp_acc = this%npp_acc
copyCohort%npp_acc_hold = this%npp_acc_hold
copyCohort%resp_tstep = this%resp_tstep
copyCohort%resp_acc = this%resp_acc
copyCohort%resp_acc_hold = this%resp_acc_hold
copyCohort%resp_m_tstep = this%resp_m_tstep
copyCohort%resp_m_acc = this%resp_m_acc
copyCohort%resp_m_acc_hold = this%resp_m_acc_hold
copyCohort%resp_g_acc_hold = this%resp_g_acc_hold
copyCohort%c13disc_clm = this%c13disc_clm
copyCohort%c13disc_acc = this%c13disc_acc
copyCohort%vcmax25top = this%vcmax25top
Expand Down Expand Up @@ -744,10 +747,8 @@ subroutine Copy(this, copyCohort)

! RESPIRATION COMPONENTS
copyCohort%rdark = this%rdark
copyCohort%resp_g_tstep = this%resp_g_tstep
copyCohort%resp_m = this%resp_m
copyCohort%resp_m_unreduced = this%resp_m_unreduced
copyCohort%resp_excess = this%resp_excess
copyCohort%resp_excess_hold = this%resp_excess_hold
copyCohort%livestem_mr = this%livestem_mr
copyCohort%livecroot_mr = this%livecroot_mr
copyCohort%froot_mr = this%froot_mr
Expand Down Expand Up @@ -880,7 +881,7 @@ subroutine InitPRTBoundaryConditions(this)
call this%prt%RegisterBCIn(acnp_bc_in_id_cdamage, bc_ival=this%crowndamage)

call this%prt%RegisterBCInOut(acnp_bc_inout_id_dbh, bc_rval=this%dbh)
call this%prt%RegisterBCInOut(acnp_bc_inout_id_resp_excess, bc_rval=this%resp_excess)
call this%prt%RegisterBCInOut(acnp_bc_inout_id_resp_excess, bc_rval=this%resp_excess_hold)
call this%prt%RegisterBCInOut(acnp_bc_inout_id_l2fr, bc_rval=this%l2fr)
call this%prt%RegisterBCInOut(acnp_bc_inout_id_cx_int, bc_rval=this%cx_int)
call this%prt%RegisterBCInOut(acnp_bc_inout_id_emadcxdt, bc_rval=this%ema_dcxdt)
Expand Down Expand Up @@ -1047,14 +1048,12 @@ subroutine Dump(this)
write(fates_log(),*) 'cohort%gpp_acc = ', this%gpp_acc
write(fates_log(),*) 'cohort%gpp_tstep = ', this%gpp_tstep
write(fates_log(),*) 'cohort%npp_acc_hold = ', this%npp_acc_hold
write(fates_log(),*) 'cohort%npp_tstep = ', this%npp_tstep
write(fates_log(),*) 'cohort%npp_acc = ', this%npp_acc
write(fates_log(),*) 'cohort%resp_tstep = ', this%resp_tstep
write(fates_log(),*) 'cohort%resp_acc = ', this%resp_acc
write(fates_log(),*) 'cohort%resp_acc_hold = ', this%resp_acc_hold
write(fates_log(),*) 'cohort%resp_m_tstep = ', this%resp_m_tstep
write(fates_log(),*) 'cohort%resp_m_acc = ', this%resp_m_acc
write(fates_log(),*) 'cohort%resp_m_acc_hold = ', this%resp_m_acc_hold
write(fates_log(),*) 'cohort%resp_g_acc_hold = ', this%resp_g_acc_hold
write(fates_log(),*) 'cohort%rdark = ', this%rdark
write(fates_log(),*) 'cohort%resp_m = ', this%resp_m
write(fates_log(),*) 'cohort%resp_g_tstep = ', this%resp_g_tstep
write(fates_log(),*) 'cohort%livestem_mr = ', this%livestem_mr
write(fates_log(),*) 'cohort%livecroot_mr = ', this%livecroot_mr
write(fates_log(),*) 'cohort%froot_mr = ', this%froot_mr
Expand Down
8 changes: 3 additions & 5 deletions biogeochem/FatesSoilBGCFluxMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ subroutine UnPackNutrientAquisitionBCs(sites, bc_in)
! Locals
integer :: nsites ! number of sites
integer :: s ! site loop index
integer :: j ! soil layer
integer :: icomp ! competitor index
integer :: id ! decomp layer index
integer :: pft ! pft index
type(fates_patch_type), pointer :: cpatch ! current patch pointer
type(fates_cohort_type), pointer :: ccohort ! current cohort pointer
Expand Down Expand Up @@ -350,9 +348,10 @@ subroutine PrepCH4BCs(csite,bc_in,bc_out)
! this is a best (bad) guess at fine root MR + total root GR
! (kgC/indiv/yr) -> gC/m2/s
bc_out%root_resp(1:bc_in%nlevsoil) = bc_out%root_resp(1:bc_in%nlevsoil) + &
ccohort%resp_acc_hold*years_per_day*g_per_kg*days_per_sec* &
(ccohort%resp_m_acc_hold + ccohort%resp_g_acc_hold)*years_per_day*g_per_kg*days_per_sec* &
ccohort%n*area_inv*(1._r8-prt_params%allom_agb_frac(pft)) * csite%rootfrac_scr(1:bc_in%nlevsoil)



end if

if( prt_params%woody(pft)==itrue ) then
Expand Down Expand Up @@ -646,7 +645,6 @@ subroutine FluxIntoLitterPools(csite, bc_in, bc_out)
integer :: nlev_eff_decomp ! number of effective decomp layers
real(r8) :: area_frac ! fraction of site's area of current patch
real(r8) :: z_decomp ! Used for calculating depth midpoints of decomp layers
integer :: s ! Site index
integer :: el ! Element index (C,N,P,etc)
integer :: j ! Soil layer index
integer :: id ! Decomposition layer index
Expand Down
13 changes: 2 additions & 11 deletions biogeophys/EDAccumulateFluxesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module EDAccumulateFluxesMod
!------------------------------------------------------------------------------
! !DESCRIPTION:
! This routine accumulates NPP, GPP and respiration of each cohort over the course of each 24 hour period.
! The fluxes are stored per cohort, and the npp_tstep (etc) fluxes are calcualted in EDPhotosynthesis
! The fluxes are stored per cohort, and the gpp_tstep (etc) fluxes are calculated in EDPhotosynthesis
! This routine cannot be in EDPhotosynthesis because EDPhotosynthesis is a loop and therefore would
! erroneously add these things up multiple times.
! Rosie Fisher. March 2014.
Expand Down Expand Up @@ -80,17 +80,8 @@ subroutine AccumulateFluxes_ED(nsites, sites, bc_in, bc_out, dt_time)
! Accumulate fluxes from hourly to daily values.
! _tstep fluxes are KgC/indiv/timestep _acc are KgC/indiv/day

if ( debug ) then

write(fates_log(),*) 'EDAccumFlux 64 ',ccohort%npp_tstep
write(fates_log(),*) 'EDAccumFlux 66 ',ccohort%gpp_tstep
write(fates_log(),*) 'EDAccumFlux 67 ',ccohort%resp_tstep

endif

ccohort%npp_acc = ccohort%npp_acc + ccohort%npp_tstep
ccohort%gpp_acc = ccohort%gpp_acc + ccohort%gpp_tstep
ccohort%resp_acc = ccohort%resp_acc + ccohort%resp_tstep
ccohort%resp_m_acc = ccohort%resp_m_acc + ccohort%resp_m_tstep

ccohort%sym_nfix_daily = ccohort%sym_nfix_daily + ccohort%sym_nfix_tstep

Expand Down
48 changes: 12 additions & 36 deletions biogeophys/FatesPlantRespPhotosynthMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -739,11 +739,10 @@ subroutine FatesPlantRespPhotosynthDrive (nsites, sites,bc_in,bc_out,dtime)
end do leaf_layer_loop

! Zero cohort flux accumulators.
Copy link
Contributor

Choose a reason for hiding this comment

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

This npp_tstep needs to be deleted now.

currentCohort%npp_tstep = 0.0_r8
currentCohort%resp_tstep = 0.0_r8

currentCohort%resp_m_tstep = 0.0_r8
currentCohort%gpp_tstep = 0.0_r8
currentCohort%rdark = 0.0_r8
currentCohort%resp_m = 0.0_r8
currentCohort%ts_net_uptake = 0.0_r8
currentCohort%c13disc_clm = 0.0_r8

Expand Down Expand Up @@ -968,47 +967,24 @@ subroutine FatesPlantRespPhotosynthDrive (nsites, sites,bc_in,bc_out,dtime)
! calcualate some fluxes that are sums and nets of the base fluxes
! ------------------------------------------------------------------

if ( debug ) write(fates_log(),*) 'EDPhoto 904 ', currentCohort%resp_m
if ( debug ) write(fates_log(),*) 'EDPhoto 905 ', currentCohort%rdark
if ( debug ) write(fates_log(),*) 'EDPhoto 906 ', currentCohort%livestem_mr
if ( debug ) write(fates_log(),*) 'EDPhoto 907 ', currentCohort%livecroot_mr
if ( debug ) write(fates_log(),*) 'EDPhoto 908 ', currentCohort%froot_mr



! add on whole plant respiration values in kgC/indiv/s-1
currentCohort%resp_m = currentCohort%livestem_mr + &
currentCohort%resp_m_tstep = currentCohort%livestem_mr + &
currentCohort%livecroot_mr + &
currentCohort%froot_mr

currentCohort%froot_mr + &
currentCohort%rdark

! no drought response right now.. something like:
! resp_m = resp_m * (1.0_r8 - currentPatch%btran_ft(currentCohort%pft) * &
! resp_m_tstep = resp_m_tstep * (1.0_r8 - currentPatch%btran_ft(currentCohort%pft) * &
! EDPftvarcon_inst%resp_drought_response(ft))

currentCohort%resp_m = currentCohort%resp_m + currentCohort%rdark

! save as a diagnostic the un-throttled maintenance respiration to be able to know how strong this is
currentCohort%resp_m_unreduced = currentCohort%resp_m / maintresp_reduction_factor

! convert from kgC/indiv/s to kgC/indiv/timestep
currentCohort%resp_m = currentCohort%resp_m * dtime
currentCohort%resp_m_tstep = currentCohort%resp_m_tstep * dtime
currentCohort%gpp_tstep = currentCohort%gpp_tstep * dtime
currentCohort%ts_net_uptake = currentCohort%ts_net_uptake * dtime

if ( debug ) write(fates_log(),*) 'EDPhoto 911 ', currentCohort%gpp_tstep
if ( debug ) write(fates_log(),*) 'EDPhoto 912 ', currentCohort%resp_tstep
if ( debug ) write(fates_log(),*) 'EDPhoto 913 ', currentCohort%resp_m


currentCohort%resp_g_tstep = prt_params%grperc(ft) * &
(max(0._r8,currentCohort%gpp_tstep - currentCohort%resp_m))


currentCohort%resp_tstep = currentCohort%resp_m + &
currentCohort%resp_g_tstep ! kgC/indiv/ts
currentCohort%npp_tstep = currentCohort%gpp_tstep - &
currentCohort%resp_tstep ! kgC/indiv/ts


! save as a diagnostic the un-throttled maintenance respiration to be able to know how strong this is
currentCohort%resp_m_unreduced = currentCohort%resp_m_tstep / maintresp_reduction_factor

! Accumulate the combined conductance (stomatal+leaf boundary layer)
! Note that currentCohort%g_sb_laweight is weighted by the leaf area
! of each cohort and has units of [m/s] * [m2 leaf]
Expand Down
Loading