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

Fix runtime_mult and Update remaining data retrieval scripts #504

Merged
merged 3 commits into from
Aug 15, 2024
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
2 changes: 1 addition & 1 deletion contrib/get_aerosol_climo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ data_files=("FV3_aeroclim1" "FV3_aeroclim2" "FV3_aeroclim3" "FV3_aeroclim_optics
cd $BASEDIR/scm/data/physics_input_data/
for file in "${data_files[@]}"; do
echo "Retrieving $file.tar.gz"
wget https://github.com/NCAR/ccpp-scm/releases/download/v6.0.0/${file}.tar.gz
wget https://github.com/NCAR/ccpp-scm/releases/download/v7.0.0-beta/${file}.tar.gz
tar -xvf ${file}.tar.gz
rm -f ${file}.tar.gz
done
Expand Down
2 changes: 1 addition & 1 deletion contrib/get_mg_inccn_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BASEDIR=$MYDIR/..

# Change to directory containing the physics input data, download and extract archive
cd $BASEDIR/scm/data/physics_input_data/
wget https://github.com/NCAR/ccpp-scm/releases/download/v6.0.0/MG_INCCN_data.tar.gz
wget https://github.com/NCAR/ccpp-scm/releases/download/v7.0.0-beta/MG_INCCN_data.tar.gz
tar -xvf MG_INCCN_data.tar.gz
rm -f MG_INCCN_data.tar.gz
cd $BASEDIR/
Expand Down
2 changes: 1 addition & 1 deletion contrib/get_thompson_tables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BASEDIR=$MYDIR/..

# Change to directory containing the physics input data, download and extract archive
cd $BASEDIR/scm/data/physics_input_data/
wget https://github.com/NCAR/ccpp-scm/releases/download/v6.0.0/thompson_tables.tar.gz
wget https://github.com/NCAR/ccpp-scm/releases/download/v7.0.0-beta/thompson_tables.tar.gz
tar -xvf thompson_tables.tar.gz
rm -f thompson_tables.tar.gz
cd $BASEDIR/
Expand Down
2 changes: 1 addition & 1 deletion scm/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ else()
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(_ccpp_suites_arg "--suites=${suite_string}")
message("Calling CCPP code generator (ccpp_prebuild.py) for SUPPORTED suites ${_ccpp_suites_arg} ...")
message("Calling CCPP code generator (ccpp_prebuild.py) for suites listed in scm/src/suite_info.py: ${_ccpp_suites_arg}.")
endif()
# Run CCPP prebuild.py
message (STATUS "Running ccpp_prebuild.py for CCPP")
Expand Down
10 changes: 4 additions & 6 deletions scm/src/run_scm.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def __init__(self, case, suite, runtime, runtime_mult, levels, npz_type, vert_co

if runtime_mult:
self._runtime_mult = runtime_mult
message = 'Existing case namelist runtime multiplied by {0}'.format(self._runtime_mult)
message = 'Existing case namelist or DEPHY runtime multiplied by {0}'.format(self._runtime_mult)
logging.debug(message)
else:
self._runtime_mult = None
Expand Down Expand Up @@ -460,11 +460,9 @@ def setup_rundir(self):
message = 'The --runtime_mult argument must be greater than 0 ({0} was entered)'.format(self._runtime_mult)
logging.critical(message)
raise Exception(message)
try:
old_runtime = case_nml['case_config']['runtime']
case_nml['case_config']['runtime'] = old_runtime*self._runtime_mult
except KeyError:
logging.info('The runtime multiplier argument was set, but the runtime is not set in {0} '.format(self._namelist))
else:
case_nml['case_config']['runtime_mult'] = self._runtime_mult

# If the number of levels is specified, set the namelist value
if self._levels:
case_nml['case_config']['n_levels'] = self._levels
Expand Down
21 changes: 17 additions & 4 deletions scm/src/scm_input.F90
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ subroutine get_config_nml(scm_state)
character(len=character_length) :: case_name !< name of case initialization and forcing dataset
real(kind=dp) :: dt !< time step in seconds
real(kind=dp) :: runtime !< total runtime in seconds
real(kind=dp) :: runtime_mult !< runtime multiplier
integer :: n_itt_out !< multiple of timestep for writing output
integer :: n_itt_diag !< multiple of timestep for resetting diagnostics (overwrites fhzero from physics namelist if present)
integer :: n_levels !< number of model levels (currently only 64 supported)
Expand Down Expand Up @@ -77,7 +78,7 @@ subroutine get_config_nml(scm_state)

CHARACTER(LEN=*), parameter :: experiment_namelist = 'input_experiment.nml'

NAMELIST /case_config/ npz_type, vert_coord_file, case_name, dt, runtime, n_itt_out, n_itt_diag, &
NAMELIST /case_config/ npz_type, vert_coord_file, case_name, dt, runtime, runtime_mult, n_itt_out, n_itt_diag, &
n_levels, output_dir, thermo_forcing_type, model_ics, &
lsm_ics, do_spinup, C_RES, spinup_timesteps, mom_forcing_type, relax_time, sfc_type, sfc_flux_spec, &
sfc_roughness_length_cm, reference_profile_choice, year, month, day, hour, min, &
Expand All @@ -95,7 +96,8 @@ subroutine get_config_nml(scm_state)
case_name = 'twpice'
dt = 600.0
time_scheme = 1
runtime = 2138400.0
runtime = 0.0
runtime_mult = 1.0
n_itt_out = 1
n_itt_diag = -999
n_levels = 127
Expand Down Expand Up @@ -179,6 +181,7 @@ subroutine get_config_nml(scm_state)
scm_state%n_itt_out = n_itt_out
scm_state%n_itt_diag = n_itt_diag
scm_state%runtime = runtime
scm_state%runtime_mult = runtime_mult
scm_state%time_scheme = time_scheme
scm_state%init_year = year
scm_state%init_month = month
Expand Down Expand Up @@ -211,7 +214,7 @@ end subroutine get_config_nml
subroutine get_case_init(scm_state, scm_input)
use scm_type_defs, only : scm_state_type, scm_input_type
use NetCDF_read, only: NetCDF_read_var, check, missing_value
type(scm_state_type), intent(in) :: scm_state
type(scm_state_type), intent(inout) :: scm_state
type(scm_input_type), target, intent(inout) :: scm_input

integer :: input_nlev !< number of levels in the input file
Expand Down Expand Up @@ -932,6 +935,9 @@ subroutine get_case_init(scm_state, scm_input)
scm_input%input_emis_ice = input_emis_ice
scm_input%input_lai = input_lai

if (scm_state%runtime_mult /= 1.0) then
scm_state%runtime = scm_state%runtime*scm_state%runtime_mult
end if
!> @}
end subroutine get_case_init

Expand Down Expand Up @@ -1867,7 +1873,14 @@ subroutine get_case_init_DEPHY(scm_state, scm_input)
scm_state%init_day = init_day
scm_state%init_hour = init_hour
scm_state%init_min = init_min
scm_state%runtime = elapsed_sec
if (scm_state%runtime > 0.0) then
!runtime is provided in the case configuration namelist - should override what is in the DEPHY file
if (scm_state%runtime_mult /= 1.0) then
scm_state%runtime = scm_state%runtime*scm_state%runtime_mult
end if
else
scm_state%runtime = elapsed_sec*scm_state%runtime_mult
end if

scm_input%input_time = input_time
scm_input%input_pres_surf(1) = input_pres_surf(active_init_time) !perhaps input_pres_surf should only be equal to input_force_pres_surf?
Expand Down
2 changes: 2 additions & 0 deletions scm/src/scm_type_defs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ module scm_type_defs
real(kind=dp) :: dt !< physics time step (s)
real(kind=dp) :: dt_now !< time step currently being used (if it changes due to time-stepping scheme)
real(kind=dp) :: runtime !< total runtime (s)
real(kind=dp) :: runtime_mult !< runtime multiplier
real(kind=dp) :: output_period !< how often output is written (s)
real(kind=dp) :: relax_time !< time scale for hor. wind nudging (s)
real(kind=dp) :: deg_to_rad_const !< conversion constant from degrees to radians
Expand Down Expand Up @@ -561,6 +562,7 @@ subroutine scm_state_create(scm_state, n_columns, n_levels, n_soil, n_snow, n_ti
scm_state%dt = real_zero
scm_state%dt_now = real_zero
scm_state%runtime = real_zero
scm_state%runtime_mult = 1.0
scm_state%output_period = real_zero
scm_state%relax_time = real_zero
scm_state%deg_to_rad_const = real_zero
Expand Down
36 changes: 33 additions & 3 deletions scm/src/suite_info.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env python

import sys, os

#DEFAULT_SUITE_BEHAVIOR = 'supported'
DEFAULT_SUITE_BEHAVIOR = 'regression_test'

class suite(object):

DEFAULT_MAX_TIMESTEP = 1800.0
Expand Down Expand Up @@ -72,9 +77,34 @@ def main():

#print supported suites separated by commas
suite_string = ''
for s in suite_list:
if s._supported:
suite_string += s._name + ',' + s._name + '_ps' + ','

if DEFAULT_SUITE_BEHAVIOR == 'regression_test':
dir_path = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(1, dir_path + '/../../test/')

rt_suite_list = []

import rt_test_cases
import rt_test_cases_sp
import rt_test_cases_nvidia

for item in rt_test_cases.run_list:
rt_suite_list.append(item.get("suite"))

for item in rt_test_cases_sp.run_list:
rt_suite_list.append(item.get("suite"))

for item in rt_test_cases_nvidia.run_list:
rt_suite_list.append(item.get("suite"))

unique_suite_list = list(set(rt_suite_list))

for s in unique_suite_list:
suite_string += s + ',' + s + '_ps' + ','
else:
for s in suite_list:
if s._supported:
suite_string += s._name + ',' + s._name + '_ps' + ','
print(suite_string[:-1])

if __name__ == '__main__':
Expand Down
Loading