Skip to content

Commit

Permalink
sminno4 and nh4 update with mimicplus smin fluxes
Browse files Browse the repository at this point in the history
  • Loading branch information
elisacw committed Aug 30, 2024
1 parent 688ded6 commit 8fa7a0b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/biogeochem/CNDriverMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,8 @@ subroutine CNDriverNoLeaching(bounds,

call t_startf('SoilBiogeochemStateUpdate1')
call SoilBiogeochemNStateUpdate1(num_bgc_soilc, filter_bgc_soilc, &
soilbiogeochem_state_inst, soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst)
soilbiogeochem_state_inst, soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, &
cnfunmimicsplus_inst)
call t_stopf('SoilBiogeochemStateUpdate1')


Expand Down
12 changes: 12 additions & 0 deletions src/biogeochem/CNFUNMIMICSplusMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,12 @@ subroutine CNFUNMIMICSplus (bounds, num_soilc, filter_soilc, num_soilp ,filter_s
npp_to_paths(p,j,ipnmno3) = n_from_paths(p,j,ipnmno3) * costs_paths(p,j,ipnmno3)
npp_to_paths(p,j,ipnmnh4) = n_from_paths(p,j,ipnmnh4) * costs_paths(p,j,ipnmnh4)

! switch units to gN/m3/s for use in other routines
sminno3_to_am_vr_patch(p,j) = sminno3_to_am_vr_patch(p,j)/(dzsoi_decomp(j)*dt)
sminno3_to_ecm_vr_patch(p,j) = sminno3_to_ecm_vr_patch(p,j)/(dzsoi_decomp(j)*dt)
sminnh4_to_am_vr_patch(p,j) = sminnh4_to_am_vr_patch(p,j)/(dzsoi_decomp(j)*dt)
sminnh4_to_ecm_vr_patch(p,j) = sminnh4_to_ecm_vr_patch(p,j)/(dzsoi_decomp(j)*dt)

N_acquired = sum(n_from_paths(p,j,ipano3:ipnmnh4)) ! How much N did we end up with

C_spent = sum(npp_to_paths(p,j,ipano3:ipnmnh4)) ! How much did it actually cost?
Expand Down Expand Up @@ -1156,6 +1162,10 @@ subroutine CNFUNMIMICSplus (bounds, num_soilc, filter_soilc, num_soilp ,filter_s
do j = 1,nlevdecomp
n_active_vr(p,j) = n_active_vr(p,j) + sum(n_from_paths(p,j,ipano3:ipanh4))
n_nonmyc_vr(p,j) = n_nonmyc_vr(p,j) + sum(n_from_paths(p,j,ipnmno3:ipnmnh4))
n_active_no3_vr(p,j) = n_active_no3_vr(p,j) + n_from_paths(p,j,ipano3)
n_active_nh4_vr(p,j) = n_active_nh4_vr(p,j) + n_from_paths(p,j,ipanh4)
n_nonmyc_n03_vr(p,j) = n_nonmyc_no3_vr(p,j) + n_from_paths(p,j,ipnmno3)
n_nonmyc_nh4_vr(p,j) = n_nonmyc_nh4_vr(p,j) + n_from_paths(p,j,ipnmnh4)
end do
end if !unmet demand`

Expand All @@ -1179,6 +1189,8 @@ subroutine CNFUNMIMICSplus (bounds, num_soilc, filter_soilc, num_soilp ,filter_s
do j = 1, nlevdecomp
!RF change. The N fixed doesn't actually come out of the soil mineral pools, it is 'new'...
sminn_to_plant_fun_vr(p,j) = n_active_vr(p,j) + n_nonmyc_vr(p,j)/(dzsoi_decomp(j)*dt)
sminn_to_plant_fun_no3_vr(p,j) = (n_nonmyc_no3_vr(p,j))/(dzsoi_decomp(j)*dt)
sminn_to_plant_fun_nh4_vr(p,j) = (n_nonmyc_nh4_vr(p,j))/(dzsoi_decomp(j)*dt)
end do

!SPLIT TO NO3 and NH4 like in original fun
Expand Down
11 changes: 10 additions & 1 deletion src/soilbiogeochem/SoilBiogeochemNStateUpdate1Mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module SoilBiogeochemNStateUpdate1Mod
use CNSharedParamsMod , only : use_fun
use SoilBiogeochemDecompCascadeConType , only : mimicsplus_decomp, decomp_method
use ColumnType , only : col
use CNFUNMIMICSplusMod , only : cnfunmimicsplus_type
!
implicit none
private
Expand All @@ -29,7 +30,7 @@ module SoilBiogeochemNStateUpdate1Mod

!-----------------------------------------------------------------------
subroutine SoilBiogeochemNStateUpdate1(num_bgc_soilc, filter_bgc_soilc, &
soilbiogeochem_state_inst, soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst)
soilbiogeochem_state_inst, soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst,cnfunmimicsplus_inst)
!
! !DESCRIPTION:
! On the radiation time step, update all the prognostic nitrogen state
Expand All @@ -41,6 +42,7 @@ subroutine SoilBiogeochemNStateUpdate1(num_bgc_soilc, filter_bgc_soilc, &
type(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst
type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst
type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst
type(cnfunmimicsplus_type), intent(in) :: cnfunmimicsplus_inst
!
! !LOCAL VARIABLES:
integer :: c,p,j,l,k ! indices
Expand Down Expand Up @@ -239,6 +241,13 @@ subroutine SoilBiogeochemNStateUpdate1(num_bgc_soilc, filter_bgc_soilc, &
ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) - nf%smin_nh4_to_plant_vr_col(c,j)*dt

ns%smin_no3_vr_col(c,j) = ns%smin_no3_vr_col(c,j) - nf%smin_no3_to_plant_vr_col(c,j)*dt
else if (decomp_method == mimicsplus_decomp) then
! we treat mycorrhiza differently in mimics plus
ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) - nf%sminn_to_plant_fun_nh4_vr_col(c,j)*dt - &
(cnfunmimicsplus_inst%sminnh4_to_am_vr_col(c,j) + cnfunmimicsplus_inst%sminnh4_to_ecm_vr_col(c,j)) * dt

ns%smin_no3_vr_col(c,j) = ns%smin_no3_vr_col(c,j) - nf%sminn_to_plant_fun_no3_vr_col(c,j)*dt - &
(cnfunmimicsplus_inst%sminno3_to_am_vr_col(c,j) + cnfunmimicsplus_inst%sminno3_to_ecm_vr_col(c,j)) * dt
else
ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) - nf%sminn_to_plant_fun_nh4_vr_col(c,j)*dt

Expand Down

0 comments on commit 8fa7a0b

Please sign in to comment.