Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions biogeochem/EDCohortDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ Module EDCohortDynamicsMod
use FatesAllometryMod , only : bstore_allom
use FatesAllometryMod , only : ForceDBH
use FatesAllometryMod , only : set_root_fraction
use PRTGenericMod, only : prt_carbon_allom_hyp
use PRTGenericMod, only : prt_cnp_flex_allom_hyp
use PRTGenericMod, only : fates_c_only
use PRTGenericMod, only : fates_cn
Copy link
Contributor Author

@slevis-lmwg slevis-lmwg Oct 9, 2025

Choose a reason for hiding this comment

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

@rgknox I found a moment to come back and look at my progress in these PRs:

  • You recently brought up the naming choice of the two indices in lines 71-72. I see that I likely should have named the second one fates_cnp, but I will refrain from making changes until we follow up and agree on something.
  • Before we meet, I still have two unchecked boxes in Completing the FATES-CLM nitrogen coupling ESCOMP/CTSM#3378 (comment), though we could also potentially touch base before I resolve them. Currently I have Friday afternoon Pacific Time (and most afternoons next week) available.
  • Regardless, I continue to make slow progress due to the ctsm5.4 preparations.

use PRTGenericMod, only : prt_vartypes
use PRTGenericMod, only : carbon12_element
use PRTGenericMod, only : nitrogen_element
Expand Down Expand Up @@ -251,12 +251,12 @@ subroutine InitPRTObject(prt)


select case(hlm_parteh_mode)
case (prt_carbon_allom_hyp)
case (fates_c_only)

allocate(c_allom_prt)
prt => c_allom_prt

case (prt_cnp_flex_allom_hyp)
case (fates_cn)

allocate(cnp_allom_prt)
prt => cnp_allom_prt
Expand Down Expand Up @@ -1030,7 +1030,7 @@ subroutine fuse_cohorts(currentSite, currentPatch, bc_in)
currentCohort%frmort = (currentCohort%n*currentCohort%frmort + nextc%n*nextc%frmort)/newn

! Nutrients
if(hlm_parteh_mode .eq. prt_cnp_flex_allom_hyp) then
if (hlm_parteh_mode == fates_cn) then

if(nextc%n > currentCohort%n) currentCohort%cnp_limiter = nextc%cnp_limiter

Expand Down
2 changes: 0 additions & 2 deletions biogeochem/EDPatchDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ module EDPatchDynamicsMod
use PRTGenericMod, only : struct_organ
use PRTLossFluxesMod, only : PRTBurnLosses
use FatesInterfaceTypesMod, only : hlm_parteh_mode
use PRTGenericMod, only : prt_carbon_allom_hyp
use PRTGenericMod, only : prt_cnp_flex_allom_hyp
use SFParamsMod, only : SF_VAL_CWD_FRAC
use EDParamsMod, only : logging_event_code
use EDParamsMod, only : logging_export_frac
Expand Down
12 changes: 6 additions & 6 deletions biogeochem/EDPhysiologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ module EDPhysiologyMod
use FatesAllometryMod , only : carea_allom
use FatesAllometryMod , only : CheckIntegratedAllometries
use FatesAllometryMod, only : set_root_fraction
use PRTGenericMod, only : prt_carbon_allom_hyp
use PRTGenericMod, only : prt_cnp_flex_allom_hyp
use PRTGenericMod, only : fates_c_only
use PRTGenericMod, only : fates_cn
use PRTGenericMod, only : prt_vartypes
use PRTGenericMod, only : leaf_organ
use PRTGenericMod, only : sapw_organ, struct_organ
Expand Down Expand Up @@ -2715,7 +2715,7 @@ subroutine recruitment(currentSite, currentPatch, bc_in)


select case(hlm_parteh_mode)
case (prt_carbon_allom_hyp, prt_cnp_flex_allom_hyp)
case (fates_c_only, fates_cn)

! put all of the leaf mass into the first bin
call SetState(prt, leaf_organ, element_id, m_leaf, 1)
Expand Down Expand Up @@ -3317,7 +3317,7 @@ subroutine UpdateRecruitL2FR(csite)

! Difference in dbh (cm) to consider a plant was recruited fairly recently

if(hlm_parteh_mode .ne. prt_cnp_flex_allom_hyp) return
if (hlm_parteh_mode /= fates_cn) return

