-
Notifications
You must be signed in to change notification settings - Fork 114
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
Conversation
c516e93
to
08bc432
Compare
jenkins build this please |
or other dimenions that involve conversion offsset, make sure the offset will not be discarded.
Indeed there is some keywords using composite dimensions with Temperature, like the following,
|
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 |
08bc432
to
5f76ed8
Compare
jenkins build this please |
@@ -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()) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, merging.
make sure the offset will not be discarded.
it was spotted when trying to review OPM/opm-simulators#5490 .