Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
fa75892
New subr. time_evolv_params to calc. time-evolving leafcn_patch
slevis-lmwg Feb 18, 2022
26ad2e5
Rename new history variable to LEAFCN_TARGET
slevis-lmwg Feb 18, 2022
48c2912
Correction for new history field LEAFCN_TARGET to appear in hist
slevis-lmwg Feb 18, 2022
878728a
Add time-evolving leafcn_patch (LEAFCN_TARGET) to restart
slevis-lmwg Feb 21, 2022
6c230ef
Move leafcn_patch declaration to CNVegNitrogenStateType from CanopyState
slevis-lmwg Feb 21, 2022
86b805b
Replace pftcon%leafcn w cnveg_nitrogenstate_inst%leafcn_patch
slevis-lmwg Feb 22, 2022
13a9af8
Repl. pftcon%leafcn also in function SpeciesTypeMultiplier
slevis-lmwg Feb 23, 2022
a5f4856
Renamed subr. time_evolv_params to time_evolv_leafcn to be specific
slevis-lmwg Feb 26, 2022
0fe849e
Changed hardwired settings for cn_slope and co2_base
slevis-lmwg Mar 2, 2022
1414d0d
Merge tag 'ctsm5.3.030' into time_evolv_params
slevis-lmwg Mar 18, 2025
830abfa
Additional conflict resolutions from side-by-side comparison of mods
slevis-lmwg Mar 18, 2025
1d64552
Corrections for aux_clm tests to build successfully
slevis-lmwg Mar 19, 2025
625ded8
Updates to get specific failing test to pass
slevis-lmwg Mar 19, 2025
1be5e2a
Merge tag 'ctsm5.3.033' into time_evolv_params
slevis-lmwg Mar 19, 2025
f7be84e
Try allocating leafcn_patch twice to prevent test failures
slevis-lmwg Mar 19, 2025
a619476
Missed this change in the original implementation
slevis-lmwg Mar 21, 2025
a24446f
This should have gone together with the last commit
slevis-lmwg Mar 21, 2025
8e1e2c6
Clarify the variable name to leafcn_t_evolving in CNFUNMod
slevis-lmwg Mar 21, 2025
237d949
Apply use_cn to the new code in Photosynthesis and clm_driver
slevis-lmwg Mar 21, 2025
6da19db
Remove the new variable from restart and update its initialization
slevis-lmwg Mar 21, 2025
cb1880a
Code change to address izumi failures
slevis-lmwg Mar 24, 2025
430b5b1
Code change to address FUNIT failure on derecho
slevis-lmwg Mar 24, 2025
1503e17
Read params leafcn_co2_base and leafcn_co2_slope from the paramfile
slevis-lmwg Mar 24, 2025
287fea8
Rename leafcn to leafcn_t_evolving where appropriate and add comments
slevis-lmwg Mar 26, 2025
56a3d6c
Rename leafcn_patch to leafcn_t_evolving_patch update some comments
slevis-lmwg Mar 26, 2025
9bbc216
Remove redundant leafcn_t_evolving_patch update from subr. restart
slevis-lmwg Mar 26, 2025
50785f6
Update comments
slevis-lmwg Mar 26, 2025
f298fc8
Rm allocate(this%leafcn_t_evolving_patch from subr. time_evolv_leafcn
slevis-lmwg Mar 26, 2025
e511893
Add testmods_dirs/clm/leafcn_t_evolving for aux_clm test to be added
slevis-lmwg Mar 26, 2025
14ef248
Add the new test to testlist_clm.xml
slevis-lmwg Mar 26, 2025
c7f008b
Move "call time_evolv_leafcn" into a loop over clumps (Bill's review)
slevis-lmwg Mar 26, 2025
e859033
Use the bgc_vegp filter instead of an if-statement for efficiency
slevis-lmwg Mar 28, 2025
9eab348
Merge tag 'ctsm5.3.043' into time_evolv_params
slevis-lmwg May 14, 2025
4ad5256
Calculate co2_ppmv with both pco2 & pbot not_downscaled (Bill's review)
slevis-lmwg May 14, 2025
7371590
Updated ChangeLog/Sum
slevis-lmwg May 14, 2025
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
8 changes: 5 additions & 3 deletions src/biogeochem/CNAllocationMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module CNAllocationMod
use CNVegCarbonStateType , only : cnveg_carbonstate_type
use CNVegCarbonFluxType , only : cnveg_carbonflux_type
use CNVegStateType , only : cnveg_state_type
use CNVegNitrogenStateType, only: cnveg_nitrogenstate_type
use CropReprPoolsMod , only : nrepr
use CNPhenologyMod , only : CropPhase
use CNSharedParamsMod , only : use_fun
Expand Down Expand Up @@ -433,7 +434,7 @@ end subroutine calc_crop_allocation_fractions

!-----------------------------------------------------------------------
subroutine calc_allometry(num_soilp, filter_soilp, &
cnveg_carbonflux_inst, cnveg_state_inst)
cnveg_carbonflux_inst, cnveg_state_inst, cnveg_nitrogenstate_inst)
!
! !DESCRIPTION:
! Calculate c_allometry and n_allometry terms based on allocation fractions
Expand All @@ -442,6 +443,7 @@ subroutine calc_allometry(num_soilp, filter_soilp, &
integer , intent(in) :: num_soilp ! number of soil patches in filter
integer , intent(in) :: filter_soilp(:) ! filter for soil patches
type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst
type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst
type(cnveg_state_type) , intent(inout) :: cnveg_state_inst
!
! !LOCAL VARIABLES:
Expand All @@ -464,7 +466,7 @@ subroutine calc_allometry(num_soilp, filter_soilp, &
croot_stem => pftcon%croot_stem , & ! Input: allocation parameter: new coarse root C per new stem C (gC/gC)
stem_leaf => pftcon%stem_leaf , & ! Input: allocation parameter: new stem c per new leaf C (gC/gC)
flivewd => pftcon%flivewd , & ! Input: allocation parameter: fraction of new wood that is live (phloem and ray parenchyma) (no units)
leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN)
leafcn_t_evolving => cnveg_nitrogenstate_inst%leafcn_patch, & ! Input: leaf C:N (gC/gN)
Comment thread
slevis-lmwg marked this conversation as resolved.
Outdated
frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN)
livewdcn => pftcon%livewdcn , & ! Input: live wood (phloem and ray parenchyma) C:N (gC/gN)
deadwdcn => pftcon%deadwdcn , & ! Input: dead wood (xylem and heartwood) C:N (gC/gN)
Expand Down Expand Up @@ -503,7 +505,7 @@ subroutine calc_allometry(num_soilp, filter_soilp, &
else
g1 = grperc(ivt(p))
end if
cnl = leafcn(ivt(p))
cnl = leafcn_t_evolving(p)
Comment thread
slevis-lmwg marked this conversation as resolved.
cnfr = frootcn(ivt(p))
cnlw = livewdcn(ivt(p))
cndw = deadwdcn(ivt(p))
Expand Down
2 changes: 1 addition & 1 deletion src/biogeochem/CNDriverMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ subroutine CNDriverNoLeaching(bounds,
end if

call calc_allometry(num_bgc_vegp, filter_bgc_vegp, &
cnveg_carbonflux_inst, cnveg_state_inst)
cnveg_carbonflux_inst, cnveg_state_inst, cnveg_nitrogenstate_inst)
call t_stopf('cnalloc')
end if

Expand Down
10 changes: 5 additions & 5 deletions src/biogeochem/CNFUNMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ subroutine CNFUNInit (bounds,cnveg_state_inst,cnveg_carbonstate_inst,cnveg_nitro

! Set local pointers
associate(ivt => patch%itype , & ! Input: [integer (:) ] p
leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN)
leafcn_t_evolving => cnveg_nitrogenstate_inst%leafcn_patch , & ! Input: leaf C:N (gC/gN)
leafcn_offset => cnveg_state_inst%leafcn_offset_patch , & ! Output:
! [real(r8) (:) ] Leaf C:N used by FUN
leafc_storage_xfer_acc => cnveg_carbonstate_inst%leafc_storage_xfer_acc_patch , & ! Output: [real(r8) (:)
Expand Down Expand Up @@ -249,7 +249,7 @@ subroutine CNFUNInit (bounds,cnveg_state_inst,cnveg_carbonstate_inst,cnveg_nitro
!---
numofyear = nstep/nstep_fun
if (mod(nstep,nstep_fun) == 0) then
leafcn_offset(bounds%begp:bounds%endp) = leafcn(ivt(bounds%begp:bounds%endp))
leafcn_offset(bounds%begp:bounds%endp) = leafcn_t_evolving(bounds%begp:bounds%endp)
storage_cdemand(bounds%begp:bounds%endp) = 0._r8
storage_ndemand(bounds%begp:bounds%endp) = 0._r8
leafn_storage_xfer_acc(bounds%begp:bounds%endp) = 0._r8
Expand Down Expand Up @@ -573,7 +573,7 @@ subroutine CNFUN(bounds,num_soilc, filter_soilc,num_soilp&
!--------------------------------------------------------------------
!---------------------------------
associate(ivt => patch%itype , & ! Input: [integer (:) ] p
leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN)
leafcn_t_evolving => cnveg_nitrogenstate_inst%leafcn_patch , & ! Input: leaf C:N (gC/gN)
season_decid => pftcon%season_decid , & ! Input: binary flag for seasonal
! -deciduous leaf habit (0 or 1)
stress_decid => pftcon%stress_decid , & ! Input: binary flag for stress
Expand Down Expand Up @@ -1276,7 +1276,7 @@ subroutine CNFUN(bounds,num_soilc, filter_soilc,num_soilp&
litterfall_c_step(p,istp)* fixerfrac,&
litterfall_n_step(p,istp)* fixerfrac,&
total_n_resistance, total_c_spent_retrans,total_c_accounted_retrans, &
free_n_retrans,paid_for_n_retrans, leafcn(ivt(p)), &
free_n_retrans,paid_for_n_retrans, leafcn_t_evolving(p), &
grperc(ivt(p)), plantCN(p))

else
Expand Down Expand Up @@ -1307,7 +1307,7 @@ subroutine CNFUN(bounds,num_soilc, filter_soilc,num_soilp&
if (leafn(p) == 0.0_r8) then ! to avoid division by zero
delta_CN = fun_cn_flex_c(ivt(p)) ! Max CN ratio over standard
else
delta_CN = (leafc(p)+leafc_storage(p))/(leafn(p)+leafn_storage(p)) - leafcn(ivt(p)) ! leaf CN ratio
delta_CN = (leafc(p)+leafc_storage(p))/(leafn(p)+leafn_storage(p)) - leafcn_t_evolving(p) ! leaf CN ratio
end if
! C used for uptake is reduced if the cost of N is very high
frac_ideal_C_use = max(0.0_r8,1.0_r8 - (total_N_resistance-fun_cn_flex_a(ivt(p)))/fun_cn_flex_b(ivt(p)) )
Expand Down
1 change: 0 additions & 1 deletion src/biogeochem/CNGRespMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ subroutine CNGResp(num_soilp, filter_soilp, cnveg_carbonflux_inst, canopystate_i
woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody)
grperc => pftcon%grperc , & ! Input: growth respiration parameter
grpnow => pftcon%grpnow , & ! Input: growth respiration parameter
leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN)
livewdcn => pftcon%livewdcn , & ! Input: live wood (phloem and ray parenchyma) C:N (gC/gN)

laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:)] sunlit projected leaf area index
Expand Down
1 change: 0 additions & 1 deletion src/biogeochem/CNGapMortalityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ subroutine CNGapMortality (bounds, num_soilp, filter_soilp, &
greffic => dgvs_inst%greffic_patch , & ! Input: [real(r8) (:) ]
heatstress => dgvs_inst%heatstress_patch , & ! Input: [real(r8) (:) ]

leafcn => pftcon%leafcn , & ! Input: [real(r8) (:)] leaf C:N (gC/gN)
livewdcn => pftcon%livewdcn , & ! Input: [real(r8) (:)] live wood (phloem and ray parenchyma) C:N (gC/gN)
laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit projected leaf area index
laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded projected leaf area index
Expand Down
27 changes: 12 additions & 15 deletions src/biogeochem/CNPhenologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1387,8 +1387,6 @@ subroutine CNStressDecidPhenology (num_soilp, filter_soilp , &
leaf_long => pftcon%leaf_long , & ! Input: leaf longevity (yrs)
woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody)
stress_decid => pftcon%stress_decid , & ! Input: binary flag for stress-deciduous leaf habit (0 or 1)
leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN)
frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN)

crit_onset_gdd_sf => pftcon%crit_onset_gdd_sf , & ! Input: scale factor for crit_onset_gdd (unitless)
ndays_on => pftcon%ndays_on , & ! Input: number of days to complete leaf onset (days)
Expand Down Expand Up @@ -2076,8 +2074,8 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , &
associate( &
ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type

leaf_long => pftcon%leaf_long , & ! Input: leaf longevity (yrs)
leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN)
leaf_long => pftcon%leaf_long , & ! Input: leaf longevity (yrs)
leafcn_t_evolving => cnveg_nitrogenstate_inst%leafcn_patch , & ! Input: leaf C:N (gC/gN)
manunitro => pftcon%manunitro , & ! Input: max manure to be applied in total (kgN/m2)
minplanttemp => pftcon%minplanttemp , & ! Input:
planttemp => pftcon%planttemp , & ! Input:
Expand Down Expand Up @@ -2303,7 +2301,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , &
vf(p) = 0._r8
end if

call PlantCrop(p, leafcn(ivt(p)), jday, kyr, do_plant_normal, &
call PlantCrop(p, leafcn_t_evolving(p), jday, kyr, do_plant_normal, &
do_plant_lastchance, do_plant_prescribed, &
temperature_inst, crop_inst, cnveg_state_inst, &
cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, &
Expand Down Expand Up @@ -2564,8 +2562,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , &
crop_seedc_to_leaf(p) = crop_seedc_to_leaf(p) - leafc_xfer(p)/dt
crop_seedn_to_leaf(p) = crop_seedn_to_leaf(p) - leafn_xfer(p)/dt
leafc_xfer(p) = 0._r8

leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p))
leafn_xfer(p) = leafc_xfer(p) / leafcn_t_evolving(p)
if (use_c13) then
c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8
endif
Expand Down Expand Up @@ -2605,7 +2602,7 @@ subroutine CropPhenology(num_pcropp, filter_pcropp , &
crop_seedn_to_leaf(p) = crop_seedn_to_leaf(p) - leafn_xfer(p)/dt
onset_counter(p) = 0._r8
leafc_xfer(p) = 0._r8
leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p))
leafn_xfer(p) = leafc_xfer(p) / leafcn_t_evolving(p)
if (use_c13) then
c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8
endif
Expand Down Expand Up @@ -2780,7 +2777,7 @@ subroutine PlantCrop(p, leafcn_in, jday, kyr, do_plant_normal, &
!
! !ARGUMENTS:
integer , intent(in) :: p ! PATCH index running over
real(r8) , intent(in) :: leafcn_in ! leaf C:N (gC/gN) of this patch's vegetation type (pftcon%leafcn(ivt(p)))
real(r8) , intent(in) :: leafcn_in ! leaf C:N (gC/gN) of this patch
integer , intent(in) :: jday ! julian day of the year
integer , intent(in) :: kyr ! current year
logical , intent(in) :: do_plant_normal ! Are all the normal requirements for planting met?
Expand Down Expand Up @@ -3391,7 +3388,7 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, &
associate( &
ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type

leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN)
leafcn_t_evolving => cnveg_nitrogenstate_inst%leafcn_patch , & ! Input: leaf C:N (gC/gN)

biofuel_harvfrac => pftcon%biofuel_harvfrac , & ! Input: cut a fraction of leaf & stem for biofuel (-)
repr_structure_harvfrac => pftcon%repr_structure_harvfrac , & ! Input: fraction of each reproductive structure component that is harvested and sent to the crop products pool
Expand Down Expand Up @@ -3743,7 +3740,7 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, &
leafcn_offset(p) = leafc(p)/leafn(p)
end if
else
leafcn_offset(p) = leafcn(ivt(p))
leafcn_offset(p) = leafcn_t_evolving(p)
end if
leafn_to_litter(p) = leafc_to_litter(p)/leafcn_offset(p) - leafn_to_retransn(p)
leafn_to_litter(p) = max(leafn_to_litter(p),0._r8)
Expand Down Expand Up @@ -3775,7 +3772,7 @@ subroutine CNOffsetLitterfall (num_soilp, filter_soilp, &
end if
! calculate the leaf N litterfall and retranslocation
leafn_to_litter(p) = leafc_to_litter(p) / lflitcn(ivt(p))
leafn_to_retransn(p) = (leafc_to_litter(p) / leafcn(ivt(p))) - leafn_to_litter(p)
leafn_to_retransn(p) = (leafc_to_litter(p) / leafcn_t_evolving(p)) - leafn_to_litter(p)

if (use_matrixcn) then
if(leafn(p) .gt. 0)then
Expand Down Expand Up @@ -3891,7 +3888,7 @@ subroutine CNBackgroundLitterfall (num_soilp, filter_soilp, &
associate( &
ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type

leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN)
leafcn_t_evolving => cnveg_nitrogenstate_inst%leafcn_patch , & ! Input: leaf C:N (gC/gN)
lflitcn => pftcon%lflitcn , & ! Input: leaf litter C:N (gC/gN)
frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN)

Expand Down Expand Up @@ -3977,7 +3974,7 @@ subroutine CNBackgroundLitterfall (num_soilp, filter_soilp, &
leafcn_offset(p) = leafc(p)/leafn(p)
end if
else
leafcn_offset(p) = leafcn(ivt(p))
leafcn_offset(p) = leafcn_t_evolving(p)
end if
leafn_to_litter(p) = leafc_to_litter(p)/leafcn_offset(p) - leafn_to_retransn(p)
leafn_to_litter(p) = max(leafn_to_litter(p),0._r8)
Expand Down Expand Up @@ -4006,7 +4003,7 @@ subroutine CNBackgroundLitterfall (num_soilp, filter_soilp, &
end if
! calculate the leaf N litterfall and retranslocation
leafn_to_litter(p) = leafc_to_litter(p) / lflitcn(ivt(p))
leafn_to_retransn(p) = (leafc_to_litter(p) / leafcn(ivt(p))) - leafn_to_litter(p)
leafn_to_retransn(p) = (leafc_to_litter(p) / leafcn_t_evolving(p)) - leafn_to_litter(p)

if (use_matrixcn) then
if(leafn(p) .ne. 0)then
Expand Down
4 changes: 3 additions & 1 deletion src/biogeochem/CNVegCarbonStateType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,6 @@ subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants,
use shr_infnan_mod , only : isnan => shr_infnan_isnan, nan => shr_infnan_nan, assignment(=)
use clm_varcon , only : c13ratio, c14ratio
use clm_varctl , only : spinup_state, use_cndv, MM_Nuptake_opt
use clm_varctl , only : spinup_state, use_cndv, MM_Nuptake_opt
use clm_time_manager , only : is_restart
use landunit_varcon , only : istsoil, istcrop
use spmdMod , only : mpicom
Expand Down Expand Up @@ -4637,6 +4636,7 @@ subroutine DynamicPatchAdjustments(this, bounds, &
num_soilp_with_inactive, filter_soilp_with_inactive, &
patch_state_updater, &
leafc_seed, deadstemc_seed, &
leafcn_t_evolving, &
conv_cflux, wood_product_cflux, crop_product_cflux, &
dwt_frootc_to_litter, &
dwt_livecrootc_to_litter, &
Expand All @@ -4658,6 +4658,7 @@ subroutine DynamicPatchAdjustments(this, bounds, &
type(patch_state_updater_type) , intent(in) :: patch_state_updater
real(r8) , intent(in) :: leafc_seed ! seed amount for leaf C
real(r8) , intent(in) :: deadstemc_seed ! seed amount for deadstem C
real(r8) , intent(in) :: leafcn_t_evolving( bounds%begp: ) ! current leaf C:N (gC/gN)
real(r8) , intent(inout) :: conv_cflux( bounds%begp: ) ! patch-level conversion C flux to atm (expressed per unit GRIDCELL area)
real(r8) , intent(inout) :: wood_product_cflux( bounds%begp: ) ! patch-level product C flux (expressed per unit GRIDCELL area)
real(r8) , intent(inout) :: crop_product_cflux( bounds%begp: ) ! patch-level crop product C flux (expressed per unit GRIDCELL area)
Expand Down Expand Up @@ -4700,6 +4701,7 @@ subroutine DynamicPatchAdjustments(this, bounds, &

call ComputeSeedAmounts(bounds, &
num_soilp_with_inactive, filter_soilp_with_inactive, &
leafcn_t_evolving = leafcn_t_evolving(begp:endp), &
species = this%species, &
leafc_seed = leafc_seed, &
deadstemc_seed = deadstemc_seed, &
Expand Down
Loading