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

Get FATES and carbon_only test-suite tests to pass with MIMICS active #1643

Merged
merged 30 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d5c1ed5
Changes to get FATES and carbon_only tests pass with MIMICS active
slevis-lmwg Feb 9, 2022
28a0406
Access the FATES copy of annsum_npp in FATES-MIMICS simulations
slevis-lmwg Feb 14, 2022
a16cc85
Calc. ligninNratioAvg(c) from values by pft when use_fates = .true.
slevis-lmwg Feb 14, 2022
41802c2
Check that FATES-MIMICS cases set use_lch4 = .true., else fail
slevis-lmwg Feb 15, 2022
bea8e4a
Replaced if-statement with select case statement as per EK's review
slevis-lmwg Feb 25, 2022
88308bd
Merge remote-tracking branch 'escomp/master' into ligninNratio_forfates
slevis-lmwg Feb 25, 2022
c0747af
Get select case statmt to compile by changing case options to constants
slevis-lmwg Feb 25, 2022
098e86f
Update Fates testmod to run w MIMICS. First draft of ChangeLog updates.
slevis-lmwg Feb 26, 2022
86d18b2
Update ChangeLog with test-suite results
slevis-lmwg Feb 26, 2022
e52992c
Error check in the fortran to ensure MIMICS-FATES sets use_lch4 = .true.
slevis-lmwg Mar 13, 2022
d95a716
Reverted my mods to FATES test and added new FATES test
slevis-lmwg Mar 13, 2022
a8057f9
Update ChangeLog about my mods to the tests (see previous commit)
slevis-lmwg Mar 13, 2022
0438304
Added fates_and_lch4_if: construct around if statement for clarity
slevis-lmwg Mar 18, 2022
ffa084a
Made the fates_and_lch4_if into nested if statements for clearer code
slevis-lmwg Apr 4, 2022
8bf3153
Merge remote-tracking branch 'escomp/master' into ligninNratio_forfates
slevis-lmwg Apr 25, 2022
50f4af3
Update FATES-MIMICS to use FATES copy of ligninNratio
slevis-lmwg Apr 25, 2022
922aaf2
Revert a testmod change I had made for testing FATES-MIMICS
slevis-lmwg Apr 25, 2022
dd24018
Corrected to receive FATES variable litt_flux_ligc_per_n as site level
slevis-lmwg Apr 26, 2022
cd42ddf
Consolidating ligninNratioAvg var from cnveg_carbonflux to ...
slevis-lmwg Apr 27, 2022
eadb090
Update ChangeLog
slevis-lmwg Apr 27, 2022
f704b40
Update ChangeSum
slevis-lmwg Apr 27, 2022
c4708e9
Update comments about microbial C heterotrophic resp. per @wwieder
slevis-lmwg Apr 27, 2022
79a4ec3
Corrections needed for failing tests to pass
slevis-lmwg Apr 27, 2022
1a4bb3f
Fix for restart test that wasn't passing
slevis-lmwg Apr 28, 2022
e5c0d80
Make my restart-fix workaround thread-safe
slevis-lmwg Apr 29, 2022
6794fa3
Updates to get threaded test to PASS
slevis-lmwg Apr 30, 2022
392d047
Merge tag 'ctsm5.1.dev092' into ligninNratio_forfates
slevis-lmwg Apr 30, 2022
611fb16
Make copy_fates_var local to clmfates_interface module
slevis-lmwg May 3, 2022
08f3a3c
The new test added with this PR now also tests threading
slevis-lmwg May 3, 2022
28acc2f
Update date on changelog add description of issue
ekluzek May 4, 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
4 changes: 4 additions & 0 deletions src/main/ColumnType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ module ColumnType
logical , pointer :: active (:) ! true=>do computations on this column
logical , pointer :: type_is_dynamic (:) ! true=>itype can change throughout the run

logical , pointer :: copy_fates_var (:) ! .true. -> copy variable from FATES to CTSM in clmfates_interface
! .false. -> do not copy in clmfates_interface and use value already in memory
logical , pointer :: is_fates (:) ! .true. -> this is a fates column
! .false. -> this is NOT a fates column

Expand Down Expand Up @@ -120,6 +122,7 @@ subroutine Init(this, begc, endc)
allocate(this%type_is_dynamic(begc:endc)) ; this%type_is_dynamic(:) = .false.

allocate(this%is_fates(begc:endc)) ; this%is_fates(:) = .false.
allocate(this%copy_fates_var(begc:endc)) ; this%copy_fates_var(:) = .false.

! The following is set in initVerticalMod
allocate(this%snl (begc:endc)) ; this%snl (:) = ispval !* cannot be averaged up
Expand Down Expand Up @@ -159,6 +162,7 @@ subroutine Clean(this)
deallocate(this%itype )
deallocate(this%lun_itype )
deallocate(this%active )
deallocate(this%copy_fates_var)
deallocate(this%is_fates )
deallocate(this%type_is_dynamic)
deallocate(this%snl )
Expand Down
13 changes: 6 additions & 7 deletions src/utils/clmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ module CLMFatesInterfaceMod
private :: GetAndSetTime

logical :: debug = .false.
logical, allocatable :: copy_fates_var(:) ! True if prefer to copy var from FATES to CTSM in clmfates_interface

character(len=*), parameter, private :: sourcefile = &
__FILE__
Expand Down Expand Up @@ -546,15 +545,13 @@ subroutine init(this, bounds_proc )
write(iulog,*) 'clm_fates%init(): allocating for ',nclumps,' threads'
end if


!$OMP PARALLEL DO PRIVATE (nc,bounds_clump,nmaxcol,s,c,l,g,collist,pi,pf,ft)
do nc = 1,nclumps
call get_clump_bounds(nc, bounds_clump)

nmaxcol = bounds_clump%endc - bounds_clump%begc + 1

allocate(collist(1:nmaxcol))
allocate(copy_fates_var(1:nmaxcol))
copy_fates_var(:) = .false. ! .false. when starting any run

! Allocate the mapping that points columns to FATES sites, 0 is NA
allocate(this%f2hmap(nc)%hsites(bounds_clump%begc:bounds_clump%endc))
Expand Down Expand Up @@ -583,6 +580,8 @@ subroutine init(this, bounds_proc )
end if
endif

col%copy_fates_var(c) = .false.
slevis-lmwg marked this conversation as resolved.
Show resolved Hide resolved

enddo

if(debug)then
Expand Down Expand Up @@ -1112,7 +1111,7 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, &
!------------------------------------------------------------------------
! FATES calculation of ligninNratio
!------------------------------------------------------------------------
! If it's the first timestep of a restart and copy_fates_var(c) = .false.
! If it's the first timestep of a restart & copy_fates_var(c) = .false.
! (this will happen in the first timestep of any restart)
! then skip this variable because a more accurate value was obtained
! from the restart file.
Expand All @@ -1128,8 +1127,8 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, &
!------------------------------------------------------------------------
do s = 1, this%fates(nc)%nsites
c = this%f2hmap(nc)%fcolumn(s)
if (is_first_restart_step() .and. .not. copy_fates_var(c)) then
copy_fates_var(c) = .true.
if (is_first_restart_step() .and. .not. col%copy_fates_var(c)) then
col%copy_fates_var(c) = .true.
else
soilbiogeochem_carbonflux_inst%litr_lig_c_to_n_col(c) = &
this%fates(nc)%bc_out(s)%litt_flux_ligc_per_n
Expand Down