From 8a6bd78a5b72c30b3586303511026610078a7b25 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 22 Sep 2023 11:14:15 -0400 Subject: [PATCH 01/15] Update external pointer for fates, better name of experimental branch --- Externals_CLM.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 35f8d1740a..0c6fc55262 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -1,8 +1,8 @@ [fates] local_path = src/fates protocol = git -repo_url = https://github.com/rgknox/fates -branch = two-stream-clean +repo_url = https://github.com/NGEET/fates +branch = unsupported_sp_calibration required = True [externals_description] From adfb459b4836b1231f315a744d59b6cc16c727ce Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 2 Nov 2023 16:32:38 -0400 Subject: [PATCH 02/15] added some comments --- src/main/clm_varctl.F90 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 95c800504b..b596a999a6 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -308,6 +308,15 @@ module clm_varctl logical, public :: use_fates_inventory_init = .false. ! true => initialize fates from inventory logical, public :: use_fates_fixed_biogeog = .false. ! true => use fixed biogeography mode logical, public :: use_fates_nocomp = .false. ! true => use no comopetition mode + + ! History density level + ! fates can produce history at either the daily timescale (dynamics) + ! and the model step timescale. It can also generate output on the extra dimension + ! Performing this output can be expensive, so we allow different history density + ! levels + + logical, public :: fates_hist_dense_level = 1 ! + character(len=256), public :: fates_inventory_ctrl_filename = '' ! filename for inventory control ! FATES SP AND FATES BGC are MUTUTALLY EXCLUSIVE, THEY CAN'T BOTH BE ON From 5aafde9d0d69e33410d6242e79b5e39172eeb413 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 3 Nov 2023 10:34:53 -0400 Subject: [PATCH 03/15] updates to crossreffing namelist history vars and allocated history vars --- src/main/histFileMod.F90 | 2 +- src/utils/clmfates_interfaceMod.F90 | 65 +++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index c72117b090..f1d45a2cdd 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -179,7 +179,7 @@ module histFileMod private :: hist_set_snow_field_2d ! Set values in history field dimensioned by levsno private :: list_index ! Find index of field in exclude list private :: set_hist_filename ! Determine history dataset filenames - private :: getname ! Retrieve name portion of input "inname" + public :: getname ! Retrieve name portion of input "inname" (PUBLIC FOR FATES) private :: getflag ! Retrieve flag private :: next_history_pointer_index ! Latest index into raw history data (clmptr_r*) arrays private :: max_nFields ! The max number of fields on any tape diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index c9b1c9a5e7..a30250040b 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -263,6 +263,7 @@ module CLMFatesInterfaceMod public :: CLMFatesGlobals1 public :: CLMFatesGlobals2 + public :: CrossRefHistoryFields contains @@ -542,6 +543,70 @@ subroutine CLMFatesGlobals2() return end subroutine CLMFatesGlobals2 + ! =================================================================================== + + subroutine CrossRefHistoryFields + + ! This routine only needs to be called on the masterproc. + ! Here we cross reference the CLM history master + ! list and make sure that all fields that start + ! with fates have been allocated. If it has + ! not, then we give a more constructive error + ! message than what is possible in PIO. The user + ! most likely needs to increase the history density + ! level + + use histFileMod, only: getname + use histFileMod, only: fincl, hist_fincl1 + use histFileMod, only: max_tapes, max_flds + + integer :: t ! iterator index for history tapes + integer :: f ! iterator index for registered history field names + integer :: nh ! iterator index for fates registered history + logical :: found ! if true, than the history field is either + ! not part of the fates set, or was found in + ! the fates set + character(len=64) :: fincl_name + + do t = 1,max_tapes + + f = 1 + search_fields: do while (f < max_flds .and. fincl(f,t) /= ' ') + + ! This fincl array might not be ready by the time + ! this is called + fincl_name = getname(fincl(f,t)) + + if(scan(fincl_name,'FATES_'))then + found = .false. + do_fates_hist: do nh = 1,fates_hist%num_history_vars + if(trim(fates_hist%hvars(nh)%vname) == & + trim(fincl_name)) then + found=.true. + exit do_fates_hist + end if + end do do_fates_hist + + if(.not.found)then + write(iulog,*) 'the history field: ',trim(fincl_name) + write(iulog,*) 'was requested in the namelist, but was' + write(iulog,*) 'not found in the list of fates_hist%hvars.' + write(iulog,*) 'Most likely, this is because this history variable' + write(iulog,*) 'was specified in the user namelist, but the user' + write(iulog,*) 'specified a FATES history output density level' + write(iulog,*) 'that does not contain that variable in its valid set.' + write(iulog,*) 'You may have to increase the namelist setting: fates_hist_dens_level' + write(iulog,*) 'current fates_hist_dens_level: ',hlm_hist_dens_level + call endrun(msg=errMsg(sourcefile, __LINE__)) + end if + end if + f = f + 1 + end do search_fields + end do + + end subroutine CrossRefHistoryFields + + ! =================================================================================== subroutine CLMFatesTimesteps() From 0e0c6c15a1638f1bfb7c5deb7280b2a61e5ab54f Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Mon, 6 Nov 2023 13:28:43 -0500 Subject: [PATCH 04/15] changed nl argument to text --- src/main/clm_varctl.F90 | 12 +++++++++--- src/utils/clmfates_interfaceMod.F90 | 7 +++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 7c5537d698..4f0665339f 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -309,13 +309,19 @@ module clm_varctl logical, public :: use_fates_fixed_biogeog = .false. ! true => use fixed biogeography mode logical, public :: use_fates_nocomp = .false. ! true => use no comopetition mode - ! History density level + ! FATES history density level ! fates can produce history at either the daily timescale (dynamics) ! and the model step timescale. It can also generate output on the extra dimension ! Performing this output can be expensive, so we allow different history density - ! levels + ! levels. + ! The first index is output at the model timescale + ! The second index is output at the dynamics (daily) timescale + ! 0 - no output + ! 1 - include only column level means + ! 2 - include only output with only 1 additional dimension + ! 3 - include all multiplexed dimensions - logical, public :: fates_hist_dense_level = 1 ! + character(len=2), public :: fates_hist_dense_level = '11' character(len=256), public :: fates_inventory_ctrl_filename = '' ! filename for inventory control diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index a30250040b..82f49211bf 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -65,6 +65,7 @@ module CLMFatesInterfaceMod use clm_varctl , only : fates_inventory_ctrl_filename use clm_varctl , only : use_nitrif_denitrif use clm_varctl , only : use_lch4 + use clm_varctl , only : fates_hist_dense_level use clm_varcon , only : tfrz use clm_varcon , only : spval use clm_varcon , only : denice @@ -391,6 +392,8 @@ subroutine CLMFatesGlobals2() call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode) call set_fates_ctrlparms('seeddisp_cadence',ival=fates_seeddisp_cadence) + call set_fates_ctrlparms('hist_dense_level',cval=fates_hist_dense_level) + ! CTSM-FATES is not fully coupled (yet) ! So lets tell fates to use the RD competition mechanism ! which has fewer boundary conditions (simpler) @@ -595,8 +598,8 @@ subroutine CrossRefHistoryFields write(iulog,*) 'was specified in the user namelist, but the user' write(iulog,*) 'specified a FATES history output density level' write(iulog,*) 'that does not contain that variable in its valid set.' - write(iulog,*) 'You may have to increase the namelist setting: fates_hist_dens_level' - write(iulog,*) 'current fates_hist_dens_level: ',hlm_hist_dens_level + write(iulog,*) 'You may have to increase the namelist setting: fates_hist_dense_level' + write(iulog,*) 'current fates_hist_dens_level: ',hlm_hist_dense_level call endrun(msg=errMsg(sourcefile, __LINE__)) end if end if From 4bbe6fa0b584876cbdc90c2c55106a1d0514e3a2 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 30 Nov 2023 12:47:35 -0500 Subject: [PATCH 05/15] changed hist dense namelist to integer --- src/main/clm_varctl.F90 | 2 +- src/main/controlMod.F90 | 4 ++-- src/utils/clmfates_interfaceMod.F90 | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 4f0665339f..7ba6a05b64 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -321,7 +321,7 @@ module clm_varctl ! 2 - include only output with only 1 additional dimension ! 3 - include all multiplexed dimensions - character(len=2), public :: fates_hist_dense_level = '11' + integer, dimension(2), public :: fates_hist_dense_level = (/1,1/) character(len=256), public :: fates_inventory_ctrl_filename = '' ! filename for inventory control diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 5937e55b04..e80b68de32 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -232,7 +232,7 @@ subroutine control_init(dtime) fates_inventory_ctrl_filename, & fates_parteh_mode, & fates_seeddisp_cadence, & - use_fates_tree_damage + use_fates_tree_damage, fates_hist_dense_level ! Ozone vegetation stress method namelist / clm_inparm / o3_veg_stress_method @@ -487,7 +487,7 @@ subroutine control_init(dtime) call endrun(msg=' ERROR: C13 and C14 dynamics are not compatible with FATES.'//& errMsg(sourcefile, __LINE__)) end if - + else ! These do default to false anyway, but this emphasizes they diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 29f76ba86d..43cf249ff5 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -392,7 +392,8 @@ subroutine CLMFatesGlobals2() call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode) call set_fates_ctrlparms('seeddisp_cadence',ival=fates_seeddisp_cadence) - call set_fates_ctrlparms('hist_dense_level',cval=fates_hist_dense_level) + call set_fates_ctrlparms('hist_hifrq_dense_level',ival=fates_hist_dense_level(1)) + call set_fates_ctrlparms('hist_dynam_dense_level',ival=fates_hist_dense_level(2)) ! CTSM-FATES is not fully coupled (yet) ! So lets tell fates to use the RD competition mechanism From 4ea5c21c139b3b79256c2abcdb03099b5cd10342 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 25 Jan 2024 12:22:18 -0500 Subject: [PATCH 06/15] fates history density work --- bld/CLMBuildNamelist.pm | 6 ++- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- .../namelist_definition_ctsm.xml | 13 +++++ src/main/clm_varctl.F90 | 1 - src/utils/clmfates_interfaceMod.F90 | 49 +++++++++++++------ 5 files changed, 51 insertions(+), 20 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 17c46f9bef..efa96a7f39 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -784,7 +784,8 @@ sub setup_cmdl_fates_mode { my @list = ( "fates_spitfire_mode", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", "use_fates_cohort_age_tracking","use_fates_inventory_init","use_fates_fixed_biogeog", "use_fates_nocomp","use_fates_sp","fates_inventory_ctrl_filename","use_fates_logging", - "fates_parteh_mode","use_fates_tree_damage","fates_seeddisp_cadence","use_fates_luh","fluh_timeseries" ); + "fates_parteh_mode","use_fates_tree_damage","fates_hist_dense_level","fates_seeddisp_cadence", + "use_fates_luh","fluh_timeseries" ); # dis-allow fates specific namelist items with non-fates runs foreach my $var ( @list ) { if ( defined($nl->get_value($var)) ) { @@ -4391,7 +4392,8 @@ sub setup_logic_fates { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'}); my @list = ( "fates_spitfire_mode", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", "use_fates_inventory_init","use_fates_fixed_biogeog","use_fates_nocomp","fates_seeddisp_cadence", - "use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking","use_fates_tree_damage","use_fates_luh" ); + "use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking","use_fates_tree_damage", + "use_fates_luh","fates_hist_dense_level" ); foreach my $var ( @list ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'use_fates'=>$nl_flags->{'use_fates'}, 'use_fates_sp'=>$nl_flags->{'use_fates_sp'} ); diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 456d99ac2a..074a1e325e 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2769,7 +2769,7 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1 .false. 1 0 - +1,1 .true. .false. .true. diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 3e3735b903..2f6b5bd1e3 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -777,6 +777,19 @@ Full pathname to the inventory initialization control file. (Only relevant if FATES is on). + + Setting for what types of FATES history to be allocate and + calculated at the dynamics timestep (1st integer) and the + model timestep (2nd integer). This must be consistent with + hist_fincl*, ie output variables must not be listed if the + output level is not enabled. + 0 = no fates history variables are calculated or allocated + 1 = only time x space (3d) fates history variables allowed + 2 = multiplexed dimensioned fates history is also allowed + (Only relevant if FATES is on) + + diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 07c309b8cc..ad37d0a224 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -330,7 +330,6 @@ module clm_varctl logical, public :: use_fates_luh = .false. ! true => use FATES landuse data mode character(len=256), public :: fluh_timeseries = '' ! filename for fates landuse timeseries data - character(len=256), public :: fates_inventory_ctrl_filename = '' ! filename for inventory control ! FATES SP AND FATES BGC are MUTUTALLY EXCLUSIVE, THEY CAN'T BOTH BE ON diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 53bfd6b9ba..ef91662f53 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -134,7 +134,7 @@ 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 @@ -1191,9 +1191,9 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! Flush arrays to values defined by %flushval (see registry entry in ! subroutine define_history_vars() ! --------------------------------------------------------------------------------- - call fates_hist%flush_hvars(nc,upfreq_in=1) + call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_simple) - call fates_hist%flush_hvars(nc,upfreq_in=5) + call fates_hist%flush_hvars(nc,upfreq_in=group_dyna_complx) ! --------------------------------------------------------------------------------- ! Part II: Call the FATES model now that input boundary conditions have been @@ -1968,11 +1968,20 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & ! ------------------------------------------------------------------------ ! Update history IO fields that depend on ecosystem dynamics ! ------------------------------------------------------------------------ - call fates_hist%flush_hvars(nc,upfreq_in=1) - do s = 1,this%fates(nc)%nsites - call fates_hist%zero_site_hvars(this%fates(nc)%sites(s), & - upfreq_in=1) - end do + if(fates_hist_dense_level(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_hist_dense_level(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%update_history_dyn( nc, & this%fates(nc)%nsites, & this%fates(nc)%sites, & @@ -2152,18 +2161,25 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & ! ------------------------------------------------------------------------ ! Update history IO fields that depend on ecosystem dynamics ! ------------------------------------------------------------------------ - call fates_hist%flush_hvars(nc,upfreq_in=1) - do s = 1,this%fates(nc)%nsites - call fates_hist%zero_site_hvars(this%fates(nc)%sites(s), & - upfreq_in=1) - end do - call fates_hist%update_history_dyn( nc, & + if(fates_hist_dense_level(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_hist_dense_level(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%update_history_dyn( nc, & this%fates(nc)%nsites, & this%fates(nc)%sites, & this%fates(nc)%bc_in) - - end if end do !$OMP END PARALLEL DO @@ -2970,6 +2986,7 @@ subroutine wrap_update_hifrq_hist(this, bounds_clump, & this%fates(nc)%nsites, & this%fates(nc)%sites, & this%fates(nc)%bc_in, & + this%fates(nc)%bc_out, & dtime) end associate From a826ce94fad9a0c24470e422205c8324ce8e00b5 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Fri, 26 Jan 2024 10:36:03 -0700 Subject: [PATCH 07/15] Changed default namelist density to level 2, which preserves b4b --- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- src/utils/clmfates_interfaceMod.F90 | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index 074a1e325e..a033f35d26 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2769,7 +2769,7 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1 .false. 1 0 -1,1 +2,2 .true. .false. .true. diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index ef91662f53..dc80be5c32 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -408,6 +408,7 @@ subroutine CLMFatesGlobals2() call set_fates_ctrlparms('parteh_mode',ival=fates_parteh_mode) call set_fates_ctrlparms('seeddisp_cadence',ival=fates_seeddisp_cadence) + call set_fates_ctrlparms('hist_hifrq_dense_level',ival=fates_hist_dense_level(1)) call set_fates_ctrlparms('hist_dynam_dense_level',ival=fates_hist_dense_level(2)) From cd289a1c7d62ac7da8b3b8bae5bcab97ac295254 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 30 Jan 2024 10:38:53 -0700 Subject: [PATCH 08/15] bcasting fates history density level --- src/main/controlMod.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 89608c9667..37381e92f3 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -790,6 +790,7 @@ subroutine control_spmd() call mpi_bcast (fluh_timeseries, len(fluh_timeseries) , MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fates_parteh_mode, 1, MPI_INTEGER, 0, mpicom, ier) call mpi_bcast (fates_seeddisp_cadence, 1, MPI_INTEGER, 0, mpicom, ier) + call mpi_bcast (fates_hist_dense_level, 2, MPI_INTEGER, 0, mpicom, ier) ! flexibleCN nitrogen model call mpi_bcast (use_flexibleCN, 1, MPI_LOGICAL, 0, mpicom, ier) From 63d251248c34a9c8c7516a87e86e6d87ac9e8c17 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 31 Jan 2024 10:15:20 -0700 Subject: [PATCH 09/15] Setting fates hist density default to 2 until we roll out new tests --- src/main/clm_varctl.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index ad37d0a224..4e1286b25f 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -326,7 +326,7 @@ module clm_varctl ! 2 - include only output with only 1 additional dimension ! 3 - include all multiplexed dimensions - integer, dimension(2), public :: fates_hist_dense_level = (/1,1/) + integer, dimension(2), public :: fates_hist_dense_level = (/2,2/) logical, public :: use_fates_luh = .false. ! true => use FATES landuse data mode character(len=256), public :: fluh_timeseries = '' ! filename for fates landuse timeseries data From f3ff644a9d35846ab61a9901ce3579afa543f4e7 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 13 Feb 2024 14:09:44 -0700 Subject: [PATCH 10/15] update allvars --- .../clm/FatesColdAllVars/user_nl_clm | 122 ++++++++---------- 1 file changed, 51 insertions(+), 71 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm index 7f5ece27c8..3b8e9a12cc 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm @@ -4,74 +4,54 @@ hist_nhtfrq = -24 hist_empty_htapes = .false. fates_spitfire_mode = 1 hist_ndens = 1 -hist_fincl1 = 'FATES_CROWNAREA_PF', 'FATES_CANOPYCROWNAREA_PF', -'FATES_NCL_AP', 'FATES_NPATCH_AP', 'FATES_VEGC_AP', -'FATES_SECONDARY_FOREST_FRACTION', 'FATES_WOOD_PRODUCT', -'FATES_SECONDARY_FOREST_VEGC', 'FATES_SECONDAREA_ANTHRODIST_AP', -'FATES_SECONDAREA_DIST_AP', 'FATES_STOMATAL_COND_AP', 'FATES_LBLAYER_COND_AP', -'FATES_NPP_AP', 'FATES_GPP_AP', 'FATES_PARSUN_Z_CLLL', 'FATES_PARSHA_Z_CLLL', -'FATES_PARSUN_Z_CLLLPF', 'FATES_PARSHA_Z_CLLLPF', 'FATES_PARSUN_Z_CL', -'FATES_PARSHA_Z_CL', 'FATES_LAISUN_Z_CLLL', 'FATES_LAISHA_Z_CLLL', -'FATES_LAISUN_Z_CLLLPF', 'FATES_LAISHA_Z_CLLLPF', 'FATES_LAISUN_TOP_CL', -'FATES_LAISHA_TOP_CL', 'FATES_FABD_SUN_CLLLPF', 'FATES_FABD_SHA_CLLLPF', -'FATES_FABI_SUN_CLLLPF', 'FATES_FABI_SHA_CLLLPF', 'FATES_FABD_SUN_CLLL', -'FATES_FABD_SHA_CLLL', 'FATES_FABI_SUN_CLLL', 'FATES_FABI_SHA_CLLL', -'FATES_PARPROF_DIR_CLLLPF', 'FATES_PARPROF_DIF_CLLLPF', -'FATES_FABD_SUN_TOPLF_CL', -'FATES_FABD_SHA_TOPLF_CL', 'FATES_FABI_SUN_TOPLF_CL', 'FATES_FABI_SHA_TOPLF_CL', -'FATES_NET_C_UPTAKE_CLLL', 'FATES_CROWNAREA_CLLL', 'FATES_NPLANT_CANOPY_SZAP', -'FATES_NPLANT_USTORY_SZAP', 'FATES_DDBH_CANOPY_SZAP', 'FATES_DDBH_USTORY_SZAP', -'FATES_MORTALITY_CANOPY_SZAP', 'FATES_MORTALITY_USTORY_SZAP', -'FATES_NPLANT_SZAPPF', 'FATES_NPP_APPF', 'FATES_VEGC_APPF', 'FATES_GPP_SZPF', -'FATES_GPP_CANOPY_SZPF', 'FATES_AUTORESP_CANOPY_SZPF', 'FATES_GPP_USTORY_SZPF', -'FATES_AUTORESP_USTORY_SZPF', 'FATES_NPP_SZPF', 'FATES_LEAF_ALLOC_SZPF', -'FATES_SEED_ALLOC_SZPF', 'FATES_FROOT_ALLOC_SZPF', 'FATES_BGSAPWOOD_ALLOC_SZPF', -'FATES_BGSTRUCT_ALLOC_SZPF', 'FATES_AGSAPWOOD_ALLOC_SZPF', -'FATES_AGSTRUCT_ALLOC_SZPF', 'FATES_STORE_ALLOC_SZPF', 'FATES_DDBH_SZPF', -'FATES_GROWTHFLUX_SZPF', 'FATES_GROWTHFLUX_FUSION_SZPF', -'FATES_DDBH_CANOPY_SZPF', 'FATES_DDBH_USTORY_SZPF', 'FATES_BASALAREA_SZPF', -'FATES_VEGC_ABOVEGROUND_SZPF', 'FATES_NPLANT_SZPF', 'FATES_NPLANT_ACPF', -'FATES_MORTALITY_BACKGROUND_SZPF', 'FATES_MORTALITY_HYDRAULIC_SZPF', -'FATES_MORTALITY_CSTARV_SZPF', 'FATES_MORTALITY_IMPACT_SZPF', -'FATES_MORTALITY_FIRE_SZPF', '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_STOREC_CANOPY_SZPF', 'FATES_LEAFC_CANOPY_SZPF', -'FATES_NPLANT_CANOPY_SZPF', 'FATES_MORTALITY_USTORY_SZPF', -'FATES_STOREC_USTORY_SZPF', 'FATES_LEAFC_USTORY_SZPF', -'FATES_NPLANT_USTORY_SZPF', 'FATES_CWD_ABOVEGROUND_DC', -'FATES_CWD_BELOWGROUND_DC', 'FATES_CWD_ABOVEGROUND_IN_DC', -'FATES_CWD_BELOWGROUND_IN_DC', 'FATES_CWD_ABOVEGROUND_OUT_DC', -'FATES_CWD_BELOWGROUND_OUT_DC', 'FATES_AUTORESP_SZPF', 'FATES_GROWAR_SZPF', -'FATES_MAINTAR_SZPF', 'FATES_RDARK_SZPF', 'FATES_AGSAPMAINTAR_SZPF', -'FATES_BGSAPMAINTAR_SZPF', 'FATES_FROOTMAINTAR_SZPF', -'FATES_YESTCANLEV_CANOPY_SZ', 'FATES_YESTCANLEV_USTORY_SZ', -'FATES_VEGC_SZ', 'FATES_DEMOTION_RATE_SZ', 'FATES_PROMOTION_RATE_SZ', -'FATES_SAI_CANOPY_SZ', 'FATES_SAI_USTORY_SZ', 'FATES_NPP_CANOPY_SZ', -'FATES_NPP_USTORY_SZ', 'FATES_TRIMMING_CANOPY_SZ', 'FATES_TRIMMING_USTORY_SZ', -'FATES_CROWNAREA_CANOPY_SZ', 'FATES_CROWNAREA_USTORY_SZ', -'FATES_LEAFCTURN_CANOPY_SZ', 'FATES_FROOTCTURN_CANOPY_SZ', -'FATES_STORECTURN_CANOPY_SZ', 'FATES_STRUCTCTURN_CANOPY_SZ', -'FATES_SAPWOODCTURN_CANOPY_SZ', 'FATES_SEED_PROD_CANOPY_SZ', -'FATES_LEAF_ALLOC_CANOPY_SZ', 'FATES_FROOT_ALLOC_CANOPY_SZ', -'FATES_SAPWOOD_ALLOC_CANOPY_SZ', 'FATES_STRUCT_ALLOC_CANOPY_SZ', -'FATES_SEED_ALLOC_CANOPY_SZ', 'FATES_STORE_ALLOC_CANOPY_SZ', -'FATES_RDARK_CANOPY_SZ', 'FATES_LSTEMMAINTAR_CANOPY_SZ', -'FATES_CROOTMAINTAR_CANOPY_SZ', 'FATES_FROOTMAINTAR_CANOPY_SZ', -'FATES_GROWAR_CANOPY_SZ', 'FATES_MAINTAR_CANOPY_SZ', -'FATES_LEAFCTURN_USTORY_SZ', 'FATES_FROOTCTURN_USTORY_SZ', -'FATES_STORECTURN_USTORY_SZ', 'FATES_STRUCTCTURN_USTORY_SZ', -'FATES_SAPWOODCTURN_USTORY_SZ', 'FATES_SEED_PROD_USTORY_SZ', -'FATES_LEAF_ALLOC_USTORY_SZ', 'FATES_FROOT_ALLOC_USTORY_SZ', -'FATES_SAPWOOD_ALLOC_USTORY_SZ', 'FATES_STRUCT_ALLOC_USTORY_SZ', -'FATES_SEED_ALLOC_USTORY_SZ', 'FATES_STORE_ALLOC_USTORY_SZ', -'FATES_RDARK_USTORY_SZ', 'FATES_LSTEMMAINTAR_USTORY_SZ', -'FATES_CROOTMAINTAR_USTORY_SZ', 'FATES_FROOTMAINTAR_USTORY_SZ', -'FATES_GROWAR_USTORY_SZ', 'FATES_MAINTAR_USTORY_SZ', 'FATES_VEGC_SZPF', -'FATES_LEAFC_SZPF', 'FATES_FROOTC_SZPF', 'FATES_SAPWOODC_SZPF', -'FATES_STOREC_SZPF', 'FATES_REPROC_SZPF', 'FATES_DROUGHT_STATUS_PF', -'FATES_DAYSINCE_DROUGHTLEAFOFF_PF', 'FATES_DAYSINCE_DROUGHTLEAFON_PF', -'FATES_MEANLIQVOL_DROUGHTPHEN_PF', 'FATES_MEANSMP_DROUGHTPHEN_PF', -'FATES_ELONG_FACTOR_PF' +hist_fincl1 = 'FATES_TLONGTERM', +'FATES_TGROWTH','FATES_SEEDS_IN_GRIDCELL_PF','FATES_SEEDS_OUT_GRIDCELL_PF','FATES_NCL_AP', +'FATES_NPATCH_AP','FATES_VEGC_AP','FATES_SECONDAREA_ANTHRODIST_AP','FATES_SECONDAREA_DIST_AP', +'FATES_FUEL_AMOUNT_APFC','FATES_STOREC_TF_USTORY_SZPF','FATES_STOREC_TF_CANOPY_SZPF', +'FATES_CROWNAREA_CLLL','FATES_ABOVEGROUND_MORT_SZPF', +'FATES_ABOVEGROUND_PROD_SZPF','FATES_NPLANT_SZAP','FATES_NPLANT_CANOPY_SZAP', +'FATES_NPLANT_USTORY_SZAP','FATES_DDBH_CANOPY_SZAP','FATES_DDBH_USTORY_SZAP', +'FATES_MORTALITY_CANOPY_SZAP','FATES_MORTALITY_USTORY_SZAP','FATES_NPLANT_SZAPPF', +'FATES_NPP_APPF','FATES_VEGC_APPF','FATES_SCORCH_HEIGHT_APPF','FATES_GPP_SZPF', +'FATES_GPP_CANOPY_SZPF','FATES_AUTORESP_CANOPY_SZPF','FATES_GPP_USTORY_SZPF', +'FATES_AUTORESP_USTORY_SZPF','FATES_NPP_SZPF','FATES_LEAF_ALLOC_SZPF', +'FATES_SEED_ALLOC_SZPF','FATES_FROOT_ALLOC_SZPF','FATES_BGSAPWOOD_ALLOC_SZPF', +'FATES_BGSTRUCT_ALLOC_SZPF','FATES_AGSAPWOOD_ALLOC_SZPF','FATES_AGSTRUCT_ALLOC_SZPF', +'FATES_STORE_ALLOC_SZPF','FATES_DDBH_SZPF','FATES_GROWTHFLUX_SZPF','FATES_GROWTHFLUX_FUSION_SZPF', +'FATES_DDBH_CANOPY_SZPF','FATES_DDBH_USTORY_SZPF','FATES_BASALAREA_SZPF','FATES_VEGC_ABOVEGROUND_SZPF', +'FATES_NPLANT_SZPF','FATES_NPLANT_ACPF','FATES_MORTALITY_BACKGROUND_SZPF','FATES_MORTALITY_HYDRAULIC_SZPF', +'FATES_MORTALITY_CSTARV_SZPF','FATES_MORTALITY_IMPACT_SZPF','FATES_MORTALITY_FIRE_SZPF', +'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_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', +'FATES_CWD_BELOWGROUND_DC','FATES_CWD_ABOVEGROUND_IN_DC','FATES_CWD_BELOWGROUND_IN_DC', +'FATES_CWD_ABOVEGROUND_OUT_DC','FATES_CWD_BELOWGROUND_OUT_DC','FATES_YESTCANLEV_CANOPY_SZ', +'FATES_YESTCANLEV_USTORY_SZ','FATES_VEGC_SZ','FATES_DEMOTION_RATE_SZ','FATES_PROMOTION_RATE_SZ', +'FATES_SAI_CANOPY_SZ','FATES_M3_MORTALITY_CANOPY_SZ','FATES_M3_MORTALITY_USTORY_SZ','FATES_SAI_USTORY_SZ', +'FATES_NPP_CANOPY_SZ','FATES_NPP_USTORY_SZ','FATES_TRIMMING_CANOPY_SZ','FATES_TRIMMING_USTORY_SZ', +'FATES_CROWNAREA_CANOPY_SZ','FATES_CROWNAREA_USTORY_SZ','FATES_LEAFCTURN_CANOPY_SZ','FATES_FROOTCTURN_CANOPY_SZ', +'FATES_STORECTURN_CANOPY_SZ','FATES_STRUCTCTURN_CANOPY_SZ','FATES_SAPWOODCTURN_CANOPY_SZ','FATES_SEED_PROD_CANOPY_SZ', +'FATES_LEAF_ALLOC_CANOPY_SZ','FATES_FROOT_ALLOC_CANOPY_SZ','FATES_SAPWOOD_ALLOC_CANOPY_SZ','FATES_STRUCT_ALLOC_CANOPY_SZ', +'FATES_SEED_ALLOC_CANOPY_SZ','FATES_STORE_ALLOC_CANOPY_SZ','FATES_LEAFCTURN_USTORY_SZ','FATES_FROOTCTURN_USTORY_SZ', +'FATES_STORECTURN_USTORY_SZ','FATES_STRUCTCTURN_USTORY_SZ','FATES_SAPWOODCTURN_USTORY_SZ', +'FATES_SEED_PROD_USTORY_SZ','FATES_LEAF_ALLOC_USTORY_SZ','FATES_FROOT_ALLOC_USTORY_SZ','FATES_SAPWOOD_ALLOC_USTORY_SZ', +'FATES_STRUCT_ALLOC_USTORY_SZ','FATES_SEED_ALLOC_USTORY_SZ','FATES_STORE_ALLOC_USTORY_SZ','FATES_CROWNAREA_CANOPY_CD', +'FATES_CROWNAREA_USTORY_CD','FATES_NPLANT_CDPF','FATES_NPLANT_CANOPY_CDPF','FATES_NPLANT_USTORY_CDPF', +'FATES_M3_CDPF','FATES_M11_SZPF','FATES_M11_CDPF','FATES_MORTALITY_CDPF','FATES_M3_MORTALITY_CANOPY_CDPF', +'FATES_M3_MORTALITY_USTORY_CDPF','FATES_M11_MORTALITY_CANOPY_CDPF','FATES_M11_MORTALITY_USTORY_CDPF', +'FATES_MORTALITY_CANOPY_CDPF','FATES_MORTALITY_USTORY_CDPF','FATES_DDBH_CDPF','FATES_DDBH_CANOPY_CDPF', +'FATES_DDBH_USTORY_CDPF','FATES_VEGC_SZPF','FATES_LEAFC_SZPF','FATES_FROOTC_SZPF','FATES_SAPWOODC_SZPF', +'FATES_STOREC_SZPF','FATES_REPROC_SZPF','FATES_NPP_AP','FATES_GPP_AP','FATES_RDARK_USTORY_SZ', +'FATES_LSTEMMAINTAR_USTORY_SZ','FATES_CROOTMAINTAR_USTORY_SZ','FATES_FROOTMAINTAR_USTORY_SZ','FATES_GROWAR_USTORY_SZ', +'FATES_MAINTAR_USTORY_SZ','FATES_RDARK_CANOPY_SZ','FATES_CROOTMAINTAR_CANOPY_SZ','FATES_FROOTMAINTAR_CANOPY_SZ', +'FATES_GROWAR_CANOPY_SZ','FATES_MAINTAR_CANOPY_SZ','FATES_LSTEMMAINTAR_CANOPY_SZ','FATES_AUTORESP_SZPF', +'FATES_GROWAR_SZPF','FATES_MAINTAR_SZPF','FATES_RDARK_SZPF','FATES_AGSAPMAINTAR_SZPF','FATES_BGSAPMAINTAR_SZPF', +'FATES_FROOTMAINTAR_SZPF','FATES_PARSUN_CLLL','FATES_PARSHA_CLLL','FATES_PARSUN_CLLLPF','FATES_PARSHA_CLLLPF', +'FATES_PARSUN_CL','FATES_PARSHA_CL','FATES_LAISUN_CLLL','FATES_LAISHA_CLLL','FATES_LAISUN_CLLLPF', +'FATES_LAISHA_CLLLPF','FATES_PARPROF_DIR_CLLLPF','FATES_PARPROF_DIF_CLLLPF','FATES_LAISUN_CL','FATES_LAISHA_CL', +'FATES_PARPROF_DIR_CLLL','FATES_PARPROF_DIF_CLLL','FATES_NET_C_UPTAKE_CLLL','FATES_CROWNFRAC_CLLLPF', +'FATES_LBLAYER_COND_AP','FATES_STOMATAL_COND_AP' From a22a01b50a562890f69e270ecf72b969765f4b19 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 28 Feb 2024 12:39:02 -0500 Subject: [PATCH 11/15] Updated namelist naming convention: from density to dimension for fates_history_dimlevel --- bld/CLMBuildNamelist.pm | 4 ++-- bld/namelist_files/namelist_defaults_ctsm.xml | 2 +- .../namelist_definition_ctsm.xml | 2 +- src/main/clm_varctl.F90 | 11 +++++----- src/main/controlMod.F90 | 4 ++-- src/utils/clmfates_interfaceMod.F90 | 20 +++++++++---------- 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index b946200c35..78db55fcd4 100755 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -784,7 +784,7 @@ sub setup_cmdl_fates_mode { my @list = ( "fates_spitfire_mode", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", "use_fates_cohort_age_tracking","use_fates_inventory_init","use_fates_fixed_biogeog", "use_fates_nocomp","use_fates_sp","fates_inventory_ctrl_filename","use_fates_logging", - "fates_parteh_mode","use_fates_tree_damage","fates_hist_dense_level","fates_seeddisp_cadence", + "fates_parteh_mode","use_fates_tree_damage","fates_history_dimlevel","fates_seeddisp_cadence", "use_fates_luh","fluh_timeseries" ); # dis-allow fates specific namelist items with non-fates runs foreach my $var ( @list ) { @@ -4417,7 +4417,7 @@ sub setup_logic_fates { my @list = ( "fates_spitfire_mode", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", "use_fates_inventory_init","use_fates_fixed_biogeog","use_fates_nocomp","fates_seeddisp_cadence", "use_fates_logging","fates_parteh_mode", "use_fates_cohort_age_tracking","use_fates_tree_damage", - "use_fates_luh","fates_hist_dense_level" ); + "use_fates_luh","fates_history_dimlevel" ); foreach my $var ( @list ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'use_fates'=>$nl_flags->{'use_fates'}, 'use_fates_sp'=>$nl_flags->{'use_fates_sp'} ); diff --git a/bld/namelist_files/namelist_defaults_ctsm.xml b/bld/namelist_files/namelist_defaults_ctsm.xml index cf953a7b82..cb9b43cfe1 100644 --- a/bld/namelist_files/namelist_defaults_ctsm.xml +++ b/bld/namelist_files/namelist_defaults_ctsm.xml @@ -2771,7 +2771,7 @@ use_crop=".true.">lnd/clm2/surfdata_map/ctsm5.1.dev052/landuse.timeseries_mpasa1 .false. 1 0 -2,2 +2,2 .true. .false. .true. diff --git a/bld/namelist_files/namelist_definition_ctsm.xml b/bld/namelist_files/namelist_definition_ctsm.xml index 2f6b5bd1e3..c29de327c7 100644 --- a/bld/namelist_files/namelist_definition_ctsm.xml +++ b/bld/namelist_files/namelist_definition_ctsm.xml @@ -777,7 +777,7 @@ Full pathname to the inventory initialization control file. (Only relevant if FATES is on). - Setting for what types of FATES history to be allocate and calculated at the dynamics timestep (1st integer) and the diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index 4e1286b25f..e932fdc6fb 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -314,19 +314,18 @@ module clm_varctl logical, public :: use_fates_fixed_biogeog = .false. ! true => use fixed biogeography mode logical, public :: use_fates_nocomp = .false. ! true => use no comopetition mode - ! FATES history density level + ! FATES history dimension level ! fates can produce history at either the daily timescale (dynamics) ! and the model step timescale. It can also generate output on the extra dimension - ! Performing this output can be expensive, so we allow different history density + ! Performing this output can be expensive, so we allow different history dimension ! levels. ! The first index is output at the model timescale ! The second index is output at the dynamics (daily) timescale ! 0 - no output - ! 1 - include only column level means - ! 2 - include only output with only 1 additional dimension - ! 3 - include all multiplexed dimensions + ! 1 - include only column level means (3D) + ! 2 - include output that includes the 4th dimension - integer, dimension(2), public :: fates_hist_dense_level = (/2,2/) + integer, dimension(2), public :: fates_history_dimlevel = (/2,2/) logical, public :: use_fates_luh = .false. ! true => use FATES landuse data mode character(len=256), public :: fluh_timeseries = '' ! filename for fates landuse timeseries data diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 37381e92f3..5e382fc395 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -235,7 +235,7 @@ subroutine control_init(dtime) fates_inventory_ctrl_filename, & fates_parteh_mode, & fates_seeddisp_cadence, & - use_fates_tree_damage, fates_hist_dense_level + use_fates_tree_damage, fates_history_dimlevel ! Ozone vegetation stress method namelist / clm_inparm / o3_veg_stress_method @@ -790,7 +790,7 @@ subroutine control_spmd() call mpi_bcast (fluh_timeseries, len(fluh_timeseries) , MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fates_parteh_mode, 1, MPI_INTEGER, 0, mpicom, ier) call mpi_bcast (fates_seeddisp_cadence, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (fates_hist_dense_level, 2, MPI_INTEGER, 0, mpicom, ier) + call mpi_bcast (fates_history_dimlevel, 2, MPI_INTEGER, 0, mpicom, ier) ! flexibleCN nitrogen model call mpi_bcast (use_flexibleCN, 1, MPI_LOGICAL, 0, mpicom, ier) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index dc80be5c32..e28ebcc52f 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -64,7 +64,7 @@ module CLMFatesInterfaceMod use clm_varctl , only : fates_inventory_ctrl_filename use clm_varctl , only : use_nitrif_denitrif use clm_varctl , only : use_lch4 - use clm_varctl , only : fates_hist_dense_level + use clm_varctl , only : fates_history_dimlevel use clm_varcon , only : tfrz use clm_varcon , only : spval use clm_varcon , only : denice @@ -409,8 +409,8 @@ subroutine CLMFatesGlobals2() call set_fates_ctrlparms('seeddisp_cadence',ival=fates_seeddisp_cadence) - call set_fates_ctrlparms('hist_hifrq_dense_level',ival=fates_hist_dense_level(1)) - call set_fates_ctrlparms('hist_dynam_dense_level',ival=fates_hist_dense_level(2)) + call set_fates_ctrlparms('hist_hifrq_dimlevel',ival=fates_history_dimlevel(1)) + call set_fates_ctrlparms('hist_dynam_dimlevel',ival=fates_history_dimlevel(2)) ! CTSM-FATES is not fully coupled (yet) ! So lets tell fates to use the RD competition mechanism @@ -643,10 +643,10 @@ subroutine CrossRefHistoryFields write(iulog,*) 'not found in the list of fates_hist%hvars.' write(iulog,*) 'Most likely, this is because this history variable' write(iulog,*) 'was specified in the user namelist, but the user' - write(iulog,*) 'specified a FATES history output density level' + write(iulog,*) 'specified a FATES history output dimension level' write(iulog,*) 'that does not contain that variable in its valid set.' - write(iulog,*) 'You may have to increase the namelist setting: fates_hist_dense_level' - write(iulog,*) 'current fates_hist_dens_level: ',fates_hist_dense_level + write(iulog,*) 'You may have to increase the namelist setting: fates_history_dimlevel' + write(iulog,*) 'current fates_history_dimlevel: ',fates_history_dimlevel(:) call endrun(msg=errMsg(sourcefile, __LINE__)) end if end if @@ -1969,13 +1969,13 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & ! ------------------------------------------------------------------------ ! Update history IO fields that depend on ecosystem dynamics ! ------------------------------------------------------------------------ - if(fates_hist_dense_level(2)>0) then + 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_hist_dense_level(2)>1) then + 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), & @@ -2162,13 +2162,13 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & ! ------------------------------------------------------------------------ ! Update history IO fields that depend on ecosystem dynamics ! ------------------------------------------------------------------------ - if(fates_hist_dense_level(2)>0) then + 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_hist_dense_level(2)>1) then + 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), & From b8cdb9070b1b31252fb2346afa695e6894130c4e Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Tue, 5 Mar 2024 15:16:32 -0700 Subject: [PATCH 12/15] updating external --- Externals_CLM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index a6fae66356..df122d2c12 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/NGEET/fates -tag = sci.1.71.0_api.33.0.0 +tag = sci.1.72.0_api.33.0.0 required = True [externals_description] From 5ce3241673f746c0f886056b033bfcce060ac797 Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Thu, 7 Mar 2024 09:51:55 -0700 Subject: [PATCH 13/15] subtle updates to namelist reading and testing --- .../testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm | 2 ++ src/main/controlMod.F90 | 3 ++- src/utils/clmfates_interfaceMod.F90 | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm index 3b8e9a12cc..a426c775b0 100644 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/FatesColdAllVars/user_nl_clm @@ -3,6 +3,8 @@ hist_mfilt = 365 hist_nhtfrq = -24 hist_empty_htapes = .false. fates_spitfire_mode = 1 +fates_history_dimlevel = 2,2 +use_fates_tree_damage = .true. hist_ndens = 1 hist_fincl1 = 'FATES_TLONGTERM', 'FATES_TGROWTH','FATES_SEEDS_IN_GRIDCELL_PF','FATES_SEEDS_OUT_GRIDCELL_PF','FATES_NCL_AP', diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 7332b8d019..723153b5f2 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -235,7 +235,8 @@ subroutine control_init(dtime) fates_inventory_ctrl_filename, & fates_parteh_mode, & fates_seeddisp_cadence, & - use_fates_tree_damage, fates_history_dimlevel + use_fates_tree_damage, & + fates_history_dimlevel ! Ozone vegetation stress method namelist / clm_inparm / o3_veg_stress_method diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index bfa32bdb4b..fcd5cb5230 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -647,6 +647,10 @@ subroutine CrossRefHistoryFields write(iulog,*) 'that does not contain that variable in its valid set.' write(iulog,*) 'You may have to increase the namelist setting: fates_history_dimlevel' write(iulog,*) 'current fates_history_dimlevel: ',fates_history_dimlevel(:) + !uncomment if you want to list all fates history variables in registry + !do_fates_hist2: do nh = 1,fates_hist%num_history_vars() + ! write(iulog,*) trim(fates_hist%hvars(nh)%vname) + !end do do_fates_hist2 call endrun(msg=errMsg(sourcefile, __LINE__)) end if end if From 1f2de041aa1a2c9c1b9413395926934237737cec Mon Sep 17 00:00:00 2001 From: Ryan Knox Date: Wed, 13 Mar 2024 10:54:09 -0600 Subject: [PATCH 14/15] Updated change logs and externals for history dim level --- Externals_CLM.cfg | 2 +- doc/ChangeLog | 58 +++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg index 97e76ea4c2..69d13ca73b 100644 --- a/Externals_CLM.cfg +++ b/Externals_CLM.cfg @@ -2,7 +2,7 @@ local_path = src/fates protocol = git repo_url = https://github.com/rgknox/fates -branch = history-density +tag = sci.1.72.2_api.34.0.0 required = True [externals_description] diff --git a/doc/ChangeLog b/doc/ChangeLog index 30058a80b4..f29f055025 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,62 @@ =============================================================== +Tag name: ctsm5.1.dev173 +Originator(s): rgknox (Ryan Knox,LAWRENCE BERKELEY NATIONAL LABORATORY) +Date: Wed 13 Mar 2024 10:42:26 AM MDT +One-line Summary: New FATES namelist variable, fates_history_dimlevel + +Purpose and description of changes +---------------------------------- +This set of changes introduces a new namelist setting that allows more control over fates history diagnostics. This setting, fates_history_dimlevel accepts two integers, comma-delimited, from 0-2. The first specifies the history output dimension level for high-frequency output (ie model timestep) and the second is for output at the dynamics timestep. A value of 0 indicates no history variables should be processed. A value of 1 indicates that only site-level mean values should be processed. A value of 2 indicates that all variables, including those that use an extra dimension should be processed. This is different from adding and excluding history variable names from the namelist, in that these settings not only omit variables from the output file, but they prevent their allocations and calculations all together. Processing history diagnostics in FATES takes a non-trivial amount of time. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +These changes have no non-trivial impacts on any scientific configurations, this is a refactor. + +Bugs fixed +---------- + +No bugs fixed, feature addition only. + +Notes of particular relevance for users +--------------------------------------- + +Users should be aware of the new namelist setting fates_history_dimlevel. Omitting this setting will default to a level of "2" which enables all output and should maintain existing model behavior. + +Substantial timing or memory changes: The FATES model is somewhere on the order of 10% faster for level 0 and 1, versus 2, for large gridded runs with non satellite phenology, on derecho. + + +Notes of particular relevance for developers: +--------------------------------------------- + +None of note. + + +Testing summary: +---------------- + + 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--) + derecho ----- OK + izumi ------- OK + + +If the tag used for baseline comparisons was NOT the previous tag, note that here: (used ctsm5.1.dev172) + + +Answer changes +-------------- + +Answer changes for FATES tests were detected. All diffs were small enough to be consistent with order of operations changes, with the exception of some variables that were updated to have ignore values used for non-vegetated patches instead of zero. + + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev171 Originator(s): olyson (Keith Oleson,UCAR/TSS) Date: Mon 04 Mar 2024 10:33:55 AM MST diff --git a/doc/ChangeSum b/doc/ChangeSum index 32b60a502f..a81856c8c5 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev173 rgknox 03/13/2024 New FATES namelist variable: fates_history_dimlevel ctsm5.1.dev171 slevis 03/01/2024 Set initial t_soisno=272 for soils and 274K for urban road ctsm5.1.dev170 samrabin 02/28/2024 Add hillslope hydrology ctsm5.1.dev169 samrabin 02/22/2024 Merge b4b-dev From de193123a0877ef025170f631fecbc5835761aca Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 13 Mar 2024 16:47:00 -0600 Subject: [PATCH 15/15] Update Changelog date, add some notes about python and build-namelist testing --- doc/ChangeLog | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index f29bc95abc..2615593353 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ =============================================================== Tag name: ctsm5.1.dev173 Originator(s): rgknox (Ryan Knox,LAWRENCE BERKELEY NATIONAL LABORATORY) -Date: Wed 13 Mar 2024 10:42:26 AM MDT +Date: Wed 13 Mar 2024 04:46:37 PM MDT One-line Summary: New FATES namelist variable, fates_history_dimlevel Purpose and description of changes @@ -36,6 +36,14 @@ None of note. Testing summary: ---------------- + build-namelist tests (if CLMBuildNamelist.pm has changed): + + derecho - OK (64 fates tests differ) + + python testing (if python code has changed; see instructions in python/README.md; document testing done): + + derecho - PASS + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): derecho ----- OK