Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIMICS updates, WIP #2365

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
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
22 changes: 18 additions & 4 deletions cime_config/usermods_dirs/NEON/defaults/shell_commands
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes to user_mods don't need to be included in this PR.

Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ TEST=`./xmlquery TEST --value`

# For a transient case run the whole length and don't cycle
if [[ $compset =~ ^HIST ]]; then
./xmlchange CALENDAR=GREGORIAN
./xmlchange DATM_YR_END=2022
./xmlchange DATM_YR_END=2023
#./xmlchange CALENDAR=GREGORIAN
#./xmlchange DATM_YR_END=2022
./xmlchange RUN_STARTDATE=2018-01-01
# Number of months that can be run for the full transient case
if [[ $TEST != "TRUE" ]]; then
./xmlchange STOP_OPTION="nmonths"
./xmlchange STOP_N=51
./xmlchange STOP_N=68
fi
./xmlchange CLM_NML_USE_CASE="2018-PD_transient"
else
Expand All @@ -46,4 +47,17 @@ fi
# Explicitly set PIO Type to NETCDF since this is a single processor case (should already be set this way)
./xmlchange PIO_TYPENAME=netcdf

./xmlchange NEONVERSION="v2"

# specific for MIMICS spinup
./xmlchange DATM_YR_END=2021
./xmlchange RUN_STARTDATE=0018-01-01
./xmlchange RESUBMIT=5
./xmlchange STOP_N=500
./xmlchange REST_N=100
./xmlchange STOP_OPTION=nyears
./xmlchange CLM_FORCE_COLDSTART=on
./xmlchange CONTINUE_RUN=False
# Slow to run in develop queue, and this didn't wrok as intended.
#./xmlchange JOB_QUEUE=develop
#./xmlchange JOB_WALLCLOCK_TIME=1:00:00

14 changes: 7 additions & 7 deletions cime_config/usermods_dirs/NEON/defaults/user_nl_clm
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable
!----------------------------------------------------------------------------------

flanduse_timeseries = ' ' ! This isn't needed for a non transient case, but will be once we start using transient compsets
fsurdat = "$DIN_LOC_ROOT/lnd/clm2/surfdata_esmf/NEON/surfdata_1x1_NEON_${NEONSITE}_hist_2000_78pfts_c240206.nc"
soil_decomp_method = 'MIMICSWieder2015'

hist_empty_htapes = .true.
hist_fincl1 = 'TOTLITC','TOTMICC','TOTSOMC','TOTLITN','TOTMICN','TOTSOMN',
'LIT_MET_C_vr','LIT_STR_C_vr','MIC_COP_C_vr','MIC_OLI_C_vr',
'SOM_AVL_C_vr', 'SOM_CHEM_C_vr', 'SOM_PHYS_C_vr',
'TOTVEGC','TOTECOSYSC','GPP','AR','HR','ELAI'

! h1 output stream
hist_fincl2 = 'AR','ELAI','FCEV','FCTR','FGEV','FIRA','FSA','FSH','GPP','H2OSOI',
'HR','SNOW_DEPTH','TBOT','TSOI','SOILC_vr','FV','NET_NMIN_vr'
hist_mfilt(2) = 48
hist_nhtfrq(2) = 1
6 changes: 3 additions & 3 deletions cime_config/usermods_dirs/NEON/defaults/user_nl_datm_streams
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@
!------------------------------------------------------------------------
presaero.SSP3-7.0:datafiles = $DIN_LOC_ROOT/atm/cam/chem/trop_mozart_aero/aero/aerodep_clm_SSP370_b.e21.BWSSP370cmip6.f09_g17.CMIP6-SSP3-7.0-WACCM.001_2018-2030_monthly_0.9x1.25_c210826.nc
presaero.SSP3-7.0:year_first=2018
presaero.SSP3-7.0:year_last=2022
presaero.SSP3-7.0:year_last=2023
presaero.SSP3-7.0:year_align=2018
presaero.SSP3-7.0:dtlimit=30

presndep.SSP3-7.0:datafiles = $DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_f09_g17.CMIP6-SSP3-7.0-WACCM_2018-2030_monthly_c210826.nc
presndep.SSP3-7.0:year_first=2018
presndep.SSP3-7.0:year_last=2022
presndep.SSP3-7.0:year_last=2023
presndep.SSP3-7.0:year_align=2018
presndep.SSP3-7.0:dtlimit=30

preso3.SSP3-7.0:year_first=2018
preso3.SSP3-7.0:year_last=2022
preso3.SSP3-7.0:year_last=2023
preso3.SSP3-7.0:year_align=2018
preso3.SSP3-7.0:dtlimit=30

