Skip to content

Commit

Permalink
adding mimics_fi, litter flux to SOM pools
Browse files Browse the repository at this point in the history
  • Loading branch information
elisacw committed Dec 18, 2024
1 parent 5d3d64c commit 990affc
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
16 changes: 14 additions & 2 deletions src/biogeochem/CNCStateUpdate1Mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module CNCStateUpdate1Mod
use clm_varpar , only : ndecomp_cascade_transitions, nlevdecomp
use clm_time_manager , only : get_step_size_real
use clm_varpar , only : i_litr_min, i_litr_max, i_cwd
use clm varpar , only : i_met_lit, i_str_lit, i_phys_som, i_chem_som
use pftconMod , only : npcropmin, nc3crop, pftcon
use abortutils , only : endrun
use decompMod , only : bounds_type
Expand All @@ -17,7 +18,7 @@ module CNCStateUpdate1Mod
use CropType , only : crop_type
use CropReprPoolsMod , only : nrepr, repr_grain_min, repr_grain_max
use CropReprPoolsMod , only : repr_structure_min, repr_structure_max
use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con, use_soil_matrixcn
use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con, decomp_method, mimicsplus_decomp, use_soil_matrixcn
use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type
use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type
use PatchType , only : patch
Expand Down Expand Up @@ -169,7 +170,7 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, &

associate( &
ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type

mimics_fi => pftcon%mimics_fi , & ! Input: MIMICSplus parameter fi
woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody)

cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & ! Input: [integer (:) ] which pool is C taken from for a given decomposition step
Expand Down Expand Up @@ -206,10 +207,21 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, &
!
if (.not. use_soil_matrixcn) then
! phenology and dynamic land cover fluxes
if (decomp_method == mimics_decomp .or. decomp_method == mimicsplus_decomp) then
do i = i_litr_min, i_litr_max ! in MIMICSplus these are 1 and 2
cf_soil%decomp_cpools_sourcesink_col(c,j,i) = (1 - mimicsplus_fi(i)) * &
cf_veg%phenology_c_to_litr_c_col(c,j,i) * dt
end do
cf_soil%decomp_cpools_sourcesink_col(c,j,i_phys_som) = mimicsplus_fi(1) * &
cf_veg%phenology_c_to_litr_c_col(c,j,i_met_lit) * dt
cf_soil%decomp_cpools_sourcesink_col(c,j,i_chem_som) = mimicsplus_fi(2) * &
cf_veg%phenology_c_to_litr_c_col(c,j,i_str_lit) * dt
else
do i = i_litr_min, i_litr_max
cf_soil%decomp_cpools_sourcesink_col(c,j,i) = &
cf_veg%phenology_c_to_litr_c_col(c,j,i) * dt
end do
end if

! NOTE(wjs, 2017-01-02) This used to be set to a non-zero value, but the
! terms have been moved to CStateUpdateDynPatch. I think this is zeroed every
Expand Down
16 changes: 14 additions & 2 deletions src/biogeochem/CNNStateUpdate1Mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ module CNNStateUpdate1Mod
use clm_time_manager , only : get_step_size_real
use clm_varpar , only : nlevdecomp
use clm_varpar , only : i_litr_min, i_litr_max, i_cwd
use clm_varpar , only : i_met_lit, i_str_lit, i_phys_som, i_chem_som
use clm_varctl , only : iulog, use_nitrif_denitrif
use SoilBiogeochemDecompCascadeConType, only : use_soil_matrixcn
use SoilBiogeochemDecompCascadeConType, only : decomp_method, mimicsplus_decomp, use_soil_matrixcn
use CNSharedParamsMod , only : use_matrixcn
use clm_varcon , only : nitrif_n2o_loss_frac
use pftconMod , only : npcropmin, pftcon
Expand Down Expand Up @@ -128,7 +129,7 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, &

associate( &
ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type

mimics_fi => pftcon%mimics_fi , & ! Input: MIMICS parameter fi
woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody)

nf_veg => cnveg_nitrogenflux_inst , & ! Input:
Expand Down Expand Up @@ -163,10 +164,21 @@ subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, &
! State update without the matrix solution
!
if (.not. use_soil_matrixcn) then ! to be consistent with C
if (decomp_method == mimicsplus_decomp) then
do i = i_litr_min, i_litr_max ! in MIMICS these are 1 and 2
nf_soil%decomp_npools_sourcesink_col(c,j,i) = (1 - mimicsplus_fi(i)) * &
nf_veg%phenology_n_to_litr_n_col(c,j,i) * dt
end do
nf_soil%decomp_npools_sourcesink_col(c,j,i_phys_som) = mimicsplus_fi(1) * &
nf_veg%phenology_n_to_litr_n_col(c,j,i_met_lit) * dt
nf_soil%decomp_npools_sourcesink_col(c,j,i_chem_som) = mimicsplus_fi(2) * &
nf_veg%phenology_n_to_litr_n_col(c,j,i_str_lit) * dt
else
do i = i_litr_min, i_litr_max
nf_soil%decomp_npools_sourcesink_col(c,j,i) = &
nf_veg%phenology_n_to_litr_n_col(c,j,i) * dt
end do
end if

! NOTE(wjs, 2017-01-02) This used to be set to a non-zero value, but the
! terms have been moved to CStateUpdateDynPatch. I think this is zeroed every
Expand Down
5 changes: 5 additions & 0 deletions src/main/pftconMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ module pftconMod
real(r8), allocatable :: wood_density (:) ! wood density (kg/m3)
real(r8), allocatable :: crit_onset_gdd_sf(:)! scale factor for crit_onset_gdd
real(r8), allocatable :: ndays_on(:) ! number of days to complete leaf onset
real(r8), allocatable :: mimics_fi(:) ! fraction of litter going directly to SOM pools [-]

! crop

Expand Down Expand Up @@ -506,6 +507,7 @@ subroutine InitAllocate (this)
allocate( this%wood_density (0:mxpft) )
allocate( this%crit_onset_gdd_sf (0:mxpft) )
allocate( this%ndays_on (0:mxpft) )
allocate(this%mimics_fi(2))

end subroutine InitAllocate

Expand Down Expand Up @@ -1095,6 +1097,9 @@ subroutine InitRead(this)
!
! clm 5 nitrogen variables
!
call ncd_io('mimics_fi',this%mimics_fi, 'read', ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__))

if (use_flexibleCN) then
call ncd_io('i_vcad', this%i_vcad, 'read', ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__))
Expand Down
5 changes: 5 additions & 0 deletions src/soilbiogeochem/SoilBiogeochemDecompCascadeMIMICSMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ subroutine readParams ( ncid )
if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__))
params_inst%mimics_cn_k = tempr

tString= trim(param_pref) // '_fi'
call ncd_io(trim(tString), tempr, 'read', ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__))
params_inst%mimicsplus_fi = tempr

! Parameters specific for mimicsplus / mimics parameters that have updated values in mimicsplus

if (decomp_method == mimicsplus_decomp) then
Expand Down

0 comments on commit 990affc

Please sign in to comment.