rec_n(1:numpft,1:nclmax) = 0._r8
rec_l2fr0(1:numpft,1:nclmax) = 0._r8
Expand Down Expand Up @@ -3379,7 +3379,7 @@ subroutine UpdateRecruitStoich(csite)
! Update the total plant stoichiometry of a new recruit, based on the updated
! L2FR values

if(hlm_parteh_mode .ne. prt_cnp_flex_allom_hyp) return
if (hlm_parteh_mode /= fates_cn) return

cpatch => csite%youngest_patch
do while(associated(cpatch))
Expand Down Expand Up @@ -3417,7 +3417,7 @@ subroutine SetRecruitL2FR(csite)
type(fates_cohort_type), pointer :: ccohort
integer :: ft,cl

if(hlm_parteh_mode .ne. prt_cnp_flex_allom_hyp) return
if (hlm_parteh_mode /= fates_cn) return

cpatch => csite%youngest_patch
do while(associated(cpatch))
Expand Down
12 changes: 6 additions & 6 deletions biogeochem/FatesCohortMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ module FatesCohortMod
use FatesGlobals, only : fates_log
use PRTGenericMod, only : max_nleafage
use PRTGenericMod, only : prt_vartypes
use PRTGenericMod, only : prt_carbon_allom_hyp
use PRTGenericMod, only : prt_cnp_flex_allom_hyp
use PRTGenericMod, only : fates_c_only
use PRTGenericMod, only : fates_cn
use PRTGenericMod, only : leaf_organ, fnrt_organ, sapw_organ
use PRTGenericMod, only : repro_organ, store_organ, struct_organ
use PRTGenericMod, only : carbon12_element
Expand Down Expand Up @@ -609,7 +609,7 @@ subroutine Create(this, prt, pft, nn, height, coage, dbh, status, &
! initialized with full stores, which match with minimum fineroot biomass
this%l2fr = prt_params%allom_l2fr(pft)

if (hlm_parteh_mode .eq. prt_cnp_flex_allom_hyp) then
if (hlm_parteh_mode == fates_cn) then
this%cx_int = 0._r8 ! Assume balanced N,P/C stores ie log(1) = 0
this%cx0 = 0._r8 ! Assume balanced N,P/C stores ie log(1) = 0
this%ema_dcxdt = 0._r8 ! Assume unchanged dCX/dt
Expand Down Expand Up @@ -727,7 +727,7 @@ subroutine Copy(this, copyCohort)
copyCohort%year_net_uptake = this%year_net_uptake
copyCohort%cnp_limiter = this%cnp_limiter

if (hlm_parteh_mode .eq. prt_cnp_flex_allom_hyp) then
if (hlm_parteh_mode == fates_cn) then
copyCohort%cx_int = this%cx_int
copyCohort%ema_dcxdt = this%ema_dcxdt
copyCohort%cx0 = this%cx0
Expand Down Expand Up @@ -852,7 +852,7 @@ subroutine InitPRTBoundaryConditions(this)
class(fates_cohort_type), intent(inout), target :: this

select case(hlm_parteh_mode)
case (prt_carbon_allom_hyp)
case (fates_c_only)

! Register boundary conditions for the Carbon Only Allometric Hypothesis

Expand All @@ -866,7 +866,7 @@ subroutine InitPRTBoundaryConditions(this)
call this%prt%RegisterBCIn(ac_bc_in_id_effnrt, bc_rval = this%effnrt_coh)
call this%prt%RegisterBCIn(ac_bc_in_id_efstem, bc_rval = this%efstem_coh)

case (prt_cnp_flex_allom_hyp)
case (fates_cn)

! Register boundary conditions for the CNP Allometric Hypothesis

Expand Down
10 changes: 5 additions & 5 deletions biogeochem/FatesSoilBGCFluxMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module FatesSoilBGCFluxMod
use PRTGenericMod , only : num_elements
use PRTGenericMod , only : element_list
use PRTGenericMod , only : element_pos
use PRTGenericMod , only : prt_carbon_allom_hyp
use PRTGenericMod , only : prt_cnp_flex_allom_hyp
use PRTGenericMod , only : fates_c_only
use PRTGenericMod , only : fates_cn
use PRTGenericMod , only : prt_vartypes
use PRTGenericMod , only : leaf_organ
use PRTGenericMod , only : sapw_organ, struct_organ
Expand Down Expand Up @@ -133,7 +133,7 @@ subroutine UnPackNutrientAquisitionBCs(sites, bc_in)

! We can exit if this is a c-only simulation
select case (hlm_parteh_mode)
case (prt_carbon_allom_hyp)
case (fates_c_only)
! These can now be zero'd
do s = 1, nsites
bc_in(s)%plant_nh4_uptake_flux(:,:) = 0._r8
Expand Down Expand Up @@ -269,7 +269,7 @@ subroutine PrepCH4BCs(csite,bc_in,bc_out)


! Exit if we need not communicate with the hlm's ch4 module
! if(.not.(hlm_use_ch4==itrue) .and. .not.(hlm_parteh_mode==prt_cnp_flex_allom_hyp) ) return
! if(.not.(hlm_use_ch4==itrue) .and. .not.(hlm_parteh_mode==fates_cn) ) return

! Initialize to zero
bc_out%annavg_agnpp_pa(:) = 0._r8
Expand All @@ -282,7 +282,7 @@ subroutine PrepCH4BCs(csite,bc_in,bc_out)
bc_out%ema_npp = 0._r8

! Process CH4 variables first
!if(.not.(hlm_use_ch4==itrue) .and. .not.(hlm_parteh_mode==prt_cnp_flex_allom_hyp) )
!if(.not.(hlm_use_ch4==itrue) .and. .not.(hlm_parteh_mode==fates_cn) )

cpatch => csite%oldest_patch
do while (associated(cpatch))
Expand Down
14 changes: 7 additions & 7 deletions biogeophys/FatesPlantRespPhotosynthMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ module FATESPlantRespPhotosynthMod
use FatesCohortMod, only : fates_cohort_type
use FatesConstantsMod, only : lmrmodel_ryan_1991
use FatesConstantsMod, only : lmrmodel_atkin_etal_2017
use PRTGenericMod, only : prt_carbon_allom_hyp
use PRTGenericMod, only : prt_cnp_flex_allom_hyp
use PRTGenericMod, only : fates_c_only
use PRTGenericMod, only : fates_cn
use PRTGenericMod, only : carbon12_element
use PRTGenericMod, only : nitrogen_element
use PRTGenericMod, only : leaf_organ
Expand Down Expand Up @@ -497,7 +497,7 @@ subroutine FatesPlantRespPhotosynthDrive (nsites, sites,bc_in,bc_out,dtime)
(hlm_use_planthydro.eq.itrue) .or. &
(hlm_radiation_model .eq. twostr_solver ) .or. &
(nleafage > 1) .or. &
(hlm_parteh_mode .ne. prt_carbon_allom_hyp ) ) then
(hlm_parteh_mode /= fates_c_only) ) then


