Fix GCONSUMP efficiency factor application#6737
Conversation
|
jenkins build this please |
seems to be unrelated to this PR. @akva2 Any idea? |
|
The real error is which means k is |
The GCONSUMP efficiency factor calculation was incorrectly applying group efficiency factors to the groups themselves, rather than following the the pattern used elsewhere in the code base: - Groups are NOT affected by their own efficiency factors - Parent groups apply child efficiency factors when accumulating contributions Changes: - Fix GroupState::update_gconsump() to implement correct efficiency pattern - Add test suite with simple and complex hierarchy scenarios
@akva2 I am able to reproduce an error (though not exactly the same error as in the jenkins build) for the same test case locally both for the PR branch and the master branch, so it seems it is not related to the PR. |
|
yeah, i ran into it in another build. there is definitely an issue. |
|
yeah, it contains out of bounds access errors. i've opened a PR to disable the test, #6739 |
|
jenkins build this please |
|
I'm probably missing something, but to me it seems this PR does the exact same thing as the originial code, only in a more inefficient (though admittedly more readable) manner. Could you provide a running example demonstrating the issue this PR intends to fix? |
@vkip The original code has a subtle bug: the Additionally, rates is passed by reference and accumulated all the way up, resulting in all groups storing the same values. You can verify this by checking out the original code and running the test: Regarding efficiency: The memoization cache in the original code actually provided no benefit during recursion. Since the group hierarchy is a tree (each group has exactly one parent), and the cache is cleared at the start of |
|
Thank you, I finally see the issue(s) now, and agree that there's no real effect of the intended optimization here (beyond obfuscating the code). Thanks a lot for identifying and fixing this! |
vkip
left a comment
There was a problem hiding this comment.
Looks good to me, just a minor comment on the new .DATA files.
There was a problem hiding this comment.
I understand it is not the intension, but with a couple of very minor changes (PVTO record 2, EQUIL item 1) the data file could actually also be run with the simulator, possibly extending the usefulness in other situations.
There was a problem hiding this comment.
Good idea, I have added a commit to address this.
There was a problem hiding this comment.
Thank for the review!
Update GCONSUMP.DATA and GCONSUMP_COMPLEX.DATA to be valid input for full simulation runs while preserving their unit test functionality: - Fix EQUIL datum depth to match gas-oil contact (7020 → 7000) - Fix PVTO bubble point relationship (Rs/Pbub must be monotonic) - Extend PVDG pressure range to cover reservoir pressure (→ 300 bar) - Adjust SGOF Sg_max to avoid floating-point SOGCR precision issue
e11cec0 to
327dcd5
Compare
|
jenkins build this please |
The GCONSUMP efficiency factor calculation was incorrectly applying group efficiency factors to the groups themselves, rather than following the the pattern used elsewhere in the code base:
Changes:
GroupState::update_gconsump()to implement correct efficiency pattern