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

Add FATES cross-grid seed dispersal mechanism #5555

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 @@ -3223,6 +3227,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 @@ -2089,6 +2089,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 @@ -778,6 +779,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 @@ -1184,6 +1186,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