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

migrate FATES to use the normal BGC call sequence #1959

Merged
merged 55 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
ff2e756
Mocked up the updated cbalance checking with fates
rgknox Jan 27, 2023
55f0af2
Incremental progress towareds converting fates-clm carbon accounting …
rgknox Feb 3, 2023
789eb9c
another incremental step towards having the native cn balancing and c…
rgknox Feb 13, 2023
c506151
more incremental fates-clm mass balance checking and pathway coupling…
rgknox Feb 16, 2023
f38d9a3
Incremental progress towards getting fates to work with the C and N b…
rgknox Mar 1, 2023
2f1ec52
Pass through of getting fates in the full BGC call sequence. This inc…
rgknox Mar 2, 2023
cb4f510
Added suppln to fates cases
rgknox Mar 2, 2023
782b894
added vertical profile code to the fates bgc call sequence
rgknox Mar 6, 2023
4772204
minor changes ot clmbuildnamelist
rgknox Mar 6, 2023
12e6b11
Removed various if-clauses that prevented BGC calls and initializatio…
rgknox Mar 9, 2023
5539289
FATES bgc work. Add use_fates_bgc, cleaned out some use_fates filteri…
rgknox Mar 10, 2023
0248331
Merge branch 'master' into clmfates-cbalance
rgknox Mar 10, 2023
8e638d4
updated fates external and the default parameter file
rgknox Mar 13, 2023
4bdfea6
moved the use_fates broadcast earlier in the control process
rgknox Mar 14, 2023
f4092b3
Fixes to CN wood products restart w/ fates on
rgknox Mar 15, 2023
873883c
cleaning up clm-fates bgc pr
rgknox Mar 15, 2023
79a77d6
cleanup of fates-bgc coupling
rgknox Mar 16, 2023
ff923e1
FATES in the normal bgc call sequence, addressing reviewer comments
rgknox May 25, 2023
158b182
Part-way through re-name-spacing the soilc and soilp filters for BGC
rgknox May 25, 2023
82d9b57
Updates to the build-namelist
rgknox May 26, 2023
1d3e8d0
Reverting namelist defaults related to NDEP, we were getting ahead of…
rgknox Jun 7, 2023
c9b6ce9
merge resolution, mostly conflicts with Gross Unrepresented Landuse t…
rgknox Jun 7, 2023
7fa071d
Fixes to build
rgknox Jun 8, 2023
6959556
Reverted use_cn filter on ndep namelist settings
rgknox Jun 8, 2023
27e28ab
preserving b4b on nitrogen variables by referting a filter to allc
rgknox Jun 8, 2023
0f2d990
Updates to the fates-clm bgc call sequence, to preserve b4b behavior …
rgknox Jun 12, 2023
0676ac2
various fixes for fates bgc
rgknox Jun 14, 2023
868e8c2
reverted call order on readfirenml
rgknox Jun 30, 2023
080cd5b
Update default scope of cn_products_type procedures
rgknox Jun 30, 2023
a4e690b
update to the span of columns that carbon summary variables are calcu…
rgknox Jul 4, 2023
40e7600
Fixes to zeroing carbon and nitrogen summary variables
rgknox Jul 5, 2023
f452386
merge resolution on fates bgc call sequence and dev 130
rgknox Jul 12, 2023
3a8fb5c
forgot to remove conflict tags
rgknox Jul 12, 2023
27f336d
Return this to what it was before the FATES addition should come later
ekluzek Jul 19, 2023
132f4eb
Check that with FATES on neither LUNA nor FUN can be on
ekluzek Jul 19, 2023
d4261c8
Explicitly make sure you can not turn LUNA on with FATES, and add a u…
ekluzek Jul 19, 2023
d2306c5
Add a test that FATES with suplemental nitrogen on is NOT allowed, th…
ekluzek Jul 19, 2023
739cf7c
Add error check for suplnitro for FATES
ekluzek Jul 20, 2023
d4ed2f6
resolving reviewer requests for clmfate-cbalance
rgknox Jul 24, 2023
9dac206
removed fates columns from the nocrop filter
rgknox Jul 24, 2023
6f3a2f1
Added calls to set the litter source on restart for fates
rgknox Jul 26, 2023
dbac92c
Updates to nfixing during fates run
rgknox Jul 27, 2023
7c920c6
Moved a call to update a call to fates litter fluxes to be immediatel…
rgknox Aug 10, 2023
e305a29
conflict resolutions between dev133 and clmfates-bgc
rgknox Aug 11, 2023
907ca1a
Provisions to satisfy nag compiler, cnveg datastructures on now alloc…
Aug 12, 2023
eaea030
Update to clm-fates-bgc zero-allocating instead of not allocating cnv…
Aug 14, 2023
6925f8c
Update fates external pointer to the fates bgc call sequence tag
rgknox Aug 14, 2023
1ccf0d9
update changelog
rgknox Aug 14, 2023
8056ae6
Run through black, fix #2112
ekluzek Aug 16, 2023
c05ce88
Add black commit to git blame ignore file
ekluzek Aug 16, 2023
76f1310
Add list of source files and directories to the github action
ekluzek Aug 16, 2023
89ad049
Try it with a one line list with square brackets
ekluzek Aug 16, 2023
44c696e
Add actions for each source
ekluzek Aug 16, 2023
bab1735
Needs a dot in front of the directory, so doesn't do an absolute path
ekluzek Aug 16, 2023
5765f94
Update Change files
ekluzek Aug 16, 2023
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
9 changes: 7 additions & 2 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2892,20 +2892,25 @@ sub setup_logic_supplemental_nitrogen {
'suplnitro', 'use_cn'=>$nl_flags->{'use_cn'}, 'use_crop'=>$nl_flags->{'use_crop'});
}

