Skip to content
Open
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: 2 additions & 0 deletions docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion toolchain/mfc/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions toolchain/mfc/lint_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion toolchain/mfc/run/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
Loading