! These values are incremented, therefore since
Expand Down Expand Up @@ -564,11 +564,11 @@ subroutine FatesPlantRespPhotosynthDrive (nsites, sites,bc_in,bc_out,dtime)
! Then scale this value at the top of the canopy for canopy depth
! Leaf nitrogen concentration at the top of the canopy (g N leaf / m**2 leaf)
select case(hlm_parteh_mode)
case (prt_carbon_allom_hyp)
case (fates_c_only)

lnc_top = prt_params%nitr_stoich_p1(ft,prt_params%organ_param_id(leaf_organ))/slatop(ft)

case (prt_cnp_flex_allom_hyp)
case (fates_cn)

leaf_c = currentCohort%prt%GetState(leaf_organ, carbon12_element)
if( (leaf_c*slatop(ft)) > nearzero) then
Expand Down Expand Up @@ -919,15 +919,15 @@ subroutine FatesPlantRespPhotosynthDrive (nsites, sites,bc_in,bc_out,dtime)


select case(hlm_parteh_mode)
case (prt_carbon_allom_hyp)
case (fates_c_only)

live_stem_n = sapw_c_agw * prt_params%nitr_stoich_p1(ft,prt_params%organ_param_id(sapw_organ))

live_croot_n = sapw_c_bgw * prt_params%nitr_stoich_p1(ft,prt_params%organ_param_id(sapw_organ))

