Skip to content

Commit

Permalink
Merge tag 'ctsm5.1.dev066' into dynamic_urban
Browse files Browse the repository at this point in the history
This set of changes synchronizes CTSM with API 20 of FATES.  API 20 of FATES requires a modification to timing boundary conditions so that FATES can maintain its own internal running means.  FATES also no-longer asks CTSM for the 24hour vegetation temperature, since this is a patch(pft) level variable, and FATES has more suitable averaging mechanisms.  These changes are synchronized with FATES Pull Request: NGEET/fates#724, which subsequently created tag: https://github.com/NGEET/fates/releases/tag/sci.1.52.0_api.20.0.0
  • Loading branch information
olyson committed Dec 13, 2021
2 parents 4996326 + ea6db00 commit 7416cd2
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Externals_CLM.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
local_path = src/fates
protocol = git
repo_url = https://github.com/NGEET/fates
tag = sci.1.51.0_api.19.0.0
tag = sci.1.52.0_api.20.0.0
required = True

[externals_description]
Expand Down
59 changes: 59 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,63 @@
===============================================================
Tag name: ctsm5.1.dev066
Originator(s): rgknox (Ryan Knox,,,)
Date: Sat Dec 4 01:58:42 MST 2021
One-line Summary: API change with FATES to enable running means inside fates, includes passing in of model timestep

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

This set of changes synchronizes CTSM with API 20 of FATES. API 20 of FATES requires a modification to timing boundary conditions so that FATES can maintain its own internal running means. FATES also no-longer asks CTSM for the 24hour vegetation temperature, since this is a patch(pft) level variable, and FATES has more suitable averaging mechanisms. These changes are synchronized with FATES Pull Request: https://github.com/NGEET/fates/pull/724, which subsequently created tag: https://github.com/NGEET/fates/releases/tag/sci.1.52.0_api.20.0.0


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.]

[ ] clm5_1

[ ] clm5_0

[ ] ctsm5_0-nwp

[ ] clm4_5

[x] clm_fates

Notes of particular relevance for developers:
---------------------------------------------

Developers should be aware that FATES does require information on the model timestep, which was not necessarily available in initialize1. Efforts were made to circumvent needing the model timetep at this phase of initialization, so impact on non-fates code was minimal.


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

cheyenne ---- PASS (fates had expectedly different results compared to base)
izumi ------- PASS (fates had expectedly different results compared to base)

fates tests: (give name of baseline if different from CTSM tagname, normally fates baselines are fates-<FATES TAG>-<CTSM TAG>)
cheyenne ---- PASS (fates had expectedly different results compared to base)
izumi -------


Additional tests:
Multi-decadal simulations were also run to evaluate fates side sensitivity to slightly different averaging scheme. The differences were not so subtle, attributed mostly to fixing an initialization bug (the previous 24hour temperature had initialized at 0K) and a 1-hour phase change in the 24-hour start-stop cycle.


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

Changes answers relative to baseline: all FATES active simulations have different results.


===============================================================
===============================================================
Tag name: ctsm5.1.dev065
Originator(s): glemieux (Gregory Lemieux,LBL/NGEET,510-486-5049)
Date: Thu Dec 2 00:13:37 MST 2021
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.1.dev066 rgknox 12/04/2021 API change with FATES to enable running means inside fates, includes passing in of model timestep
ctsm5.1.dev065 glemieux 12/02/2021 Refactor static fire data input by moving variables into fire_base_type from cnveg_state_type
ctsm5.1.dev064 afoster 11/29/2021 Updates to facilitate FATES history variable overhaul
ctsm5.1.dev063 glemieux 11/23/2021 Provide access to the fraction of canopy covered by snow variable to fates
Expand Down
3 changes: 2 additions & 1 deletion src/biogeophys/CanopyFluxesMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp,
bsha => energyflux_inst%bsha_patch ! Output: [real(r8) (:) ] sunlit canopy transpiration wetness factor (0 to 1)
end if


