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

C-based harvest in ELM-FATES #5106

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
975c41a
Add LUC fluxes in ELM-FATES interface.
sshu3 Feb 22, 2022
e60d108
Removed pprodharv10 from bc_in.
sshu3 Mar 11, 2022
be484a5
Merge branch 'master' into fatesluc
sshu3 Mar 20, 2022
17bb955
Change the maximum numbers of patches to 20.
sshu3 Apr 12, 2022
f50460d
Revise back to 14 patches version from 'flex_numpatch'.
sshu3 Jun 16, 2022
b00fb40
Revised ELM C fluxes diagnostic outputs.
sshu3 Aug 2, 2022
3da7482
Removed unnecessary changes.
sshu3 Aug 29, 2022
f69a848
Revert changes in config_pesall.xml and .gitignore
sshu3 Sep 12, 2022
12be3a6
Revert changes in testmod files.
sshu3 Sep 12, 2022
b322f08
Added a missing blank line in testmod file.
sshu3 Sep 12, 2022
362fecf
Revised the solar radiation imbalance threshold for FATES.
sshu3 Oct 10, 2022
9b49c52
Remove the confusing IF-ELSE logic.
sshu3 Oct 10, 2022
f165e40
Update interface code to allow FATES API 25
rgknox Dec 12, 2022
60ee280
Update FATES submodule pointer to sci.1.61.0_api.25.0.0
rgknox Dec 12, 2022
16d43dc
Merge pull request #2 from rgknox/fatesluc_cbasedhrv_v2_api25
sshu88 Dec 19, 2022
afe87df
merging changes for fates api24 into c-based lu branch
rgknox Dec 19, 2022
08dc6ad
Updating FATES pointer to api25
rgknox Dec 19, 2022
f9a40a5
Merge resolution between fates api 24 and 25 parameter defaults
rgknox Dec 19, 2022
e96fc25
Merge pull request #3 from rgknox/fatesluc_cbasedhrv_v2
sshu88 Dec 19, 2022
164e333
Minor revisions based on reviewers' comments.
sshu3 Dec 20, 2022
0ccaedf
Code clean-up.
sshu3 Dec 20, 2022
13d0f5a
fates-nutrient coupling api changes
rgknox Jan 6, 2023
ed780f8
small update to a comment
rgknox Jan 6, 2023
d215068
Merge pull request #4 from rgknox/fatesluc_cbasedhrv_v2_allocationfixes
sshu88 Jan 6, 2023
7480098
Update elmfates_interfaceMod.F90
sshu88 Jan 18, 2023
3730a54
Update elmfates_interfaceMod.F90
sshu88 Jan 18, 2023
cbc03fb
Update ColumnDataType.F90
sshu88 Jan 27, 2023
45d053d
Removed a deprecated mapping between fates and elm soil layers that h…
rgknox Jan 31, 2023
1beed82
Updated pftvarcon to read in phosphorus parameters when fates is on
rgknox Jan 31, 2023
2e05202
Added a div0 protection to phosphorus cycling
rgknox Jan 31, 2023
1b3257f
Merge pull request #5 from rgknox/fatesluc_cbasedhrv_v2
sshu88 Jan 31, 2023
4d13737
update fates submodule pointer to carbon harvest compatible tag
glemieux Jan 31, 2023
076299a
Merge pull request #6 from glemieux/fatesluc_cbasedhrv_v2-fatestag
sshu88 Jan 31, 2023
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
2 changes: 1 addition & 1 deletion components/elm/bld/namelist_files/namelist_defaults.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<!-- ================================================================== -->
<!-- FATES default parameter file -->
<!-- ================================================================== -->
<fates_paramfile >lnd/clm2/paramdata/fates_params_api.24.0.0_12pft_c220719.nc</fates_paramfile>
<fates_paramfile >lnd/clm2/paramdata/fates_params_api.25.0.0_12pft_c221212.nc</fates_paramfile>

