From a61049ae306cd752a75a8064840432a86ced347b Mon Sep 17 00:00:00 2001 From: John Omotani Date: Sun, 8 Dec 2024 13:06:53 +0000 Subject: [PATCH] Fix writing of 'dt' when 'stopnow' is used When the 'stopnow' file is created to immediately stop a run, `t_params.dt_before_output[]` was previously not set, because the `adaptive_timestep_update_t_params!()` function does not know that there is going to be an output triggered by 'stopnow', so 'dt' was written incorrectly. Fix this by setting `t_params.dt_before_output[] = t_params.dt[]` when 'stopnow' is found. --- moment_kinetics/src/time_advance.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/moment_kinetics/src/time_advance.jl b/moment_kinetics/src/time_advance.jl index 881a8eea3..a810a16a5 100644 --- a/moment_kinetics/src/time_advance.jl +++ b/moment_kinetics/src/time_advance.jl @@ -1921,6 +1921,7 @@ function time_advance!(pdf, scratch, scratch_implicit, scratch_electron, t_para # Stop cleanly if a file called 'stop' was created println("Found 'stopnow' file $(t_params.stopfile * "now"), aborting run") finish_now = true + t_params.dt_before_output[] = t_params.dt[] end if t_params.adaptive && !t_params.write_after_fixed_step_count