Skip to content
2 changes: 2 additions & 0 deletions src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ subroutine InitHistory(this, bounds, carbon_type)
call hist_addfld2d (fname='HR_vr', units='gC/m^3/s', type2d='levsoi', &
avgflag='A', long_name='total vertically resolved heterotrophic respiration', &
ptr_col=data2dptr)

! WW TODO is this where I can add overflow_vr fluxes to history?
Comment thread
slevis-lmwg marked this conversation as resolved.
Outdated
endif

end if
Expand Down
16 changes: 9 additions & 7 deletions src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90
Comment thread
slevis-lmwg marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ subroutine SoilBiogeochemCompetition (bounds, num_bgc_soilc, filter_bgc_soilc,nu
sminn_vr => soilbiogeochem_nitrogenstate_inst%sminn_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral N
smin_nh4_vr => soilbiogeochem_nitrogenstate_inst%smin_nh4_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral NH4
smin_no3_vr => soilbiogeochem_nitrogenstate_inst%smin_no3_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral NO3

c_overflow_vr => soilbiogeochem_carbonflux_inst%c_overflow_vr , & ! Output: [real(r8) (:,:,:)] (gC/m3/s) vertically-resolved C rejected by microbes that cannot process it
!WW handling overflow respiration in SoilBiogeochemPotentialMod for now
!c_overflow_vr => soilbiogeochem_carbonflux_inst%c_overflow_vr , & ! Output: [real(r8) (:,:,:)] (gC/m3/s) vertically-resolved C rejected by microbes that cannot process it
cascade_receiver_pool => decomp_cascade_con%cascade_receiver_pool , & ! Input: [integer (:) ] which pool is C added to for a given decomposition step

pot_f_nit_vr => soilbiogeochem_nitrogenflux_inst%pot_f_nit_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3/s) potential soil nitrification flux
Expand Down Expand Up @@ -821,26 +821,28 @@ subroutine SoilBiogeochemCompetition (bounds, num_bgc_soilc, filter_bgc_soilc,nu
cascade_receiver_pool(k) == i_oli_mic) then
sum_ndemand_vr(c,j) = sum_no3_demand_scaled(c,j) + &
sum_nh4_demand_scaled(c,j)
! WW effectively turn this off now, since pmnf_decomp_cascade < 0 for mineralization
if (pmnf_decomp_cascade(c,j,k) > 0.0_r8 .and. &
sum_ndemand_vr(c,j) > 0.0_r8) then
amnf_immob_vr = (sminn_vr(c,j) / dt) * &
(pmnf_decomp_cascade(c,j,k) / &
sum_ndemand_vr(c,j))
n_deficit_vr = pmnf_decomp_cascade(c,j,k) - &
amnf_immob_vr
c_overflow_vr(c,j,k) = &
n_deficit_vr * p_decomp_cn_gain(c,j,cascade_receiver_pool(k))
!c_overflow_vr(c,j,k) = &
! n_deficit_vr * p_decomp_cn_gain(c,j,cascade_receiver_pool(k))
! TODO, need to updated p_decomp_c_gain accordingly
else ! not pmnf and sum_ndemand > 0
c_overflow_vr(c,j,k) = 0.0_r8
!c_overflow_vr(c,j,k) = 0.0_r8
end if
else ! not microbes receiving
c_overflow_vr(c,j,k) = 0.0_r8
!c_overflow_vr(c,j,k) = 0.0_r8
end if
end do
end do
end do
else ! not mimics_decomp
c_overflow_vr(:,:,:) = 0.0_r8
!c_overflow_vr(:,:,:) = 0.0_r8
end if

if(.not.local_use_fun)then
Expand Down
40 changes: 29 additions & 11 deletions src/soilbiogeochem/SoilBiogeochemPotentialMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ subroutine SoilBiogeochemPotential (bounds, num_bgc_soilc, filter_bgc_soilc, &
real(r8):: p_decomp_npool_gain_sum(1:ndecomp_pools) ! total potential N gain by receiver pool (only microbial pools)
real(r8):: decomp_nc_loss_donor ! N:C ratio of donor pool
real(r8):: p_decomp_cn_diff_ratio ! relative change in receiver pool C:N
real(r8):: adjusted_c_to_mic ! relative change in receiver pool C:N
real(r8):: p_decomp_npool_loss ! potential N flux out of donor pool
real(r8):: ratio !temporary variable
!-----------------------------------------------------------------------
Expand All @@ -129,6 +130,7 @@ subroutine SoilBiogeochemPotential (bounds, num_bgc_soilc, filter_bgc_soilc, &
decomp_npools_vr => soilbiogeochem_nitrogenstate_inst%decomp_npools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) N pools

decomp_cpools_vr => soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) c pools
c_overflow_vr => soilbiogeochem_carbonflux_inst%c_overflow_vr , & ! Output: [real(r8) (:,:,:)] (gC/m3/s) vertically-resolved C rejected by microbes that cannot process it

