Skip to content

Commit

Permalink
Merge pull request #2008 from ekluzek/ctsm5.2_makefile
Browse files Browse the repository at this point in the history
Get the Makefile working for CTSM5.2 surface dataset creation
  • Loading branch information
ekluzek authored Jan 11, 2024
2 parents e758538 + 4d77e89 commit d5e8f08
Show file tree
Hide file tree
Showing 109 changed files with 4,060 additions and 4,764 deletions.
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ b88e1cd1b28e3609684c79a2ec0e88f26cfc362b
51c102c5df2e0ef971b5f8eeeb477567899af63a
7dacad70e74e2ec97f6492d4e7a3cb5dd498bcd7
a0d014fae9550dd9ffbc934abd29ef16176f8208
c7b7ca1d94ac19abb9ecea9fb5b712ddbdd6645d
b565b55ce7a9f8d812a573d716a5fd3d78cfea81
fdf72cd011e2ba318987a1e100efc5a1847c9d04
de9a30bfbbec36f9dcacc4380005ab596da47af4
cda0cf1412212e6f4363e6e8eb39f74c944b454d`
aa04d1f7d86cc2503b98b7e2b2d84dbfff6c316b
13 changes: 9 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ test_driver_*.sh

# mksurfdata output
surfdata_*.log
surfdata_*.namelist
landuse.timeseries_*.namelist
*.namelist
mksurfdata.o*
landuse.timeseries_*.log
landuse_timeseries_*.txt
ctsm.input_data_list
Expand All @@ -89,10 +89,15 @@ ctsm.input_data_list.previous
/tools/mksurfdata_esmf/PET*
/tools/mksurfdata_esmf/job_name.o*
/tools/mksurfdata_esmf/mksurfdata_in
/tools/mksurfdata_esmf/bld
/tools/mksurfdata_esmf/src
/tools/mksurfdata_esmf/surfdata_*.nc
/tools/mksurfdata_esmf/landuse.timeseries_*.nc
/tools/mksurfdata_esmf/mksurfdata_jobscript_multi
/tools/mksurfdata_esmf/mksurfdata_jobscript_single
/tools/mksurfdata_esmf/pio_iotype.txt
/tools/mksurfdata_esmf/*.sh
/tools/mksurfdata_esmf/mksrf_*.o*
/tools/mksurfdata_esmf/tool_bld
/tools/mksurfdata_esmf/pio_iotype.txt

# mksurfdata unit tests
unit_test_build
Expand Down
2 changes: 1 addition & 1 deletion Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ local_path = components/cmeps
required = True

[cdeps]
tag = cdeps1.0.9
tag = cdeps1.0.12
protocol = git
repo_url = https://github.com/ESCOMP/CDEPS.git
local_path = components/cdeps
Expand Down
38 changes: 26 additions & 12 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2343,11 +2343,17 @@ sub setup_logic_initial_conditions {
}
my $useinitvar = "use_init_interp";

my %settings;
my $use_init_interp_default = $nl->get_value($useinitvar);
$settings{$useinitvar} = $use_init_interp_default;
if ( string_is_undef_or_empty( $use_init_interp_default ) ) {
$use_init_interp_default = $defaults->get_value($useinitvar, \%settings);
$settings{$useinitvar} = ".false.";
}
if (not defined $finidat ) {
my $ic_date = $nl->get_value('start_ymd');
my $st_year = $nl_flags->{'st_year'};
my $nofail = 1;
my %settings;
$settings{'hgrid'} = $nl_flags->{'res'};
$settings{'phys'} = $physv->as_string();
$settings{'nofail'} = $nofail;
Expand Down Expand Up @@ -2384,12 +2390,6 @@ sub setup_logic_initial_conditions {
}
my $try = 0;
my $done = 2;
my $use_init_interp_default = $nl->get_value($useinitvar);
$settings{$useinitvar} = $use_init_interp_default;
if ( string_is_undef_or_empty( $use_init_interp_default ) ) {
$use_init_interp_default = $defaults->get_value($useinitvar, \%settings);
$settings{$useinitvar} = ".false.";
}
do {
$try++;
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, %settings );
Expand Down Expand Up @@ -2436,14 +2436,24 @@ SIMYR: foreach my $sim_yr ( @sim_years ) {
}
} # SIMYR:
$settings{'sim_year'} = $closest_sim_year;
# Add options set here to the "$set" variable below...
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $useinitvar,
'use_cndv'=>$nl_flags->{'use_cndv'}, 'phys'=>$physv->as_string(), 'hgrid'=>$nl_flags->{'res'},
'sim_year'=>$settings{'sim_year'}, 'nofail'=>1, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'},
'use_fates'=>$nl_flags->{'use_fates'} );
$settings{$useinitvar} = $nl->get_value($useinitvar);
if ( ! &value_is_true($nl->get_value($useinitvar) ) ) {
if ( $nl_flags->{'clm_start_type'} =~ /startup/ ) {
$log->fatal_error("clm_start_type is startup so an initial conditions ($var) file is required, but can't find one without $useinitvar being set to true");
if ( $nl_flags->{'clm_start_type'} =~ /startup/ ) {
my $err_msg = "clm_start_type is startup so an initial conditions ($var) file is required,";
if ( defined($use_init_interp_default) ) {
$log->fatal_error($err_msg." but can't find one without $useinitvar being set to true, change it to true in your user_nl_clm file in your case");
} else {
my $set = "Relevent settings: use_cndv = ". $nl_flags->{'use_cndv'} . " phys = " .
$physv->as_string() . " hgrid = " . $nl_flags->{'res'} . " sim_year = " .
$settings{'sim_year'} . " lnd_tuning_mode = " . $nl_flags->{'lnd_tuning_mode'} .
"use_fates = " . $nl_flags->{'use_fates'};
$log->fatal_error($err_msg." but the default setting of $useinitvar is false, so set both $var to a startup file and $useinitvar==TRUE, or developers should modify the namelist_defaults file".$set);
}
}
} else {
my $stat = add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_attributes",
Expand All @@ -2452,15 +2462,15 @@ SIMYR: foreach my $sim_yr ( @sim_years ) {
'hgrid'=>$nl_flags->{'res'},
'use_cn'=>$nl_flags->{'use_cn'}, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'}, 'nofail'=>1 );
if ( $stat ) {
$log->fatal_error("$useinitvar is NOT synchronized with init_interp_attributes");
$log->fatal_error("$useinitvar is NOT synchronized with init_interp_attributes in the namelist_defaults file, this should be corrected there");
}
my $attributes = $nl->get_value("init_interp_attributes");
my $attributes_string = remove_leading_and_trailing_quotes($attributes);
foreach my $pair ( split( /\s/, $attributes_string) ) {
if ( $pair =~ /^([a-z_]+)=([a-zA-Z._0-9]+)$/ ) {
$settings{$1} = $2;
} else {
$log->fatal_error("Problem interpreting init_interp_attributes: $pair");
$log->fatal_error("Problem interpreting init_interp_attributes from the namelist_defaults file: $pair");
}
}
}
Expand All @@ -2475,7 +2485,11 @@ SIMYR: foreach my $sim_yr ( @sim_years ) {
}
$finidat = $nl->get_value($var);
if ( &value_is_true($nl->get_value($useinitvar) ) && string_is_undef_or_empty($finidat) ) {
$log->fatal_error("$useinitvar is set BUT $var is NOT, need to set both" );
if ( ! defined($use_init_interp_default) ) {
$log->fatal_error("You set $useinitvar but a $var file could not be found for this case, try setting $var explicitly, and/or removing the setting for $useinitvar" );
} else {
$log->fatal_error("$useinitvar is being set for you but a $var was not found, so $useinitvar, init_interp_attributes, and finidat must not be set correctly for this configuration in the namelist_default file" );
}
}
} # end initial conditions

Expand Down
17 changes: 0 additions & 17 deletions bld/README
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,6 @@ build-namelist --- Build the namelists needed

env_run.xml --- Sample case runtime environment variables, so build-namelist can run outside of a case directory.

--------- Scripts to query namelist defaults
listDefaultNamelist.pl -- List the files needed, for a list of resolutions,
to run CLM that are currently NOT on your machine.
This file can then be used by
cime/CIME/Tools/check_input_data
to retreive them from the inputdata repository.
Setting up cases with create_newcase also does
this -- but only for the exact configuration
given. This tries to get all the files need
for several different resolutions and configurations
at once.
queryDefaultNamelist.pl - Query default namelist for settings of variables
queryDefaultXML.pm ------ Subroutines needed by queryDefaultNamelist.pl script


--------- Test scripts directory
unit_testers --- Directory of scripts to test scipts in this directory
(most notably build-namelist)
Expand All @@ -59,7 +44,5 @@ namelist_files/namelist_definition_drv_flds.xml --- Definition of add driver fie

---------- XML helper files
namelist_files/LogMessages.pm ---- Perl module to handle log output
namelist_files/checkmapfiles.ncl -- NCL script to check that all of the mapping files are valid
namelist_files/createMapEntry.pl -- Perl script to create a map entry for the
namelist_files/history_fields.xsl - Style sheet for history fields as created by script that lists all of the
history fields from the source files (../src/main/findHistFields.pl)
Loading

0 comments on commit d5e8f08

Please sign in to comment.