Skip to content

refactor: fix statistics time#4050

Draft
kdrienCG wants to merge 4 commits intodevelopfrom
refactor/kdrienCG/unifyTimestepBehavior
Draft

refactor: fix statistics time#4050
kdrienCG wants to merge 4 commits intodevelopfrom
refactor/kdrienCG/unifyTimestepBehavior

Conversation

@kdrienCG
Copy link
Copy Markdown

@kdrienCG kdrienCG commented May 7, 2026

This PR fixes some time misalignements in the statistics.

Statistics time label misaligned by one timestep, starting at t1 instead of t0.
Here is an example (resvol_constraint.xml) starting at t0 = 2500s while values correspond to the values in the XML input file (5000000 Pa pressure)

Time [s],Min pressure [Pa],Average pressure [Pa],Max pressure [Pa], ...
    2500,          5000000,              5000000,          5000000
    5000,          4571243,              4960905,          5264805
    7500,          4470766,              4951167,          5345129
   10000,          4428837,              4945246,          5381950
...

Now:

Time [s],Min pressure [Pa],Average pressure [Pa],Max pressure [Pa], ...
       0,          5000000,              5000000,          5000000
    2500,          4571243,              4960905,          5264805
    5000,          4470766,              4951167,          5345129
    7500,          4428837,              4945246,          5381950
   10000,          4398290,              4940123,          5408567
...
Details Stats events previously used `time + dt` to label time and now uses `time + dt * eventProgress` to output the correct time at which statistics are launched/computed. `eventProgress` (always?) equals `0` in those cases, so stats basically run at `time = time`, but I added it if one day stats could launch/be computed at mid-event, I can remove it if it's not correct.

Statistics where missing the last timestep
Now statistics implements the ExecutableGroup::cleanup() to trigger a last execution, similar to other components such as VTKOutput, etc.

Details Statistics were missing a last timestep, and some people had to modify the `maxTime` to `maxTime + dt` to inspect the last timestep statistics.

THis was the case in the testFlowStatistics.cpp file, which defined maxTime = 5500 instead of maxTime = 5000 (with 500s timesteps) to be able to output the last statistic.

@kdrienCG kdrienCG self-assigned this May 7, 2026
@kdrienCG kdrienCG added the type: cleanup / refactor Non-functional change (NFC) label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: cleanup / refactor Non-functional change (NFC)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant