diff --git a/docs/documentation/case.md b/docs/documentation/case.md index 83f5a50fd5..57a51d62ca 100644 --- a/docs/documentation/case.md +++ b/docs/documentation/case.md @@ -689,6 +689,8 @@ The value of `dt` needs to be sufficiently small to satisfy the Courant-Friedric `t_step_save` is the time step interval for data output during simulation. To newly start the simulation, set `t_step_start = 0`. To restart the simulation from $k$-th time step, set `t_step_start = k`; see @ref running "Restarting Cases". +When `t_step_start > 0`, `./mfc.sh run` skips `pre_process` by default, since it would otherwise overwrite the +restart data being resumed from. Pass `-t pre_process` explicitly (as in the restart workflow) if regenerating it is intended. ##### Adaptive Time-Stepping diff --git a/toolchain/mfc/args.py b/toolchain/mfc/args.py index 031e2db9bb..0169a2cdf1 100644 --- a/toolchain/mfc/args.py +++ b/toolchain/mfc/args.py @@ -86,8 +86,10 @@ def custom_error(message): subparser.error = custom_error - args: dict = vars(parser.parse_args(sys.argv[1:extra_index])) + cli_argv = sys.argv[1:extra_index] + args: dict = vars(parser.parse_args(cli_argv)) args["--"] = sys.argv[extra_index + 1 :] + args["targets_explicit"] = any(tok in ("-t", "--targets") for tok in cli_argv) # Handle --help at top level if args.get("help") and args["command"] is None: diff --git a/toolchain/mfc/lint_docs.py b/toolchain/mfc/lint_docs.py index e4752932bd..6eff9185da 100644 --- a/toolchain/mfc/lint_docs.py +++ b/toolchain/mfc/lint_docs.py @@ -69,6 +69,8 @@ "zeros_default", # Analytic expression language: module name (not a case param) "m_constants", + # Build/run target name (not a case param) + "pre_process", } # Docs to check for parameter references, with per-file skip sets diff --git a/toolchain/mfc/run/run.py b/toolchain/mfc/run/run.py index cd6987cd90..ce7394b26b 100644 --- a/toolchain/mfc/run/run.py +++ b/toolchain/mfc/run/run.py @@ -9,7 +9,7 @@ from mako.lookup import TemplateLookup from mako.template import Template -from ..build import REQUIRED_TARGETS, SIMULATION, build, get_targets +from ..build import PRE_PROCESS, REQUIRED_TARGETS, SIMULATION, build, get_targets from ..common import MFC_ROOT_DIR, MFC_TEMPLATE_DIR, MFCException, does_command_exist, file_dump_yaml, file_read, file_write, format_list_to_string, isspace, system from ..printer import cons from ..state import ARG, ARGS, CFG, gpuConfigOptions @@ -157,9 +157,14 @@ def __execute_job_script(qsystem: queues.QueueSystem): def run(targets=None, case=None): + targets_explicit = targets is not None or ARG("targets_explicit", False) targets = get_targets(list(REQUIRED_TARGETS) + (targets or ARG("targets"))) case = case or input.load(ARG("input"), ARG("--")) + if not targets_explicit and PRE_PROCESS in targets and (int(case.params.get("t_step_start", 0)) > 0 or int(case.params.get("n_start", 0)) > 0): + cons.print("[yellow]t_step_start > 0: skipping pre_process so it doesn't overwrite the restart data being resumed from. Pass -t pre_process explicitly to force it.[/yellow]") + targets = [t for t in targets if t is not PRE_PROCESS] + build(targets) verbosity = ARG("verbose")