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

Get FATES and carbon_only test-suite tests to pass with MIMICS active #1643

Merged
merged 30 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d5c1ed5
Changes to get FATES and carbon_only tests pass with MIMICS active
slevis-lmwg Feb 9, 2022
28a0406
Access the FATES copy of annsum_npp in FATES-MIMICS simulations
slevis-lmwg Feb 14, 2022
a16cc85
Calc. ligninNratioAvg(c) from values by pft when use_fates = .true.
slevis-lmwg Feb 14, 2022
41802c2
Check that FATES-MIMICS cases set use_lch4 = .true., else fail
slevis-lmwg Feb 15, 2022
bea8e4a
Replaced if-statement with select case statement as per EK's review
slevis-lmwg Feb 25, 2022
88308bd
Merge remote-tracking branch 'escomp/master' into ligninNratio_forfates
slevis-lmwg Feb 25, 2022
c0747af
Get select case statmt to compile by changing case options to constants
slevis-lmwg Feb 25, 2022
098e86f
Update Fates testmod to run w MIMICS. First draft of ChangeLog updates.
slevis-lmwg Feb 26, 2022
86d18b2
Update ChangeLog with test-suite results
slevis-lmwg Feb 26, 2022
e52992c
Error check in the fortran to ensure MIMICS-FATES sets use_lch4 = .true.
slevis-lmwg Mar 13, 2022
d95a716
Reverted my mods to FATES test and added new FATES test
slevis-lmwg Mar 13, 2022
a8057f9
Update ChangeLog about my mods to the tests (see previous commit)
slevis-lmwg Mar 13, 2022
0438304
Added fates_and_lch4_if: construct around if statement for clarity
slevis-lmwg Mar 18, 2022
ffa084a
Made the fates_and_lch4_if into nested if statements for clearer code
slevis-lmwg Apr 4, 2022
8bf3153
Merge remote-tracking branch 'escomp/master' into ligninNratio_forfates
slevis-lmwg Apr 25, 2022
50f4af3
Update FATES-MIMICS to use FATES copy of ligninNratio
slevis-lmwg Apr 25, 2022
922aaf2
Revert a testmod change I had made for testing FATES-MIMICS
slevis-lmwg Apr 25, 2022
dd24018
Corrected to receive FATES variable litt_flux_ligc_per_n as site level
slevis-lmwg Apr 26, 2022
cd42ddf
Consolidating ligninNratioAvg var from cnveg_carbonflux to ...
slevis-lmwg Apr 27, 2022
eadb090
Update ChangeLog
slevis-lmwg Apr 27, 2022
f704b40
Update ChangeSum
slevis-lmwg Apr 27, 2022
c4708e9
Update comments about microbial C heterotrophic resp. per @wwieder
slevis-lmwg Apr 27, 2022
79a4ec3
Corrections needed for failing tests to pass
slevis-lmwg Apr 27, 2022
1a4bb3f
Fix for restart test that wasn't passing
slevis-lmwg Apr 28, 2022
e5c0d80
Make my restart-fix workaround thread-safe
slevis-lmwg Apr 29, 2022
6794fa3
Updates to get threaded test to PASS
slevis-lmwg Apr 30, 2022
392d047
Merge tag 'ctsm5.1.dev092' into ligninNratio_forfates
slevis-lmwg Apr 30, 2022
611fb16
Make copy_fates_var local to clmfates_interface module
slevis-lmwg May 3, 2022
08f3a3c
The new test added with this PR now also tests threading
slevis-lmwg May 3, 2022
28acc2f
Update date on changelog add description of issue
ekluzek May 4, 2022
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
5 changes: 4 additions & 1 deletion src/biogeochem/CNDriverMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module CNDriverMod
use SaturatedExcessRunoffMod , only : saturated_excess_runoff_type
use ActiveLayerMod , only : active_layer_type
use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type
use CLMFatesInterfaceMod , only : hlm_fates_interface_type
!
! !PUBLIC TYPES:
implicit none
Expand Down Expand Up @@ -95,7 +96,7 @@ subroutine CNDriverNoLeaching(bounds,
c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, &
soilbiogeochem_state_inst, &
soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, &
active_layer_inst, &
active_layer_inst, clm_fates, &
atm2lnd_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, &
wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, &
soil_water_retention_curve, crop_inst, ch4_inst, &
Expand Down Expand Up @@ -196,6 +197,7 @@ subroutine CNDriverNoLeaching(bounds,
class(nutrient_competition_method_type) , intent(inout) :: nutrient_competition_method
class(fire_method_type) , intent(inout) :: cnfire_method
logical , intent(in) :: dribble_crophrv_xsmrpool_2atm
type(hlm_fates_interface_type) , intent(inout) :: clm_fates
!
! !LOCAL VARIABLES:
real(r8):: cn_decomp_pools(bounds%begc:bounds%endc,1:nlevdecomp,1:ndecomp_pools)
Expand Down Expand Up @@ -320,6 +322,7 @@ subroutine CNDriverNoLeaching(bounds,
soilstate_inst, temperature_inst, ch4_inst, soilbiogeochem_carbonflux_inst)
else if (decomp_method == mimics_decomp) then
call decomp_rates_mimics(bounds, num_soilc, filter_soilc, &
num_soilp, filter_soilp, clm_fates, &
soilstate_inst, temperature_inst, cnveg_carbonflux_inst, ch4_inst, &
soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst)
end if
Expand Down
6 changes: 4 additions & 2 deletions src/biogeochem/CNVegetationFacade.F90
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ module CNVegetationFacade
use CNPrecisionControlMod , only: CNPrecisionControl
use SoilBiogeochemPrecisionControlMod , only: SoilBiogeochemPrecisionControl
use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type
use CLMFatesInterfaceMod , only : hlm_fates_interface_type
!
implicit none
private
Expand Down Expand Up @@ -887,7 +888,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, &
c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, &
soilbiogeochem_state_inst, &
soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, &
active_layer_inst, &
active_layer_inst, clm_fates, &
atm2lnd_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, &
wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, &
soil_water_retention_curve, crop_inst, ch4_inst, &
Expand Down Expand Up @@ -942,6 +943,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, &
type(energyflux_type) , intent(in) :: energyflux_inst
class(nutrient_competition_method_type) , intent(inout) :: nutrient_competition_method
type(fireemis_type) , intent(inout) :: fireemis_inst
type(hlm_fates_interface_type) , intent(inout) :: clm_fates
!
! !LOCAL VARIABLES:

Expand Down Expand Up @@ -969,7 +971,7 @@ subroutine EcosystemDynamicsPreDrainage(this, bounds, &
c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, &
soilbiogeochem_state_inst, &
soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, &
active_layer_inst, &
active_layer_inst, clm_fates, &
atm2lnd_inst, waterstatebulk_inst, waterdiagnosticbulk_inst, waterfluxbulk_inst, &
wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, &
soil_water_retention_curve, crop_inst, ch4_inst, &
Expand Down
9 changes: 5 additions & 4 deletions src/biogeochem/EDBGCDynMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module EDBGCDynMod
use atm2lndType , only : atm2lnd_type
use SoilStateType , only : soilstate_type
use ch4Mod , only : ch4_type
use CLMFatesInterfaceMod , only : hlm_fates_interface_type


! public :: EDBGCDynInit ! BGC dynamics: initialization
Expand All @@ -44,7 +45,7 @@ subroutine EDBGCDyn(bounds, &
num_soilc, filter_soilc, num_soilp, filter_soilp, num_pcropp, filter_pcropp, doalb, &
cnveg_carbonflux_inst, cnveg_carbonstate_inst, &
soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, &
soilbiogeochem_state_inst, &
soilbiogeochem_state_inst, clm_fates, &
soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, &
c13_soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonflux_inst, &
c14_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonflux_inst, &
Expand Down Expand Up @@ -108,6 +109,7 @@ subroutine EDBGCDyn(bounds, &
type(temperature_type) , intent(inout) :: temperature_inst
type(crop_type) , intent(in) :: crop_inst
type(ch4_type) , intent(in) :: ch4_inst
type(hlm_fates_interface_type) , intent(inout) :: clm_fates
!
! !LOCAL VARIABLES:
real(r8):: cn_decomp_pools(bounds%begc:bounds%endc,1:nlevdecomp,1:ndecomp_pools)
Expand Down Expand Up @@ -184,6 +186,7 @@ subroutine EDBGCDyn(bounds, &
soilstate_inst, temperature_inst, ch4_inst, soilbiogeochem_carbonflux_inst)
else if (decomp_method == mimics_decomp) then
call decomp_rates_mimics(bounds, num_soilc, filter_soilc, &
num_soilp, filter_soilp, clm_fates, &
soilstate_inst, temperature_inst, cnveg_carbonflux_inst, ch4_inst, &
soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst)
end if
Expand Down Expand Up @@ -266,7 +269,7 @@ subroutine EDBGCDynSummary(bounds, num_soilc, filter_soilc, num_soilp, filter_so
c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, &
c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, &
soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, &
clm_fates, nc)
nc)
!
! !DESCRIPTION:
! Call to all CN and SoilBiogeochem summary routines
Expand All @@ -276,7 +279,6 @@ subroutine EDBGCDynSummary(bounds, num_soilc, filter_soilc, num_soilp, filter_so
use clm_varpar , only: ndecomp_cascade_transitions
use CNPrecisionControlMod , only: CNPrecisionControl
use SoilBiogeochemPrecisionControlMod , only: SoilBiogeochemPrecisionControl
use CLMFatesInterfaceMod , only: hlm_fates_interface_type
!
! !ARGUMENTS:
type(bounds_type) , intent(in) :: bounds
Expand All @@ -292,7 +294,6 @@ subroutine EDBGCDynSummary(bounds, num_soilc, filter_soilc, num_soilp, filter_so
type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst
type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst
type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst
type(hlm_fates_interface_type) , intent(inout) :: clm_fates
integer , intent(in) :: nc ! thread index
!
! !LOCAL VARIABLES:
Expand Down
6 changes: 3 additions & 3 deletions src/main/clm_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro
c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, &
soilbiogeochem_state_inst, &
soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, &
active_layer_inst, &
active_layer_inst, clm_fates, &
atm2lnd_inst, water_inst%waterstatebulk_inst, &
water_inst%waterdiagnosticbulk_inst, water_inst%waterfluxbulk_inst, &
water_inst%wateratm2lndbulk_inst, canopystate_inst, soilstate_inst, temperature_inst, &
Expand Down Expand Up @@ -1083,7 +1083,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro
bgc_vegetation_inst%cnveg_carbonflux_inst, &
bgc_vegetation_inst%cnveg_carbonstate_inst, &
soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, &
soilbiogeochem_state_inst, &
soilbiogeochem_state_inst, clm_fates, &
soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, &
c13_soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonflux_inst, &
c14_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonflux_inst, &
Expand All @@ -1097,7 +1097,7 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro
c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, &
c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, &
soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, &
clm_fates, nc)
nc)

call clm_fates%wrap_update_hifrq_hist(bounds_clump, &
soilbiogeochem_carbonflux_inst, &
Expand Down
75 changes: 69 additions & 6 deletions src/soilbiogeochem/SoilBiogeochemDecompCascadeMIMICSMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module SoilBiogeochemDecompCascadeMIMICSMod
use ColumnType , only : col
use GridcellType , only : grc
use SoilBiogeochemStateType , only : get_spinup_latitude_term
use CLMFatesInterfaceMod , only : hlm_fates_interface_type

!
implicit none
Expand Down Expand Up @@ -752,6 +753,7 @@ end subroutine init_decompcascade_mimics

!-----------------------------------------------------------------------
subroutine decomp_rates_mimics(bounds, num_soilc, filter_soilc, &
num_soilp, filter_soilp, clm_fates, &
soilstate_inst, temperature_inst, cnveg_carbonflux_inst, &
ch4_inst, soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst)
!
Expand All @@ -763,9 +765,13 @@ subroutine decomp_rates_mimics(bounds, num_soilc, filter_soilc, &
use clm_time_manager , only : get_curr_days_per_year
use clm_varcon , only : secspday, secsphr, tfrz
use clm_varcon , only : g_to_mg, cm3_to_m3
use subgridAveMod , only : p2c
use PatchType , only : patch
!
! !ARGUMENTS:
type(bounds_type) , intent(in) :: bounds
integer , intent(in) :: num_soilp ! number of soil patches in filter
integer , intent(in) :: filter_soilp(:) ! filter for soil patches
integer , intent(in) :: num_soilc ! number of soil columns in filter
integer , intent(in) :: filter_soilc(:) ! filter for soil columns
type(soilstate_type) , intent(in) :: soilstate_inst
Expand All @@ -774,6 +780,7 @@ subroutine decomp_rates_mimics(bounds, num_soilc, filter_soilc, &
type(ch4_type) , intent(in) :: ch4_inst
type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst
type(soilbiogeochem_carbonstate_type), intent(in) :: soilbiogeochem_carbonstate_inst
type(hlm_fates_interface_type) , intent(inout) :: clm_fates
!
! !LOCAL VARIABLES:
real(r8), parameter :: eps = 1.e-6_r8
Expand Down Expand Up @@ -807,7 +814,9 @@ subroutine decomp_rates_mimics(bounds, num_soilc, filter_soilc, &
real(r8):: term_2 !
real(r8):: t_soi_degC
! real(r8):: decomp_depth_efolding ! (meters) e-folding depth for reduction in decomposition [
integer :: c, fc, j, k, l
integer :: p, fp, c, fc, j, k, l, s ! indices
integer :: pf ! fates patch index
integer :: nc ! clump index
real(r8):: days_per_year ! days per year
real(r8):: depth_scalar(bounds%begc:bounds%endc,1:nlevdecomp)
real(r8):: w_d_o_scalars ! product of w_scalar * depth_scalar * o_scalar
Expand Down Expand Up @@ -846,12 +855,16 @@ subroutine decomp_rates_mimics(bounds, num_soilc, filter_soilc, &
real(r8):: spinup_geogterm_s3(bounds%begc:bounds%endc) ! geographically-varying spinup term for s3
real(r8):: spinup_geogterm_m1(bounds%begc:bounds%endc) ! geographically-varying spinup term for m1
real(r8):: spinup_geogterm_m2(bounds%begc:bounds%endc) ! geographically-varying spinup term for m2
real(r8):: ligninNratioAvg_local(bounds%begc:bounds%endc) ! local column-level lignin to nitrogen ratio
real(r8):: annsum_npp_col_local(bounds%begc:bounds%endc) ! local annual sum of NPP at the column level
real(r8):: ligninNratio(bounds%begp:bounds%endp) ! local patch-level lignin to nitrogen ratio
real(r8):: annsum_npp(bounds%begp:bounds%endp) ! local annual sum of NPP at the patch level
real(r8):: ligninNratioAvg_scalar ! lignin to nitrogen ratio, scalar in column-level loop
real(r8):: annsum_npp_col_scalar ! annual sum of NPP, scalar in column-level loop

!-----------------------------------------------------------------------

associate( &
ligninNratioAvg => cnveg_carbonflux_inst%ligninNratioAvg_col , & ! Input: [real(r8) (:) ] column-level lignin to nitrogen ratio
annsum_npp_col => cnveg_carbonflux_inst%annsum_npp_col , & ! Input: [real(r8) (:) ] annual sum of NPP at the column level (gC/m2/yr)

rf_cwdl2 => CNParamsShareInst%rf_cwdl2 , & ! Input: [real(r8) ] respiration fraction in CWD to litter2 transition (frac)
minpsi => CNParamsShareInst%minpsi , & ! Input: [real(r8) ] minimum soil suction (mm)
Expand Down Expand Up @@ -1100,21 +1113,71 @@ subroutine decomp_rates_mimics(bounds, num_soilc, filter_soilc, &
mimics_cn_r = params_inst%mimics_cn_r
mimics_cn_k = params_inst%mimics_cn_k

! Local column-level ligninNratioAvg because
! not available when use_fates = .true.
! Also get FATES copy of annsum_npp for FATES cases
if (use_fates) then
Copy link
Collaborator

Choose a reason for hiding this comment

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

recommend using a label here: a la "fates_if: if (use_fates) then"

Copy link
Collaborator

Choose a reason for hiding this comment

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

We didn't do that this time. But, with testing done it can happen on a future time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did do for lines 1118, 1119 where the if statements are long:

fates_if: if (use_fates) then
         lch4_if: if (use_lch4) then

True, didn't do elsewhere.

! Initialize
do fc = 1,num_soilc
c = filter_soilc(fc)
ligninNratioAvg_local(c) = 0._r8
annsum_npp_col_local(c) = 0._r8
end do

! Sum over p
nc = bounds%clump_index
do fp = 1, num_soilp

p = filter_soilp(fp)
c = patch%column(p)

pf = p - col%patchi(c)
s = clm_fates%f2hmap(nc)%hsites(c)
annsum_npp(p) = clm_fates%fates(nc)%bc_out(s)%annsum_npp_pa(pf)

! TODO Obtain values by pft from
! https://bg.copernicus.org/articles/9/565/2012/bg-9-565-2012.pdf
! TODO Move values by pft to the params files?
! if (patch%itype(p) = noveg) then
ligninNratio(p) = 0._r8
! else if (patch%itype(p) = nbrdlf_evr_trp_tree) then
! ligninNratio(p) =
! else if (patch%itype(p) = ...
! end if

end do ! p loop

! Calculate the column-level averages
call p2c(bounds, num_soilc, filter_soilc, &
ligninNratio(bounds%begp:bounds%endp), &
ligninNratioAvg_local(bounds%begc:bounds%endc))
call p2c(bounds, num_soilc, filter_soilc, &
annsum_npp(bounds%begp:bounds%endp), &
annsum_npp_col_local(bounds%begc:bounds%endc))
end if ! use_fates

! calculate rates for all litter and som pools
do fc = 1,num_soilc
c = filter_soilc(fc)

if (use_fates) then
ligninNratioAvg_scalar = ligninNratioAvg_local(c)
annsum_npp_col_scalar = max(0._r8, annsum_npp_col_local(c))
else
ligninNratioAvg_scalar = cnveg_carbonflux_inst%ligninNratioAvg_col(c)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was tracking down how mimics w/o fates arrives at this column level cnveg_carbonflux_inst%ligninNratioAvg_col(c)

Which took me here:

https://github.com/ESCOMP/CTSM/blob/master/src/biogeochem/CNVegCarbonFluxType.F90#L4498-L4503

It looks like its taking an average of the leaf, fineroot and cwd pools. But I was expecting that the terms ligninNratio_leaf_col(c), ligninNratio_froot_col(c) and ligninNratio_cwd would all be multiplied by their respective carbon weighting factors (ie leafc_to_litter_col, etc) before being divided through by the sum of those factors. I probably missed something though, maybe they already are, or I don't understand the units.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I understand it now, looking here at the leaf term:
https://github.com/ESCOMP/CTSM/blob/master/src/biogeochem/CNVegCarbonFluxType.F90#L4422-L4424
I see that it is pre-multiplied by leafc_to_litter_patch(p).
Alright, I see no issue.

Copy link
Collaborator

@rgknox rgknox Mar 4, 2022

Choose a reason for hiding this comment

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

However, I really think there should be units for the definition of the column level average, it wasn't clear to me exactly what this ratio is. It is defined here:

https://github.com/ESCOMP/CTSM/blob/master/src/biogeochem/CNVegCarbonFluxType.F90#L338

And I think it should have the same units as the multiple of these two factors (using leaf as a guide):

real(r8), allocatable :: lf_flig (:) ! leaf litter lignin fraction
real(r8), allocatable :: lflitcn (:) ! leaf litter C:N (gC/gN)

So it seems like this column level average is the mean C:N ratio of lignin tissues from leaves, fine-roots and cwd in the column. [gC/gN]

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for diving in here @rgknox. @slevisconsulting maybe some additional comments in the code are warranted to clarify what's going on?

annsum_npp_col_scalar = max(0._r8, cnveg_carbonflux_inst%annsum_npp_col(c))
end if

! Time-dependent params from Wieder et al. 2015 & testbed code

! Set limits on Lignin:N to keep fmet > 0.2
! Necessary for litter quality in boreal forests with high cwd flux
! TODO Check for high-freq variations in ligninNratioAvg. To avoid,
! replace pool_to_litter terms with ann or other long term mean
! in CNVegCarbonFluxType.
fmet = mimics_fmet_p1 * (mimics_fmet_p2 - mimics_fmet_p3 * min(mimics_fmet_p4, ligninNratioAvg(c)))
fmet = mimics_fmet_p1 * (mimics_fmet_p2 - mimics_fmet_p3 * min(mimics_fmet_p4, ligninNratioAvg_scalar))
tau_mod = min(mimics_tau_mod_max, max(mimics_tau_mod_min, &
sqrt(mimics_tau_mod_factor * &
annsum_npp_col(c))))
sqrt(mimics_tau_mod_factor * annsum_npp_col_scalar)))

! tau_m1 is tauR and tau_m2 is tauK in Wieder et al. 2015
! tau ends up in units of per hour but is expected
Expand Down