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 into vertically resolved CTSM #1318

Merged
merged 80 commits into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
9985a65
First commit of MIMICS in CTSM
slevis-lmwg Mar 27, 2021
131147e
Introduce MIMICS using SoilBiogeochemDecompCascadeBGCMod.F90 as template
slevis-lmwg Mar 31, 2021
d963ada
Updating SoilBiogeochemDecompCascadeMIMICSMod.F90 based on code review
slevis-lmwg Apr 2, 2021
5dd9ff2
Updating SoilBiogeochemDecompCascadeMIMICSMod.F90 based on meeting
slevis-lmwg Apr 3, 2021
8601f6e
Mainly changed "rate constants" to "rates" in the comments
slevis-lmwg Apr 13, 2021
0141a3e
Merge tag 'ctsm5.1.dev033' into vert_res_in_mimics
slevis-lmwg Apr 13, 2021
5995cc0
Add new and remove old TODO BFB refactor comments
slevis-lmwg Apr 14, 2021
e6833ea
Remove old TODO BFB refactor comment
slevis-lmwg Apr 14, 2021
446b587
Minor mods to ...DecompCascadeMIMICSMod based on refactor branch
slevis-lmwg Apr 18, 2021
32222a9
Merge tag 'ctsm5.1.dev043' into vert_res_in_mimics
slevis-lmwg Jun 4, 2021
2f67c21
Making ...CascadeMIMICSMod.F90 consistent w pre-MIMICS refactor
slevis-lmwg Jun 5, 2021
e962b0e
Ongoing work in SoilBiogeochemDecompCascadeMIMICSMod.F90
slevis-lmwg Jun 11, 2021
cda5d14
Merge tag 'ctsm5.1.dev048' into vert_res_in_mimics
slevis-lmwg Jul 11, 2021
487f5b3
Updates to MIMICSMod.F90 for consistency w corresponding BGC refactors
slevis-lmwg Jul 12, 2021
65d47da
Working on the tau calculations
slevis-lmwg Jul 12, 2021
39d51b6
Comment updates...
slevis-lmwg Jul 12, 2021
7662239
Updates from today's code review with @wwieder
slevis-lmwg Jul 14, 2021
0fde398
Updates based on new comments from @wwieder
slevis-lmwg Jul 15, 2021
030e9c5
Updates addressing comments in the PR
slevis-lmwg Jul 17, 2021
17fa68f
Minor updates
slevis-lmwg Jul 17, 2021
0860aa4
Rm unnecessary associate assignments as I look through the whole model
slevis-lmwg Jul 19, 2021
8715ec5
First draft of the ligninNratioAvg calculation
slevis-lmwg Jul 19, 2021
3ba4ad3
Made parameters of some two unit conversions
slevis-lmwg Jul 19, 2021
5222227
Working on the calculation of ligninNratioAve
slevis-lmwg Jul 22, 2021
ae3b11b
Closer to completing calculation of ligninNratioAve
slevis-lmwg Jul 23, 2021
d5d83e4
Some clean-up and corrections before starting on the nitrogen
slevis-lmwg Jul 23, 2021
0b91a02
Negligible changes but pushing to have access to latest during downtime
slevis-lmwg Jul 25, 2021
63cfa3d
Mods originally from @wwieder for the MIMICS nitrogen hooks
slevis-lmwg Aug 1, 2021
bf87bd3
Variable declarations and other loose ends from prev commit
slevis-lmwg Aug 5, 2021
3cf47eb
Adding use_mimics_decomp where needed in the fortran
slevis-lmwg Aug 6, 2021
043d8bc
Corrections and minor cleanup
slevis-lmwg Aug 7, 2021
ed35311
Code corrections from attempting to build (part 1)
slevis-lmwg Aug 9, 2021
fc2c33c
Merge tag 'ctsm5.1.dev051' into vert_res_in_mimics
slevis-lmwg Aug 9, 2021
ebadca9
Adding history variables for use with Newton-Krylov
slevis-lmwg Aug 9, 2021
5236864
Adding pathfrac_decomp_cascade to ctsm history
slevis-lmwg Aug 10, 2021
724cb82
Change to variable description as per code review suggestion
slevis-lmwg Aug 11, 2021
1f13e65
Code corrections from attempting to build (part 2)
slevis-lmwg Aug 12, 2021
dcf7689
Code corrections from attempting to build (part 3)
slevis-lmwg Aug 16, 2021
731475e
Merge branch 'hist_vars_for_newton_krylov' into vert_res_in_mimics
slevis-lmwg Aug 17, 2021
fefccc9
Code corrections from attempting to build (part 4)
slevis-lmwg Aug 18, 2021
dfe0688
Code corrections from attempting to build (part 5)
slevis-lmwg Aug 19, 2021
4e22c91
Adding rf_decomp_cascade to history
slevis-lmwg Aug 19, 2021
695f85c
Merge tag 'ctsm5.1.dev053' into hist_vars_for_newton_krylov
slevis-lmwg Aug 19, 2021
07c641b
user_nl_clm and shell_commands files for Newton-Krylov testing
slevis-lmwg Aug 21, 2021
2687cf1
Typo correction...
slevis-lmwg Aug 21, 2021
bae1162
Merge tag 'ctsm5.1.dev053' into vert_res_in_mimics
slevis-lmwg Aug 23, 2021
3033578
Merge branch 'hist_vars_for_newton_krylov' into vert_res_in_mimics
slevis-lmwg Aug 24, 2021
1c1a945
Made params consistent w current params file ctsm51_params.c210528.nc
slevis-lmwg Aug 25, 2021
ecadf73
Added use_mimics_decomp to the namelist
slevis-lmwg Aug 30, 2021
66d7b92
Introduced MIMICS test mod directory
slevis-lmwg Aug 31, 2021
3ff27f3
Debugging while running with use_mimics_decomp = .true.
slevis-lmwg Sep 4, 2021
ee6c401
Corrections to unit conversions based on meeting with @wwieder
slevis-lmwg Sep 13, 2021
680512e
C balance error seems resolved and replaced with N balance error
slevis-lmwg Sep 23, 2021
c522916
Now past the big N balance error but still getting small one
slevis-lmwg Sep 23, 2021
3ce2163
Small changes that seem necessary for N balance though still looking...
slevis-lmwg Oct 13, 2021
e037adf
Adding totmicn to the N balance; still not fixed though
slevis-lmwg Oct 19, 2021
e6d365c
Dimension p_decomp_cn_gain by pools instead of transitions
slevis-lmwg Oct 22, 2021
f3f7d0a
Eliminate max from a line and correct NaNs that resulted
slevis-lmwg Oct 25, 2021
80c0c2f
Updates discussed with @wwieder
slevis-lmwg Oct 25, 2021
520f4f9
The model now runs without balance or other errors
slevis-lmwg Oct 27, 2021
1faa673
Code simplification for improved clarity
slevis-lmwg Oct 27, 2021
e30d41e
Merge tag 'ctsm5.1.dev061' into vert_res_in_mimics
slevis-lmwg Nov 4, 2021
3b2073b
Minor corrections of mistakes that snuck through the dev061 merge
slevis-lmwg Nov 4, 2021
a399480
Change use_mimics_decomp -> mimics_decomp and coordinate w decomp_method
slevis-lmwg Nov 5, 2021
8166fd0
Updated params files and respective code
slevis-lmwg Nov 8, 2021
4eb3372
Add mimics tests, one to cheyenne and one to izumi test suites
slevis-lmwg Nov 8, 2021
019fe54
Update params files (var names/values), clean up various TODOs
slevis-lmwg Nov 15, 2021
3b94597
Revisions in response to Erik's code review and 1 or 2 remaining TODOs
slevis-lmwg Nov 16, 2021
3211e89
I should have removed this comment in the previous commit
slevis-lmwg Nov 16, 2021
e5f3ffd
Revert unnecessary changes in bld/listDefaultNamelist.pl
slevis-lmwg Nov 16, 2021
f6b3bf9
Correct the clay units by converting from % to fraction in MIMICS
slevis-lmwg Nov 18, 2021
2b071a3
Merge tag 'ctsm5.1.dev066' into vert_res_in_mimics
slevis-lmwg Dec 10, 2021
6205b30
First draft of updated ChangeLog
slevis-lmwg Dec 11, 2021
b69a4e7
Merge remote-tracking branch 'escomp/master' into vert_res_in_mimics
slevis-lmwg Jan 27, 2022
ab17157
Minor merge conflict caught by test-suite
slevis-lmwg Jan 27, 2022
c2a21bf
Update ChangeLog + add comment in SoilBiogeochemDecompCascadeMIMICSMod
slevis-lmwg Jan 28, 2022
99c3c30
Committing the three new timing calls that I added to time MIMICS
slevis-lmwg Jan 28, 2022
5451493
Updated ChangeLog/ChangeSum
slevis-lmwg Jan 29, 2022
eba8244
Added newton_krylov_spinup testmod and corresponding new test
slevis-lmwg Feb 2, 2022
be14cd1
Update changelog, tweak a few things, make sure issues mentioned have…
ekluzek Feb 2, 2022
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
1 change: 0 additions & 1 deletion src/biogeochem/CNFUNMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,6 @@ subroutine CNFUN(bounds,num_soilc, filter_soilc,num_soilp&
!---------------------------------
associate(ivt => patch%itype , & ! Input: [integer (:) ] p
leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN)
lflitcn => pftcon%lflitcn , & ! Input: leaf litter C:N (gC/gN)
season_decid => pftcon%season_decid , & ! Input: binary flag for seasonal
! -deciduous leaf habit (0 or 1)
stress_decid => pftcon%stress_decid , & ! Input: binary flag for stress
Expand Down
1 change: 0 additions & 1 deletion src/biogeochem/CNGRespMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ subroutine CNGResp(num_soilp, filter_soilp, cnveg_carbonflux_inst, canopystate_i
grperc => pftcon%grperc , & ! Input: growth respiration parameter
grpnow => pftcon%grpnow , & ! Input: growth respiration parameter
leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN)
frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN)
livewdcn => pftcon%livewdcn , & ! Input: live wood (phloem and ray parenchyma) C:N (gC/gN)

laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:)] sunlit projected leaf area index
Expand Down
1 change: 0 additions & 1 deletion src/biogeochem/CNGapMortalityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ subroutine CNGapMortality (bounds, num_soilc, filter_soilc, num_soilp, filter_so
heatstress => dgvs_inst%heatstress_patch , & ! Input: [real(r8) (:) ]

leafcn => pftcon%leafcn , & ! Input: [real(r8) (:)] leaf C:N (gC/gN)
frootcn => pftcon%frootcn , & ! Input: [real(r8) (:)] fine root C:N (gC/gN)
livewdcn => pftcon%livewdcn , & ! Input: [real(r8) (:)] live wood (phloem and ray parenchyma) C:N (gC/gN)
laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit projected leaf area index
laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded projected leaf area index
Expand Down
2 changes: 1 addition & 1 deletion src/biogeochem/CNNDynamicsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ subroutine CNNFixation(num_soilc, filter_soilc, &
!-----------------------------------------------------------------------

associate( &
cannsum_npp => cnveg_carbonflux_inst%annsum_npp_col , & ! Input: [real(r8) (:)] nitrogen deposition rate (gN/m2/s)
cannsum_npp => cnveg_carbonflux_inst%annsum_npp_col , & ! Input: [real(r8) (:)] (gC/m2/yr) annual sum of NPP, averaged from patch-level
col_lag_npp => cnveg_carbonflux_inst%lag_npp_col , & ! Input: [real(r8) (:)] (gC/m2/s) lagged net primary production

nfix_to_sminn => soilbiogeochem_nitrogenflux_inst%nfix_to_sminn_col & ! Output: [real(r8) (:)] symbiotic/asymbiotic N fixation to soil mineral N (gN/m2/s)
Expand Down
49 changes: 46 additions & 3 deletions src/biogeochem/CNVegCarbonFluxType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ module CNVegCarbonFluxType
use decompMod , only : bounds_type
use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con
use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools
use clm_varpar , only : nlevdecomp_full, nlevdecomp, i_litr_min, i_litr_max
use clm_varpar , only : nlevdecomp_full, nlevdecomp, i_litr_min, i_litr_max, i_cwdl2
use clm_varcon , only : spval, dzsoi_decomp
use clm_varctl , only : use_cndv, use_c13, use_nitrif_denitrif, use_crop
use clm_varctl , only : use_grainproduct
use clm_varctl , only : iulog
use landunit_varcon , only : istsoil, istcrop, istdlak
use pftconMod , only : npcropmin
use pftconMod , only : npcropmin, pftcon
use LandunitType , only : lun
use ColumnType , only : col
use PatchType , only : patch
Expand Down Expand Up @@ -4004,7 +4004,7 @@ subroutine Summary_carbonflux(this, &
use clm_varctl , only: nfix_timeconst, carbon_resp_opt
use subgridAveMod , only: p2c, c2g
use SoilBiogeochemDecompCascadeConType , only: decomp_cascade_con
use CNSharedParamsMod , only: use_fun
use CNSharedParamsMod , only: use_fun, CNParamsShareInst
!
! !ARGUMENTS:
class(cnveg_carbonflux_type) :: this
Expand Down Expand Up @@ -4396,6 +4396,19 @@ subroutine Summary_carbonflux(this, &
this%hrv_gresp_storage_to_litter_patch(p) + &
this%hrv_gresp_xfer_to_litter_patch(p)

if (use_mimics_decomp) then
! Calculate ligninNratio for leaves and fine roots
slevis-lmwg marked this conversation as resolved.
Show resolved Hide resolved
! TODO Declare ligninNratio vars wherever they need to be and
! initialize if necessary for call p2c to work correctly
associate(ivt => patch%itype) ! Input: [integer (:)] patch plant type
ligninNratio_leaf_patch(p) = pftcon%lf_flig(ivt(p)) * &
pftcon%lflitcn(ivt(p)) * &
this%leafc_to_litter_patch(p)
ligninNratio_froot_patch(p) = pftcon%fr_flig(ivt(p)) * &
pftcon%frootcn(ivt(p)) * &
this%frootc_to_litter_patch(p)
end associate
end if
end do ! end of patches loop

!------------------------------------------------
Expand Down Expand Up @@ -4440,6 +4453,36 @@ subroutine Summary_carbonflux(this, &
this%gpp_patch(bounds%begp:bounds%endp), &
this%gpp_col(bounds%begc:bounds%endc))

if (use_mimics_decomp) then
call p2c(bounds, num_soilc, filter_soilc, &
ligninNratio_leaf_patch(bounds%begp:bounds%endp), &
ligninNratio_leaf_col(bounds%begc:bounds%endc))
call p2c(bounds, num_soilc, filter_soilc, &
ligninNratio_froot_patch(bounds%begp:bounds%endp), &
ligninNratio_froot_col(bounds%begc:bounds%endc))
call p2c(bounds, num_soilc, filter_soilc, &
this%leafc_to_litter_patch(bounds%begp:bounds%endp), &
leafc_to_litter_col(bounds%begc:bounds%endc))
call p2c(bounds, num_soilc, filter_soilc, &
this%frootc_to_litter_patch(bounds%begp:bounds%endp), &
frootc_to_litter_col(bounds%begc:bounds%endc))

! Calculate ligninNratioAve
do fc = 1,num_soilc
c = filter_soilc(fc)
! TODO Use cwd_flig in *CascadeBGC the same way for consistency?
ligninNratio_cwd = CNParamsShareInst%cwd_flig * &
(this%cwdc_col(c) / this%cwdn_col(c)) * &
this%decomp_cascade_ctransfer_col(c,i_cwdl2)
this%ligninNratioAvg_col(c) = &
(ligninNratio_leaf_col(c) + ligninNratio_froot_col(c) + &
ligninNratio_cwd) / &
max(1.0e-3_r8, leafc_to_litter_col(c) + &
frootc_to_litter_col(c) + &
this%decomp_cascade_ctransfer_col(c,i_cwdl2))
end do
end if

! this code is to calculate an exponentially-relaxed npp value for use in NDynamics code

if ( trim(isotope) == 'bulk') then
Expand Down
19 changes: 14 additions & 5 deletions src/main/clm_varpar.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ module clm_varpar
use shr_sys_mod , only: shr_sys_abort
use spmdMod , only: masterproc
use clm_varctl , only: use_extralakelayers, use_vertsoilc
use clm_varctl , only: use_century_decomp, use_c13, use_c14
use clm_varctl , only: use_century_decomp, use_mimics_decomp
use clm_varctl , only: use_c13, use_c14
use clm_varctl , only: iulog, use_crop, create_crop_landunit, irrigate
use clm_varctl , only: use_vichydro, rundef
use clm_varctl , only: soil_layerstruct_predefined
Expand Down Expand Up @@ -72,6 +73,8 @@ module clm_varpar
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_cwd = -9 ! index of cwd pool; overwritten in SoilBiogeochemDecompCascade*Mod
! TODO Not necessary but cleaner to use this copy of i_cwdl2 in *CascadeBGC?
integer, public :: i_cwdl2 = -9 ! index of cwd to l2 transition; overwritten in SoilBiogeochemDecompCascade*Mod
slevis-lmwg marked this conversation as resolved.
Show resolved Hide resolved

integer, public :: ndecomp_pools_max
integer, public :: ndecomp_pools
Expand Down Expand Up @@ -237,22 +240,28 @@ subroutine clm_varpar_init(actual_maxsoil_patches, actual_numcft)
! in InitAllocate (in SoilBiogeochemStateType) which is called earlier than
! init_decompcascade_bgc where they might have otherwise been derived on the
! fly. For reference, if they were determined in init_decompcascade_bgc:
! ndecomp_pools would get the value of i_pas_som or i_cwd and
! ndecomp_cascade_transitions would get the value of i_s3s1 or i_cwdl3
! ndecomp_pools would get the value of i_oli_mic or i_cwd and
! ndecomp_cascade_transitions would get the value of i_m2s3 or i_cwdl2
! depending on how use_fates is set.
if ( use_fates ) then
if (use_century_decomp) then
ndecomp_pools = 6
ndecomp_cascade_transitions = 8
else ! TODO slevis: Currently for CN. MIMICS will get its own.
else if (use_mimics_decomp) then
ndecomp_pools = 7
ndecomp_cascade_transitions = 14
else ! TODO slevis: Currently for CN (deprecated)
ndecomp_pools = 7
ndecomp_cascade_transitions = 7
end if
else
if (use_century_decomp) then
ndecomp_pools = 7
ndecomp_cascade_transitions = 10
else ! TODO slevis: Currently for CN. MIMICS will get its own.
else if (use_mimics_decomp) then
ndecomp_pools = 8
ndecomp_cascade_transitions = 15
else ! TODO slevis: Currently for CN (deprecated)
ndecomp_pools = 8
ndecomp_cascade_transitions = 9
end if
Expand Down
3 changes: 3 additions & 0 deletions src/soilbiogeochem/SoilBiogeochemDecompCascadeConType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module SoilBiogeochemDecompCascadeConType
character(len=8) , pointer :: decomp_pool_name_history(:) ! name of pool for history files
character(len=20) , pointer :: decomp_pool_name_long(:) ! name of pool for netcdf long names
character(len=8) , pointer :: decomp_pool_name_short(:) ! name of pool for netcdf short names
logical , pointer :: is_microbe(:) ! TRUE => pool is a microbe pool
logical , pointer :: is_litter(:) ! TRUE => pool is a litter pool
logical , pointer :: is_soil(:) ! TRUE => pool is a soil pool
logical , pointer :: is_cwd(:) ! TRUE => pool is a cwd pool
Expand Down Expand Up @@ -72,6 +73,7 @@ subroutine init_decomp_cascade_constants( use_century_decomp )
allocate(decomp_cascade_con%decomp_pool_name_history(ibeg:ndecomp_pools))
allocate(decomp_cascade_con%decomp_pool_name_long(ibeg:ndecomp_pools))
allocate(decomp_cascade_con%decomp_pool_name_short(ibeg:ndecomp_pools))
allocate(decomp_cascade_con%is_microbe(ibeg:ndecomp_pools))
allocate(decomp_cascade_con%is_litter(ibeg:ndecomp_pools))
allocate(decomp_cascade_con%is_soil(ibeg:ndecomp_pools))
allocate(decomp_cascade_con%is_cwd(ibeg:ndecomp_pools))
Expand All @@ -93,6 +95,7 @@ subroutine init_decomp_cascade_constants( use_century_decomp )
decomp_cascade_con%decomp_pool_name_restart(ibeg:ndecomp_pools) = ''
decomp_cascade_con%decomp_pool_name_long(ibeg:ndecomp_pools) = ''
decomp_cascade_con%decomp_pool_name_short(ibeg:ndecomp_pools) = ''
decomp_cascade_con%is_microbe(ibeg:ndecomp_pools) = .false.
decomp_cascade_con%is_litter(ibeg:ndecomp_pools) = .false.
decomp_cascade_con%is_soil(ibeg:ndecomp_pools) = .false.
decomp_cascade_con%is_cwd(ibeg:ndecomp_pools) = .false.
Expand Down
Loading