Skip to content

Commit

Permalink
Better naming for variables and restart setting
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaehn committed Oct 24, 2023
1 parent 70f6fc9 commit 07582e3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions cases/icon-test/icon_runjob.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ cat > icon_master.namelist << EOF
&master_model_nml
model_type = 1 ! identifies which component to run (atmosphere,ocean,...)
model_name = "ATMO" ! character string for naming this component.
model_namelist_filename = "NAMELIST_NWP" ! file name containing the model namelists
model_namelist_filename = "NAMELIST_{cfg.casename}" ! file name containing the model namelists
model_min_rank = 1 ! start MPI rank for this model
model_max_rank = 65536 ! end MPI rank for this model
model_inc_rank = 1 ! stride of MPI ranks
Expand All @@ -66,7 +66,7 @@ EOF
# model namelists
# ----------------------------------------------------------------------

cat > NAMELIST_NWP << EOF
cat > NAMELIST_{cfg.casename} << EOF
! parallel_nml: MPI parallelization -------------------------------------------
&parallel_nml
nproma = 128 ! loop chunk length
Expand Down Expand Up @@ -95,6 +95,7 @@ cat > NAMELIST_NWP << EOF
output = "nml" ! main switch for enabling/disabling components of the model output
lart = .FALSE. ! main switch for ART
debug_check_level = 10
restart_filename = "{cfg.icon_restart_out}/{cfg.output_filename}_<rsttime>.nc"
/
! diffusion_nml: horizontal (numerical) diffusion ----------------------------
Expand Down Expand Up @@ -265,7 +266,7 @@ cat > NAMELIST_NWP << EOF
steps_per_file = 1 ! number of steps per file
mode = 1 ! 1: forecast mode (relative t-axis), 2: climate mode (absolute t-axis)
include_last = .TRUE.
output_filename = 'ICON'
output_filename = '{cfg.output_filename}'
filename_format = '{cfg.icon_output}/<output_filename>_DOM<physdom>_<ddhhmmss>' ! file name base
steps_per_file_inclfirst = .FALSE.
output_grid = .TRUE.
Expand Down
2 changes: 1 addition & 1 deletion jobs/icon.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def main(starttime, hstart, hstop, cfg, model_cfg):
starttime_real = starttime + timedelta(hours=hstart)
inidata_filename = os.path.join(
cfg.icon_input_icbc,
starttime_real.strftime(cfg.meteo_nameformat) + '.nc')
starttime_real.strftime(cfg.meteo['prefix'] + cfg.meteo['nameformat']) + '.nc')

# Write run script (run_icon.job)
icon_runjob = os.path.join(cfg.case_path, cfg.icon_runjob_filename)
Expand Down
6 changes: 6 additions & 0 deletions run_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,12 @@ def restart_runs(work_root, model_cfg, cfg, start, hstart, hstop, job_names,
continue
sub_hstop = sub_hstart + runtime

# Set restart variable (only takes effect for ICON)
if time == start:
setattr(cfg, "lrestart", '.FALSE.')
else:
setattr(cfg, "lrestart", '.TRUE.')

print("Starting run with starttime {}".format(time))

run_chain(work_root=work_root,
Expand Down

0 comments on commit 07582e3

Please sign in to comment.