Skip to content

Commit

Permalink
Merge pull request ESCOMP#2594 from rgknox/fates-hist-flush
Browse files Browse the repository at this point in the history
fates history flushing
  • Loading branch information
ekluzek authored Sep 5, 2024
2 parents 0999a32 + 249f850 commit b4199d8
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
[submodule "fates"]
path = src/fates
url = https://github.com/NGEET/fates
fxtag = sci.1.77.2_api.36.0.0
fxtag = sci.1.78.2_api.36.0.0
fxrequired = AlwaysRequired
# Standard Fork to compare to with "git fleximod test" to ensure personal forks aren't committed
fxDONOTUSEurl = https://github.com/NCAR/fates-release
Expand Down
3 changes: 2 additions & 1 deletion cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,7 @@
<test name="SMS" grid="f45_f45_mg37" compset="I2000Clm60FatesSpRsGs" testmods="clm/FatesColdSatPhen">
<machines>
<machine name="derecho" compiler="nvhpc" category="aux_clm"/>
<machine name="derecho" compiler="nvhpc" category="fates"/>
</machines>
<options>
<option name="wallclock">00:20:00</option>
Expand Down Expand Up @@ -3169,7 +3170,7 @@
<test name="SMS_D" grid="1x1_brazil" compset="I2000Clm60FatesSpCruRsGs" testmods="clm/FatesColdSatPhen">
<machines>
<machine name="derecho" compiler="intel" category="ctsm_sci"/>
<machine name="derecho" compiler="intel" category="fates"/>
<machine name="derecho" compiler="gnu" category="fates"/>
</machines>
<options>
<option name="wallclock">00:20:00</option>
Expand Down
3 changes: 1 addition & 2 deletions cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ hist_fincl1 = 'FATES_NCOHORTS', 'FATES_TRIMMING', 'FATES_AREA_PLANTS',
'FATES_NEP', 'FATES_HET_RESP', 'FATES_FIRE_CLOSS', 'FATES_FIRE_FLUX_EL',
'FATES_CBALANCE_ERROR', 'FATES_ERROR_EL', 'FATES_LEAF_ALLOC',
'FATES_SEED_ALLOC', 'FATES_STEM_ALLOC', 'FATES_FROOT_ALLOC',
'FATES_CROOT_ALLOC', 'FATES_STORE_ALLOC',
'FATES_PATCHAREA_LU', 'FATES_DISTURBANCE_RATE_MATRIX_LULU'
'FATES_CROOT_ALLOC', 'FATES_STORE_ALLOC'
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ hist_fincl1 = 'FATES_TLONGTERM',
'FATES_MORTALITY_CROWNSCORCH_SZPF','FATES_MORTALITY_CAMBIALBURN_SZPF','FATES_MORTALITY_TERMINATION_SZPF',
'FATES_MORTALITY_LOGGING_SZPF','FATES_MORTALITY_FREEZING_SZPF','FATES_MORTALITY_SENESCENCE_SZPF',
'FATES_MORTALITY_AGESCEN_SZPF','FATES_MORTALITY_AGESCEN_ACPF','FATES_MORTALITY_CANOPY_SZPF',
'FATES_M3_MORTALITY_CANOPY_SZPF','FATES_M3_MORTALITY_USTORY_SZPF','FATES_C13DISC_SZPF',
'FATES_M3_MORTALITY_CANOPY_SZPF','FATES_M3_MORTALITY_USTORY_SZPF',
'FATES_STOREC_CANOPY_SZPF','FATES_LEAFC_CANOPY_SZPF','FATES_LAI_CANOPY_SZPF','FATES_CROWNAREA_CANOPY_SZPF',
'FATES_CROWNAREA_USTORY_SZPF','FATES_NPLANT_CANOPY_SZPF','FATES_MORTALITY_USTORY_SZPF','FATES_STOREC_USTORY_SZPF',
'FATES_LEAFC_USTORY_SZPF','FATES_LAI_USTORY_SZPF','FATES_NPLANT_USTORY_SZPF','FATES_CWD_ABOVEGROUND_DC',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ use_fates_nocomp = .true.
use_fates_fixed_biogeog = .true.
use_fates_sp = .false.
use_fates_potentialveg = .false.
hist_fincl1 = 'FATES_PATCHAREA_LU', 'FATES_DISTURBANCE_RATE_MATRIX_LULU',
'FATES_TRANSITION_MATRIX_LULU'
79 changes: 79 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,83 @@
===============================================================
Tag name: ctsm5.2.028
Originator(s): rgknox (Ryan Knox, LBNL, [email protected])
glemieux (Gregory Lemieux, LBNL, [email protected])
Date: Thu 05 Sep 2024 02:47:14 PM MDT
One-line Summary: FATES history flushing update

Purpose and description of changes
----------------------------------

This updates the way in which FATES history output is flushed during model initialization
utilizing a new FATES-side subroutine, flush_all_hvars. This update also makes corrections
to a subset of FATES testmods as well as expands the FATES test list by duplicating two
existing tests to run on different compilers for better coverage. The FATES submodule tag
has been updated to the latest scientific tag as well.


Significant changes to scientifically-supported configurations
--------------------------------------------------------------

Does this tag change answers significantly for any of the following physics configurations?
(Details of any changes will be given in the "Answer changes" section below.)

[Put an [X] in the box for any configuration with significant answer changes.]

[ ] clm6_0

[ ] clm5_1

[ ] clm5_0

[ ] ctsm5_0-nwp

[ ] clm4_5


