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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 10 additions & 5 deletions biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1066,11 +1066,16 @@ 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 = (currentCohort%n*currentCohort%resp_g_acc + &
nextc%n*nextc%resp_g_acc)/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
Expand Down
47 changes: 26 additions & 21 deletions biogeochem/FatesCohortMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,15 @@ module FatesCohortMod
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 ! Growth respication can only be calculated at the daily timestep
Copy link
Contributor

Choose a reason for hiding this comment

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

@ckoven , do we need resp_g_acc? The _acc variable was created to track the accumulation of the flux through the fast timesteps over the course of the day. Since we don't accumulate growth respiration anymore, since it is defined only at the end of the day, I believe we only need resp_g_acc_hold, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, this was a thing I wasn't sure about. I was guessing that it is as you describe, but wanted to include the _acc variable to be on the safe side. If you don't think it is needed, then happy to remove.

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 @@ -376,12 +378,13 @@ 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 = nan
this%resp_g_acc_hold = nan
this%c13disc_clm = nan
this%c13disc_acc = nan
this%vcmax25top = nan
Expand Down Expand Up @@ -478,17 +481,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
this%resp_g_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%c13disc_clm = 0._r8
this%c13disc_acc = 0._r8
Expand Down Expand Up @@ -707,12 +711,13 @@ 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 = this%resp_g_acc
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 @@ -1048,14 +1053,14 @@ 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 = ', this%resp_g_acc
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
2 changes: 1 addition & 1 deletion biogeochem/FatesSoilBGCFluxMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ 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
Expand Down
8 changes: 3 additions & 5 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 @@ -82,15 +82,13 @@ subroutine AccumulateFluxes_ED(nsites, sites, bc_in, bc_out, dt_time)

if ( debug ) then
Copy link
Contributor

Choose a reason for hiding this comment

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

we should remove this debug statement. we can add these types of write statements in when needed, but not maintained in the main codebase


write(fates_log(),*) 'EDAccumFlux 64 ',ccohort%npp_tstep
write(fates_log(),*) 'EDAccumFlux 66 ',ccohort%gpp_tstep
write(fates_log(),*) 'EDAccumFlux 67 ',ccohort%resp_tstep
write(fates_log(),*) 'EDAccumFlux 67 ',ccohort%resp_m_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
14 changes: 3 additions & 11 deletions biogeophys/FatesPlantRespPhotosynthMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ subroutine FatesPlantRespPhotosynthDrive (nsites, sites,bc_in,bc_out,dtime)

! 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
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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
Expand Down Expand Up @@ -987,23 +987,15 @@ subroutine FatesPlantRespPhotosynthDrive (nsites, sites,bc_in,bc_out,dtime)

! convert from kgC/indiv/s to kgC/indiv/timestep
currentCohort%resp_m = currentCohort%resp_m * dtime
currentCohort%resp_m_tstep = currentCohort%resp_m ! these two things are the same. we should get rid of one them
Copy link
Contributor

Choose a reason for hiding this comment

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

agreed, I vote we get rid of resp_m since resp_m_tstep is more descriptive

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 912 ', currentCohort%resp_m_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

! 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
36 changes: 28 additions & 8 deletions main/EDMainMod.F90
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a resp_acc on line 675 that needs to be updated

Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ subroutine ed_integrate_state_variables(currentSite, bc_in, bc_out )
use FatesConstantsMod, only : itrue
use FatesConstantsMod , only : nearzero
use EDCanopyStructureMod , only : canopy_structure

use PRTParametersMod , only : prt_params

! !ARGUMENTS:

type(ed_site_type) , intent(inout) :: currentSite
Expand Down Expand Up @@ -498,7 +499,7 @@ subroutine ed_integrate_state_variables(currentSite, bc_in, bc_out )
! We don't explicitly define a respiration rate for prescribe phys
! but we do need to pass mass balance. So we say it is zero respiration
currentCohort%gpp_acc = currentCohort%npp_acc
currentCohort%resp_acc = 0._r8
currentCohort%resp_m_acc = 0._r8

end if

