Fix ensemble contour map GENERATED result statistics and caching bugs - #14813
Merged
magnesj merged 2 commits intoOct 2, 2026
Merged
Conversation
…ching bugs Compute grid calculations when a view is stepped to another case.
magnesj
force-pushed
the
ensemble-contour-map-generated-result-caching
branch
from
October 1, 2026 08:54
1cb5c95 to
15a649b
Compare
magnesj
marked this pull request as ready for review
October 1, 2026 08:54
kriben
reviewed
Oct 2, 2026
…ble results in calculateForCase() calculateForCase() now opens required source cases before validation, like calculate() already did, fixing a null-deref crash when a source case is closed. Recalculating an ensemble's main case for a plain per-cell expression now also invalidates any stale result already computed for another, currently open realization, so it is lazily recomputed instead of being mistaken for up to date.
Member
Author
|
Addressed both review comments in 21d609e:
All 44 tests in the targeted suite pass, and the full |
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.
Summary
Fixes #14812 - a set of related bugs affecting ensemble contour maps that use a GENERATED (grid calculation) result, plus a related bug where switching a view's case lost generated results.
Per-realization recompute:
RimStatisticsContourMap::computeStatisticsForMaps()opens and closes each ensemble realization in turn to bound memory use.RimEclipseCase::closeReservoirCase()discards the wholeRigEclipseCaseData, so a GENERATED result computed for one realization is lost again before the next realization is processed. AddedensureGeneratedResultIsComputed(), called for the current case inside the per-case loop, which looks up the matchingRimGridCalculation(by result variable name) and re-runs it for that single realization.Disk cache always rejected for GENERATED results:
RimStatisticsContourMap::selectedTimeSteps()collapses to a single time step unless the mapped result reports as dynamic (RimEclipseResultDefinition::hasDynamicResult()). For a GENERATED result, that check depends on whether the primary case currently has the result computed in memory - true right after computing statistics (cache write time), false on a fresh session before the calculation has run again (cache check time). This made the cache validity key unstable between sessions, so the on-disk.gricache was always rejected and the whole ensemble recomputed on every load. Fixed by proactively computing the GENERATED result on the primary case inensureResultsComputed(), before the cache is checked."Calculate" button always recomputed the whole ensemble: clicking "Calculate" for a calculation with a Destination Ensemble iterated every realization, even for a plain per-cell expression whose result can be recomputed lazily, one realization at a time (see point 1). Restricted
RimGridCalculation::calculate()to the ensemble's main case for plain expressions via a newcasesToCalculate()helper; only aggregation expressions (sum/avg/min/max/count, whose result is the per-realization summary itself and cannot be produced lazily) still compute for every realization.Generated results lost when a view is stepped to another case: grid calculation results are not stored with the case, so switching a view's case (
RimEclipseView::fieldChangedByUi()) left no generated results available and the view was cleared. AddedRimGridCalculationCollection::ensureCalculationsAreComputed(), called before the result definitions are updated, which computes any calculation missing for the new case. IntroducedRimGridCalculation::calculateForCase()to compute a single case using the calculation's own filter and time step settings, and reused it inensureGeneratedResultIsComputed()for the ensemble contour map per-realization path (point 1), so that path now also respects the calculation's filter/time step settings instead of always using none.Testing
RimStatisticsContourMapTest.GeneratedDynamicResultIsNotReportedAsDynamicBeforeItIsComputedandRimStatisticsContourMapTest.EnsureResultsComputedMakesGeneratedResultDynamicBeforeCacheCheckreproducing and verifying the caching fix.RimGridCalculationTest.EnsembleDestinationWithPlainExpressionOnlyCalculatesMainCaseandRimGridCalculationTest.EnsembleDestinationWithAggregationExpressionCalculatesAllCasesverifying the "Calculate" button restriction.RimGridCalculationTest.EnsureCalculationsAreComputedForCaseNotInOutputCasesverifying generated results are computed for a case stepped to that is not an output case of the calculation.