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

fixing the parsing of unit with string "Temperature" #4155

Merged
merged 2 commits into from
Aug 1, 2024

Conversation

GitPaean
Copy link
Member

make sure the offset will not be discarded.

it was spotted when trying to review OPM/opm-simulators#5490 .

@GitPaean GitPaean force-pushed the fixing_temperature_unit_parsing branch from c516e93 to 08bc432 Compare July 31, 2024 11:38
@GitPaean
Copy link
Member Author

jenkins build this please

or other dimenions that involve conversion offsset,
make sure the offset will not be discarded.
@GitPaean
Copy link
Member Author

GitPaean commented Aug 1, 2024

Indeed there is some keywords using composite dimensions with Temperature,

like the following,

input/eclipse/share/keywords/900_OPM/O/OILJT-19-      "value_type": "DOUBLE",
input/eclipse/share/keywords/900_OPM/O/OILJT:20:      "dimension": "Temperature/Pressure",
input/eclipse/share/keywords/900_OPM/O/OILJT-21-      "default": 0,
--
input/eclipse/share/keywords/900_OPM/G/GASJT-19-      "value_type": "DOUBLE",
input/eclipse/share/keywords/900_OPM/G/GASJT:20:      "dimension": "Temperature/Pressure",
input/eclipse/share/keywords/900_OPM/G/GASJT-21-      "default": 0,
--
input/eclipse/share/keywords/900_OPM/W/WATJT-19-      "value_type": "DOUBLE",
input/eclipse/share/keywords/900_OPM/W/WATJT:20:      "dimension": "Temperature/Pressure",
input/eclipse/share/keywords/900_OPM/W/WATJT-21-      "default": 0,

@GitPaean
Copy link
Member Author

GitPaean commented Aug 1, 2024

For this cases, they using as dT/dP, so the offset can be ignored.

But the PR is trying to fix the situation that 25C will be converted to 25K.

I think the solution will be to use Absolute temperature for Temperature/Pressure.

@GitPaean GitPaean force-pushed the fixing_temperature_unit_parsing branch from 08bc432 to 5f76ed8 Compare August 1, 2024 08:47
@GitPaean
Copy link
Member Author

GitPaean commented Aug 1, 2024

jenkins build this please

@GitPaean GitPaean requested a review from bska August 1, 2024 10:56
@GitPaean GitPaean requested review from atgeirr and hnil August 1, 2024 10:56
@@ -1560,8 +1566,9 @@ namespace {
Dimension dividend = this->parseFactor( parts[0] );
Dimension divisor = this->parseFactor( parts[1] );

if (dividend.getSIOffset() != 0.0 || divisor.getSIOffset() != 0.0)
throw std::invalid_argument("Composite dimensions cannot currently require a conversion offset");
if (!dividend.isCompositable() || !divisor.isCompositable()) {
Copy link
Member

Choose a reason for hiding this comment

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

I just understood why this is necessary: If any factor of either dividend or divisor is not compositable, that would usually trigger an exception from parseFactor(), but the exception is if either dividend or divisor is a single incompositable factor, then it must be handled here.

Can you confirm this is a correct understanding?

Copy link
Member Author

@GitPaean GitPaean Aug 1, 2024

Choose a reason for hiding this comment

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

dividend and divisor themselves can be possibly a single atomic unit with conversion offset. In this PR, this unit can be Temperature.

Function paserFactor can parse Temperature while not Temperature*Pressure (throw).

And we do not allow either dividend or divisor contain conversion offset (like Temperature. ) before we think it is possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you confirm this is a correct understanding?

Your understanding is correct.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, merging.

@atgeirr atgeirr merged commit f900ed4 into OPM:master Aug 1, 2024
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.

3 participants