Skip to content

Commit

Permalink
Merge tag 'ctsm5.1.dev035' into snow_occlusion_ctsm
Browse files Browse the repository at this point in the history
Misc bfb enhancements and fixes

(1) If CISM is running over Antarctica, use virtual glacier columns over
    Antarctica

(2) Remove "mec" from some glacier/ice variable names (it is misleading
    to have "mec" in variable names when the ice landunit can actually
    have multiple columns *or* a single column) (ESCOMP#1294)

(3) Add history file metadata on each variable's l2g_scale_type (adds a
    landunit_mask attribute) (ESCOMP#1343)

(4) Use python3 in more shebang lines - needed to run python unit tests
    on cheyenne

(5) New compset naming for IG compsets (ESCOMP#1289)

(6) Remove calculation of fun_cost_fix that is overwritten
    (ESCOMP#1115)

(7) Bypass grid-level water mass check when fates hydro is active
    (ESCOMP#1334)

(8) Remove some dead code (ESCOMP#1333)
  • Loading branch information
glemieux committed Apr 20, 2021
2 parents f9a166d + 075b273 commit 51d3145
Show file tree
Hide file tree
Showing 159 changed files with 6,000 additions and 5,268 deletions.
13 changes: 6 additions & 7 deletions Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ required = True
local_path = components/cism
protocol = git
repo_url = https://github.com/ESCOMP/CISM-wrapper
tag = cism2_1_69
tag = cism2_1_78
externals = Externals_CISM.cfg
required = True

[rtm]
local_path = components/rtm
protocol = git
repo_url = https://github.com/ESCOMP/RTM
tag = rtm1_0_73
tag = rtm1_0_76
required = True

[mosart]
local_path = components/mosart
protocol = git
repo_url = https://github.com/ESCOMP/MOSART
tag = mosart1_0_38
tag = mosart1_0_42
required = True

[mizuRoute]
Expand All @@ -37,21 +37,21 @@ required = True
local_path = cime
protocol = git
repo_url = https://github.com/ESMCI/cime
tag = branch_tags/cime5.8.32_a02
tag = branch_tags/cime5.8.42_a01
required = True

[cmeps]
local_path = cime/src/drivers/nuopc/
protocol = git
repo_url = https://github.com/ESCOMP/CMEPS.git
hash = 7654038
tag = v0.9.0
required = True

[cdeps]
local_path = components/cdeps
protocol = git
repo_url = https://github.com/ESCOMP/CDEPS.git
hash = 45b7a85
tag = v0.6.0
required = True

[doc-builder]
Expand All @@ -63,4 +63,3 @@ required = False

[externals_description]
schema_version = 1.0.0

37 changes: 35 additions & 2 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ OPTIONS
(Note: buildnml copies the file for use by the driver)
-glc_nec <name> Glacier number of elevation classes [0 | 3 | 5 | 10 | 36]
(default is 0) (standard option with land-ice model is 10)
-glc_use_antarctica Set defaults appropriate for runs that include Antarctica
-help [or -h] Print usage to STDOUT.
-light_res <value> Resolution of lightning dataset to use for CN fire (360x720 or 94x192)
-ignore_ic_date Ignore the date on the initial condition files
Expand Down Expand Up @@ -253,6 +254,7 @@ sub process_commandline {
clm_demand => "null",
help => 0,
glc_nec => "default",
glc_use_antarctica => 0,
light_res => "default",
lnd_tuning_mode => "default",
lnd_frac => undef,
Expand Down Expand Up @@ -297,6 +299,7 @@ sub process_commandline {
"note!" => \$opts{'note'},
"megan!" => \$opts{'megan'},
"glc_nec=i" => \$opts{'glc_nec'},
"glc_use_antarctica!" => \$opts{'glc_use_antarctica'},
"light_res=s" => \$opts{'light_res'},
"d:s" => \$opts{'dir'},
"h|help" => \$opts{'help'},
Expand Down Expand Up @@ -1102,6 +1105,12 @@ sub setup_cmdl_spinup {
$nl_flags->{'bgc_spinup'} = "off";
$val = $defaults->get_value($var);
}
# For AD spinup mode by default reseed dead plants
if ( $nl_flags->{$var} ne "off" ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition,
$defaults, $nl, "reseed_dead_plants", clm_accelerated_spinup=>$nl_flags->{$var},
use_cn=>$nl_flags->{'use_cn'} );
}
} else {
if ( defined($nl->get_value("spinup_state")) ) {
$log->fatal_error("spinup_state is accelerated (=1 or 2) which is for a BGC mode of CN or BGC," .
Expand Down Expand Up @@ -1616,6 +1625,11 @@ sub process_namelist_inline_logic {
##################################
setup_logic_bgc_shared($opts, $nl_flags, $definition, $defaults, $nl, $physv);

##################################
# namelist group: cnphenology
##################################
setup_logic_cnphenology($opts, $nl_flags, $definition, $defaults, $nl, $physv);

#############################################
# namelist group: soilwater_movement_inparm #
#############################################
Expand Down Expand Up @@ -1902,7 +1916,7 @@ sub setup_logic_glacier {
$log->fatal_error("glc_do_dynglacier can only be set via the env variable $clm_upvar: it can NOT be set in user_nl_clm");
}

my $var = "maxpatch_glcmec";
my $var = "maxpatch_glc";
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'val'=>$nl_flags->{'glc_nec'} );

my $val = $nl->get_value($var);
Expand All @@ -1917,7 +1931,8 @@ sub setup_logic_glacier {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glc_snow_persistence_max_days');

add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'albice');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_behavior');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_behavior',
'glc_use_antarctica'=>$opts->{'glc_use_antarctica'});
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_melt_behavior');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_ice_runoff_behavior');
}
Expand Down Expand Up @@ -2685,6 +2700,24 @@ sub setup_logic_bgc_shared {

#-------------------------------------------------------------------------------

sub setup_logic_cnphenology {
my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_;

my @list = ( "onset_thresh_depends_on_veg", "min_crtical_dayl_depends_on_lat" );
foreach my $var ( @list ) {
if ( &value_is_true($nl_flags->{'use_cn'}) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
'phys'=>$physv->as_string(), 'use_cn'=>$nl_flags->{'use_cn'} );
} else {
if ( defined($nl->get_value($var)) ) {
$log->fatal_error("$var should only be set if use_cn is on");
}
}
}
}

#-------------------------------------------------------------------------------

sub setup_logic_supplemental_nitrogen {
#
# Supplemental Nitrogen for prognostic crop cases
Expand Down
25 changes: 20 additions & 5 deletions bld/namelist_files/namelist_defaults_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<spinup_state clm_accelerated_spinup="on" use_fates=".true." phys="clm4_5" >1</spinup_state>
<spinup_state clm_accelerated_spinup="off" >0</spinup_state>

<!-- Reseeding of dead plants normally only done for AD spinup -->
<reseed_dead_plants clm_accelerated_spinup="on" use_cn=".true.">.true.</reseed_dead_plants>
<reseed_dead_plants >.false.</reseed_dead_plants>

<for_testing_run_ncdiopio_tests>.false.</for_testing_run_ncdiopio_tests>

<!-- Set to .true. in namelist to write hist fields master list file -->
Expand Down Expand Up @@ -442,8 +446,14 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
Mountain glaciers: single_at_atm_topo
Greenland - inside CISM grid but outside Greenland itself: virtual
Greenland itself: virtual
Antarctica: multiple -->
<glacier_region_behavior>'single_at_atm_topo','virtual','virtual','multiple'</glacier_region_behavior>
Antarctica: multiple
If CISM is running over Antarctica, then we change the Antarctica
behavior to virtual. Note that the Greenland behavior is always
virtual, even if Greenland isn't included in this run.
-->
<glacier_region_behavior glc_use_antarctica="0">'single_at_atm_topo','virtual','virtual','multiple'</glacier_region_behavior>
<glacier_region_behavior glc_use_antarctica="1">'single_at_atm_topo','virtual','virtual','virtual' </glacier_region_behavior>

<!-- Default glacier melt behavior is:
Mountain glaciers: remains_in_place
Expand Down Expand Up @@ -473,9 +483,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<!-- The default filenames are given relative to the root directory
for the CLM2 data in the CESM distribution -->
<!-- Plant function types (relative to {csmdata}) -->
<paramfile phys="clm5_1" >lnd/clm2/paramdata/ctsm51_params.c210112.nc</paramfile>
<paramfile phys="clm5_0" >lnd/clm2/paramdata/clm50_params.c210112.nc</paramfile>
<paramfile phys="clm4_5" >lnd/clm2/paramdata/clm45_params.c210112.nc</paramfile>
<paramfile phys="clm5_1" >lnd/clm2/paramdata/ctsm51_params.c210305.nc</paramfile>
<paramfile phys="clm5_0" >lnd/clm2/paramdata/clm50_params.c210217.nc</paramfile>
<paramfile phys="clm4_5" >lnd/clm2/paramdata/clm45_params.c210217.nc</paramfile>

<!-- ================================================================== -->
<!-- FATES default parameter file -->
Expand Down Expand Up @@ -549,6 +559,11 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<initial_seed_at_planting use_crop=".true." phys="clm5_0" >3.d00</initial_seed_at_planting>
<initial_seed_at_planting use_crop=".true." phys="clm4_5" >1.d00</initial_seed_at_planting>

<!-- CN Phenology -->
<onset_thresh_depends_on_veg use_cn=".true." phys="clm5_1" >.true.</onset_thresh_depends_on_veg>
<min_crtical_dayl_depends_on_lat use_cn=".true." phys="clm5_1" >.true.</min_crtical_dayl_depends_on_lat>
<onset_thresh_depends_on_veg >.false.</onset_thresh_depends_on_veg>
<min_crtical_dayl_depends_on_lat >.false.</min_crtical_dayl_depends_on_lat>

<!-- turnover time modifications -->
<decomp_depth_efolding phys="clm4_5" >0.5</decomp_depth_efolding>
Expand Down
2 changes: 1 addition & 1 deletion bld/namelist_files/namelist_defaults_ctsm_tools.xml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ attributes from the config_cache.xml file (with keys converted to upper-case).

<!-- urban -->
<mksrf_furban hgrid="3x3min" lmask="LandScan2004"
>lnd/clm2/rawdata/mksrf_urban_0.05x0.05_simyr2000.c170724.nc</mksrf_furban>
>lnd/clm2/rawdata/mksrf_urban_0.05x0.05_simyr2000.c120621.nc</mksrf_furban>

<mksrf_furban hgrid="3x3min" lmask="LandScan2004" sim_year="PtVg"
>lnd/clm2/rawdata/mksrf_urban_0.05x0.05_zerourbanpct.c181014.nc</mksrf_furban>
Expand Down
16 changes: 8 additions & 8 deletions bld/namelist_files/namelist_defaults_overall.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@ determine default values for namelists.
<!-- Default land/ocean mask type -->
<mask hgrid="0.23x0.31" >gx1v6</mask>
<mask hgrid="0.47x0.63" >gx1v6</mask>
<mask hgrid="0.9x1.25" >gx1v6</mask>
<mask hgrid="1.9x2.5" >gx1v6</mask>
<mask hgrid="0.9x1.25" >gx1v7</mask>
<mask hgrid="1.9x2.5" >gx1v7</mask>
<mask hgrid="2.5x3.33" >gx3v7</mask>
<mask hgrid="4x5" >gx3v7</mask>
<mask hgrid="10x15" >USGS</mask>
<mask hgrid="10x15" >gx3v7</mask>

<mask hgrid="360x720cru" >cruncep</mask>
<mask hgrid="128x256" >USGS</mask>
<mask hgrid="64x128" >USGS</mask>
<mask hgrid="128x256" >gx1v7</mask>
<mask hgrid="64x128" >gx1v7</mask>
<mask hgrid="48x96" >gx3v7</mask>
<mask hgrid="32x64" >USGS</mask>
<mask hgrid="8x16" >USGS</mask>
<mask hgrid="32x64" >gx3v7</mask>
<mask hgrid="8x16" >gx3v7</mask>

<mask hgrid="94x192" >T62</mask>

Expand All @@ -111,7 +111,7 @@ determine default values for namelists.
<mask hgrid="1x1_urbanc_alpha" >test</mask>
<mask hgrid="1x1_numaIA" >navy</mask>
<mask hgrid="1x1_smallvilleIA" >test</mask>
<mask >gx1v6</mask>
<mask >gx1v7</mask>

<!-- Default glacier model options -->

Expand Down
18 changes: 15 additions & 3 deletions bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ If TRUE, irrigation will be active.
If TRUE, fsat will be set to zero for crop columns.
</entry>

<entry id="maxpatch_glcmec" type="integer" category="clm_physics"
<entry id="maxpatch_glc" type="integer" category="clm_physics"
group="clm_inparm" valid_values="1,3,5,10,36" >
Number of multiple elevation classes over glacier points.
</entry>
Expand Down Expand Up @@ -1096,6 +1096,18 @@ Initial seed Carbon to use at planting
(only used when CN is on as well as crop)
</entry>

<entry id="onset_thresh_depends_on_veg" type="logical" category="physics"
group="cnphenology">
Phenology onset depends on the vegetation type
(only used when CN is on)
</entry>

<entry id="min_crtical_dayl_depends_on_lat" type="logical" category="physics"
group="cnphenology">
The minimum critical day length for onset depends on latitude
(only used when CN is on)
</entry>

<entry id="use_ozone" type="logical" category="physics"
group="clm_inparm" valid_values="" value=".false.">
Toggle to turn on ozone stress
Expand Down Expand Up @@ -1537,7 +1549,7 @@ If TRUE, repartition rain/snow from atmosphere based on temperature.

<entry id="glcmec_downscale_longwave" type="logical" category="clm_physics"
group="atm2lnd_inparm" valid_values="" >
If TRUE, downscale longwave radiation over glc_mec landunits.
If TRUE, downscale longwave radiation over glacier landunits.
This downscaling is conservative.
<default>Default: .true.</default>
</entry>
Expand Down Expand Up @@ -2003,7 +2015,7 @@ CLM datasets exist for years: 1000 (for testing), 1850, and 2000

<entry id="sim_year_range" type="char*9" category="default_settings"
group="default_settings" valid_values=
"constant,1000-1002,1000-1004,850-1850,1850-1855,1850-2000,1850-2005,1850-2100,1980-2015,2000-2100">
"constant,1000-1002,1000-1004,850-1850,1850-1855,1850-2000,1850-2005,1850-2100,1980-2015,2000-2025,2000-2100">
Range of years to simulate transitory datasets for (such as dynamic: land-use datasets, aerosol-deposition, Nitrogen deposition rates etc.)
Constant means simulation will be held at a constant year given in sim_year.
A sim_year_range of 1000-1002 or 1000-1004 corresponds to data used for testing only, NOT corresponding to any real datasets.
Expand Down
2 changes: 1 addition & 1 deletion bld/namelist_files/use_cases/stdurbpt_pd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<hist_fincl1>'TBUILD','BUILDHEAT','TRAFFICFLUX','WASTEHEAT','SWup','LWup','Rnet','Qh','Qle','Qstor','Qtau','Qanth','Wind','Qair','Tair','PSurf','Rainf','SWdown','LWdown','COSZEN'</hist_fincl1>

<hist_fincl2>'TG','TBOT','FIRE','FIRA','FLDS','FSDS','FSR','FSA','FGEV','FSH','FGR','TSOI','ERRSOI','BUILDHEAT','SABV','SABG','FSDSVD','FSDSND','FSDSVI','FSDSNI','FSRVD','FSRND','FSRVI','FSRNI','TSA','FCTR','FCEV','QBOT','Q2M','H2OSOI','H2OSNO','SOILLIQ','SOILICE','SWup','LWup','Rnet','Qh','Qle','Qstor','Qtau','Qanth','Wind','Qair','Tair','PSurf','Rainf','SWdown','LWdown','SoilAlpha_U','ZWT','WA'
<hist_fincl2>'TG','TBOT','FIRE','FIRA','FLDS','FSDS','FSR','FSA','FGEV','FSH','FGR','TSOI','ERRSOI','BUILDHEAT','SABV','SABG','FSDSVD','FSDSND','FSDSVI','FSDSNI','FSRVD','FSRND','FSRVI','FSRNI','TSA','FCTR','FCEV','QBOT','Q2M','H2OSOI','H2OSNO','SOILLIQ','SOILICE','SWup','LWup','Rnet','Qh','Qle','Qstor','Qtau','Qanth','Wind','Qair','Tair','PSurf','Rainf','SWdown','LWdown','SoilAlpha_U','ZWT'
</hist_fincl2>

<hist_fincl3>'SWup','LWup','Rnet','Qh','Qle','Qstor','Qtau','Qanth','Wind','Qair','Tair','PSurf','Rainf','SWdown','LWdown','FSA','FIRA','TG','COSZEN','SoilAlpha_U','TBUILD','BUILDHEAT'
Expand Down
9 changes: 7 additions & 2 deletions bld/unit_testers/build-namelist_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ sub make_config_cache {
#
# Figure out number of tests that will run
#
my $ntests = 1551;
my $ntests = 1552;
if ( defined($opts{'compare'}) ) {
$ntests += 1044;
}
Expand Down Expand Up @@ -446,6 +446,11 @@ sub make_config_cache {
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
"onset_threh w SP" =>{ options=>" -envxml_dir . -bgc sp",
namelst=>"onset_thresh_depends_on_veg=.true.",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_1",
},
"dribble_crphrv w/o CN" =>{ options=>" -envxml_dir . -bgc sp",
namelst=>"dribble_crophrv_xsmrpool_2atm=.true.",
GLC_TWO_WAY_COUPLING=>"FALSE",
Expand Down Expand Up @@ -803,7 +808,7 @@ sub make_config_cache {
phys=>"clm5_0",
},
"glc_nec inconsistent" =>{ options=>"-envxml_dir .",
namelst=>"maxpatch_glcmec=5",
namelst=>"maxpatch_glc=5",
GLC_TWO_WAY_COUPLING=>"FALSE",
phys=>"clm5_0",
},
Expand Down
3 changes: 3 additions & 0 deletions cime_config/buildlib
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ def _main_func():
# to use its directories in place of stub_rof
paths.append(os.path.join(lnd_root,"lilac","stub_rof"))

if (driver == 'lilac' or driver == 'nuopc'):
paths.append(os.path.join(lnd_root,"src","cpl","share_esmf"))

with open(filepath_file, "w") as filepath:
filepath.write("\n".join(paths))
filepath.write("\n")
Expand Down
17 changes: 15 additions & 2 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def buildnml(case, caseroot, compname):
run_refdate = case.get_value("RUN_REFDATE")
run_reftod = case.get_value("RUN_REFTOD")
glc_nec = case.get_value("GLC_NEC")
cism_use_antarctica = case.get_value("CISM_USE_ANTARCTICA")
mask = case.get_value("MASK_GRID")

# -----------------------------------------------------
Expand Down Expand Up @@ -127,6 +128,18 @@ def buildnml(case, caseroot, compname):
else:
nomeg = ""

if cism_use_antarctica is None:
# This is the case for compsets without CISM, where the CISM_USE_ANTARCTICA xml
# variable isn't defined
glc_use_antarctica_flag = ""
elif isinstance(cism_use_antarctica, bool):
if cism_use_antarctica:
glc_use_antarctica_flag = "-glc_use_antarctica"
else:
glc_use_antarctica_flag = ""
else:
expect(False, "Unexpected value for CISM_USE_ANTARCTICA: {}".format(cism_use_antarctica))

if clm_nml_use_case != "UNSET":
usecase = "-use_case %s" %clm_nml_use_case
else:
Expand Down Expand Up @@ -218,12 +231,12 @@ def buildnml(case, caseroot, compname):
command = ("%s -cimeroot %s -infile %s -csmdata %s -inputdata %s %s -namelist \"&clm_inparm start_ymd=%s %s/ \" "
"%s %s -res %s %s -clm_start_type %s -envxml_dir %s "
"-configuration %s -structure %s "
"-lnd_frac %s -glc_nec %s -co2_ppmv %s -co2_type %s -config %s "
"-lnd_frac %s -glc_nec %s %s -co2_ppmv %s -co2_type %s -config %s "
"%s %s %s %s"
%(cmd, _CIMEROOT, infile, din_loc_root, inputdata_file, ignore, start_ymd, clm_namelist_opts,
nomeg, usecase, lnd_grid, clmusr, start_type, caseroot,
configuration, structure,
lndfrac_file, glc_nec, ccsm_co2_ppmv, clm_co2_type, config_cache_file,
lndfrac_file, glc_nec, glc_use_antarctica_flag, ccsm_co2_ppmv, clm_co2_type, config_cache_file,
clm_bldnml_opts, spinup, tuning, gridmask))

rc, out, err = run_cmd(command, from_dir=ctsmconf)
Expand Down
Loading

0 comments on commit 51d3145

Please sign in to comment.