From 07582e36d5ce6b5b5f6ba64c59d94687024a3e51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20J=C3=A4hn?= Date: Tue, 24 Oct 2023 10:00:33 +0200 Subject: [PATCH] Better naming for variables and restart setting --- cases/icon-test/icon_runjob.cfg | 7 ++++--- jobs/icon.py | 2 +- run_chain.py | 6 ++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cases/icon-test/icon_runjob.cfg b/cases/icon-test/icon_runjob.cfg index de329100..87d65ca6 100755 --- a/cases/icon-test/icon_runjob.cfg +++ b/cases/icon-test/icon_runjob.cfg @@ -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 @@ -66,7 +66,7 @@ EOF # model namelists # ---------------------------------------------------------------------- -cat > NAMELIST_NWP << EOF +cat > NAMELIST_{cfg.casename} << EOF ! parallel_nml: MPI parallelization ------------------------------------------- ¶llel_nml nproma = 128 ! loop chunk length @@ -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}_.nc" / ! diffusion_nml: horizontal (numerical) diffusion ---------------------------- @@ -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}/_DOM_' ! file name base steps_per_file_inclfirst = .FALSE. output_grid = .TRUE. diff --git a/jobs/icon.py b/jobs/icon.py index 6a900d78..a699339c 100644 --- a/jobs/icon.py +++ b/jobs/icon.py @@ -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) diff --git a/run_chain.py b/run_chain.py index cc8d3cc7..35fca10c 100755 --- a/run_chain.py +++ b/run_chain.py @@ -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,