From b324212f5423fe7b147b2e942e235473531d5f45 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 1 Mar 2023 15:25:23 -0500 Subject: [PATCH 1/5] Keeping N litter flux bc_outs on for all modes, which suits clm --- main/FatesInterfaceMod.F90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main/FatesInterfaceMod.F90 b/main/FatesInterfaceMod.F90 index c322fc5a6a..5286626549 100644 --- a/main/FatesInterfaceMod.F90 +++ b/main/FatesInterfaceMod.F90 @@ -313,6 +313,9 @@ subroutine zero_bcs(fates,s) fates%bc_out(s)%litt_flux_cel_c_si(:) = 0._r8 fates%bc_out(s)%litt_flux_lig_c_si(:) = 0._r8 fates%bc_out(s)%litt_flux_lab_c_si(:) = 0._r8 + fates%bc_out(s)%litt_flux_cel_n_si(:) = 0._r8 + fates%bc_out(s)%litt_flux_lig_n_si(:) = 0._r8 + fates%bc_out(s)%litt_flux_lab_n_si(:) = 0._r8 case(prt_cnp_flex_allom_hyp) fates%bc_in(s)%plant_nh4_uptake_flux(:,:) = 0._r8 @@ -636,8 +639,10 @@ subroutine allocate_bcout(bc_out, nlevsoil_in, nlevdecomp_in) allocate(bc_out%litt_flux_cel_c_si(nlevdecomp_in)) allocate(bc_out%litt_flux_lig_c_si(nlevdecomp_in)) allocate(bc_out%litt_flux_lab_c_si(nlevdecomp_in)) + allocate(bc_out%litt_flux_cel_n_si(nlevdecomp_in)) + allocate(bc_out%litt_flux_lig_n_si(nlevdecomp_in)) + allocate(bc_out%litt_flux_lab_n_si(nlevdecomp_in)) case(prt_cnp_flex_allom_hyp) - allocate(bc_out%litt_flux_cel_c_si(nlevdecomp_in)) allocate(bc_out%litt_flux_lig_c_si(nlevdecomp_in)) From 1b570d88c52d64bab2e952ac90ff7ffae9f11510 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 9 Mar 2023 19:20:32 -0500 Subject: [PATCH 2/5] comments on n litter fluxes added --- main/FatesInterfaceMod.F90 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main/FatesInterfaceMod.F90 b/main/FatesInterfaceMod.F90 index c81053da3a..53daac0453 100644 --- a/main/FatesInterfaceMod.F90 +++ b/main/FatesInterfaceMod.F90 @@ -313,6 +313,9 @@ subroutine zero_bcs(fates,s) fates%bc_out(s)%litt_flux_cel_c_si(:) = 0._r8 fates%bc_out(s)%litt_flux_lig_c_si(:) = 0._r8 fates%bc_out(s)%litt_flux_lab_c_si(:) = 0._r8 + ! Yes, zero out N flux arrays for c-only runs. + ! This is because we want these on (and zero) + ! with CLM. fates%bc_out(s)%litt_flux_cel_n_si(:) = 0._r8 fates%bc_out(s)%litt_flux_lig_n_si(:) = 0._r8 fates%bc_out(s)%litt_flux_lab_n_si(:) = 0._r8 @@ -642,11 +645,13 @@ subroutine allocate_bcout(bc_out, nlevsoil_in, nlevdecomp_in) allocate(bc_out%litt_flux_cel_c_si(nlevdecomp_in)) allocate(bc_out%litt_flux_lig_c_si(nlevdecomp_in)) allocate(bc_out%litt_flux_lab_c_si(nlevdecomp_in)) + ! Yes, allocate N flux arrays for c-only runs. + ! This is because we want these on (and zero) + ! with CLM. allocate(bc_out%litt_flux_cel_n_si(nlevdecomp_in)) allocate(bc_out%litt_flux_lig_n_si(nlevdecomp_in)) allocate(bc_out%litt_flux_lab_n_si(nlevdecomp_in)) case(prt_cnp_flex_allom_hyp) - allocate(bc_out%litt_flux_cel_c_si(nlevdecomp_in)) allocate(bc_out%litt_flux_lig_c_si(nlevdecomp_in)) allocate(bc_out%litt_flux_lab_c_si(nlevdecomp_in)) @@ -656,10 +661,8 @@ subroutine allocate_bcout(bc_out, nlevsoil_in, nlevdecomp_in) allocate(bc_out%litt_flux_cel_p_si(nlevdecomp_in)) allocate(bc_out%litt_flux_lig_p_si(nlevdecomp_in)) allocate(bc_out%litt_flux_lab_p_si(nlevdecomp_in)) - allocate(bc_out%source_nh4(nlevdecomp_in)) allocate(bc_out%source_p(nlevdecomp_in)) - case default write(fates_log(), *) 'An unknown parteh hypothesis was passed' write(fates_log(), *) 'to the site level output boundary conditions' From 6a8898abd74351b1799a6d599cec3317c0e30f15 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 27 Jul 2023 11:59:33 -0600 Subject: [PATCH 3/5] removing conditional on ch4 bcs --- biogeochem/FatesSoilBGCFluxMod.F90 | 132 +++++++++++++++++------------ main/FatesInterfaceMod.F90 | 5 +- 2 files changed, 80 insertions(+), 57 deletions(-) diff --git a/biogeochem/FatesSoilBGCFluxMod.F90 b/biogeochem/FatesSoilBGCFluxMod.F90 index b32186c93f..564510bb49 100644 --- a/biogeochem/FatesSoilBGCFluxMod.F90 +++ b/biogeochem/FatesSoilBGCFluxMod.F90 @@ -268,8 +268,9 @@ subroutine PrepCH4BCs(csite,bc_in,bc_out) real(r8), parameter :: ema_npp_tscale = 10._r8 ! 10 day + ! 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==prt_cnp_flex_allom_hyp) ) return ! Initialize to zero bc_out%annavg_agnpp_pa(:) = 0._r8 @@ -279,12 +280,17 @@ subroutine PrepCH4BCs(csite,bc_in,bc_out) bc_out%frootc_pa(:) = 0._r8 bc_out%root_resp(:) = 0._r8 bc_out%woody_frac_aere_pa(:) = 0._r8 + bc_out%ema_npp = 0._r8 + site_npp = 0._r8 + + ! Process CH4 variables first + !if(.not.(hlm_use_ch4==itrue) .and. .not.(hlm_parteh_mode==prt_cnp_flex_allom_hyp) ) fp = 0 cpatch => csite%oldest_patch do while (associated(cpatch)) - + ! Patch ordering when passing boundary conditions ! always goes from oldest to youngest, following ! the convention of EDPatchDynamics::set_patchno() @@ -298,7 +304,7 @@ subroutine PrepCH4BCs(csite,bc_in,bc_out) ccohort => cpatch%tallest do while (associated(ccohort)) - + ! For consistency, only apply calculations to non-new ! cohorts. New cohorts will not have respiration rates ! at this point in the call sequence. @@ -306,23 +312,12 @@ subroutine PrepCH4BCs(csite,bc_in,bc_out) if(.not.ccohort%isnew) then pft = ccohort%pft - + call set_root_fraction(csite%rootfrac_scr, pft, csite%zi_soil, & bc_in%max_rooting_depth_index_col ) - + fnrt_c = ccohort%prt%GetState(fnrt_organ, carbon12_element) - - ! Fine root fraction over depth - - bc_out%rootfr_pa(fp,1:bc_in%nlevsoil) = & - bc_out%rootfr_pa(fp,1:bc_in%nlevsoil) + & - csite%rootfrac_scr(1:bc_in%nlevsoil) - - ! Fine root carbon, convert [kg/plant] -> [g/m2] - bc_out%frootc_pa(fp) = & - bc_out%frootc_pa(fp) + & - fnrt_c*ccohort%n/cpatch%area * g_per_kg - + ! [kgC/day] sapw_net_alloc = ccohort%prt%GetNetAlloc(sapw_organ, carbon12_element) * days_per_sec store_net_alloc = ccohort%prt%GetNetAlloc(store_organ, carbon12_element) * days_per_sec @@ -330,23 +325,37 @@ subroutine PrepCH4BCs(csite,bc_in,bc_out) fnrt_net_alloc = ccohort%prt%GetNetAlloc(fnrt_organ, carbon12_element) * days_per_sec struct_net_alloc = ccohort%prt%GetNetAlloc(struct_organ, carbon12_element) * days_per_sec repro_net_alloc = ccohort%prt%GetNetAlloc(repro_organ, carbon12_element) * days_per_sec - + ! [kgC/plant/day] -> [gC/m2/s] agnpp = agnpp + ccohort%n/cpatch%area * (leaf_net_alloc + repro_net_alloc + & prt_params%allom_agb_frac(pft)*(sapw_net_alloc+store_net_alloc+struct_net_alloc)) * g_per_kg - + ! [kgC/plant/day] -> [gC/m2/s] bgnpp = bgnpp + ccohort%n/cpatch%area * (fnrt_net_alloc + & (1._r8-prt_params%allom_agb_frac(pft))*(sapw_net_alloc+store_net_alloc+struct_net_alloc)) * g_per_kg - - ! (gC/m2/s) root respiration (fine root MR + total root GR) - ! RGK: We do not save root respiration and average over the day. Until we do - ! 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%n*area_inv*(1._r8-prt_params%allom_agb_frac(pft)) * csite%rootfrac_scr(1:bc_in%nlevsoil) - + + if(hlm_use_ch4==itrue)then + + ! Fine root fraction over depth + bc_out%rootfr_pa(fp,1:bc_in%nlevsoil) = & + bc_out%rootfr_pa(fp,1:bc_in%nlevsoil) + & + csite%rootfrac_scr(1:bc_in%nlevsoil) + + ! Fine root carbon, convert [kg/plant] -> [g/m2] + bc_out%frootc_pa(fp) = & + bc_out%frootc_pa(fp) + & + fnrt_c*ccohort%n/cpatch%area * g_per_kg + + ! (gC/m2/s) root respiration (fine root MR + total root GR) + ! RGK: We do not save root respiration and average over the day. Until we do + ! 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%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 woody_area = woody_area + ccohort%c_area end if @@ -357,33 +366,38 @@ subroutine PrepCH4BCs(csite,bc_in,bc_out) ccohort => ccohort%shorter end do - - if( sum(bc_out%rootfr_pa(fp,1:bc_in%nlevsoil)) > nearzero) then - bc_out%rootfr_pa(fp,1:bc_in%nlevsoil) = & - bc_out%rootfr_pa(fp,1:bc_in%nlevsoil) / & - sum(bc_out%rootfr_pa(fp,1:bc_in%nlevsoil)) - end if - - ! RGK: These averages should switch to the new patch averaging methods - ! when available. Right now we are not doing any time averaging - ! because it would be mixing the memory of patches, which - ! would be arguably worse than just using the instantaneous value - ! gC/m2/s - bc_out%annavg_agnpp_pa(fp) = agnpp - bc_out%annavg_bgnpp_pa(fp) = bgnpp - ! gc/m2/yr - bc_out%annsum_npp_pa(fp) = (bgnpp+agnpp)*days_per_year*sec_per_day - - site_npp = site_npp + bc_out%annsum_npp_pa(fp)*cpatch%area*area_inv - - if(plant_area>nearzero) then - bc_out%woody_frac_aere_pa(fp) = woody_area/plant_area + if(hlm_use_ch4==itrue)then + if( sum(bc_out%rootfr_pa(fp,1:bc_in%nlevsoil)) > nearzero) then + bc_out%rootfr_pa(fp,1:bc_in%nlevsoil) = & + bc_out%rootfr_pa(fp,1:bc_in%nlevsoil) / & + sum(bc_out%rootfr_pa(fp,1:bc_in%nlevsoil)) + end if + + ! RGK: These averages should switch to the new patch averaging methods + ! when available. Right now we are not doing any time averaging + ! because it would be mixing the memory of patches, which + ! would be arguably worse than just using the instantaneous value + + ! gC/m2/s + bc_out%annavg_agnpp_pa(fp) = agnpp + bc_out%annavg_bgnpp_pa(fp) = bgnpp + ! gc/m2/yr + bc_out%annsum_npp_pa(fp) = (bgnpp+agnpp)*days_per_year*sec_per_day + + site_npp = site_npp + (bgnpp+agnpp)*days_per_year*sec_per_day*cpatch%area*area_inv + + if(plant_area>nearzero) then + bc_out%woody_frac_aere_pa(fp) = woody_area/plant_area + end if + end if + site_npp = site_npp + (bgnpp+agnpp)*days_per_year*sec_per_day*cpatch%area*area_inv + cpatch => cpatch%younger end do - + ! Smoothed [gc/m2/yr] if(csite%ema_npp<-9000._r8)then ! For cold starts, we initialize the ema_npp value at -9999, so that @@ -394,7 +408,7 @@ subroutine PrepCH4BCs(csite,bc_in,bc_out) end if bc_out%ema_npp = csite%ema_npp - + return end subroutine PrepCH4BCs @@ -701,6 +715,12 @@ subroutine FluxIntoLitterPools(csite, bc_in, bc_out) do id = 1,nlev_eff_decomp surface_prof(id) = surface_prof(id)/surface_prof_tot end do + + + !bc_out%litt_flux_cel_n_si(:) = 100._r8 + !bc_out%litt_flux_lab_n_si(:) = 100._r8 + !bc_out%litt_flux_lig_n_si(:) = 100._r8 + ! Loop over the different elements. do el = 1, num_elements @@ -711,9 +731,9 @@ subroutine FluxIntoLitterPools(csite, bc_in, bc_out) select case (element_list(el)) case (carbon12_element) - bc_out%litt_flux_cel_c_si(:) = 0._r8 - bc_out%litt_flux_lig_c_si(:) = 0._r8 - bc_out%litt_flux_lab_c_si(:) = 0._r8 + bc_out%litt_flux_cel_c_si(:) = 0.0_r8 + bc_out%litt_flux_lig_c_si(:) = 0.0_r8 + bc_out%litt_flux_lab_c_si(:) = 0.0_r8 flux_cel_si => bc_out%litt_flux_cel_c_si(:) flux_lab_si => bc_out%litt_flux_lab_c_si(:) flux_lig_si => bc_out%litt_flux_lig_c_si(:) @@ -733,6 +753,10 @@ subroutine FluxIntoLitterPools(csite, bc_in, bc_out) flux_lig_si => bc_out%litt_flux_lig_p_si(:) end select + !end do + !return + !do el = 1, num_elements + currentPatch => csite%oldest_patch do while (associated(currentPatch)) diff --git a/main/FatesInterfaceMod.F90 b/main/FatesInterfaceMod.F90 index d39155ecfe..7c8aaba4ba 100644 --- a/main/FatesInterfaceMod.F90 +++ b/main/FatesInterfaceMod.F90 @@ -463,7 +463,6 @@ subroutine allocate_bcin(bc_in, nlevsoil_in, nlevdecomp_in, num_lu_harvest_cats, allocate(bc_in%plant_p_uptake_flux(1,1)) end if - allocate(bc_in%zi_sisl(0:nlevsoil_in)) allocate(bc_in%dz_sisl(nlevsoil_in)) allocate(bc_in%z_sisl(nlevsoil_in)) @@ -620,7 +619,7 @@ subroutine allocate_bcout(bc_out, nlevsoil_in, nlevdecomp_in) ! Include the bare-ground patch for these patch-level boundary conditions ! (it will always be zero for all of these) - if(hlm_use_ch4.eq.itrue) then + !if(hlm_use_ch4.eq.itrue) then allocate(bc_out%annavg_agnpp_pa(0:maxpatch_total));bc_out%annavg_agnpp_pa(:)=nan allocate(bc_out%annavg_bgnpp_pa(0:maxpatch_total));bc_out%annavg_bgnpp_pa(:)=nan allocate(bc_out%annsum_npp_pa(0:maxpatch_total));bc_out%annsum_npp_pa(:)=nan @@ -632,7 +631,7 @@ subroutine allocate_bcout(bc_out, nlevsoil_in, nlevdecomp_in) ! Give the bare-ground root fractions a nominal fraction of unity over depth bc_out%rootfr_pa(0,1:nlevsoil_in)=1._r8/real(nlevsoil_in,r8) - end if + !end if bc_out%ema_npp = -9999.9_r8 From 97ae3548b341d968030b39c90d81a4fc1ae0aba6 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 31 Jul 2023 07:40:17 -0600 Subject: [PATCH 4/5] Updates to bgc coupling --- biogeochem/FatesSoilBGCFluxMod.F90 | 34 ++++++------------------------ main/FatesInterfaceMod.F90 | 32 +++++++++++++++++++++------- 2 files changed, 31 insertions(+), 35 deletions(-) diff --git a/biogeochem/FatesSoilBGCFluxMod.F90 b/biogeochem/FatesSoilBGCFluxMod.F90 index 564510bb49..5dafb6276c 100644 --- a/biogeochem/FatesSoilBGCFluxMod.F90 +++ b/biogeochem/FatesSoilBGCFluxMod.F90 @@ -255,7 +255,6 @@ subroutine PrepCH4BCs(csite,bc_in,bc_out) integer :: fp ! patch index of the site real(r8) :: agnpp ! Above ground daily npp real(r8) :: bgnpp ! Below ground daily npp - real(r8) :: site_npp ! Site level NPP gC/m2/year real(r8) :: plant_area ! crown area (m2) of all plants in patch real(r8) :: woody_area ! corwn area (m2) of woody plants in patch real(r8) :: fnrt_c ! Fine root carbon [kg/plant] @@ -282,8 +281,6 @@ subroutine PrepCH4BCs(csite,bc_in,bc_out) bc_out%woody_frac_aere_pa(:) = 0._r8 bc_out%ema_npp = 0._r8 - site_npp = 0._r8 - ! Process CH4 variables first !if(.not.(hlm_use_ch4==itrue) .and. .not.(hlm_parteh_mode==prt_cnp_flex_allom_hyp) ) @@ -384,29 +381,16 @@ subroutine PrepCH4BCs(csite,bc_in,bc_out) bc_out%annavg_bgnpp_pa(fp) = bgnpp ! gc/m2/yr bc_out%annsum_npp_pa(fp) = (bgnpp+agnpp)*days_per_year*sec_per_day - - site_npp = site_npp + (bgnpp+agnpp)*days_per_year*sec_per_day*cpatch%area*area_inv - + if(plant_area>nearzero) then bc_out%woody_frac_aere_pa(fp) = woody_area/plant_area end if end if - site_npp = site_npp + (bgnpp+agnpp)*days_per_year*sec_per_day*cpatch%area*area_inv - cpatch => cpatch%younger end do - ! Smoothed [gc/m2/yr] - if(csite%ema_npp<-9000._r8)then - ! For cold starts, we initialize the ema_npp value at -9999, so that - ! it becomes memoryless and uses the first calculated value - csite%ema_npp = site_npp - else - csite%ema_npp = (1._r8-1._r8/ema_npp_tscale)*csite%ema_npp + (1._r8/ema_npp_tscale)*site_npp - end if - bc_out%ema_npp = csite%ema_npp return @@ -716,12 +700,6 @@ subroutine FluxIntoLitterPools(csite, bc_in, bc_out) surface_prof(id) = surface_prof(id)/surface_prof_tot end do - - !bc_out%litt_flux_cel_n_si(:) = 100._r8 - !bc_out%litt_flux_lab_n_si(:) = 100._r8 - !bc_out%litt_flux_lig_n_si(:) = 100._r8 - - ! Loop over the different elements. do el = 1, num_elements @@ -753,10 +731,12 @@ subroutine FluxIntoLitterPools(csite, bc_in, bc_out) flux_lig_si => bc_out%litt_flux_lig_p_si(:) end select - !end do - !return - !do el = 1, num_elements - + ! These lines are for testing and should be removed + ! when the fates bgc pathway PR is integrated + !end do + !return + !do el = 1, num_elements + currentPatch => csite%oldest_patch do while (associated(currentPatch)) diff --git a/main/FatesInterfaceMod.F90 b/main/FatesInterfaceMod.F90 index 7c8aaba4ba..de4703017c 100644 --- a/main/FatesInterfaceMod.F90 +++ b/main/FatesInterfaceMod.F90 @@ -40,6 +40,7 @@ module FatesInterfaceMod use FatesConstantsMod , only : sec_per_day use FatesConstantsMod , only : days_per_year use FatesConstantsMod , only : TRS_regeneration + use FatesConstantsMod , only : g_per_kg use FatesGlobals , only : fates_global_verbose use FatesGlobals , only : fates_log use FatesGlobals , only : endrun => fates_endrun @@ -633,7 +634,7 @@ subroutine allocate_bcout(bc_out, nlevsoil_in, nlevdecomp_in) bc_out%rootfr_pa(0,1:nlevsoil_in)=1._r8/real(nlevsoil_in,r8) !end if - bc_out%ema_npp = -9999.9_r8 + bc_out%ema_npp = nan ! Fates -> BGC fragmentation mass fluxes select case(hlm_parteh_mode) @@ -1962,6 +1963,7 @@ subroutine UpdateFatesRMeansTStep(sites,bc_in) type(ed_patch_type), pointer :: cpatch type(ed_cohort_type), pointer :: ccohort integer :: s, ifp, io_si, pft + real(r8) :: site_npp ! Site level NPP gC/m2/year real(r8) :: new_seedling_layer_par ! seedling layer par in the current timestep real(r8) :: new_seedling_layer_smp ! seedling layer smp in the current timestep real(r8) :: new_seedling_mdd ! seedling layer moisture deficit days in the current timestep @@ -1971,10 +1973,12 @@ subroutine UpdateFatesRMeansTStep(sites,bc_in) real(r8) :: seedling_par_low ! lower intensity par for seedlings (par under the undergrowth) [W/m2] real(r8) :: par_low_frac ! fraction of ground where PAR is low integer,parameter :: ipar = 1 ! solar radiation in the shortwave band (i.e. par) + real(r8), parameter :: ema_npp_tscale = 480._r8 ! 10 day (10*48 steps) do s = 1,size(sites,dim=1) ifp=0 + site_npp = 0._r8 cpatch => sites(s)%oldest_patch do while(associated(cpatch)) if (cpatch%patchno .ne. 0) then @@ -1983,8 +1987,6 @@ subroutine UpdateFatesRMeansTStep(sites,bc_in) call cpatch%tveg_lpa%UpdateRMean(bc_in(s)%t_veg_pa(ifp)) call cpatch%tveg_longterm%UpdateRMean(bc_in(s)%t_veg_pa(ifp)) - - ! Update the seedling layer par running means if ( regeneration_model == TRS_regeneration ) then @@ -2030,15 +2032,29 @@ subroutine UpdateFatesRMeansTStep(sites,bc_in) end if - !ccohort => cpatch%tallest - !do while (associated(ccohort)) - ! call ccohort%tveg_lpa%UpdateRMean(bc_in(s)%t_veg_pa(ifp)) - ! ccohort => ccohort%shorter - !end do + ccohort => cpatch%tallest + do while (associated(ccohort)) + ! call ccohort%tveg_lpa%UpdateRMean(bc_in(s)%t_veg_pa(ifp)) + + ! [kgC/plant/yr] -> [gC/m2/s] + site_npp = site_npp + ccohort%npp_acc_hold * ccohort%n*area_inv * & + g_per_kg * hlm_days_per_year / sec_per_day + + ccohort => ccohort%shorter + end do + end if cpatch => cpatch%younger enddo + + ! Smoothed [gc/m2/yr] + if(sites(s)%ema_npp<-9000._r8)then + sites(s)%ema_npp = site_npp + else + sites(s)%ema_npp = (1._r8-1._r8/ema_npp_tscale)*sites(s)%ema_npp + (1._r8/ema_npp_tscale)*site_npp + end if + end do return From e12062f831e965e1439bbab7941d2299c49d72cb Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 10 Aug 2023 14:31:47 -0600 Subject: [PATCH 5/5] Small syntax updates and accomodations for moving litter flux bc outs --- biogeochem/FatesSoilBGCFluxMod.F90 | 6 ------ main/EDMainMod.F90 | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/biogeochem/FatesSoilBGCFluxMod.F90 b/biogeochem/FatesSoilBGCFluxMod.F90 index 5dafb6276c..6dd9300e51 100644 --- a/biogeochem/FatesSoilBGCFluxMod.F90 +++ b/biogeochem/FatesSoilBGCFluxMod.F90 @@ -731,12 +731,6 @@ subroutine FluxIntoLitterPools(csite, bc_in, bc_out) flux_lig_si => bc_out%litt_flux_lig_p_si(:) end select - ! These lines are for testing and should be removed - ! when the fates bgc pathway PR is integrated - !end do - !return - !do el = 1, num_elements - currentPatch => csite%oldest_patch do while (associated(currentPatch)) diff --git a/main/EDMainMod.F90 b/main/EDMainMod.F90 index 75f9c3e498..61691f4228 100644 --- a/main/EDMainMod.F90 +++ b/main/EDMainMod.F90 @@ -743,9 +743,9 @@ subroutine ed_integrate_state_variables(currentSite, bc_in, bc_out ) enddo - ! Before we start messing with the patch areas, and before we start removing - ! trees, this is a good time to pass fragmentation litter fluxes and - ! plant-to-soil fluxes (such as efflux and fixation fluxes) + ! RGK: This call is unecessary for CLM coupling. I believe we + ! can remove it completely if/when this call is added in ELM to + ! subroutine UpdateLitterFluxes(this,bounds_clump) in elmfates_interfaceMod.F90 call FluxIntoLitterPools(currentsite, bc_in, bc_out)