Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total output steps inconsistent with inputs when using multiple monitors with higher frequency #2895

Open
ZedThree opened this issue Mar 28, 2024 · 0 comments

Comments

@ZedThree
Copy link
Member

I think there's a bug in the current implementation in master and next, or at least behaviour that I find surprising. I've modified the monitor example to print the name of the monitor for clarity, and got this output (on next):

Custom output monitor fast, time = 0.000000e+00, step -1 of 20

Custom output monitor default, time = 0.000000e+00, step -1 of 10
Sim Time  |  RHS evals  | Wall Time |  Calc    Inv   Comm    I/O   SOLVER

0.000e+00          1       4.33e-02    -1.3    0.0    1.6  147.2  -47.4
|  Step 1 of 10. Elapsed 0:00:00.0 ETA 0:00:00.3
Custom output monitor fast, time = 1.000000e+00, step 0 of 10

Custom output monitor fast, time = 2.000000e+00, step 1 of 10

Custom output monitor default, time = 2.000000e+00, step 0 of 5
2.000e+00         92       6.33e-02     5.8    0.0    0.0   50.6   43.6
/  Step 1 of 5. Elapsed 0:00:00.1 ETA 0:00:00.1
Custom output monitor fast, time = 3.000000e+00, step 2 of 10

Custom output monitor fast, time = 4.000000e+00, step 3 of 10

Custom output monitor default, time = 4.000000e+00, step 1 of 5
4.000e+00         41       5.49e-02     4.1    0.0    0.0   45.3   50.7
-  Step 2 of 5. Elapsed 0:00:00.2 ETA 0:00:00.1
Custom output monitor fast, time = 5.000000e+00, step 4 of 10

Custom output monitor fast, time = 6.000000e+00, step 5 of 10

Custom output monitor default, time = 6.000000e+00, step 2 of 5
6.000e+00         44       5.48e-02     3.5    0.0    0.0   46.1   50.3
\  Step 3 of 5. Elapsed 0:00:00.2 ETA 0:00:00.0
Custom output monitor fast, time = 7.000000e+00, step 6 of 10

Custom output monitor fast, time = 8.000000e+00, step 7 of 10

Custom output monitor default, time = 8.000000e+00, step 3 of 5
8.000e+00         41       5.24e-02     3.7    0.0    0.0   45.3   51.0
|  Step 4 of 5. Elapsed 0:00:00.3 ETA 0:00:-0.1
Custom output monitor fast, time = 9.000000e+00, step 8 of 10

Custom output monitor fast, time = 1.000000e+01, step 9 of 10

Custom output monitor default, time = 1.000000e+01, step 4 of 5
1.000e+01         44       5.80e-02     4.2    0.0    0.0   42.8   53.0
/  Step 5 of 5. Elapsed 0:00:00.3 ETA 0:00:-0.1

This is with nout = 10 and timestep = 1. Although the simulation runs to sim time nout * timestep and the relative frequencies of the monitors are all correct, notice that there are only 5 output steps that happen with timestep = 2.

I think the fix is:

modified   src/solver/solver.cxx
@@ -498,6 +498,9 @@ int Solver::solve(int nout, BoutReal timestep) {
 
   finaliseMonitorPeriods(nout, timestep);
 
+  number_output_steps = nout;
+  output_timestep = timestep;
+
   output_progress.write(
       _("Solver running for {:d} outputs with output timestep of {:e}\n"), nout,
       timestep);

This then runs for 10 output steps with timestep = 1, which is what I expect at least

Originally posted by @ZedThree in #2882 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant