refactor: fix statistics time#4050
Draft
kdrienCG wants to merge 5 commits into
Draft
Conversation
MelReyCG
reviewed
May 18, 2026
MelReyCG
requested changes
Jul 21, 2026
| SourceFluxStatsAggregator & timestepStats = | ||
| problem.getGroupByPath< SourceFluxStatsAggregator >( testSet.inputs.timeStepFluxStatsPath ); | ||
|
|
||
| // Stats run before the solver, so at t=0 elements counts are at 0 |
Contributor
There was a problem hiding this comment.
I suggest to abort this function if timestepId == 0 since flux statistics does not have any sense if we do not have any simulated timestep before.
Comment on lines
+357
to
+359
| EXPECT_DOUBLE_EQ( time_n, timestepId * testSet.inputs.dt ) | ||
| << GEOS_FMT( "Unexpected time for timestep {}: expected {}, got {}", | ||
| timestepId, timestepId * testSet.inputs.dt, time_n ); |
Contributor
There was a problem hiding this comment.
To preserve flexibility on the TableFunction values, I would check if time_n is the TableFunction coordinate at index timestepId, rather than having this linear timestepId * testSet.inputs.dt relation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)Now:
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 were missing the last timestep
Now statistics implements the
ExecutableGroup::cleanup()to trigger a last execution, similar to other components such asVTKOutput, etc.Details
Statistics were missing a last timestep, and some people had to modify the
maxTimetomaxTime + 1 dtto inspect the last timestep statistics.This was the case in the
testFlowStatistics.cppfile, which definedmaxTime = 5500instead ofmaxTime = 5000(with 500s timesteps) to be able to output the last statistic.