23 changes: 18 additions & 5 deletions src/biogeochem/CNCStateUpdate1Mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,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 @@ -20,7 +21,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, mimics_decomp, use_soil_matrixcn
use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type
use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type
use PatchType , only : patch
Expand Down Expand Up @@ -172,6 +173,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: MIMICS 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 @@ -210,10 +212,21 @@ subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, &
!
if (.not. use_soil_matrixcn) then
! phenology and dynamic land cover fluxes
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
if (decomp_method == mimics_decomp) then
do i = i_litr_min, i_litr_max ! in MIMICS these are 1 and 2
cf_soil%decomp_cpools_sourcesink_col(c,j,i) = (1 - mimics_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) = mimics_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) = mimics_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
23 changes: 18 additions & 5 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, mimics_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 @@ -129,6 +130,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 +165,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
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
if (decomp_method == mimics_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 - mimics_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) = mimics_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) = mimics_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
3 changes: 3 additions & 0 deletions src/main/clm_varpar.F90
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ module clm_varpar
integer, public :: i_litr_min = -9 ! min index of litter pools; overwritten in SoilBiogeochemDecompCascade*Mod
integer, public :: i_litr_max = -9 ! max index of litter pools; overwritten in SoilBiogeochemDecompCascade*Mod
integer, public :: i_met_lit = -9 ! index of metabolic litter pool; overwritten in SoilBiogeochemDecompCascade*Mod
integer, public :: i_str_lit = -9 ! index of structural litter pool; overwritten in SoilBiogeochemDecompCascade*Mod
integer, public :: i_phys_som = -9 ! index of physically protected Soil Organic Matter (SOM); overwritten in SoilBiogeochemDecompCascade*Mod
integer, public :: i_chem_som = -9 ! index of chemically protected Soil Organic Matter (SOM); overwritten in SoilBiogeochemDecompCascade*Mod
integer, public :: i_cop_mic = -9 ! index of copiotrophic microbial pool; overwritten in SoilBiogeochemDecompCascade*Mod
integer, public :: i_oli_mic = -9 ! index of oligotrophic microbial pool; overwritten in SoilBiogeochemDecompCascade*Mod
integer, public :: i_cwd = -9 ! index of cwd pool; overwritten in SoilBiogeochemDecompCascade*Mod
Expand Down
11 changes: 11 additions & 0 deletions src/main/pftconMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ module pftconMod
real(r8), allocatable :: rstem_per_dbh (:) ! stem resistance per dbh (s/m/m)
real(r8), allocatable :: wood_density (:) ! wood density (kg/m3)

! MIMICS
real(r8), allocatable :: mimics_fi(:)

! crop

! These arrays give information about the merge of unused crop types to the types CLM
Expand Down Expand Up @@ -506,6 +509,8 @@ subroutine InitAllocate (this)
allocate( this%taper (0:mxpft) )
allocate( this%rstem_per_dbh (0:mxpft) )
allocate( this%wood_density (0:mxpft) )

allocate( this%mimics_fi(2) )

end subroutine InitAllocate

Expand Down Expand Up @@ -1090,6 +1095,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 Expand Up @@ -1132,6 +1140,7 @@ subroutine InitRead(this)
if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__))
call ncd_io('wood_density',this%wood_density, 'read', ncid, readvar=readv)
if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__))

else
this%dbh = 0.0_r8
this%fbw = 0.0_r8
Expand Down Expand Up @@ -1595,6 +1604,8 @@ subroutine Clean(this)
deallocate( this%rstem_per_dbh)
deallocate( this%wood_density)
deallocate( this%taper)

deallocate( this%mimics_fi)
end subroutine Clean

end module pftconMod
Expand Down
13 changes: 5 additions & 8 deletions src/soilbiogeochem/SoilBiogeochemDecompCascadeMIMICSMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module SoilBiogeochemDecompCascadeMIMICSMod
use shr_const_mod , only : SHR_CONST_TKFRZ
use shr_log_mod , only : errMsg => shr_log_errMsg
use clm_varpar , only : nlevdecomp, ndecomp_pools_max
use clm_varpar , only : i_met_lit, i_cop_mic, i_oli_mic, i_cwd
use clm_varpar , only : i_phys_som, i_chem_som, i_str_lit, i_met_lit, i_cop_mic, i_oli_mic, i_cwd
use clm_varpar , only : i_litr_min, i_litr_max, i_cwdl2
use clm_varctl , only : iulog, spinup_state, anoxia, use_lch4, use_fates
use clm_varcon , only : zsoi
Expand Down Expand Up @@ -48,10 +48,7 @@ module SoilBiogeochemDecompCascadeMIMICSMod
real(r8), private, allocatable :: fphys_m1(:,:)
real(r8), private, allocatable :: fphys_m2(:,:)
real(r8), private, allocatable :: p_scalar(:,:)
integer, private :: i_phys_som ! index of physically protected Soil Organic Matter (SOM)
integer, private :: i_chem_som ! index of chemically protected SOM
integer, private :: i_avl_som ! index of available (aka active) SOM
integer, private :: i_str_lit ! index of structural litter pool
integer, private :: i_l1m1 ! indices of transitions, eg l1m1: litter 1 -> first microbial pool
integer, private :: i_l1m2
integer, private :: i_l2m1
Expand Down Expand Up @@ -1288,14 +1285,14 @@ subroutine decomp_rates_mimics(bounds, num_bgc_soilc, filter_bgc_soilc, &
decomp_k(c,j,i_chem_som) = (term_1 + term_2) * w_d_o_scalars

! Currently, mimics_densdep = 1 so as to have no effect
decomp_k(c,j,i_cop_mic) = tau_m1 * &
m1_conc**(mimics_densdep - 1.0_r8) * w_d_o_scalars
decomp_k(c,j,i_cop_mic) = tau_m1 * m1_conc**(mimics_densdep)

favl = min(1.0_r8, max(0.0_r8, 1.0_r8 - fphys_m1(c,j) - fchem_m1))
pathfrac_decomp_cascade(c,j,i_m1s1) = favl
pathfrac_decomp_cascade(c,j,i_m1s2) = fchem_m1

decomp_k(c,j,i_oli_mic) = tau_m2 * &
m2_conc**(mimics_densdep - 1.0_r8) * w_d_o_scalars
decomp_k(c,j,i_oli_mic) = tau_m2 * m2_conc**(mimics_densdep)

favl = min(1.0_r8, max(0.0_r8, 1.0_r8 - fphys_m2(c,j) - fchem_m2))
pathfrac_decomp_cascade(c,j,i_m2s1) = favl
pathfrac_decomp_cascade(c,j,i_m2s2) = fchem_m2
Expand Down
Loading