Trixi.jl icon indicating copy to clipboard operation
Trixi.jl copied to clipboard

Graceful exit on aborting a simulation with Ctrl-C

Open sloede opened this issue 3 months ago • 5 comments

Raise your hands if you haven't encountered this situation at least once before:

You tinker with a new feature implementation and/or simulation setup. Finally, you get it to run. For good measure, you wait a while to make sure it does not crash. Satisfied, you hit Ctrl-C to abort Now, you'd really like to look at the results using Plots.jl/Makie.jl.

But, alas, there is no way to visualize the result easily from within Julia because you do not have a sol object yet!

What I thus propose is to investigate possible ways to allow a "graceful abort" (an oxymoron if there ever was one) when running simulations from the REPL, discuss them, and then implement them for Trixi.jl. Ideally, I'd be looking at something like the following setup:

  • Hit Ctrl-C once and only once: Get a graceful exist after the next time step has finished. A soothing message to the user informs them of what an excellent choice they made in not hitting Ctrl-C multiple times out of frustration, and if they wait juuuust a little longer, they get a proper sol object.
  • Hit Ctrl-C repeatedly: Get out of dodge, and fast (i.e., as it does right now).
  • Obviously, there is no measurable performance impact for but the tiniest of simulation setups
  • It just "works" without user interaction

sloede avatar Mar 17 '24 07:03 sloede