Skip to content

Commit

Permalink
Merge remote-tracking branch 'glemfork/lnd/fates-crossgrid-seeddisper…
Browse files Browse the repository at this point in the history
…sal' (PR #5555)

This PR enables FATES to disperse seeds across neighboring grid cells using MPI.
The API update includes calls to new fates dispersal procedures and as such should be coordinated with NGEET/fates#1005.

[B4B] except for FATES
  • Loading branch information
peterdschwartz committed Nov 20, 2023
2 parents faac9f0 + e7921a0 commit 93ab10c
Show file tree
Hide file tree
Showing 10 changed files with 241 additions and 24 deletions.
11 changes: 8 additions & 3 deletions components/elm/bld/ELMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -790,11 +790,11 @@ sub setup_cmdl_fates_mode {

# The following variables may be set by the user and are compatible with use_fates
# no need to set defaults, covered in a different routine
my @list = ( "fates_spitfire_mode", "use_vertsoilc", "use_century_decomp",
my @list = ( "fates_spitfire_mode", "use_vertsoilc", "use_century_decomp", "fates_seeddisp_cadence",
"use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys",
"use_fates_inventory_init", "use_fates_fixed_biogeog", "use_fates_nocomp","use_fates_sp",
"use_fates_inventory_init", "use_fates_fixed_biogeog", "use_fates_nocomp","use_fates_sp",
"fates_inventory_ctrl_filename","use_fates_logging", "use_fates_tree_damage",
"use_fates_parteh_mode","use_fates_cohort_age_tracking","use_snicar_ad");
"use_fates_parteh_mode","use_fates_cohort_age_tracking","use_snicar_ad");
foreach my $var ( @list ) {
if ( defined($nl->get_value($var)) ) {
$nl_flags->{$var} = $nl->get_value($var);
Expand Down Expand Up @@ -858,6 +858,10 @@ sub setup_cmdl_fates_mode {
if ( defined($nl->get_value($var)) ) {
fatal_error("$var is being set, but can ONLY be set when -bgc fates option is used.\n");
}
$var = "fates_seeddisp_cadence";
if ( defined($nl->get_value($var)) ) {
fatal_error("$var is being set, but can ONLY be set when -bgc fates option is used.\n");
}

}
}
Expand Down Expand Up @@ -3224,6 +3228,7 @@ sub setup_logic_fates {
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_fates_sp', 'use_fates'=>$nl_flags->{'use_fates'});
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_fates_nocomp', 'use_fates'=>$nl_flags->{'use_fates'});
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_fates_tree_damage', 'use_fates'=>$nl_flags->{'use_fates'});
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_seeddisp_cadence', 'use_fates'=>$nl_flags->{'use_fates'});
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'});

}
Expand Down
1 change: 1 addition & 0 deletions components/elm/bld/namelist_files/namelist_defaults.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2091,6 +2091,7 @@ this mask will have smb calculated over the entire global land surface
<use_fates_cohort_age_tracking use_fates=".true.">.false.</use_fates_cohort_age_tracking>
<use_fates_sp use_fates=".true.">.false.</use_fates_sp>
<fates_parteh_mode use_fates=".true.">1</fates_parteh_mode>
<fates_seeddisp_cadence use_fates=".true.">0</fates_seeddisp_cadence>
<use_fates_inventory_init use_fates=".true.">.false.</use_fates_inventory_init>
<fates_inventory_ctrl_filename use_fates=".true."> "/dev/null" </fates_inventory_ctrl_filename>
<use_fates_nocomp use_fates=".true." use_fates_sp=".true.">.true.</use_fates_nocomp>
Expand Down
11 changes: 11 additions & 0 deletions components/elm/bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,17 @@ Allowed values are:
Switch deciding which nutrient model to use in FATES.
</entry>

<entry id="fates_seeddisp_cadence" type="integer" category="physics"
group="elm_inparm" valid_values="0,1,2,3">
Switch defining the cadence at which seeds are dispersed across
gridcells. Setting the switch value to zero turns off dispersal.
Setting the switch to 1, 2, or 3 sets the dispersal cadence to
daily, monthly or yearly. The daily cadence is primarily
recommended for test and debug only. Note that turning this
feature on will result in more memory usage.
(Only relevant if FATES is being used).
</entry>

<entry id="use_fates_fixed_biogeog" type="logical" category="physics"
group="elm_inparm" valid_values="" value=".false.">
Toggle to turn on FATES fixed biogeography mode (only relevant if FATES is being used).
Expand Down
2 changes: 1 addition & 1 deletion components/elm/src/data_types/GridcellType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ subroutine grc_pp_init(this, begg, endg)
allocate(this%MaxElevation (begg:endg)) ; this%MaxElevation (:) = spval

allocate(this%landunit_indices(1:max_lunit, begg:endg)); this%landunit_indices(:,:) = ispval

! allocate(this%topounit_indices (begg:endg,1:max_topounits)) ; this%topounit_indices (:,:) = ispval

end subroutine grc_pp_init
Expand Down
4 changes: 4 additions & 0 deletions components/elm/src/main/controlMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ subroutine control_init( )
use_fates_nocomp, &
use_fates_sp, &
fates_parteh_mode, &
fates_seeddisp_cadence, &
use_fates_tree_damage

namelist /elm_inparm / use_betr
Expand Down Expand Up @@ -781,6 +782,7 @@ subroutine control_spmd()
call mpi_bcast (fates_inventory_ctrl_filename, len(fates_inventory_ctrl_filename), &
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 (use_fates_tree_damage, 1, MPI_LOGICAL, 0, mpicom, ier)

call mpi_bcast (use_betr, 1, MPI_LOGICAL, 0, mpicom, ier)
Expand Down Expand Up @@ -1192,6 +1194,8 @@ subroutine control_print ()
write(iulog, *) ' use_fates_nocomp = ', use_fates_nocomp
write(iulog, *) ' use_fates_sp = ', use_fates_sp
write(iulog, *) ' fates_inventory_ctrl_filename = ',fates_inventory_ctrl_filename
write(iulog, *) ' fates_seeddisp_cadence = ', fates_seeddisp_cadence
write(iulog, *) ' fates_seeddisp_cadence: 0, 1, 2, 3 => off, daily, monthly, or yearly dispersal'
end if

! VSFM
Expand Down
11 changes: 9 additions & 2 deletions components/elm/src/main/elm_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ subroutine elm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate)
! the calling tree is given in the description of this module.
!
! !USES:
use elm_varctl , only : fates_spitfire_mode
use FATESFireFactoryMod , only : scalar_lightning
use elm_varctl , only : fates_spitfire_mode
use elm_varctl , only : fates_seeddisp_cadence
use FATESFireFactoryMod , only : scalar_lightning
use FatesInterfaceTypesMod, only : fates_dispersal_cadence_none

! !ARGUMENTS:
implicit none
Expand Down Expand Up @@ -1387,6 +1389,11 @@ subroutine elm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate)
end do
!$OMP END PARALLEL DO

! Pass fates seed dispersal information to all nodes
if (use_fates) then
if (fates_seeddisp_cadence /= fates_dispersal_cadence_none) call alm_fates%WrapGlobalSeedDispersal()
end if

! ============================================================================
! Determine gridcell averaged properties to send to atm
! ============================================================================
Expand Down
2 changes: 1 addition & 1 deletion components/elm/src/main/elm_initializeMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ subroutine initialize1( )
use dynSubgridControlMod , only: dynSubgridControl_init
use filterMod , only: allocFilters
use reweightMod , only: reweight_wrapup
use topounit_varcon , only: max_topounits, has_topounit, topounit_varcon_init
use topounit_varcon , only: max_topounits, has_topounit, topounit_varcon_init
use elm_varctl , only: use_top_solar_rad
!
! !LOCAL VARIABLES:
Expand Down
2 changes: 2 additions & 0 deletions components/elm/src/main/elm_varctl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ module elm_varctl
integer, public :: fates_parteh_mode = -9 ! 1 => carbon only
! 2 => C+N+P (not enabled yet)
! no others enabled
integer, public :: fates_seeddisp_cadence = iundef ! 0 => no seed dispersal across gridcells
! 1, 2, 3 => daily, monthly, or yearly seed dispersal


!----------------------------------------------------------
Expand Down
Loading

0 comments on commit 93ab10c

Please sign in to comment.