if ( $nl_flags->{'bgc_mode'} ne "sp" && $nl_flags->{'bgc_mode'} eq "fates" ) {
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl,
'suplnitro', 'use_fates'=>$nl_flags->{'use_fates'});
}

#
# Error checking for suplnitro
#
my $suplnitro = $nl->get_value('suplnitro');
if ( defined($suplnitro) ) {
if ( $nl_flags->{'bgc_mode'} eq "sp" ) {
$log->fatal_error("supplemental Nitrogen (suplnitro) is set, but neither CN nor CNDV is active!");
$log->fatal_error("supplemental Nitrogen (suplnitro) is set, but neither CN nor CNDV nor FATES is active!");
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
}
if ( ! &value_is_true($nl_flags->{'use_crop'}) && $suplnitro =~ /PROG_CROP_ONLY/i ) {
$log->fatal_error("supplemental Nitrogen is set to run over prognostic crops, but prognostic crop is NOT active!");
}

if ( $suplnitro =~ /ALL/i ) {
if ( $nl_flags->{'bgc_spinup'} eq "on" ) {
if ( $nl_flags->{'bgc_spinup'} eq "on" && $nl_flags->{'bgc_mode'} ne "fates" ) {
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
$log->warning("There is no need to use a bgc_spinup mode when supplemental Nitrogen is on for all PFT's, as these modes spinup Nitrogen" );
}
}
Expand Down
2 changes: 1 addition & 1 deletion bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).

<!-- Supplmental Nitrogen mode -->
<suplnitro use_cn=".true." >NONE</suplnitro>
<suplnitro use_fates=".true." >NONE</suplnitro>
<suplnitro use_fates=".true." >ALL</suplnitro>

<!-- Albedo for glaciers -->
<albice phys="clm5_1" >0.50,0.30</albice>
Expand Down
48 changes: 27 additions & 21 deletions src/biogeochem/CNAnnualUpdateMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module CNAnnualUpdateMod
use CNvegStateType , only : cnveg_state_type
use PatchType , only : patch
use filterColMod , only : filter_col_type, col_filter_from_filter_and_logical_array
use ColumnType , only : col
!
implicit none
private
Expand Down Expand Up @@ -55,20 +56,23 @@ subroutine CNAnnualUpdate(bounds, num_soilc, filter_soilc, num_soilp, filter_soi

do fc = 1,num_soilc
c = filter_soilc(fc)
cnveg_state_inst%annsum_counter_col(c) = cnveg_state_inst%annsum_counter_col(c) + dt
if (cnveg_state_inst%annsum_counter_col(c) >= secspyear) then
end_of_year(c) = .true.
cnveg_state_inst%annsum_counter_col(c) = 0._r8
else
end_of_year(c) = .false.
if(.not.col%is_fates(c))then
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
cnveg_state_inst%annsum_counter_col(c) = cnveg_state_inst%annsum_counter_col(c) + dt
if (cnveg_state_inst%annsum_counter_col(c) >= secspyear) then
end_of_year(c) = .true.
cnveg_state_inst%annsum_counter_col(c) = 0._r8
else
end_of_year(c) = .false.
end if
end if
end do


do fp = 1,num_soilp
p = filter_soilp(fp)
c = patch%column(p)

if (end_of_year(c)) then
if (end_of_year(c) .and. .not.col%is_fates(c)) then
ekluzek marked this conversation as resolved.
Show resolved Hide resolved

! update annual plant ndemand accumulator
cnveg_state_inst%annsum_potential_gpp_patch(p) = cnveg_state_inst%tempsum_potential_gpp_patch(p)
Expand All @@ -94,20 +98,22 @@ subroutine CNAnnualUpdate(bounds, num_soilc, filter_soilc, num_soilp, filter_soi
end do

! Get column-level averages, just for the columns that have reached their personal end-of-year
filter_endofyear_c = col_filter_from_filter_and_logical_array( &
bounds = bounds, &
num_orig = num_soilc, &
filter_orig = filter_soilc, &
logical_col = end_of_year(bounds%begc:bounds%endc))

call p2c(bounds, filter_endofyear_c%num, filter_endofyear_c%indices, &
cnveg_carbonflux_inst%annsum_npp_patch(bounds%begp:bounds%endp), &
cnveg_carbonflux_inst%annsum_npp_col(bounds%begc:bounds%endc))

call p2c(bounds, filter_endofyear_c%num, filter_endofyear_c%indices, &
cnveg_state_inst%annavg_t2m_patch(bounds%begp:bounds%endp), &
cnveg_state_inst%annavg_t2m_col(bounds%begc:bounds%endc))

if(num_soilp>0)then
ekluzek marked this conversation as resolved.
Show resolved Hide resolved
filter_endofyear_c = col_filter_from_filter_and_logical_array( &
bounds = bounds, &
num_orig = num_soilc, &
filter_orig = filter_soilc, &
logical_col = end_of_year(bounds%begc:bounds%endc))

call p2c(bounds, filter_endofyear_c%num, filter_endofyear_c%indices, &
cnveg_carbonflux_inst%annsum_npp_patch(bounds%begp:bounds%endp), &
cnveg_carbonflux_inst%annsum_npp_col(bounds%begc:bounds%endc))

call p2c(bounds, filter_endofyear_c%num, filter_endofyear_c%indices, &
cnveg_state_inst%annavg_t2m_patch(bounds%begp:bounds%endp), &
cnveg_state_inst%annavg_t2m_col(bounds%begc:bounds%endc))
end if

end subroutine CNAnnualUpdate

end module CNAnnualUpdateMod
Loading