Bugs fixed
----------
List of CTSM issues fixed (include CTSM Issue # and description) [one per line]:
Fixes #2657 Add FATES_TRANSITIONS_MATRIX_LULU to FatesColdLUH2 testmods

Notes of particular relevance for developers:
---------------------------------------------
Changes to tests or testing:

Adds nvhpc and gnu FatesSatColdPhen smoke tests to the fates list to expand compiler
coverage.

Testing summary:
----------------

[PASS means all tests PASS; OK means tests PASS other than expected fails.]

regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing):

derecho ----- OK
izumi ------- OK

fates tests: (give name of baseline if different from CTSM tagname, normally fates baselines are fates-<FATES TAG>-<CTSM TAG>)
derecho ----- OK
izumi ------- OK

Answer changes
--------------

Changes answers relative to baseline: Yes, for FATES tests only

Changes are consistent with differences in FATES_EFFECT_WSPEED due to NGEET/fates#1215

Other details
-------------
List any git submodules updated (cime, rtm, mosart, cism, fates, etc.):

FATES: sci.1.77.2_api.36.0.0 -> sci.1.78.2_api.36.0.0

Pull Requests that document the changes (include PR ids):
https://github.com/ESCOMP/ctsm/pull/2594

===============================================================
===============================================================
Tag name: ctsm5.2.027
Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326)
Date: Wed 28 Aug 2024 09:13:22 PM MDT
Expand Down
1 change: 1 addition & 0 deletions doc/ChangeSum
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Tag Who Date Summary
============================================================================================================================
ctsm5.2.028 rgknox 09/05/2024 FATES history flushing update
ctsm5.2.027 erik 08/28/2024 Merge b4b-dev
ctsm5.2.026 slevis 08/23/2024 Turn on excess ice, explicit AC, Leung_2023 for clm6
ctsm5.2.025 samrabin 08/23/2024 Minor fixes to li2024 fire methods
Expand Down
58 changes: 16 additions & 42 deletions src/utils/clmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ module CLMFatesInterfaceMod
use FatesParametersInterface, only : fates_parameters_type

use FatesInterfaceMod , only : DetermineGridCellNeighbors
use FatesIOVariableKindMod, only : group_dyna_simple, group_dyna_complx
use FatesHistoryInterfaceMod, only : fates_hist
use FatesRestartInterfaceMod, only : fates_restart_interface_type

Expand Down Expand Up @@ -1241,14 +1240,6 @@ subroutine dynamics_driv(this, nc, bounds_clump, &
call this%WrapUpdateFatesSeedInOut(bounds_clump)
end if

! ---------------------------------------------------------------------------------
! Flush arrays to values defined by %flushval (see registry entry in
! subroutine define_history_vars()
! ---------------------------------------------------------------------------------
call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_simple)

call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_complx)

! ---------------------------------------------------------------------------------
! Part II: Call the FATES model now that input boundary conditions have been
! provided.
Expand Down Expand Up @@ -2019,23 +2010,16 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, &
this%fates(nc)%sites, &
this%fates(nc)%bc_out)


! ------------------------------------------------------------------------
! Update history IO fields that depend on ecosystem dynamics
! Flush FATES history variables.
! The flushing process sets all columns outside of FATES perview to
! the ignore value. This only needs to be done once, because FATES will
! not overwright values outside the columns that it is in charge of.
! ------------------------------------------------------------------------
if(fates_history_dimlevel(2)>0) then
call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_simple)
do s = 1,this%fates(nc)%nsites
call fates_hist%zero_site_hvars(this%fates(nc)%sites(s), &
upfreq_in=group_dyna_simple)
end do
if(fates_history_dimlevel(2)>1) then
call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_complx)
do s = 1,this%fates(nc)%nsites
call fates_hist%zero_site_hvars(this%fates(nc)%sites(s), &
upfreq_in=group_dyna_complx)
end do
end if
end if

call fates_hist%flush_all_hvars(nc)

call fates_hist%update_history_dyn( nc, &
this%fates(nc)%nsites, &
this%fates(nc)%sites, &
Expand Down Expand Up @@ -2220,22 +2204,15 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, &
soilbiogeochem_carbonflux_inst, .false.)

! ------------------------------------------------------------------------
! Update history IO fields that depend on ecosystem dynamics
! Flush and zero FATES history variables.
! The flushing process sets all columns outside of FATES perview to
! the ignore value. This only needs to be done once, because FATES will
! not overwright values outside the columns that it is in charge of.
! We also start off by setting all values on FATES columns to zero.
! ------------------------------------------------------------------------
if(fates_history_dimlevel(2)>0) then
call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_simple)
do s = 1,this%fates(nc)%nsites
call fates_hist%zero_site_hvars(this%fates(nc)%sites(s), &
upfreq_in=group_dyna_simple)
end do
if(fates_history_dimlevel(2)>1) then
call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_complx)
do s = 1,this%fates(nc)%nsites
call fates_hist%zero_site_hvars(this%fates(nc)%sites(s), &
upfreq_in=group_dyna_complx)
end do
end if
end if

call fates_hist%flush_all_hvars(nc)

call fates_hist%update_history_dyn( nc, &
this%fates(nc)%nsites, &
this%fates(nc)%sites, &
Expand Down Expand Up @@ -3626,9 +3603,6 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, &
this%fates(nc)%bc_out(s)%plant_stored_h2o_si
end do


! Update History Buffers that need to be updated after hydraulics calls

call fates_hist%update_history_hydraulics(nc, &
this%fates(nc)%nsites, &
this%fates(nc)%sites, &
Expand Down

0 comments on commit b4199d8

Please sign in to comment.