Skip to content

Commit

Permalink
Merge pull request #99 from mvertens/feature/megan_cherrypick_ctsm_mv…
Browse files Browse the repository at this point in the history
…ertens

add MEGAN compatibility with FATES
  • Loading branch information
rosiealice authored Nov 22, 2024
2 parents 95a4d93 + c89f3cc commit ca5cddb
Show file tree
Hide file tree
Showing 16 changed files with 981 additions and 703 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#
[submodule "fates"]
path = src/fates
url = https://github.com/NGEET/fates
fxtag = sci.1.78.3_api.36.1.0
url = https://github.com/NorESMhub/fates
fxtag = sci.1.78.3_api.36.1.0_noresm_v1
fxrequired = AlwaysRequired
# Standard Fork to compare to with "git fleximod test" to ensure personal forks aren't committed
fxDONOTUSEurl = https://github.com/NCAR/fates-release
Expand Down
12 changes: 4 additions & 8 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ sub setup_cmdl_bgc {
# Set soil matrix (which is needed later for spinup)
$var = "use_soil_matrixcn";
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
, 'use_fates'=>$nl_flags->{'use_fates'},
, 'use_fates'=>$nl_flags->{'use_fates'},
, 'soil_decomp_method'=>$nl_flags->{'soil_decomp_method'},
, 'phys'=>$nl_flags->{'phys'}, clm_accelerated_spinup=>$nl_flags->{'clm_accelerated_spinup'} );
if ( &value_is_true($nl->get_value($var)) ) {
Expand Down Expand Up @@ -1214,7 +1214,7 @@ sub setup_cmdl_spinup {
if ( &value_is_true($nl_flags->{'use_cn'}) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition,
$defaults, $nl, "spinup_state", clm_accelerated_spinup=>$nl_flags->{'clm_accelerated_spinup'},
use_cn=>$nl_flags->{'use_cn'}, use_fates=>$nl_flags->{'use_fates'},
use_cn=>$nl_flags->{'use_cn'}, use_fates=>$nl_flags->{'use_fates'},
use_soil_matrixcn=>$nl_flags->{"use_soil_matrixcn"} );
if ( $nl->get_value("spinup_state") ne 0 ) {
$nl_flags->{'bgc_spinup'} = "on";
Expand Down Expand Up @@ -4148,12 +4148,8 @@ sub setup_logic_megan {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'megan_factors_file');
}
if ( defined($nl->get_value('megan_specifier')) ||
defined($nl->get_value('megan_factors_file')) ) {
defined($nl->get_value('megan_factors_file')) ) {
check_megan_spec( $opts, $nl, $definition );
if ( &value_is_true( $nl_flags->{'use_fates'} ) ) {
$log->warning("MEGAN can NOT be on when FATES is also on.\n" .
" Use the '-no-megan' option when '-bgc fates' is activated");
}
}
}

Expand Down Expand Up @@ -4966,7 +4962,7 @@ sub setup_logic_exice {
# excess ice streams, must be set before initial conditions
#
my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_;
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_excess_ice', 'phys'=>$physv->as_string());
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_excess_ice', 'phys'=>$physv->as_string());
my $use_exice = $nl->get_value( 'use_excess_ice' );
# Put use_exice into nl_flags so can be referenced later
if ( value_is_true($use_exice) ) {
Expand Down
8 changes: 4 additions & 4 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,8 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<!-- FATES default parameter file -->
<!-- ================================================================== -->

<fates_paramfile>lnd/clm2/paramdata/fates_params_api.36.1.0_14pft_c241003.nc</fates_paramfile>

<!-- <fates_paramfile>lnd/clm2/paramdata/fates_params_api.36.1.0_14pft_c241003.nc</fates_paramfile> -->
<fates_paramfile>lnd/clm2/paramdata/fates_params_api.36.1.0_14pft_c241003_megan.nc</fates_paramfile>

<!-- ================================================================== -->
<!-- Default surface roughness parameterization -->
Expand Down Expand Up @@ -1908,10 +1908,10 @@ lnd/clm2/surfdata_esmf/NEON/ctsm5.3.0/surfdata_1x1_NEON_TOOL_hist_2000_78pfts_c2
<!-- As of 2024/02/02 the Grids Support spreadsheet includes no 16-pft landuse files. -->
<flanduse_timeseries hgrid="4x5" sim_year_range="1850-2000"
>lnd/clm2/surfdata_esmf/ctsm5.3.0/landuse.timeseries_4x5_SSP2-4.5_1850-2100_78pfts_c240908.nc</flanduse_timeseries>
<flanduse_timeseries hgrid="10x15" sim_year_range="1850-2000"
<flanduse_timeseries hgrid="10x15" sim_year_range="1850-2000"
>lnd/clm2/surfdata_esmf/ctsm5.3.0/landuse.timeseries_10x15_SSP2-4.5_1850-2100_78pfts_c240908.nc</flanduse_timeseries>

<flanduse_timeseries hgrid="360x720cru" sim_year_range="1850-2000"
<flanduse_timeseries hgrid="360x720cru" sim_year_range="1850-2000"
>lnd/clm2/surfdata_esmf/ctsm5.3.0/landuse.timeseries_360x720cru_SSP2-4.5_1850-2100_78pfts_c240908.nc</flanduse_timeseries>

<flanduse_timeseries hgrid="1x1_brazil" sim_year_range="1850-2000"
Expand Down
11 changes: 1 addition & 10 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ _config_cache_template = """
<?xml version="1.0"?>
<config_definition>
<commandline></commandline>
<entry id="phys" value="{clm_phys}" list="" valid_values="clm4_5,clm5_0,clm5_1,clm6_0">Specifies CTSM physics</entry>
<entry id="phys" value="{clm_phys}" list="" valid_values="clm4_5,clm5_0,clm6_0">Specifies CTSM physics</entry>
</config_definition>
"""

Expand Down Expand Up @@ -105,11 +105,6 @@ def buildnml(case, caseroot, compname):
"clm5_0_QIAN": "clm5_0_GSWP3v1",
"clm5_0_NLDAS2": "clm5_0_GSWP3v1",
"clm5_0_ERA5": "clm5_0_GSWP3v1",
"clm5_1_1PT": "clm5_1_GSWP3v1",
"clm5_1_QIAN": "clm5_1_GSWP3v1",
"clm5_1_NLDAS2": "clm5_1_GSWP3v1",
"clm5_1_ERA5": "clm5_1_GSWP3v1",
"clm5_1_CRUv7": "clm5_1_GSWP3v1",
"clm6_0_1PT": "clm6_0_GSWP3v1",
"clm6_0_QIAN": "clm6_0_GSWP3v1",
"clm6_0_NLDAS2": "clm6_0_GSWP3v1",
Expand All @@ -136,13 +131,9 @@ def buildnml(case, caseroot, compname):
# to the CAM version)
tuning_based_on = {
"clm6_0_GSWP3v1": "clm5_0_GSWP3v1",
"clm5_1_GSWP3v1": "clm5_0_GSWP3v1",
"clm6_0_cam6.0": "clm5_0_cam6.0",
"clm6_0_cam5.0": "clm5_0_cam6.0",
"clm6_0_cam4.0": "clm5_0_cam6.0",
"clm5_1_cam6.0": "clm5_0_cam6.0",
"clm5_1_cam5.0": "clm5_0_cam6.0",
"clm5_1_cam4.0": "clm5_0_cam6.0",
"clm5_0_cam5.0": "clm5_0_cam6.0",
"clm5_0_cam4.0": "clm5_0_cam6.0",
"clm4_5_cam6.0": "clm5_0_cam6.0",
Expand Down
34 changes: 10 additions & 24 deletions cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<description modifier_mode="1">
<desc lnd="CLM45[%SP][%SP-VIC][%BGC][%BGC-CROP][%FATES][%BGCDV][%BGCDV-CROP]" >clm4.5:</desc>
<desc lnd="CLM50[%SP][%SP-VIC][%SP-NOANTHRO][%BGC-NOANTHRO][%BGC][%BGC-CROP][%FATES][%BGCDV][%BGCDV-CROP][%BGC-CROP-CMIP6DECK][%BGC-CROP-CMIP6WACCMDECK][%NWP-SP][%NWP-BGC-CROP]">clm5.0:</desc>
<desc lnd="CLM51[%SP][%SP-NOANTHRO][%BGC-NOANTHRO][%BGC][%BGC-CROP][%FATES][%FATES-SP][%FATES-NOCOMP][%NWP-SP][%NWP-BGC-CROP]">clm5.1:</desc>
<desc lnd="CLM60[%SP][%SP-NOANTHRO][%BGC-NOANTHRO][%BGC][%BGC-CROP][%FATES][%FATES-SP][%FATES-NOCOMP][%BGC-CROP-CMIP6DECK][%BGC-CROP-CMIP6WACCMDECK][%NWP-SP][%NWP-BGC-CROP]">clm6.0:</desc>
<desc option="SP" >Satellite phenology:</desc>

Expand Down Expand Up @@ -79,7 +78,7 @@
</desc>
<default_value>UNSET</default_value>
<!-- 10 forcing options for each CLM physics option: CRUv7, GSWP3, cam7.0, cam6.0, cam5.0, cam4.0, QIAN, 1PT, NLDAS2, ERA5 -->
<valid_values>clm5_0_cam6.0,clm5_0_cam7.0,clm5_0_cam5.0,clm5_0_cam4.0,clm5_0_GSWP3v1,clm5_0_CRUv7,clm5_0_QIAN,clm5_0_1PT,clm5_0_NLDAS2,clm5_0_ERA5,clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_QIAN,clm4_5_cam6.0,clm4_5_cam7.0,clm4_5_cam5.0,clm4_5_cam4.0,clm4_5_1PT,clm4_5_NLDAS2,clm4_5_ERA5,clm5_1_CRUv7,clm5_1_GSWP3v1,clm5_1_cam6.0,clm5_1_QIAN,clm5_1_1PT,clm5_1_NLDAS2,clm5_1_ERA5,clm6_0_CRUv7,clm6_0_GSWP3v1,clm6_0_cam6.0,clm6_0_cam7.0,clm6_0_cam5.0,clm6_0_cam4.0,clm6_0_QIAN,clm6_0_1PT,clm6_0_NLDAS2,clm6_0_ERA5</valid_values>
<valid_values>clm5_0_cam6.0,clm5_0_cam7.0,clm5_0_cam5.0,clm5_0_cam4.0,clm5_0_GSWP3v1,clm5_0_CRUv7,clm5_0_QIAN,clm5_0_1PT,clm5_0_NLDAS2,clm5_0_ERA5,clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_QIAN,clm4_5_cam6.0,clm4_5_cam7.0,clm4_5_cam5.0,clm4_5_cam4.0,clm4_5_1PT,clm4_5_NLDAS2,clm4_5_ERA5,clm6_0_CRUv7,clm6_0_GSWP3v1,clm6_0_cam6.0,clm6_0_cam7.0,clm6_0_cam5.0,clm6_0_cam4.0,clm6_0_QIAN,clm6_0_1PT,clm6_0_NLDAS2,clm6_0_ERA5</valid_values>
<values match="last">
<!-- Options for atm forcing are: CRU, CRUv7, GSWP3, cam6.0 (also used for DATM%CPLHIST), cam5.0, cam4.0, QIAN, WISOQIA, 1PT, NLDAS2, and ERA5) -->
<!-- All the clm4_5 physics options -->
Expand Down Expand Up @@ -114,14 +113,6 @@
<value compset="DATM%1PT_CLM50" >clm5_0_1PT</value>
<value compset="DATM%NLDAS2_CLM50" >clm5_0_NLDAS2</value>
<value compset="DATM%ERA5_CLM50" >clm5_0_ERA5</value>
<!-- All the clm5_1 physics options -->
<value compset="DATM%GSWP3v1_CLM51">clm5_1_GSWP3v1</value>
<value compset="CAM[^_]*_CLM51" >INVALID_USE_CLM60_NOT_CLM51</value>
<value compset="CAM40[^_]*_CLM51" >clm5_1_cam4.0</value>
<value compset="CAM50[^_]*_CLM51" >clm5_1_cam5.0</value>
<value compset="CAM60[^_]*_CLM51" >clm5_1_cam6.0</value>
<value compset="CAM70[^_]*_CLM51" >INVALID_USE_CLM60_NOT_CLM51_FOR_CAM70</value>
<value compset="DATM%CPLHIST_CLM51">INVALID_USE_CLM60_NOT_CLM51_FOR_CPLHIST</value>
<!-- All the clm6_0 physics options -->
<value compset="DATM%CRUv7_CLM60" >clm6_0_CRUv7</value>
<value compset="DATM%CRU_CLM60" >clm6_0_CRUv7</value>
Expand All @@ -148,7 +139,7 @@

<entry id="CLM_PHYSICS_VERSION" >
<type>char</type>
<valid_values>clm4_5,clm5_0,clm5_1,clm6_0</valid_values>
<valid_values>clm4_5,clm5_0,clm6_0</valid_values>
<!-- By setting the default_value to UNSET (or some other non-empty
string that doesn't appear in the list of valid_values), the
scripts will ensure that one of the below values is picked up
Expand All @@ -157,7 +148,6 @@
<values>
<value compset="_CLM45" >clm4_5</value>
<value compset="_CLM50" >clm5_0</value>
<value compset="_CLM51" >clm5_1</value>
<value compset="_CLM60" >clm6_0</value>
</values>
<group>run_component_ctsm</group>
Expand All @@ -172,11 +162,9 @@
<type>logical</type>
<valid_values>TRUE,FALSE</valid_values>
<default_value>TRUE</default_value>
<!-- Until CAM sets dust settings in drv_flds_in this should only be TRUE
<values>
<value compset="CAM" >FALSE</value>
<value compset="CAM">FALSE</value>
</values>
-->
<group>run_component_cpl</group>
<file>env_run.xml</file>
<desc>If CTSM will set the dust settings in drv_flds_in (TRUE), or if ATM (i.e. CAM) will - DO NOT EDIT (set by compset name)</desc>
Expand Down Expand Up @@ -256,9 +244,9 @@
<value compset="_CLM[^_]*%SP" >-bgc sp</value>
<value compset="_CLM[^_]*BGC" >-bgc bgc</value>
<value compset="_CLM[^_]*BGC-CROP" >-bgc bgc -crop</value>
<value compset="_CLM[^_]*FATES" >-bgc fates -no-megan</value>
<value compset="_CLM[^_]*FATES-SP" >-bgc fates -no-megan</value>
<value compset="_CLM[^_]*FATES-NOCOMP">-bgc fates -no-megan</value>
<value compset="_CLM[^_]*FATES" >-bgc fates -nomeg</value>
<value compset="_CLM[^_]*FATES-SP" >-bgc fates</value>
<value compset="_CLM[^_]*FATES-NOCOMP">-bgc fates</value>

<!-- Options specific for CLM4.5 -->
<value compset="_CLM45%[^_]*BGCDV" >-bgc bgc -dynamic_vegetation</value>
Expand Down Expand Up @@ -367,12 +355,10 @@
<valid_values></valid_values>
<default_value></default_value>
<values match="last">
<value compset="_CLM60%[^_]*FATES-SP[%_]" >$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/fates_sp</value>
<value compset="_CLM51%[^_]*FATES-SP[%_]" >$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/fates_sp</value>
<value compset="_CLM50%[^_]*CMIP6DECK[%_]" >$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_deck</value>
<value compset="_CLM51%[^_]*FATES-SP[%_]" >$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/fates_sp</value>
<value compset="_CLM51%[^_]*FATES-NOCOMP[%_]" >$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/fates_nocomp</value>
<value grid="l%1.9x2.5" compset="_CLM50%[^_]*CMIP6DECK[%_]" >$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_nociso_deck</value>
<value compset="_CLM60%[^_]*FATES-SP[%_]" >$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/fates_sp</value>
<value compset="_CLM60%[^_]*FATES-NOCOMP[%_]">$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/fates_nocomp</value>
<value compset="_CLM50%[^_]*CMIP6DECK[%_]" >$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_deck</value>
<value grid="l%1.9x2.5" compset="_CLM50%[^_]*CMIP6DECK[%_]" >$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_nociso_deck</value>
<value compset="_CLM50%[^_]*CMIP6WACCMDECK[%_]">$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_waccm_deck</value>
<value grid="l%1.9x2.5" compset="_CLM50%[^_]*CMIP6WACCMDECK[%_]">$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_waccm_nociso_deck</value>
<value compset="_CLM60%[^_]*CMIP6DECK[%_]" >$COMP_ROOT_DIR_LND/cime_config/usermods_dirs/cmip6_deck</value>
Expand Down
18 changes: 3 additions & 15 deletions cime_config/config_compsets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Where for the CAM specific compsets below the following is supported
TIME = Time period (e.g. 2000, HIST, SSP585...)
ATM = [CAM40, CAM50, CAM60]
LND = [CLM45, CLM50, CLM51, CLM60, SLND]
LND = [CLM45, CLM50, CLM60, SLND]
ICE = [CICE, DICE, SICE]
OCN = [DOCN, ,AQUAP, SOCN]
ROF = [RTM, SROF]
Expand Down Expand Up @@ -344,12 +344,6 @@
<science_support grid="f19_g17"/>
</compset>

<!-- Needed for testing until CAM removes used of CLM51 in compsets-->
<compset>
<alias>IHistClm51Sp</alias>
<lname>HIST_DATM%GSWP3v1_CLM51%SP_SICE_SOCN_MOSART_SGLC_SWAV</lname>
</compset>

<compset>
<alias>IHistClm60SpRs</alias>
<lname>HIST_DATM%GSWP3v1_CLM60%SP_SICE_SOCN_SROF_SGLC_SWAV</lname>
Expand Down Expand Up @@ -407,7 +401,7 @@
<lname>HIST_DATM%QIA_CLM60%BGC_SICE_SOCN_SROF_SGLC_SWAV</lname>
</compset>

<!--
<!--
future scenario compsets
-->
<compset>
Expand Down Expand Up @@ -610,7 +604,7 @@
<lname>2000_DATM%CRUv7_CLM45%SP-VIC_SICE_SOCN_RTM_SGLC_SWAV</lname>
</compset>

<!--
<!--
IG compsets with active Glacier model
-->

Expand Down Expand Up @@ -660,12 +654,6 @@
<science_support grid="f19_g17"/>
<science_support grid="ne30pg3_t232"/>
</compset>
<!-- Needed for testing until removed by CESM -->
<compset>
<alias>I1850Clm51BgcCropG</alias>
<lname>1850_DATM%GSWP3v1_CLM51%BGC-CROP_SICE_SOCN_MOSART_CISM2%GRIS-EVOLVE_SWAV</lname>
</compset>


<!-- Primarily for testing: same as I1850Clm50SpGag but with SROF -->
<compset>
Expand Down
Loading

0 comments on commit ca5cddb

Please sign in to comment.