Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
26eab1f
NEONv3 updates
wwieder Jan 9, 2024
c3d752b
turn on mimics v1
wwieder Jan 30, 2024
3a9eab5
more mimics mods
wwieder Feb 1, 2024
a004eb6
longer runs on cpu queue
wwieder Feb 1, 2024
d2f770a
Merge remote-tracking branch 'origin/master' into mimics_NEON_Derecho
wwieder Feb 1, 2024
34d33a4
start removing fW from tau calculation & using beta
wwieder Feb 9, 2024
a8c322c
remove w_scalar from tau, correct beta
wwieder Feb 10, 2024
3380488
adding Fi fluxes from @slevis-lmwg
wwieder Mar 18, 2024
faefaa5
usermods for MIMICS
wwieder May 20, 2024
933d229
removing conflicts
wwieder Sep 6, 2024
f2dd873
usermods for MIMICS cases
wwieder Sep 6, 2024
3878450
correct surface data for 5.3 datasets
wwieder Sep 10, 2024
f5ff4a0
adding mimics fi flux
wwieder Sep 10, 2024
2f52b64
usermods for mimics
wwieder Oct 1, 2024
df63275
subset crujra datm
wwieder Oct 1, 2024
9a8ba0e
restore usermod defaults
wwieder Feb 28, 2025
c75d439
Merge tag 'ctsm5.3.026' into mimics_NEON_Derecho
wwieder Feb 28, 2025
4cb68e8
Merge tag 'ctsm5.3.030' into mimics_NEON_Derecho
slevis-lmwg Mar 12, 2025
5bc5726
Reverse changes to subset_data + default_data that come in with #2956
slevis-lmwg Mar 12, 2025
fd7b3f4
Reverse changes to single_point_case.py
slevis-lmwg Mar 12, 2025
e165c0e
Update to the new paramfiles
slevis-lmwg Mar 14, 2025
fe30970
Draft ChangeLog/ChangeSum
slevis-lmwg Mar 14, 2025
d93f683
Merge tag 'ctsm5.3.032' into mimics_NEON_Derecho
slevis-lmwg Mar 17, 2025
6e8674e
Updated ChangeLog/Sum
slevis-lmwg Mar 19, 2025
78371a1
Another update to ChangeLog
slevis-lmwg Mar 19, 2025
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
74 changes: 35 additions & 39 deletions python/ctsm/site_and_regional/single_point_case.py
Comment thread
slevis-lmwg marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ def extract_datm_at(self, file_in, file_out):
f_out = f_out.expand_dims(["lat", "lon"])

# specify dimension order
f_out = f_out.transpose("scalar", "time", "lat", "lon")
f_out = f_out.transpose("time", "lat", "lon")

# update attributes
self.update_metadata(f_out)
Expand Down Expand Up @@ -648,46 +648,42 @@ def create_datm_at_point(self, datm_tuple: DatmFiles, datm_syr, datm_eyr, datm_s
tpqwfiles = []
for year in range(datm_syr, datm_eyr + 1):
ystr = str(year)
for month in range(FIRST_MONTH, LAST_MONTH + 1):
mstr = str(month)
if month < 10:
mstr = "0" + mstr

dtag = ystr + "-" + mstr
dtag = ystr

fsolar = os.path.join(
datm_tuple.indir,
datm_tuple.dir_solar,
"{}{}.nc".format(datm_tuple.tag_solar, dtag),
)
fsolar2 = "{}{}.{}.nc".format(datm_tuple.tag_solar, self.tag, dtag)
fprecip = os.path.join(
datm_tuple.indir,
datm_tuple.dir_prec,
"{}{}.nc".format(datm_tuple.tag_prec, dtag),
)
fprecip2 = "{}{}.{}.nc".format(datm_tuple.tag_prec, self.tag, dtag)
ftpqw = os.path.join(
datm_tuple.indir,
datm_tuple.dir_tpqw,
"{}{}.nc".format(datm_tuple.tag_tpqw, dtag),
)
ftpqw2 = "{}{}.{}.nc".format(datm_tuple.tag_tpqw, self.tag, dtag)

outdir = os.path.join(self.out_dir, datm_tuple.outdir)
infile += [fsolar, fprecip, ftpqw]
outfile += [
os.path.join(outdir, fsolar2),
os.path.join(outdir, fprecip2),
os.path.join(outdir, ftpqw2),
]
solarfiles.append(
os.path.join("${}".format(USRDAT_DIR), datm_tuple.outdir, fsolar2)
)
precfiles.append(
os.path.join("${}".format(USRDAT_DIR), datm_tuple.outdir, fprecip2)
)
tpqwfiles.append(os.path.join("${}".format(USRDAT_DIR), datm_tuple.outdir, ftpqw2))
fsolar = os.path.join(
datm_tuple.indir,
datm_tuple.dir_solar,
"{}{}.nc".format(datm_tuple.tag_solar, dtag),
)
fsolar2 = "{}{}.{}.nc".format(datm_tuple.tag_solar, self.tag, dtag)
fprecip = os.path.join(
datm_tuple.indir,
datm_tuple.dir_prec,
"{}{}.nc".format(datm_tuple.tag_prec, dtag),
)
fprecip2 = "{}{}.{}.nc".format(datm_tuple.tag_prec, self.tag, dtag)
ftpqw = os.path.join(
datm_tuple.indir,
datm_tuple.dir_tpqw,
"{}{}.nc".format(datm_tuple.tag_tpqw, dtag),
)
ftpqw2 = "{}{}.{}.nc".format(datm_tuple.tag_tpqw, self.tag, dtag)

outdir = os.path.join(self.out_dir, datm_tuple.outdir)
infile += [fsolar, fprecip, ftpqw]
outfile += [
os.path.join(outdir, fsolar2),
os.path.join(outdir, fprecip2),
os.path.join(outdir, ftpqw2),
]
solarfiles.append(
os.path.join("${}".format(USRDAT_DIR), datm_tuple.outdir, fsolar2)
)
precfiles.append(
os.path.join("${}".format(USRDAT_DIR), datm_tuple.outdir, fprecip2)
)
tpqwfiles.append(os.path.join("${}".format(USRDAT_DIR), datm_tuple.outdir, ftpqw2))

for idx, out_f in enumerate(outfile):
logger.debug(out_f)
Expand Down
23 changes: 18 additions & 5 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, 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 @@ -170,6 +171,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 @@ -206,10 +208,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
Comment thread
slevis-lmwg marked this conversation as resolved.
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
9 changes: 9 additions & 0 deletions src/main/pftconMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ module pftconMod
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

! 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 @@ -504,6 +507,7 @@ 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) )
allocate( this%crit_onset_gdd_sf (0:mxpft) )
allocate( this%ndays_on (0:mxpft) )

Expand Down Expand Up @@ -1095,6 +1099,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 +1139,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 @@ -1594,6 +1602,7 @@ subroutine Clean(this)
deallocate( this%rstem_per_dbh)
deallocate( this%wood_density)
deallocate( this%taper)
deallocate( this%mimics_fi)
deallocate( this%crit_onset_gdd_sf)
deallocate( this%ndays_on)
end subroutine Clean
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 @@ -1293,14 +1290,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