<!-- soil order related parameters (relative to {csmdata}) -->
<fsoilordercon >lnd/clm2/paramdata/CNP_parameters_c131108.nc</fsoilordercon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ hist_fincl1 = 'FATES_NCOHORTS', 'FATES_TRIMMING', 'FATES_AREA_PLANTS',
'FATES_FUEL_AMOUNT', 'FATES_LITTER_IN', 'FATES_LITTER_OUT',
'FATES_SEED_BANK', 'FATES_SEEDS_IN', 'FATES_STOREC', 'FATES_VEGC',
'FATES_SAPWOODC', 'FATES_LEAFC', 'FATES_FROOTC', 'FATES_REPROC',
'FATES_CEFFLUX', 'FATES_STRUCTC', 'FATES_NONSTRUCTC', 'FATES_VEGC_ABOVEGROUND',
'FATES_STRUCTC', 'FATES_NONSTRUCTC', 'FATES_VEGC_ABOVEGROUND',
'FATES_CANOPY_VEGC', 'FATES_USTORY_VEGC', 'FATES_PRIMARY_PATCHFUSION_ERR',
'FATES_DISTURBANCE_RATE_P2P', 'FATES_DISTURBANCE_RATE_P2S',
'FATES_DISTURBANCE_RATE_S2S', 'FATES_DISTURBANCE_RATE_FIRE',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ hist_fincl1 = 'FATES_NCOHORTS', 'FATES_TRIMMING', 'FATES_AREA_PLANTS',
'FATES_FUEL_AMOUNT', 'FATES_LITTER_IN', 'FATES_LITTER_OUT',
'FATES_SEED_BANK', 'FATES_SEEDS_IN', 'FATES_STOREC', 'FATES_VEGC',
'FATES_SAPWOODC', 'FATES_LEAFC', 'FATES_FROOTC', 'FATES_REPROC',
'FATES_CEFFLUX', 'FATES_STRUCTC', 'FATES_NONSTRUCTC', 'FATES_VEGC_ABOVEGROUND',
'FATES_STRUCTC', 'FATES_NONSTRUCTC', 'FATES_VEGC_ABOVEGROUND',
'FATES_CANOPY_VEGC', 'FATES_USTORY_VEGC', 'FATES_PRIMARY_PATCHFUSION_ERR',
'FATES_DISTURBANCE_RATE_P2P', 'FATES_DISTURBANCE_RATE_P2S',
'FATES_DISTURBANCE_RATE_S2S', 'FATES_DISTURBANCE_RATE_FIRE',
Expand All @@ -33,7 +33,16 @@ hist_fincl1 = 'FATES_NCOHORTS', 'FATES_TRIMMING', 'FATES_AREA_PLANTS',
'FATES_CBALANCE_ERROR', 'FATES_ERROR_EL', 'FATES_LEAF_ALLOC',
'FATES_SEED_ALLOC', 'FATES_STEM_ALLOC', 'FATES_FROOT_ALLOC',
'FATES_CROOT_ALLOC', 'FATES_STORE_ALLOC','FATES_LITTER_IN_EL','FATES_LITTER_OUT_EL',
'FATES_LEAFN','FATES_LEAFP','FATES_FROOTN','FATES_FROOTP','FATES_NH4UPTAKE',
'FATES_NO3UPTAKE','FATES_NEFFLUX','FATES_PUPTAKE','FATES_PEFFLUX',
'NET_NMIN','NET_PMIN','LITR1P_vr','LITR1C_vr','LITR1N_vr','SOLUTIONP',
'SMIN_NO3','SMIN_NH4','TOTSOMN','TOTSOMP'
'SMIN_NO3','SMIN_NH4','TOTSOMN','TOTSOMP',
'FATES_L2FR','FATES_L2FR_CANOPY_REC_PF','FATES_L2FR_USTORY_REC_PF',
'FATES_NH4UPTAKE_SZPF','FATES_NO3UPTAKE_SZPF','FATES_NEFFLUX_SZPF' ,
'FATES_NDEMAND_SZPF','FATES_NFIX_SYM_SZPF','FATES_NH4UPTAKE','FATES_NO3UPTAKE',
'FATES_NEFFLUX','FATES_NDEMAND','FATES_NFIX_SYM','FATES_STOREN','FATES_STOREN_TF',
'FATES_VEGN','FATES_SAPWOODN','FATES_LEAFN','FATES_FROOTN','FATES_REPRON','FATES_VEGN_SZPF',
'FATES_LEAFN_SZPF','FATES_FROOTN_SZPF','FATES_SAPWOODN_SZPF','FATES_STOREN_SZPF','FATES_STOREN_TF_CANOPY_SZPF',
'FATES_STOREN_TF_USTORY_SZPF','FATES_REPRON_SZPF','FATES_STOREP','FATES_STOREP_TF','FATES_VEGP','FATES_SAPWOODP',
'FATES_LEAFP','FATES_FROOTP','FATES_REPROP','FATES_PUPTAKE','FATES_PEFFLUX','FATES_PDEMAND',
'FATES_VEGP_SZPF','FATES_LEAFP_SZPF','FATES_FROOTP_SZPF','FATES_SAPWOODP_SZPF','FATES_STOREP_SZPF',
'FATES_STOREP_TF_CANOPY_SZPF','FATES_STOREP_TF_USTORY_SZPF','FATES_REPROP_SZPF','FATES_PUPTAKE_SZPF',
'FATES_PEFFLUX_SZPF','FATES_PDEMAND_SZPF'
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ hist_fincl1 = 'FATES_NCOHORTS', 'FATES_TRIMMING', 'FATES_AREA_PLANTS',
'FATES_FUEL_AMOUNT', 'FATES_LITTER_IN', 'FATES_LITTER_OUT',
'FATES_SEED_BANK', 'FATES_SEEDS_IN', 'FATES_STOREC', 'FATES_VEGC',
'FATES_SAPWOODC', 'FATES_LEAFC', 'FATES_FROOTC', 'FATES_REPROC',
'FATES_CEFFLUX', 'FATES_STRUCTC', 'FATES_NONSTRUCTC', 'FATES_VEGC_ABOVEGROUND',
'FATES_STRUCTC', 'FATES_NONSTRUCTC', 'FATES_VEGC_ABOVEGROUND',
'FATES_CANOPY_VEGC', 'FATES_USTORY_VEGC', 'FATES_PRIMARY_PATCHFUSION_ERR',
'FATES_DISTURBANCE_RATE_P2P', 'FATES_DISTURBANCE_RATE_P2S',
'FATES_DISTURBANCE_RATE_S2S', 'FATES_DISTURBANCE_RATE_FIRE',
Expand All @@ -33,7 +33,16 @@ hist_fincl1 = 'FATES_NCOHORTS', 'FATES_TRIMMING', 'FATES_AREA_PLANTS',
'FATES_CBALANCE_ERROR', 'FATES_ERROR_EL', 'FATES_LEAF_ALLOC',
'FATES_SEED_ALLOC', 'FATES_STEM_ALLOC', 'FATES_FROOT_ALLOC',
'FATES_CROOT_ALLOC', 'FATES_STORE_ALLOC','FATES_LITTER_IN_EL','FATES_LITTER_OUT_EL',
'FATES_LEAFN','FATES_LEAFP','FATES_FROOTN','FATES_FROOTP','FATES_NH4UPTAKE',
'FATES_NO3UPTAKE','FATES_NEFFLUX','FATES_PUPTAKE','FATES_PEFFLUX',
'NET_NMIN','NET_PMIN','LITR1P_vr','LITR1C_vr','LITR1N_vr','SOLUTIONP',
'SMIN_NO3','SMIN_NH4','TOTSOMN','TOTSOMP'
'SMIN_NO3','SMIN_NH4','TOTSOMN','TOTSOMP',
'FATES_L2FR','FATES_L2FR_CANOPY_REC_PF','FATES_L2FR_USTORY_REC_PF',
'FATES_NH4UPTAKE_SZPF','FATES_NO3UPTAKE_SZPF','FATES_NEFFLUX_SZPF' ,
'FATES_NDEMAND_SZPF','FATES_NFIX_SYM_SZPF','FATES_NH4UPTAKE','FATES_NO3UPTAKE',
'FATES_NEFFLUX','FATES_NDEMAND','FATES_NFIX_SYM','FATES_STOREN','FATES_STOREN_TF',
'FATES_VEGN','FATES_SAPWOODN','FATES_LEAFN','FATES_FROOTN','FATES_REPRON','FATES_VEGN_SZPF',
'FATES_LEAFN_SZPF','FATES_FROOTN_SZPF','FATES_SAPWOODN_SZPF','FATES_STOREN_SZPF','FATES_STOREN_TF_CANOPY_SZPF',
'FATES_STOREN_TF_USTORY_SZPF','FATES_REPRON_SZPF','FATES_STOREP','FATES_STOREP_TF','FATES_VEGP','FATES_SAPWOODP',
'FATES_LEAFP','FATES_FROOTP','FATES_REPROP','FATES_PUPTAKE','FATES_PEFFLUX','FATES_PDEMAND',
'FATES_VEGP_SZPF','FATES_LEAFP_SZPF','FATES_FROOTP_SZPF','FATES_SAPWOODP_SZPF','FATES_STOREP_SZPF',
'FATES_STOREP_TF_CANOPY_SZPF','FATES_STOREP_TF_USTORY_SZPF','FATES_REPROP_SZPF','FATES_PUPTAKE_SZPF',
'FATES_PEFFLUX_SZPF','FATES_PDEMAND_SZPF'
130 changes: 79 additions & 51 deletions components/elm/src/biogeochem/AllocationMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ subroutine Allocation2_ResolveNPLimit (bounds, num_soilc, filter_soilc , &
real(r8) :: excess_immob_no3_vr(1:nlevdecomp) ! no3 excess flux, if soil microbes are more P limited
real(r8) :: excess_immob_p_vr(1:nlevdecomp) ! P excess flux, if soil microbes are more N limited
real(r8) :: decompmicc(1:nlevdecomp) ! column-level soil microbial decomposer biomass gC/m3

real(r8) :: ndemand, pdemand ! Column level N and P demand used for downscaling plant level uptake for FATES
real(r8) :: fpi_no3_vr(1:nlevdecomp) ! fraction of potential immobilization supplied by no3(no units)
real(r8) :: fpi_nh4_vr(1:nlevdecomp) ! fraction of potential immobilization supplied by nh4 (no units)

Expand All @@ -918,8 +918,7 @@ subroutine Allocation2_ResolveNPLimit (bounds, num_soilc, filter_soilc , &
integer :: fc ! lake filter column index
integer :: f ! loop index for plant competitors
integer :: ci, s ! used for FATES BC (clump index, site index)
integer :: j_f ! local index that maps a decomposition
! layer onto a fates uptake layer
integer :: ft ! FATES PFT index

! Fractional uptake profiles, that are proportional to root density
real(r8):: nuptake_prof(bounds%begc:bounds%endc,1:nlevdecomp)
Expand All @@ -933,10 +932,8 @@ subroutine Allocation2_ResolveNPLimit (bounds, num_soilc, filter_soilc , &
integer :: pci, pcf ! (I)nitial and (F)inal plant competitor index
real(r8), pointer :: veg_rootc_ptr(:,:) ! points to either native ELM or FATES root carbon array
integer, pointer :: ft_index_ptr(:) ! points to either native ELM or FATES PFT array
real(r8), pointer :: cn_scalar_ptr(:) ! points to either native ELM or FATES C:N scalar array
real(r8), pointer :: cn_scalar_runmean_ptr(:) ! points to either native ELM or FATES C:N scalar array
real(r8), pointer :: cp_scalar_ptr(:) ! points to either native ELM or FATES C:P scalar array
real(r8), pointer :: cp_scalar_runmean_ptr(:) ! points to either native ELM or FATES C:P scalar array
real(r8), pointer :: cn_scalar_runmean_ptr(:)
real(r8), pointer :: cp_scalar_runmean_ptr(:)
real(r8), pointer :: plant_nh4demand_vr_ptr(:,:)
real(r8), pointer :: plant_no3demand_vr_ptr(:,:)
real(r8), pointer :: plant_pdemand_vr_ptr(:,:)
Expand Down Expand Up @@ -1112,13 +1109,34 @@ subroutine Allocation2_ResolveNPLimit (bounds, num_soilc, filter_soilc , &
! Overwrite the column level demands, since fates plants are all sharing
! the same space, in units per the same square meter, we just add demand
! to scale up to column
plant_ndemand_col(c) = sum(elm_fates%fates(ci)%bc_out(s)%n_demand(1:n_pcomp))
plant_pdemand_col(c) = sum(elm_fates%fates(ci)%bc_out(s)%p_demand(1:n_pcomp))

plant_ndemand_col(c) = 0._r8
plant_pdemand_col(c) = 0._r8
! We fill the vertically resolved array to simplify some jointly used code
do j = 1, nlevdecomp
col_plant_ndemand_vr(c,j) = plant_ndemand_col(c) * nuptake_prof(c,j)
col_plant_pdemand_vr(c,j) = plant_pdemand_col(c) * puptake_prof(c,j)

col_plant_ndemand_vr(c,j) = 0._r8
col_plant_pdemand_vr(c,j) = 0._r8

do f = 1,n_pcomp
ft = elm_fates%fates(ci)%bc_out(s)%ft_index(f)

! [gN/m3/s] = [gC/m3] * [gN/gC/s]
col_plant_ndemand_vr(c,j) = col_plant_ndemand_vr(c,j) + &
elm_fates%fates(ci)%bc_out(s)%veg_rootc(f,j) * &
(elm_fates%fates(ci)%bc_pconst%vmax_nh4(ft) + &
elm_fates%fates(ci)%bc_pconst%vmax_no3(ft))

col_plant_pdemand_vr(c,j) = col_plant_pdemand_vr(c,j) + &
elm_fates%fates(ci)%bc_out(s)%veg_rootc(f,j) * &
elm_fates%fates(ci)%bc_pconst%vmax_p(ft)

end do

! [gN/m2/s]
plant_ndemand_col(c) = plant_ndemand_col(c) + col_plant_ndemand_vr(c,j)*dzsoi_decomp(j)
plant_pdemand_col(c) = plant_pdemand_col(c) + col_plant_pdemand_vr(c,j)*dzsoi_decomp(j)

end do

else !(ECA)
Expand All @@ -1131,19 +1149,17 @@ subroutine Allocation2_ResolveNPLimit (bounds, num_soilc, filter_soilc , &
ft_index_ptr => elm_fates%fates(ci)%bc_out(s)%ft_index ! Should be
decompmicc(:) = elm_fates%fates(ci)%bc_out(s)%decompmicc(:) ! Should be (nlevdecomp)

cn_scalar_ptr => elm_fates%fates(ci)%bc_out(s)%cn_scalar ! (i,j)
cn_scalar_runmean_ptr => elm_fates%fates(ci)%bc_out(s)%cn_scalar ! (i,j)
cn_scalar_runmean_ptr => elm_fates%fates(ci)%bc_out(s)%cn_scalar ! This is 1.0
plant_nh4demand_vr_ptr => plant_nh4demand_vr_fates
km_nh4_ptr => elm_fates%fates(ci)%bc_pconst%eca_km_nh4
vmax_nh4_ptr => elm_fates%fates(ci)%bc_pconst%eca_vmax_nh4
vmax_nh4_ptr => elm_fates%fates(ci)%bc_pconst%vmax_nh4
plant_no3demand_vr_ptr => plant_no3demand_vr_fates
km_no3_ptr => elm_fates%fates(ci)%bc_pconst%eca_km_no3
vmax_no3_ptr => elm_fates%fates(ci)%bc_pconst%eca_vmax_no3
cp_scalar_ptr => elm_fates%fates(ci)%bc_out(s)%cp_scalar
cp_scalar_runmean_ptr => elm_fates%fates(ci)%bc_out(s)%cp_scalar
vmax_no3_ptr => elm_fates%fates(ci)%bc_pconst%vmax_no3
cp_scalar_runmean_ptr => elm_fates%fates(ci)%bc_out(s)%cp_scalar ! This is 1.0
plant_pdemand_vr_ptr => plant_pdemand_vr_fates
km_p_ptr => elm_fates%fates(ci)%bc_pconst%eca_km_p
vmax_p_ptr => elm_fates%fates(ci)%bc_pconst%eca_vmax_p
vmax_p_ptr => elm_fates%fates(ci)%bc_pconst%vmax_p

end if

Expand Down Expand Up @@ -1201,7 +1217,6 @@ subroutine Allocation2_ResolveNPLimit (bounds, num_soilc, filter_soilc , &

km_nh4_ptr => km_plant_nh4
vmax_nh4_ptr => vmax_plant_nh4
cn_scalar_ptr => cn_scalar
cn_scalar_runmean_ptr => cn_scalar_runmean
km_no3_ptr => km_plant_no3
vmax_no3_ptr => vmax_plant_no3
Expand Down Expand Up @@ -1700,32 +1715,52 @@ subroutine Allocation2_ResolveNPLimit (bounds, num_soilc, filter_soilc , &

if( plant_ndemand_col(c)>tiny(plant_ndemand_col(c)) ) then
do f = 1,n_pcomp
do j = 1,nlevdecomp

j_f = elm_fates%fates(ci)%bc_pconst%j_uptake(j)
ft = elm_fates%fates(ci)%bc_out(s)%ft_index(f)

elm_fates%fates(ci)%bc_in(s)%plant_nh4_uptake_flux(f,j_f) = &
elm_fates%fates(ci)%bc_in(s)%plant_nh4_uptake_flux(f,j_f) + &
! [gN/m2/s]
ndemand=0._r8
do j = 1,nlevdecomp
ndemand = ndemand + elm_fates%fates(ci)%bc_out(s)%veg_rootc(f,j) * &
(elm_fates%fates(ci)%bc_pconst%vmax_nh4(ft)+elm_fates%fates(ci)%bc_pconst%vmax_no3(ft)) * &
dzsoi_decomp(j)
end do

do j = 1,nlevdecomp

elm_fates%fates(ci)%bc_in(s)%plant_nh4_uptake_flux(f,1) = &
elm_fates%fates(ci)%bc_in(s)%plant_nh4_uptake_flux(f,1) + &
smin_nh4_to_plant_vr(c,j)*dt*dzsoi_decomp(j) * &
(elm_fates%fates(ci)%bc_out(s)%n_demand(f)/plant_ndemand_col(c))
(ndemand/plant_ndemand_col(c))

elm_fates%fates(ci)%bc_in(s)%plant_no3_uptake_flux(f,j_f) = &
elm_fates%fates(ci)%bc_in(s)%plant_no3_uptake_flux(f,j_f) + &
elm_fates%fates(ci)%bc_in(s)%plant_no3_uptake_flux(f,1) = &
elm_fates%fates(ci)%bc_in(s)%plant_no3_uptake_flux(f,1) + &
smin_no3_to_plant_vr(c,j)*dt*dzsoi_decomp(j) * &
(elm_fates%fates(ci)%bc_out(s)%n_demand(f)/plant_ndemand_col(c))
(ndemand/plant_ndemand_col(c))

end do
end do
end if

if( plant_pdemand_col(c)>tiny(plant_pdemand_col(c)) ) then
do f = 1,n_pcomp

ft = elm_fates%fates(ci)%bc_out(s)%ft_index(f)

pdemand=0._r8
do j = 1,nlevdecomp
j_f = elm_fates%fates(ci)%bc_pconst%j_uptake(j)
elm_fates%fates(ci)%bc_in(s)%plant_p_uptake_flux(f,j_f) = &
elm_fates%fates(ci)%bc_in(s)%plant_p_uptake_flux(f,j_f) + &
! [gP/m2/s]
pdemand = pdemand+elm_fates%fates(ci)%bc_out(s)%veg_rootc(f,j) * &
elm_fates%fates(ci)%bc_pconst%vmax_p(ft) * &
dzsoi_decomp(j)
end do

do j = 1,nlevdecomp
! [gP/m2/step]
elm_fates%fates(ci)%bc_in(s)%plant_p_uptake_flux(f,1) = &
elm_fates%fates(ci)%bc_in(s)%plant_p_uptake_flux(f,1) + &
sminp_to_plant_vr(c,j)*dt*dzsoi_decomp(j) * &
(elm_fates%fates(ci)%bc_out(s)%p_demand(f)/plant_pdemand_col(c))
(pdemand/plant_pdemand_col(c))

end do
end do
Expand All @@ -1735,18 +1770,17 @@ subroutine Allocation2_ResolveNPLimit (bounds, num_soilc, filter_soilc , &

do f = 1,n_pcomp
do j = 1,nlevdecomp
j_f = elm_fates%fates(ci)%bc_pconst%j_uptake(j)

elm_fates%fates(ci)%bc_in(s)%plant_nh4_uptake_flux(f,j_f) = &
elm_fates%fates(ci)%bc_in(s)%plant_nh4_uptake_flux(f,j_f) + &
elm_fates%fates(ci)%bc_in(s)%plant_nh4_uptake_flux(f,1) = &
elm_fates%fates(ci)%bc_in(s)%plant_nh4_uptake_flux(f,1) + &
plant_nh4demand_vr_fates(f,j) * fpg_nh4_vr(c,j) * dzsoi_decomp(j) * dt

elm_fates%fates(ci)%bc_in(s)%plant_no3_uptake_flux(f,j_f) = &
elm_fates%fates(ci)%bc_in(s)%plant_no3_uptake_flux(f,j_f) + &
elm_fates%fates(ci)%bc_in(s)%plant_no3_uptake_flux(f,1) = &
elm_fates%fates(ci)%bc_in(s)%plant_no3_uptake_flux(f,1) + &
plant_no3demand_vr_fates(f,j) * fpg_no3_vr(c,j) * dzsoi_decomp(j) * dt

elm_fates%fates(ci)%bc_in(s)%plant_p_uptake_flux(f,j_f) = &
elm_fates%fates(ci)%bc_in(s)%plant_p_uptake_flux(f,j_f) + &
elm_fates%fates(ci)%bc_in(s)%plant_p_uptake_flux(f,1) = &
elm_fates%fates(ci)%bc_in(s)%plant_p_uptake_flux(f,1) + &
(plant_pdemand_vr_fates(f,j) * fpg_p_vr(c,j)) * dzsoi_decomp(j) * dt

end do
Expand Down Expand Up @@ -3315,18 +3349,12 @@ subroutine PAllocationECAMIC(pci, &
e_km_p = e_km_p + e_decomp_scalar*decompmicc(j)/km_decomp_p + &
max(0._r8,vmax_minsurf_p_vr(j)-labilep_vr(j))/km_minsurf_p_vr(j)

! if(carbon_only .or. carbonnitrogen_only) then
! do i = 1, n_pcomp
! compet_plant(i) = 1._r8
! end do
! else
do i = 1,n_pcomp
ip = filter_pcomp(i)
ft = ft_index(ip)
compet_plant(i) = solution_pconc / &
(km_plant_p(ft)*(1._r8 + solution_pconc/km_plant_p(ft) + e_km_p))
end do
! end if
do i = 1,n_pcomp
ip = filter_pcomp(i)
ft = ft_index(ip)
compet_plant(i) = solution_pconc / &
(km_plant_p(ft)*(1._r8 + solution_pconc/km_plant_p(ft) + e_km_p))
end do

compet_decomp_p = solution_pconc / &
(km_decomp_p * (1._r8 + solution_pconc/km_decomp_p + e_km_p))
Expand Down
7 changes: 7 additions & 0 deletions components/elm/src/biogeochem/EcosystemDynMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,13 @@ subroutine EcosystemDynNoLeaching2(bounds, &

call t_stop_lnd(event)

else
call alm_fates%wrap_WoodProducts(bounds, num_soilc, filter_soilc)

call WoodProducts(num_soilc, filter_soilc )

call CropHarvestPools(num_soilc, filter_soilc, dt)

end if

if ( ero_ccycle ) then
Expand Down
10 changes: 9 additions & 1 deletion components/elm/src/biogeophys/BalanceCheckMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ subroutine ColWaterBalanceCheck( bounds, num_do_smb_c, filter_do_smb_c, &
integer :: indexp,indexc,indexl,indext,indexg ! index of first found in search loop
real(r8) :: forc_rain_col(bounds%begc:bounds%endc) ! column level rain rate [mm/s]
real(r8) :: forc_snow_col(bounds%begc:bounds%endc) ! column level snow rate [mm/s]
real(r8) :: sol_err_th ! solar radiation imbalance threshold
!-----------------------------------------------------------------------

associate( &
Expand Down Expand Up @@ -616,7 +617,14 @@ subroutine ColWaterBalanceCheck( bounds, num_do_smb_c, filter_do_smb_c, &
found = .false.
do p = bounds%begp, bounds%endp
if (veg_pp%active(p)) then
if ( (errsol(p) /= spval) .and. (abs(errsol(p)) > 1.e-7_r8) ) then
! solar radiation balance error is high when running FATES
! adjust the threshold to 5.e-7
if (veg_pp%is_fates(p)) then
sol_err_th = 5.e-7_r8
else
sol_err_th = 1.e-7_r8
end if
if ( (errsol(p) /= spval) .and. (abs(errsol(p)) > sol_err_th) ) then
found = .true.
indexp = p
indext = veg_pp%topounit(indexp)
Expand Down
Loading