Expand All @@ -514,14 +515,30 @@ subroutine ed_integrate_state_variables(currentSite, bc_in, bc_out )
! photosynthesis step
! -----------------------------------------------------------------------------

currentCohort%npp_acc_hold = currentCohort%npp_acc * real(hlm_days_per_year,r8)
currentCohort%gpp_acc_hold = currentCohort%gpp_acc * real(hlm_days_per_year,r8)
currentCohort%resp_acc_hold = currentCohort%resp_acc * real(hlm_days_per_year,r8)
currentCohort%resp_m_acc_hold = currentCohort%resp_m_acc * real(hlm_days_per_year,r8)

! at this point we have the info we need to calculate growth respiration
! as a "tax" on the difference between daily GPP and daily maintenance respiration
if (hlm_use_ed_prescribed_phys .eq. itrue) then
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this if else statement the wrong way around? if prescribed physiology is true then we should set resp_g_acc to 0 as in the comments?

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (hlm_use_ed_prescribed_phys .eq. itrue) then
if (hlm_use_ed_prescribed_phys .eq. ifalse) then

currentCohort%resp_g_acc = prt_params%grperc(ft) * &
max(0._r8,(currentCohort%gpp_acc - currentCohort%resp_m_acc))
currentCohort%resp_g_acc_hold = currentCohort%resp_g_acc * real(hlm_days_per_year,r8)
else
! set growth respiration to zero in prescribed physiology mode,
! that way the npp_acc vars will be set to the nominal gpp values set above.
currentCohort%resp_g_acc = 0._r8
currentCohort%resp_g_acc_hold = 0._r8
endif

! calculate the npp as the difference between gpp and autotrophic respiration
currentCohort%npp_acc = currentCohort%gpp_acc - (currentCohort%resp_m_acc + currentCohort%resp_g_acc)
currentCohort%npp_acc_hold = currentCohort%gpp_acc_hold - (currentCohort%resp_m_acc_hold + currentCohort%resp_g_acc_hold)

! Passing gpp_acc_hold to HLM
bc_out%gpp_site = bc_out%gpp_site + currentCohort%gpp_acc_hold * &
AREA_INV * currentCohort%n / hlm_days_per_year / sec_per_day
bc_out%ar_site = bc_out%ar_site + currentCohort%resp_acc_hold * &
bc_out%ar_site = bc_out%ar_site + (currentCohort%resp_m_acc_hold + currentCohort%resp_g_acc_hold) * &
AREA_INV * currentCohort%n / hlm_days_per_year / sec_per_day

! Conduct Maintenance Turnover (parteh)
Expand Down Expand Up @@ -630,7 +647,8 @@ subroutine ed_integrate_state_variables(currentSite, bc_in, bc_out )
currentCohort%gpp_acc * currentCohort%n

site_cmass%aresp_acc = site_cmass%aresp_acc + &
(currentCohort%resp_acc+currentCohort%resp_excess) * currentCohort%n
(currentCohort%resp_m_acc+currentCohort%resp_g_acc+currentCohort%resp_excess) * &
currentCohort%n

call currentCohort%prt%CheckMassConservation(ft,5)

Expand Down Expand Up @@ -1050,11 +1068,13 @@ subroutine bypass_dynamics(currentSite)

currentCohort%npp_acc_hold = currentCohort%npp_acc * real(hlm_days_per_year,r8)
currentCohort%gpp_acc_hold = currentCohort%gpp_acc * real(hlm_days_per_year,r8)
currentCohort%resp_acc_hold = currentCohort%resp_acc * real(hlm_days_per_year,r8)
currentCohort%resp_g_acc_hold = currentCohort%resp_g_acc * real(hlm_days_per_year,r8)
currentCohort%resp_m_acc_hold = currentCohort%resp_m_acc * real(hlm_days_per_year,r8)

currentCohort%npp_acc = 0.0_r8
currentCohort%gpp_acc = 0.0_r8
currentCohort%resp_acc = 0.0_r8
currentCohort%resp_g_acc = 0.0_r8
currentCohort%resp_m_acc = 0.0_r8

! No need to set the "net_art" terms to zero
! they are zeroed at the beginning of the daily step
Expand Down
Loading