diff --git a/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 b/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 index 23f24e44d5..0b9d461af1 100644 --- a/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 +++ b/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 @@ -30,7 +30,9 @@ module SoilBiogeochemCarbonFluxType ! decomposition fluxes real(r8), pointer :: decomp_cpools_sourcesink_col (:,:,:) ! change in decomposing c pools. Used to update concentrations concurrently with vertical transport (gC/m3/timestep) - real(r8), pointer :: c_overflow_vr (:,:,:) ! vertically-resolved C rejected by microbes that cannot process it (gC/m3/s) + real(r8), pointer :: c_overflow_hr_vr (:,:,:) ! vertically-resolved C rejected by microbes that cannot process it (gC/m3/s) (included in the heterotrophic respiration) + real(r8), pointer :: c_overflow_hr (:,:) ! vertically-integrated C rejected by microbes that cannot process it (gC/m2/s) (included in the heterotrophic respiration) + real(r8), pointer :: c_overflow_hr_sum (:) ! vertically-integrated and summed over all transitions, C rejected by microbes that cannot process it (gC/m2/s) (included in the heterotrophic respiration) real(r8), pointer :: decomp_cascade_hr_vr_col (:,:,:) ! vertically-resolved het. resp. from decomposing C pools (gC/m3/s) real(r8), pointer :: decomp_cascade_hr_col (:,:) ! vertically-integrated (diagnostic) het. resp. from decomposing C pools (gC/m2/s) real(r8), pointer :: decomp_cascade_ctransfer_vr_col (:,:,:) ! vertically-resolved C transferred along deomposition cascade (gC/m3/s) @@ -139,8 +141,14 @@ subroutine InitAllocate(this, bounds) allocate(this%decomp_cpools_sourcesink_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) this%decomp_cpools_sourcesink_col(:,:,:)= nan - allocate(this%c_overflow_vr(begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions)) - this%c_overflow_vr(:,:,:) = nan + allocate(this%c_overflow_hr_vr(begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions)) + this%c_overflow_hr_vr(:,:,:) = nan + + allocate(this%c_overflow_hr(begc:endc,1:ndecomp_cascade_transitions)) + this%c_overflow_hr(:,:) = nan + + allocate(this%c_overflow_hr_sum(begc:endc)) + this%c_overflow_hr_sum(:) = nan allocate(this%decomp_cascade_hr_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions)) this%decomp_cascade_hr_vr_col(:,:,:)= spval @@ -264,6 +272,11 @@ subroutine InitHistory(this, bounds, carbon_type) ptr_col=this%hr_col) if (decomp_method == mimics_decomp) then + this%c_overflow_hr_sum(begc:endc) = spval + call hist_addfld1d (fname='COVERFLOW_HR_SUM', units='gC/m^2/s', & + avgflag='A', long_name='C overflow (already included in the heterotrophic respiration)', & + ptr_col=this%c_overflow_hr_sum) + this%michr_col(begc:endc) = spval call hist_addfld1d (fname='MICC_HR', units='gC/m^2/s', & avgflag='A', long_name='microbial C heterotrophic respiration: donor-pool based, so expect zero with MIMICS', & @@ -307,6 +320,8 @@ subroutine InitHistory(this, bounds, carbon_type) ptr_col=data2dptr, default='inactive') end do + this%c_overflow_hr(begc:endc,:) = spval + this%c_overflow_hr_vr(begc:endc,:,:) = spval this%decomp_cascade_hr_col(begc:endc,:) = spval this%decomp_cascade_hr_vr_col(begc:endc,:,:) = spval this%decomp_cascade_ctransfer_col(begc:endc,:) = spval @@ -316,6 +331,29 @@ subroutine InitHistory(this, bounds, carbon_type) do l = 1, ndecomp_cascade_transitions ! output the vertically integrated fluxes only as default + !-- C overflow (ONLY c12 FOR NOW) + if (decomp_method == mimics_decomp) then + data1dptr => this%c_overflow_hr(:,l) + ! check to see if there are multiple pathways that include respiration, and if so, note that in the history file + ii = 0 + do jj = 1, ndecomp_cascade_transitions + if ( decomp_cascade_con%cascade_donor_pool(jj) == decomp_cascade_con%cascade_donor_pool(l) ) ii = ii+1 + end do + if ( ii == 1 ) then + fieldname = & + trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'_COVERFLOW' + else + fieldname = & + trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'_COVERFLOW_'//& + trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_receiver_pool(l))) + endif + longname = 'C overflow (already included in HR) from '//& + trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l))) + call hist_addfld1d (fname=fieldname, units='gC/m^2/s', & + avgflag='A', long_name=longname, & + ptr_col=data1dptr) + end if + !-- HR fluxes data1dptr => this%decomp_cascade_hr_col(:,l) ! check to see if there are multiple pathways that include respiration, and if so, note that in the history file @@ -352,6 +390,31 @@ subroutine InitHistory(this, bounds, carbon_type) ! output the vertically resolved fluxes if ( nlevdecomp_full > 1 ) then + !-- C overflow (ONLY c12 FOR NOW) + if (decomp_method == mimics_decomp) then + data2dptr => this%c_overflow_hr_vr(:,:,l) + ! check to see if there are multiple pathways that include respiration, and if so, note that in the history file + ii = 0 + do jj = 1, ndecomp_cascade_transitions + if ( decomp_cascade_con%cascade_donor_pool(jj) == decomp_cascade_con%cascade_donor_pool(l) ) ii = ii+1 + end do + if ( ii == 1 ) then + fieldname = & + trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& + //'_COVERFLOW'//trim(vr_suffix) + else + fieldname = & + trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'_COVERFLOW_'//& + trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_receiver_pool(l)))& + //trim(vr_suffix) + endif + longname = 'C overflow (already included in HR) from '//& + trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l))) + call hist_addfld_decomp (fname=fieldname, units='gC/m^3/s', type2d='levdcmp', & + avgflag='A', long_name=longname, & + ptr_col=data2dptr) + end if + !-- HR fluxes data2dptr => this%decomp_cascade_hr_vr_col(:,:,l) ! check to see if there are multiple pathways that include respiration, and if so, note that in the history file @@ -731,8 +794,10 @@ subroutine SetValues ( this, num_column, filter_column, value_column) do j = 1, nlevdecomp_full do fi = 1,num_column i = filter_column(fi) + this%c_overflow_hr_sum(i) = value_column + this%c_overflow_hr(i,l) = value_column + this%c_overflow_hr_vr(i,j,l) = value_column this%decomp_cascade_hr_col(i,l) = value_column - this%c_overflow_vr(i,j,l) = value_column this%decomp_cascade_hr_vr_col(i,j,l) = value_column this%decomp_cascade_ctransfer_col(i,l) = value_column this%decomp_cascade_ctransfer_vr_col(i,j,l) = value_column @@ -850,6 +915,10 @@ subroutine Summary(this, bounds, & do j = 1,nlevdecomp do fc = 1,num_bgc_soilc c = filter_bgc_soilc(fc) + this%c_overflow_hr(c,k) = & + this%c_overflow_hr(c,k) + & + this%c_overflow_hr_vr(c,j,k) * dzsoi_decomp(j) + this%decomp_cascade_hr_col(c,k) = & this%decomp_cascade_hr_col(c,k) + & this%decomp_cascade_hr_vr_col(c,j,k) * dzsoi_decomp(j) @@ -898,13 +967,14 @@ subroutine Summary(this, bounds, & end do end do - ! soil organic matter heterotrophic respiration + ! soil organic matter heterotrophic respiration associate(is_soil => decomp_cascade_con%is_soil) ! TRUE => pool is a soil pool do k = 1, ndecomp_cascade_transitions if ( is_soil(decomp_cascade_con%cascade_donor_pool(k)) ) then do fc = 1,num_bgc_soilc c = filter_bgc_soilc(fc) this%somhr_col(c) = this%somhr_col(c) + this%decomp_cascade_hr_col(c,k) + this%c_overflow_hr_sum(c) = this%c_overflow_hr_sum(c) + this%c_overflow_hr(c,k) end do end if end do @@ -917,6 +987,7 @@ subroutine Summary(this, bounds, & do fc = 1,num_bgc_soilc c = filter_bgc_soilc(fc) this%lithr_col(c) = this%lithr_col(c) + this%decomp_cascade_hr_col(c,k) + this%c_overflow_hr_sum(c) = this%c_overflow_hr_sum(c) + this%c_overflow_hr(c,k) end do end if end do @@ -929,6 +1000,7 @@ subroutine Summary(this, bounds, & do fc = 1,num_bgc_soilc c = filter_bgc_soilc(fc) this%cwdhr_col(c) = this%cwdhr_col(c) + this%decomp_cascade_hr_col(c,k) + this%c_overflow_hr_sum(c) = this%c_overflow_hr_sum(c) + this%c_overflow_hr(c,k) end do end if end do @@ -941,6 +1013,7 @@ subroutine Summary(this, bounds, & do fc = 1,num_bgc_soilc c = filter_bgc_soilc(fc) this%michr_col(c) = this%michr_col(c) + this%decomp_cascade_hr_col(c,k) + this%c_overflow_hr_sum(c) = this%c_overflow_hr_sum(c) + this%c_overflow_hr(c,k) end do end if end do diff --git a/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 b/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 index 9a7e62f2ae..d3cb1fb474 100644 --- a/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 +++ b/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 @@ -262,8 +262,6 @@ 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 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 @@ -920,6 +918,7 @@ 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) * & @@ -927,19 +926,11 @@ subroutine SoilBiogeochemCompetition (bounds, num_bgc_soilc, filter_bgc_soilc,nu 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)) - else ! not pmnf and sum_ndemand > 0 - c_overflow_vr(c,j,k) = 0.0_r8 end if - else ! not microbes receiving - 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 end if if(.not.local_use_fun)then diff --git a/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 b/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 index 6be924bcf5..b63ac49837 100644 --- a/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 +++ b/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 @@ -127,7 +127,7 @@ subroutine SoilBiogeochemDecomp (bounds, num_bgc_soilc, filter_bgc_soilc, net_nmin => soilbiogeochem_nitrogenflux_inst%net_nmin_col , & ! Output: [real(r8) (:) ] net rate of N mineralization (gN/m2/s) w_scalar => soilbiogeochem_carbonflux_inst%w_scalar_col , & ! Input: [real(r8) (:,:) ] fraction by which decomposition is limited by moisture availability - c_overflow_vr => soilbiogeochem_carbonflux_inst%c_overflow_vr , & ! Input: [real(r8) (:,:,:) ] vertically-resolved C rejected by microbes that cannot process it (gC/m3/s) + c_overflow_hr_vr => soilbiogeochem_carbonflux_inst%c_overflow_hr_vr , & ! Input: [real(r8) (:,:,:) ] vertically-resolved C rejected by microbes that cannot process it (gC/m3/s) decomp_cascade_hr_vr => soilbiogeochem_carbonflux_inst%decomp_cascade_hr_vr_col , & ! Output: [real(r8) (:,:,:) ] vertically-resolved het. resp. from decomposing C pools (gC/m3/s) decomp_cascade_ctransfer_vr => soilbiogeochem_carbonflux_inst%decomp_cascade_ctransfer_vr_col , & ! Output: [real(r8) (:,:,:) ] vertically-resolved het. resp. from decomposing C pools (gC/m3/s) phr_vr => soilbiogeochem_carbonflux_inst%phr_vr_col , & ! Input: [real(r8) (:,:) ] potential HR (gC/m3/s) @@ -194,7 +194,7 @@ subroutine SoilBiogeochemDecomp (bounds, num_bgc_soilc, filter_bgc_soilc, if (decomp_method == mimics_decomp) then decomp_cascade_hr_vr(c,j,k) = min( & p_decomp_cpool_loss(c,j,k), & - decomp_cascade_hr_vr(c,j,k) + c_overflow_vr(c,j,k)) + decomp_cascade_hr_vr(c,j,k) + c_overflow_hr_vr(c,j,k)) decomp_cascade_ctransfer_vr(c,j,k) = max(0.0_r8, p_decomp_cpool_loss(c,j,k) - decomp_cascade_hr_vr(c,j,k)) end if if (decomp_npools_vr(c,j,cascade_donor_pool(k)) > 0._r8 .and. cascade_receiver_pool(k) /= i_atm) then diff --git a/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 b/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 index deb9bdbf78..044cad9115 100644 --- a/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 +++ b/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 @@ -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 !----------------------------------------------------------------------- @@ -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_hr_vr => soilbiogeochem_carbonflux_inst%c_overflow_hr_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) (:,:) ] @@ -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_hr_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 @@ -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_hr_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_hr_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