Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
83 changes: 78 additions & 5 deletions src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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', &
Expand Down Expand Up @@ -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
Expand All @@ -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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here and below: I decided to make them default active while we're testing. Can return them to inactive before merging if we prefer.

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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rather than adding a unique new loop to sum the c_overflow_hr_sum variable, I introduced partial sums in the existing loops. This line here is in the "is_soil" loop, next is the litter loop, then cwd, and last the is_microbe loop.

@wwieder based on what you said this morning, we may need to have this in one or some of those and not all, but I went for full coverage since I do not know.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think that's fine. I'm curious to see what the history files from MIMICS tests look like, once you are able to run them on derecho.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that's fine. I'm curious to see what the history files from MIMICS tests look like, once you are able to run them on derecho.

@wwieder in the next post I have posted four mimics tests that you could look at in this directory:
/glade/work/slevis/git_people/wwieder/mimics_5.2.028_working/tests_0513-205326de/

end do
end if
end do
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
11 changes: 1 addition & 10 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 @@ -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
Expand Down Expand Up @@ -920,26 +918,19 @@ 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))
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
Expand Down
4 changes: 2 additions & 2 deletions src/soilbiogeochem/SoilBiogeochemDecompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Loading
Loading