fnrt_n = fnrt_c * prt_params%nitr_stoich_p1(ft,prt_params%organ_param_id(fnrt_organ))

case(prt_cnp_flex_allom_hyp)
case(fates_cn)

live_stem_n = prt_params%allom_agb_frac(currentCohort%pft) * &
currentCohort%prt%GetState(sapw_organ, nitrogen_element)
Expand Down
24 changes: 12 additions & 12 deletions functional_unit_testing/parteh/f90src/FatesCohortWrapMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ module FatesCohortWrapMod
use PRTGenericMod, only : carbon12_element
use PRTGenericMod, only : SetState
use PRTGenericMod, only : prt_global
use PRTGenericMod, only : prt_carbon_allom_hyp
use PRTGenericMod, only : prt_cnp_flex_allom_hyp
use PRTGenericMod, only : fates_c_only
use PRTGenericMod, only : fates_cn

use PRTAllometricCarbonMod, only : callom_prt_vartypes
use PRTAllometricCarbonMod, only : ac_bc_inout_id_netdc
Expand Down Expand Up @@ -257,12 +257,12 @@ subroutine CohortPySet(ipft,hgt_min,canopy_trim)
! -----------------------------------------------------

select case(ccohort%parteh_mode)
case (prt_carbon_allom_hyp)
case (fates_c_only)
prt_global => prt_global_ac
allocate(callom_prt)
ccohort%prt => callom_prt

case(prt_cnp_flex_allom_hyp)
case(fates_cn)
prt_global => prt_global_acnp
allocate(cnpallom_prt)
ccohort%prt => cnpallom_prt
Expand All @@ -276,7 +276,7 @@ subroutine CohortPySet(ipft,hgt_min,canopy_trim)
call ccohort%prt%InitPRTVartype()

select case(ccohort%parteh_mode)
case (prt_carbon_allom_hyp)
case (fates_c_only)

call SetState(ccohort%prt,leaf_organ, carbon12_element, leaf_c)
call SetState(ccohort%prt,fnrt_organ, carbon12_element, fnrt_c)
Expand All @@ -291,7 +291,7 @@ subroutine CohortPySet(ipft,hgt_min,canopy_trim)
call ccohort%prt%RegisterBCIn(ac_bc_in_id_pft,bc_ival = ccohort%pft)
call ccohort%prt%RegisterBCIn(ac_bc_in_id_ctrim,bc_rval = ccohort%canopy_trim)

case (prt_cnp_flex_allom_hyp)
case (fates_cn)

