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

salt solubility table allowing specification of solubility per region #2593

Merged
merged 7 commits into from
Dec 8, 2021

Conversation

plgbrts
Copy link
Contributor

@plgbrts plgbrts commented Aug 4, 2021

No description provided.


namespace Opm {

class DeckItem;
Copy link
Member

Choose a reason for hiding this comment

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

did you mean to forward DeckRecord here?

Also in general we do not indent for namespace. Maybe whatever you used as blueprint did but please do not replicate the mistake.

@akva2
Copy link
Member

akva2 commented Aug 4, 2021

jenkins build this please

@joakim-hove
Copy link
Member

joakim-hove commented Aug 5, 2021

Many other tables are managed by the SimpleTableContainer which handles the region based lookup; I think you should look into whether that machinery can be used also in this situation.

If you decide it is best to stick with the current implementation - that is OK to, but maybe comment on it.

@plgbrts
Copy link
Contributor Author

plgbrts commented Nov 29, 2021

I followed for this table the SDENSITY table implementation which has the same structure. This PR is needed for coming PRs of @goncalvesmachadoc and myself. Would it be OK to merge as it is so we can go ahead?


#include <vector>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
Copy link
Member

Choose a reason for hiding this comment

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

Don't need the DeckKeyword include

@@ -897,6 +902,10 @@ std::optional<JFunc> make_jfunc(const Deck& deck) {
return getTables("SALTPVD");
}

const TableContainer& TableManager::getSaltsolTables() const {
Copy link
Member

Choose a reason for hiding this comment

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

Will this work? Does not look like this tablecontainer is initialized at all.

size_t numTables = m_tabdims.getNumPVTTables();
saltsoltables.resize(numTables);

const auto& keyword = deck.getKeyword("SALTSOL");
Copy link
Member

@joakim-hove joakim-hove Nov 29, 2021

Choose a reason for hiding this comment

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

This will not compile any longer:

#include <opm/parser/eclipse/Parser/ParserKeywords/S.hpp>
...
const auto& keyword = deck.get<ParserKeywords::S::SALTSOL>().back();
...

@joakim-hove
Copy link
Member

This PR is needed for coming PRs of @goncalvesmachadoc and myself. Would it be OK to merge as it is so we can go ahead?

I must say I find this a bit amusing; I suggest a change which I think is an improvement and in particular aligning with how most of the other tables are implemented[1]. Then after nearly four months of silence you come back and ask if it can be merged unmodified. Have you considered my suggestion? Maybe it was a poor suggestion after all.

If you still prefer the current implementation you should at least add some tests.

[1]: The TableContainer class implements the region based lookup, where you will automatically go the proceeding region number if the region you query for is not defined - i.e. this would be valid in Eclipse:

TABDIMS
   NTPVT=3 /
...
...
SALTSOL
  1 2 3 4 5 /
/
/

and the code should automatically work with the first table for all regions - that will not work out of the box with the current code.

@joakim-hove
Copy link
Member

jenkins build this please

@joakim-hove
Copy link
Member

I have been encouraged to withdraw from this PR - please disregard all my previous comments and wait for someone else to review and merge it.

Joakim

@goncalvesmachadoc
Copy link
Contributor

We appreciate your comments explaining the benefits of changing approach. We are working on modifying the table to use the SimpleTableContainer framework.

@plgbrts
Copy link
Contributor Author

plgbrts commented Dec 2, 2021

The table implementation is modified following the suggestion of @joakim-hove to use the SimpleTableContainer setup

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.

I will review this more carefully later, but I noticed a couple of issues that, at least superficially, look unexpected. I'm probably missing something though, so please correct my understanding.

@plgbrts
Copy link
Contributor Author

plgbrts commented Dec 2, 2021

Thanks @bska for catching the accidental mistakes. I fixed them.

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.

I think this looks good in general, and I'd like to get it into the master branch. I do however have a couple of questions regarding the table schema for the multirecord version of SALTSOL. In particular, I wonder what the most general structure of the keyword will be in the case of NTPVT > 1 and how that structure is reflected in the JSON keyword representation.

{
"name": "DATA",
"value_type": "DOUBLE",
"size_type": "ALL",
Copy link
Member

Choose a reason for hiding this comment

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

@joakim-hove will know the exact details, but I believe entering size_type: ALL here means that it is possible to parse a table with the following structure (assume NTPVT = 3)

SALTSOL
  0.1 0.2 0.3 /
  /
  0.123 /

Is that intentional? If not, what is the expected structure of a fully general SALTSOL table?

Copy link
Contributor

@goncalvesmachadoc goncalvesmachadoc Dec 6, 2021

Choose a reason for hiding this comment

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

For NTPVT = 3, we would want to have:

SALTSOL
  0.1 /
  0.2 /
  0.3 /

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The table you (@bska ) mentioned is indeed not intended.
What I understood from @joakim-hove 's comment earlier that for NTPVT=3 also the table

SALTSOL
0.1 /
 /
 /

is allowed for which region 2 and 3 takes the value of region 1.
As far I can see all tables use "ALL" for size_type . Is that observation correct?

Copy link
Member

Choose a reason for hiding this comment

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

Is that observation correct?

Yes, you're right. There may be an exception somewhere that I've overlooked, but using size_type = "ALL" does appear to be the typical case.

"550 0.5/\n"
"\n"
"SALTSOL\n"
"8.0/\n"
Copy link
Member

Choose a reason for hiding this comment

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

This test data has a single record for SALTSOL, but NTPVT = 2. Is that supposed to work? Would you mind adding an example case that uses a fully general SALTSOL table?

Copy link
Contributor

@goncalvesmachadoc goncalvesmachadoc Dec 6, 2021

Choose a reason for hiding this comment

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

Here

"TABDIMS\n"
        "1 1/\n"

So shouldn't be NTPVT = 1 in this test case?

Copy link
Member

Choose a reason for hiding this comment

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

So shouldn't be NTPVT = 1 in this test case?

Yes, you're right. My mistake. I was confused by the layout of the RWGSALT table data.

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.

Thank you for adding a test case with NTPVT > 1. This looks good to me now. I'll run a final build check and then merge once it comes back clear.

"550 0.5/\n"
"\n"
"SALTSOL\n"
"8.0/\n"
Copy link
Member

Choose a reason for hiding this comment

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

So shouldn't be NTPVT = 1 in this test case?

Yes, you're right. My mistake. I was confused by the layout of the RWGSALT table data.

{
"name": "DATA",
"value_type": "DOUBLE",
"size_type": "ALL",
Copy link
Member

Choose a reason for hiding this comment

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

Is that observation correct?

Yes, you're right. There may be an exception somewhere that I've overlooked, but using size_type = "ALL" does appear to be the typical case.

@bska
Copy link
Member

bska commented Dec 6, 2021

jenkins build this please

2 similar comments
@bska
Copy link
Member

bska commented Dec 7, 2021

jenkins build this please

@bska
Copy link
Member

bska commented Dec 8, 2021

jenkins build this please

@bska
Copy link
Member

bska commented Dec 8, 2021

I'll run a final build check and then merge once it comes back clear.

Build check is clear. I'll merge into master. Thanks a lot.

@bska bska merged commit 84bf899 into OPM:master Dec 8, 2021
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.

5 participants