! Determine step size

dtime = get_step_size_real()
Expand All @@ -631,7 +632,7 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp,

fn = num_exposedvegp
filterp(1:fn) = filter_exposedvegp(1:fn)

! -----------------------------------------------------------------
! Time step initialization of photosynthesis variables
! -----------------------------------------------------------------
Expand Down
15 changes: 11 additions & 4 deletions src/main/clm_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,12 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro

if ( use_fates) then

! FATES has its own running mean functions, such as 24hr
! vegetation temperature and exponential moving averages
! for leaf photosynthetic acclimation temperature. These
! moving averages are updated here
call clm_fates%WrapUpdateFatesRmean(nc,temperature_inst)

call EDBGCDyn(bounds_clump, &
filter(nc)%num_soilc, filter(nc)%soilc, &
filter(nc)%num_soilp, filter(nc)%soilp, &
Expand All @@ -1092,11 +1098,11 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro
c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, &
soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, &
clm_fates, nc)

call clm_fates%wrap_update_hifrq_hist(bounds_clump, &
soilbiogeochem_carbonflux_inst, &
soilbiogeochem_carbonstate_inst)


if( is_beg_curr_day() ) then

Expand All @@ -1107,7 +1113,6 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro
if ( masterproc ) then
write(iulog,*) 'clm: calling FATES model ', get_nstep()
end if

call clm_fates%dynamics_driv( nc, bounds_clump, &
atm2lnd_inst, soilstate_inst, temperature_inst, active_layer_inst, &
water_inst%waterstatebulk_inst, water_inst%waterdiagnosticbulk_inst, &
Expand All @@ -1119,7 +1124,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro
call setFilters( bounds_clump, glc_behavior )

end if




end if ! use_fates branch

! ============================================================================
Expand Down
6 changes: 5 additions & 1 deletion src/main/clm_initializeMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module clm_initializeMod
use reweightMod , only : reweight_wrapup
use filterMod , only : allocFilters, filter, filter_inactive_and_active
use CLMFatesInterfaceMod , only : CLMFatesGlobals
use CLMFatesInterfaceMod , only : CLMFatesTimesteps
use dynSubgridControlMod , only : dynSubgridControl_init, get_reset_dynbal_baselines
use SelfTestDriver , only : self_test_driver
use SoilMoistureStreamMod , only : PrescribedSoilMoistureInit
Expand Down Expand Up @@ -234,7 +235,7 @@ subroutine initialize2(ni,nj)
! to allocate space)
! This also sets up various global constants in FATES
! ------------------------------------------------------------------------

call CLMFatesGlobals()

! Determine decomposition of subgrid scale landunits, columns, patches
Expand Down Expand Up @@ -311,6 +312,9 @@ subroutine initialize2(ni,nj)
call timemgr_restart()
end if

! Pass model timestep info to FATES
call CLMFatesTimesteps()

! Initialize daylength from the previous time step (needed so prev_dayl can be set correctly)
call t_startf('init_orbd')
calday = get_curr_calday()
Expand Down
65 changes: 50 additions & 15 deletions src/utils/clmfates_interfaceMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ module CLMFatesInterfaceMod
use FatesInterfaceMod , only : zero_bcs
use FatesInterfaceMod , only : SetFatesTime
use FatesInterfaceMod , only : set_fates_ctrlparms


use FatesInterfaceMod , only : UpdateFatesRMeansTStep
use FatesInterfaceMod , only : InitTimeAveragingGlobals
use FatesHistoryInterfaceMod, only : fates_hist
use FatesRestartInterfaceMod, only : fates_restart_interface_type