potential_immob_vr => soilbiogeochem_nitrogenflux_inst%potential_immob_vr_col , & ! Output: [real(r8) (:,:) ]
gross_nmin_vr => soilbiogeochem_nitrogenflux_inst%gross_nmin_vr_col , & ! Output: [real(r8) (:,:) ]
Expand Down Expand Up @@ -198,6 +200,7 @@ subroutine SoilBiogeochemPotential (bounds, num_bgc_soilc, filter_bgc_soilc, &
endif
else ! CWD -> litter OR mimics_decomp is true
pmnf_decomp_cascade(c,j,k) = 0._r8
c_overflow_vr(c,j,k) = 0._r8

if (decomp_method == mimics_decomp) then
! N:C ratio of donor pools (N:C instead of C:N because
Expand Down Expand Up @@ -271,18 +274,33 @@ subroutine SoilBiogeochemPotential (bounds, num_bgc_soilc, filter_bgc_soilc, &
cascade_receiver_pool(k) == i_oli_mic) then
if (decomp_cpools_vr(c,j,cascade_donor_pool(k)) > 0._r8 .and. &
decomp_k(c,j,cascade_donor_pool(k)) > 0._r8 ) then
! if p_decomp_cn_diff < 0 N mineralization
! > 0 immobilization
! "min" in next line turns off immobilization flux
p_decomp_cn_diff_ratio = min(0.0_r8, &
! if p_decomp_cn_diff_ratio < 0 N mineralization
! > 0 immobilization
!! Easier here if p_decomp_cn_diff_ratio < 0
!! then calculate C supply for each N flux to meet cn_col demands
!! and extra C goes to overflow respiration
!! This approcah this would be on a per flux basis
!! Alternatively could sum all C and N fluxes into microbes and then balance stoich
!! but this would have to take place outside of k loop
p_decomp_cn_diff_ratio = &
(p_decomp_cn_gain(c,j,cascade_receiver_pool(k)) - &
cn_col(c,cascade_receiver_pool(k))) / cn_col(c,cascade_receiver_pool(k)))
! Actual amount of N that's mineralized or that would
! need to be immobilized
! negative=mineralization: add to the DIN pool
! positive=immobilizaiton: compete for N with plants to
! see how much we get
pmnf_decomp_cascade(c,j,k) = p_decomp_cn_diff_ratio * p_decomp_npool_gain(c,j,k)
cn_col(c,cascade_receiver_pool(k))) / cn_col(c,cascade_receiver_pool(k))

! Actual amount of N that's mineralized or that would be need to be immobilized
! negative=mineralization: add to the DIN pool
! positive=immobilizaiton: compete for N with plants to see how much we get
! WW Overflow respiration calculation requires positive ratio to be active
! TODO may need to think about how we track actual immobilization fluxes too?
if (p_decomp_cn_diff_ratio <= 0._r8) then
pmnf_decomp_cascade(c,j,k) = p_decomp_cn_diff_ratio * p_decomp_npool_gain(c,j,k)
c_overflow_vr(c,j,k) = 0.0_r8
else
! Assumes each flux into MIC must be in stoichiometric ballance
! Could also sum at all C fluxes into MIC and then maintain stoichiometry
pmnf_decomp_cascade(c,j,k) = 0._r8
adjusted_c_to_mic = p_decomp_npool_gain(c,j,k) * cn_col(c,cascade_receiver_pool(k))
c_overflow_vr(c,j,k) = p_decomp_cpool_gain(c,j,k) - adjusted_c_to_mic
end if
end if ! donors donating (decomp_cpools_vr & decomp_k > 0)
end if ! microbes receiving
end do ! transitions loop
Expand Down
Loading