! Initializing with the target stoichiometric ratios
! (OR you can initialize with the minimum ratios too.... p2)
Expand Down Expand Up @@ -394,7 +394,7 @@ subroutine WrapDailyPRT(ipft,daily_carbon_gain,canopy_trim,flush_c,drop_frac_c,l
call PRTMaintTurnover(ccohort%prt, ipft, is_drought)

select case(ccohort%parteh_mode)
case (prt_carbon_allom_hyp)
case (fates_c_only)
prt_global => prt_global_ac
ccohort%daily_carbon_gain = daily_carbon_gain

Expand All @@ -403,7 +403,7 @@ subroutine WrapDailyPRT(ipft,daily_carbon_gain,canopy_trim,flush_c,drop_frac_c,l
ccohort%daily_r_grow = 0.0_r8
ccohort%carbon_root_efflux = 0.0_r8

case (prt_cnp_flex_allom_hyp)
case (fates_cn)

prt_global => prt_global_acnp
ccohort%daily_carbon_gain = daily_carbon_gain
Expand Down Expand Up @@ -457,9 +457,9 @@ subroutine WrapQueryVars(ipft,crowndamage, leaf_area,crown_area,agb,store_c,targ
canopy_lai(:) = 0._r8

select case(ccohort%parteh_mode)
case (prt_carbon_allom_hyp)
case (fates_c_only)
prt_global => prt_global_ac
case (prt_cnp_flex_allom_hyp)
case (fates_cn)
prt_global => prt_global_acnp
end select

Expand Down Expand Up @@ -547,9 +547,9 @@ subroutine WrapQueryDiagnostics(ipft, dbh, &
ccohort => cohort_array(ipft)

select case(ccohort%parteh_mode)
case (prt_carbon_allom_hyp )
case (fates_c_only )
prt_global => prt_global_ac
case (prt_cnp_flex_allom_hyp)
case (fates_cn)
prt_global => prt_global_acnp
end select

Expand Down
6 changes: 3 additions & 3 deletions main/EDInitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ module EDInitMod
use FatesAllometryMod , only : carea_allom
use PRTGenericMod , only : StorageNutrientTarget
use FatesInterfaceTypesMod, only : hlm_parteh_mode
use PRTGenericMod, only : prt_carbon_allom_hyp
use PRTGenericMod, only : prt_cnp_flex_allom_hyp
use PRTGenericMod, only : fates_c_only
use PRTGenericMod, only : fates_cn
use PRTGenericMod, only : prt_vartypes
use PRTGenericMod, only : leaf_organ
use PRTGenericMod, only : fnrt_organ
Expand Down Expand Up @@ -1310,7 +1310,7 @@ subroutine init_cohorts(site_in, patch_in, bc_in)
end select

select case(hlm_parteh_mode)
case (prt_carbon_allom_hyp, prt_cnp_flex_allom_hyp )
case (fates_c_only, fates_cn )
! Put all of the leaf mass into the first bin
call SetState(prt, leaf_organ, element_id, m_leaf, 1)
do iage = 2,nleafage
Expand Down
6 changes: 3 additions & 3 deletions main/EDMainMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ module EDMainMod
use FatesInterfaceTypesMod , only : hlm_masterproc
use FatesInterfaceTypesMod , only : numpft
use FatesInterfaceTypesMod , only : hlm_use_nocomp
use PRTGenericMod , only : prt_carbon_allom_hyp
use PRTGenericMod , only : prt_cnp_flex_allom_hyp
use PRTGenericMod , only : fates_c_only
use PRTGenericMod , only : fates_cn
use PRTGenericMod , only : nitrogen_element
use PRTGenericMod , only : phosphorus_element
use EDCohortDynamicsMod , only : terminate_cohorts
Expand Down Expand Up @@ -748,7 +748,7 @@ subroutine ed_integrate_state_variables(currentSite, bc_in, bc_out )
! Update history diagnostics related to Nutrients (if any)
! -----------------------------------------------------------------------------
select case(hlm_parteh_mode)
case (prt_cnp_flex_allom_hyp)
case (fates_cn)
call fates_hist%update_history_nutrflux(currentSite)
end select

Expand Down
6 changes: 3 additions & 3 deletions main/EDPftvarcon.F90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module EDPftvarcon
use FatesLitterMod, only : ilabile,icellulose,ilignin
use PRTGenericMod, only : leaf_organ, fnrt_organ, store_organ
use PRTGenericMod, only : sapw_organ, struct_organ, repro_organ
use PRTGenericMod, only : prt_cnp_flex_allom_hyp,prt_carbon_allom_hyp
use PRTGenericMod, only : fates_cn, fates_c_only
use FatesInterfaceTypesMod, only : hlm_nitrogen_spec, hlm_phosphorus_spec
use FatesInterfaceTypesMod, only : hlm_parteh_mode
use FatesInterfaceTypesMod, only : hlm_nu_com
Expand Down Expand Up @@ -1714,7 +1714,7 @@ subroutine FatesCheckParams(is_master)
if(.not.is_master) return

select case (hlm_parteh_mode)
case (prt_cnp_flex_allom_hyp)
case (fates_cn)

! Check to see if either RD/ECA/MIC is turned on

Expand Down Expand Up @@ -1792,7 +1792,7 @@ subroutine FatesCheckParams(is_master)
end if
end if

case (prt_carbon_allom_hyp)
case (fates_c_only)
! No additional checks needed for now.
continue

Expand Down
2 changes: 0 additions & 2 deletions main/EDTypesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ module EDTypesMod
use PRTGenericMod, only : prt_vartypes
use PRTGenericMod, only : leaf_organ, fnrt_organ, sapw_organ
use PRTGenericMod, only : repro_organ, store_organ, struct_organ
use PRTGenericMod, only : prt_carbon_allom_hyp
use PRTGenericMod, only : prt_cnp_flex_allom_hyp
use PRTGenericMod, only : num_organ_types
use PRTGenericMod, only : num_elements
use PRTGenericMod, only : element_list
Expand Down
Loading