use EDTypesMod , only : ed_patch_type
use PRTGenericMod , only : num_elements
use FatesInterfaceTypesMod , only : hlm_numlevgrnd
use FatesInterfaceTypesMod, only : hlm_numlevgrnd
use FatesInterfaceTypesMod, only : hlm_stepsize
use EDMainMod , only : ed_ecosystem_dynamics
use EDMainMod , only : ed_update_site
use EDInitMod , only : zero_site
Expand Down Expand Up @@ -216,7 +217,8 @@ module CLMFatesInterfaceMod
procedure, private :: init_soil_depths
procedure, public :: ComputeRootSoilFlux
procedure, public :: wrap_hydraulics_drive

procedure, public :: WrapUpdateFatesRmean

end type hlm_fates_interface_type

! hlm_bounds_to_fates_bounds is not currently called outside the interface.
Expand Down Expand Up @@ -456,7 +458,19 @@ subroutine CLMFatesGlobals()
end subroutine CLMFatesGlobals


! ====================================================================================
! ===================================================================================

subroutine CLMFatesTimesteps()

hlm_stepsize = get_step_size_real()

call InitTimeAveragingGlobals()

return
end subroutine CLMFatesTimesteps


! ====================================================================================

subroutine init(this, bounds_proc )

Expand Down Expand Up @@ -854,9 +868,6 @@ subroutine dynamics_driv(this, nc, bounds_clump, &
! Mapping between IFP space (1,2,3) and HLM P space (looping by IFP)
p = ifp+col%patchi(c)

this%fates(nc)%bc_in(s)%t_veg24_pa(ifp) = &
temperature_inst%t_veg24_patch(p)

this%fates(nc)%bc_in(s)%precip24_pa(ifp) = &
wateratm2lndbulk_inst%prec24_patch(p)

Expand Down Expand Up @@ -1673,6 +1684,7 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, &
call HydrSiteColdStart(this%fates(nc)%sites,this%fates(nc)%bc_in)
end if

! Newly initialized patches need a starting temperature
call init_patches(this%fates(nc)%nsites, this%fates(nc)%sites, &
this%fates(nc)%bc_in)

Expand Down Expand Up @@ -2505,7 +2517,9 @@ subroutine InitAccVars(this, bounds)
end subroutine InitAccVars

!-----------------------------------------------------------------------
subroutine UpdateAccVars(this, bounds)

subroutine UpdateAccVars(this, bounds_proc)

!
! !DESCRIPTION:
! Update any accumulation variables needed for FATES
Expand All @@ -2514,23 +2528,44 @@ subroutine UpdateAccVars(this, bounds)
!
! !ARGUMENTS:
class(hlm_fates_interface_type), intent(inout) :: this
type(bounds_type), intent(in) :: bounds
type(bounds_type), intent(in) :: bounds_proc
!
! !LOCAL VARIABLES:


character(len=*), parameter :: subname = 'UpdateAccVars'
!-----------------------------------------------------------------------

call t_startf('fates_updateaccvars')

call this%fates_fire_data_method%UpdateAccVars( bounds )

call this%fates_fire_data_method%UpdateAccVars( bounds_proc )
call t_stopf('fates_updateaccvars')

end subroutine UpdateAccVars

! ======================================================================================

subroutine WrapUpdateFatesRmean(this, nc, temperature_inst)

class(hlm_fates_interface_type), intent(inout) :: this
type(temperature_type), intent(in) :: temperature_inst

! !LOCAL VARIABLES:
integer :: nc,s,c,p,ifp ! indices and loop counters

do s = 1, this%fates(nc)%nsites
c = this%f2hmap(nc)%fcolumn(s)
do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno
p = ifp+col%patchi(c)
this%fates(nc)%bc_in(s)%t_veg_pa(ifp) = temperature_inst%t_veg_patch(p)
end do
end do

call UpdateFatesRMeansTStep(this%fates(nc)%sites,this%fates(nc)%bc_in)

end subroutine WrapUpdateFatesRmean

! ======================================================================================

subroutine init_history_io(this,bounds_proc)

use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp
Expand Down

0 comments on commit 7416cd2

Please sign in to comment.