Skip to content

Commit

Permalink
Update elm-fates to enable use of lightning data
Browse files Browse the repository at this point in the history
This imports and adapts the clm-fates fire base types and
factory method of fire type creation.  The standard elm
FireMod has not been changed, but could adopt this method
in the future if so desired.  FATES will now have access
to the same lightning and population data the the FireMod
make use of.  The code also includes the hooks to enable
the use of additonal FATES fire modes, but these require
the use of data sets not currently stored on most machines.
  • Loading branch information
glemieux committed Mar 6, 2023
1 parent a3d082c commit 41339b9
Show file tree
Hide file tree
Showing 14 changed files with 1,426 additions and 21 deletions.
18 changes: 9 additions & 9 deletions components/elm/bld/ELMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2945,13 +2945,13 @@ sub setup_logic_popd_streams {
my ($test_files, $nl_flags, $definition, $defaults, $nl, $physv) = @_;

{
if ( $nl_flags->{'bgc_mode'} =~/cn|bgc/ ) {
if ( $nl_flags->{'bgc_mode'} =~/cn|bgc|fates/ ) {
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'popdensmapalgo', 'hgrid'=>$nl_flags->{'res'} );
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_popdens', 'phys'=>$nl_flags->{'phys'},
'use_cn'=>$nl_flags->{'use_cn'}, 'sim_year'=>$nl_flags->{'sim_year'},
'use_cn'=>$nl_flags->{'use_cn'}, 'use_fates'=>$nl_flags->{'use_fates'}, 'sim_year'=>$nl_flags->{'sim_year'},
'sim_year_range'=>$nl_flags->{'sim_year_range'});
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_popdens', 'phys'=>$nl_flags->{'phys'},
'use_cn'=>$nl_flags->{'use_cn'}, 'sim_year'=>$nl_flags->{'sim_year'},
'use_cn'=>$nl_flags->{'use_cn'}, 'use_fates'=>$nl_flags->{'use_fates'}, 'sim_year'=>$nl_flags->{'sim_year'},
'sim_year_range'=>$nl_flags->{'sim_year_range'});
# Set align year, if first and last years are different
if ( $nl->get_value('stream_year_first_popdens') !=
Expand All @@ -2960,7 +2960,7 @@ sub setup_logic_popd_streams {
'sim_year_range'=>$nl_flags->{'sim_year_range'});
}
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_popdens', 'phys'=>$nl_flags->{'phys'},
'use_cn'=>$nl_flags->{'use_cn'}, 'hgrid'=>"0.5x0.5" );
'use_cn'=>$nl_flags->{'use_cn'}, 'use_fates'=>$nl_flags->{'use_fates'}, 'hgrid'=>"0.5x0.5" );
} else {
# If bgc is NOT CN/CNDV then make sure none of the popdens settings are set
if ( defined($nl->get_value('stream_year_first_popdens')) ||
Expand All @@ -2982,14 +2982,14 @@ sub setup_logic_lightning_streams {
my ($test_files, $nl_flags, $definition, $defaults, $nl, $physv) = @_;

{
if ( $nl_flags->{'bgc_mode'} =~/cn|bgc/ ) {
if ( $nl_flags->{'bgc_mode'} =~/cn|bgc|fates/ ) {
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'use_cn'=>$nl_flags->{'use_cn'},
'hgrid'=>$nl_flags->{'res'} );
'use_fates'=>$nl_flags->{'use_fates'}, 'hgrid'=>$nl_flags->{'res'} );
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lightng', 'use_cn'=>$nl_flags->{'use_cn'},
'sim_year'=>$nl_flags->{'sim_year'},
'use_fates'=>$nl_flags->{'use_fates'}, 'sim_year'=>$nl_flags->{'sim_year'},
'sim_year_range'=>$nl_flags->{'sim_year_range'});
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_lightng', 'use_cn'=>$nl_flags->{'use_cn'},
'sim_year'=>$nl_flags->{'sim_year'},
'use_fates'=>$nl_flags->{'use_fates'}, 'sim_year'=>$nl_flags->{'sim_year'},
'sim_year_range'=>$nl_flags->{'sim_year_range'});
# Set align year, if first and last years are different
if ( $nl->get_value('stream_year_first_lightng') !=
Expand All @@ -2998,7 +2998,7 @@ sub setup_logic_lightning_streams {
'sim_year_range'=>$nl_flags->{'sim_year_range'});
}
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_lightng', 'use_cn'=>$nl_flags->{'use_cn'},
'hgrid'=>"94x192" );
'use_fates'=>$nl_flags->{'use_fates'}, 'hgrid'=>"94x192" );
} else {
# If bgc is NOT CN/CNDV then make sure none of the Lightng settings are set
if ( defined($nl->get_value('stream_year_first_lightng')) ||
Expand Down
51 changes: 51 additions & 0 deletions components/elm/bld/namelist_files/namelist_defaults.xml
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,11 @@ this mask will have smb calculated over the entire global land surface
<stream_year_first_lightng use_cn=".true." >0001</stream_year_first_lightng>
<stream_year_last_lightng use_cn=".true." >0001</stream_year_last_lightng>

<stream_year_first_lightng use_fates=".true." >0001</stream_year_first_lightng>
<stream_year_last_lightng use_fates=".true." >0001</stream_year_last_lightng>

<stream_fldfilename_lightng hgrid="94x192" use_cn=".true." >atm/datm7/NASA_LIS/clmforc.Li_2012_climo1995-2011.T62.lnfm_Total_c140423.nc</stream_fldfilename_lightng>
<stream_fldfilename_lightng hgrid="94x192" use_fates=".true." >atm/datm7/NASA_LIS/clmforc.Li_2012_climo1995-2011.T62.lnfm_Total_c140423.nc</stream_fldfilename_lightng>

<lightngmapalgo use_cn=".true." >bilinear</lightngmapalgo>

Expand All @@ -770,6 +774,17 @@ this mask will have smb calculated over the entire global land surface
<lightngmapalgo use_cn=".true." hgrid="1x1_tropicAtl" >nn</lightngmapalgo>
<lightngmapalgo use_cn=".true." hgrid="5x5_amazon" >nn</lightngmapalgo>

<lightngmapalgo use_fates=".true." >bilinear</lightngmapalgo>

<lightngmapalgo use_fates=".true." hgrid="1x1_brazil" >nn</lightngmapalgo>
<lightngmapalgo use_fates=".true." hgrid="1x1_mexicocityMEX" >nn</lightngmapalgo>
<lightngmapalgo use_fates=".true." hgrid="1x1_vancouverCAN" >nn</lightngmapalgo>
<lightngmapalgo use_fates=".true." hgrid="1x1_urbanc_alpha" >nn</lightngmapalgo>
<lightngmapalgo use_fates=".true." hgrid="1x1_camdenNJ" >nn</lightngmapalgo>
<lightngmapalgo use_fates=".true." hgrid="1x1_asphaltjungleNJ" >nn</lightngmapalgo>
<lightngmapalgo use_fates=".true." hgrid="1x1_tropicAtl" >nn</lightngmapalgo>
<lightngmapalgo use_fates=".true." hgrid="5x5_amazon" >nn</lightngmapalgo>

<!-- Population density streams namelist defaults -->
<stream_year_first_popdens use_cn=".true." sim_year="2000" >2000</stream_year_first_popdens>
<stream_year_last_popdens use_cn=".true." sim_year="2000" >2000</stream_year_last_popdens>
Expand All @@ -795,7 +810,32 @@ this mask will have smb calculated over the entire global land surface
<stream_year_first_popdens use_cn=".true." sim_year="constant" sim_year_range="2000-2100" >1850</stream_year_first_popdens>
<stream_year_last_popdens use_cn=".true." sim_year="constant" sim_year_range="2000-2100" >2010</stream_year_last_popdens>

<stream_year_first_popdens use_fates=".true." sim_year="2000" >2000</stream_year_first_popdens>
<stream_year_last_popdens use_fates=".true." sim_year="2000" >2000</stream_year_last_popdens>

<stream_year_first_popdens use_fates=".true." sim_year="1850" >1850</stream_year_first_popdens>
<stream_year_last_popdens use_fates=".true." sim_year="1850" >1850</stream_year_last_popdens>

<stream_year_first_popdens use_fates=".true." sim_year="1000" >2000</stream_year_first_popdens>
<stream_year_last_popdens use_fates=".true." sim_year="1000" >2000</stream_year_last_popdens>

<stream_year_first_popdens use_fates=".true." sim_year="constant" sim_year_range="1000-1002" >2000</stream_year_first_popdens>
<stream_year_last_popdens use_fates=".true." sim_year="constant" sim_year_range="1000-1002" >2000</stream_year_last_popdens>

<stream_year_first_popdens use_fates=".true." sim_year="constant" sim_year_range="1000-1004" >2000</stream_year_first_popdens>
<stream_year_last_popdens use_fates=".true." sim_year="constant" sim_year_range="1000-1004" >2000</stream_year_last_popdens>

<stream_year_first_popdens use_fates=".true." sim_year="constant" sim_year_range="1850-2000" >1850</stream_year_first_popdens>
<stream_year_last_popdens use_fates=".true." sim_year="constant" sim_year_range="1850-2000" >2010</stream_year_last_popdens>

<stream_year_first_popdens use_fates=".true." sim_year="constant" sim_year_range="1850-2100" >1850</stream_year_first_popdens>
<stream_year_last_popdens use_fates=".true." sim_year="constant" sim_year_range="1850-2100" >2010</stream_year_last_popdens>

<stream_year_first_popdens use_fates=".true." sim_year="constant" sim_year_range="2000-2100" >1850</stream_year_first_popdens>
<stream_year_last_popdens use_fates=".true." sim_year="constant" sim_year_range="2000-2100" >2010</stream_year_last_popdens>

<stream_fldfilename_popdens hgrid="0.5x0.5" use_cn=".true." >lnd/clm2/firedata/elmforc.ssp5_hdm_0.5x0.5_simyr1850-2100_c190109.nc</stream_fldfilename_popdens>
<stream_fldfilename_popdens hgrid="0.5x0.5" use_fates=".true." >lnd/clm2/firedata/elmforc.ssp5_hdm_0.5x0.5_simyr1850-2100_c190109.nc</stream_fldfilename_popdens>

<popdensmapalgo use_cn=".true." >bilinear</popdensmapalgo>

Expand All @@ -808,6 +848,17 @@ this mask will have smb calculated over the entire global land surface
<popdensmapalgo use_cn=".true." hgrid="1x1_tropicAtl" >nn</popdensmapalgo>
<popdensmapalgo use_cn=".true." hgrid="5x5_amazon" >nn</popdensmapalgo>

<popdensmapalgo use_fates=".true." >bilinear</popdensmapalgo>

<popdensmapalgo use_fates=".true." hgrid="1x1_brazil" >nn</popdensmapalgo>
<popdensmapalgo use_fates=".true." hgrid="1x1_mexicocityMEX" >nn</popdensmapalgo>
<popdensmapalgo use_fates=".true." hgrid="1x1_vancouverCAN" >nn</popdensmapalgo>
<popdensmapalgo use_fates=".true." hgrid="1x1_urbanc_alpha" >nn</popdensmapalgo>
<popdensmapalgo use_fates=".true." hgrid="1x1_camdenNJ" >nn</popdensmapalgo>
<popdensmapalgo use_fates=".true." hgrid="1x1_asphaltjungleNJ" >nn</popdensmapalgo>
<popdensmapalgo use_fates=".true." hgrid="1x1_tropicAtl" >nn</popdensmapalgo>
<popdensmapalgo use_fates=".true." hgrid="5x5_amazon" >nn</popdensmapalgo>

<!-- Create crop on a separate land-unit -->
<create_crop_landunit use_crop=".true." >.true.</create_crop_landunit>
<create_crop_landunit use_crop=".false." >.false.</create_crop_landunit>
Expand Down
11 changes: 9 additions & 2 deletions components/elm/bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,15 @@ Toggle to turn on the FATES
</entry>

<entry id="fates_spitfire_mode" type="integer" category="physics"
group="elm_inparm" valid_values="0,1" >
Set to 0 to keep fire off. Set to 1 to turn on fates spitfire module (only relevant if FATES is being used).
group="elm_inparm" valid_values="0,1,2,3,4,5", value="0" >
Turn on spitfire module to simulate fire by setting fates_spitfire_mode > 0.
Allowed values are:
0 : Simulations of fire are off
1 : use a global constant lightning rate found in fates_params
2 : use an external lightning dataset
3 : use an external confirmed ignitions dataset (not available through standard CESM dataset collection)
4 : use external lightning and population datasets to simulate both natural and anthropogenic
5 : use gross domestic production and population datasets to simulate anthropogenic fire supression
</entry>

<entry id="fates_parteh_mode" type="integer" category="physics"
Expand Down
144 changes: 144 additions & 0 deletions components/elm/src/biogeochem/FATESFireBase.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
module FATESFireBase

!-----------------------------------------------------------------------
! !DESCRIPTION:
! Abstract base class for FATES fire data object
!
! !USES:
use shr_kind_mod , only : r8 => shr_kind_r8
use abortutils , only : endrun
use decompMod , only : bounds_type
use FireDataBaseType , only : fire_base_type

implicit none
private
!
! !PUBLIC TYPES:
public :: fates_fire_base_type

type, abstract, extends(fire_base_type) :: fates_fire_base_type

private
! !PRIVATE MEMBER DATA:

contains
! !PUBLIC MEMBER FUNCTIONS:
procedure(GetLight24_interface), public, deferred :: GetLight24 ! Return the 24-hour averaged lightning data
procedure(GetGDP_interface), public, deferred :: GetGDP ! Return the global gdp data
procedure(InitAccBuffer_interface), public, deferred :: InitAccBuffer ! Initialize accumulation processes
procedure(InitAccVars_interface), public, deferred :: InitAccVars ! Initialize accumulation variables
procedure(UpdateAccVars_interface), public, deferred :: UpdateAccVars ! Update/extract accumulations vars
procedure(need_lightning_and_popdens_interface), public, deferred :: &
need_lightning_and_popdens ! Returns true if need lightning & popdens

end type fates_fire_base_type

!-----------------------

abstract interface
!-----------------------------------------------------------------------

function need_lightning_and_popdens_interface(this) result(need_lightning_and_popdens)
!
! !DESCRIPTION:
! Returns true if need lightning and popdens, false otherwise
!
! USES
import :: fates_fire_base_type
!
! !ARGUMENTS:
class(fates_fire_base_type), intent(in) :: this
logical :: need_lightning_and_popdens ! function result
!-----------------------------------------------------------------------
end function need_lightning_and_popdens_interface

!------------------------------------------------------------------------
function GetLight24_interface( this ) result(lnfm24)
!
! !DESCRIPTION: Get the 24-hour averaged lightning data
! !USES
use shr_kind_mod , only: r8 => shr_kind_r8
import :: fates_fire_base_type
!
! !ARGUMENTS:
class(fates_fire_base_type) :: this
real(r8), pointer :: lnfm24(:)
!---------------------------------------------------------------------
!---------------------------------------------------------------------
end function GetLight24_interface

!------------------------------------------------------------------------
function GetGDP_interface( this ) result(gdp)
!
! !DESCRIPTION: Get the global gross domestic product data
! !USES
use shr_kind_mod , only: r8 => shr_kind_r8
import :: fates_fire_base_type
!
! !ARGUMENTS:
class(fates_fire_base_type) :: this
real(r8), pointer :: gdp(:)
!---------------------------------------------------------------------
!---------------------------------------------------------------------
end function GetGDP_interface

!-----------------------------------------------------------------------
subroutine InitAccBuffer_interface (this, bounds)
!
! !DESCRIPTION:
! Initialize the accumulation buffers
!
! !USES
use decompMod , only: bounds_type
import :: fates_fire_base_type
!
! !ARGUMENTS:
class(fates_fire_base_type) :: this
type(bounds_type), intent(in) :: bounds

! !LOCAL VARIABLES:
!---------------------------------------------------------------------

end subroutine InitAccBuffer_interface

!-----------------------------------------------------------------------
subroutine InitAccVars_interface(this, bounds)
!
! !DESCRIPTION:
! Initialize the accumulation variables
!
! !USES
use decompMod , only: bounds_type
import :: fates_fire_base_type
!
! !ARGUMENTS:
class(fates_fire_base_type) :: this
type(bounds_type), intent(in) :: bounds
!
! !LOCAL VARIABLES:
!---------------------------------------------------------------------

end subroutine InitAccVars_interface

!-----------------------------------------------------------------------
subroutine UpdateAccVars_interface (this, bounds)
!
! !DESCRIPTION:
! Update accumulation variables
!
! !USES
use decompMod , only: bounds_type
import :: fates_fire_base_type
!
! !ARGUMENTS:
class(fates_fire_base_type) :: this
type(bounds_type), intent(in) :: bounds
!
! !LOCAL VARIABLES:
!---------------------------------------------------------------------

end subroutine UpdateAccVars_interface

end interface

end module FATESFireBase
Loading

0 comments on commit 41339b9

Please sign in to comment.