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

Minor adjustments #4395

Merged
merged 3 commits into from
Jan 6, 2025
Merged

Minor adjustments #4395

merged 3 commits into from
Jan 6, 2025

Conversation

magnesj
Copy link
Member

@magnesj magnesj commented Dec 23, 2024

Several adjustments based on testing on regression test datasets in ResInsight.

One commit is related to performance, avoid loading data until requested.

@magnesj
Copy link
Member Author

magnesj commented Dec 23, 2024

jenkins build this please

1 similar comment
@akva2
Copy link
Member

akva2 commented Dec 23, 2024

jenkins build this please

Comment on lines 712 to 714
if (this->pathMap.find(stringToFind) != this->pathMap.end()) {
std::string stringToReplace = this->pathMap.at(stringToFind);
replaceAll(path, pathKeywordPrefix + stringToFind, stringToReplace);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably omit multiple searches.

Suggested change
if (this->pathMap.find(stringToFind) != this->pathMap.end()) {
std::string stringToReplace = this->pathMap.at(stringToFind);
replaceAll(path, pathKeywordPrefix + stringToFind, stringToReplace);
if (auto candidate = this->pathMap.find(stringToFind); candidate != this->pathMap.end()) {
replaceAll(path, pathKeywordPrefix + stringToFind, *candidate);

Would also be cool, if you add a test that triggers this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have now improved the code based on your suggestion. I have also looked for a test file to trigger this error, but I did not find it.

Copy link
Member

@blattms blattms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool that you are contributing. Does that mean to ResInsight will use newer version of opm-common soon?

Tests for the crashes would be cool or at least some info where/how they originate.

@magnesj
Copy link
Member Author

magnesj commented Jan 2, 2025

Cool that you are contributing. Does that mean to ResInsight will use newer version of opm-common soon?

Tests for the crashes would be cool or at least some info where/how they originate.

The plan is to us a new version of opm-common soon. We aim for having as few patches to opm-common as possible. I assume that we still need a few patches that would not fit in main opm-common repo for now.

I will investigate to see if I can provide more info related to the bugfixes.

@magnesj
Copy link
Member Author

magnesj commented Jan 2, 2025

Most of these issues are seen in older grid cases. These cases are not possible to share, as they are based on real field cases.

I think this PR is ready for merge, please let me know if you need more info.

Copy link
Member

@bska bska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the code changes are obviously small the semantic changes are considerable here. Especially the change to opm/io/eclipse/rst/state.cpp is a little too large for comfort. That one, in particular, opens the door to use cases which the overall facility is not set up to handle and which I don't think are appropriate for the overall logic here.

I realise that the needs of ResInsight are very different from the needs of the OPM Flow simulator's restart facility, and as such I'd really prefer if at least that part could be kept as an independent patch in the ResInsight repository.

opm/io/eclipse/rst/state.cpp Outdated Show resolved Hide resolved
Loading all arrays is useful in some workflows, but will cause a significant performance penalty for larger cases. The data will be loaded on demand when required in RestartFileView::getKeyword<T>()
@magnesj magnesj force-pushed the minor-adjustments branch from 7de7445 to 1b52437 Compare January 3, 2025 13:22
@magnesj
Copy link
Member Author

magnesj commented Jan 3, 2025

I have updated this PR with a smaller subset of fixes. Please let me know if you need more info.

@bska
Copy link
Member

bska commented Jan 6, 2025

jenkins build this please

Copy link
Member

@bska bska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the updates. This looks good to me and I'll merge into master.

@bska bska merged commit 82a5575 into OPM:master Jan 6, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

4 participants