Skip to content

Commit

Permalink
Merge pull request #4155 from GitPaean/fixing_temperature_unit_parsing
Browse files Browse the repository at this point in the history
fixing the parsing of unit with string "Temperature"
  • Loading branch information
atgeirr authored Aug 1, 2024
2 parents c83894e + 5f76ed8 commit f900ed4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
19 changes: 13 additions & 6 deletions opm/input/eclipse/Units/UnitSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1536,12 +1536,18 @@ namespace {
for( const auto& x : dimensionList ) {
auto dim = this->getDimension( x );

// all constituing dimension must be compositable. The
// all constituting dimensions must be compositable. The
// only exception is if there is the "composite" dimension
// consists of exactly a single atomic dimension...
if (dimensionList.size() > 1 && !dim.isCompositable())
throw std::invalid_argument("Composite dimensions currently cannot require a conversion offset");

if ( !dim.isCompositable() ) {
if (dimensionList.size() > 1) {
throw std::invalid_argument("Composite dimensions currently cannot handle conversion offsets");
} else {
// If there is only one single dimension, and it's not compositable (involving conversion offsets),
// return it directly
return dim;
}
}
SIfactor *= dim.getSIScaling();
}
return Dimension( SIfactor );
Expand All @@ -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()) {
throw std::invalid_argument("Composite dimensions currently cannot handle conversion offsets");
}

return Dimension( dividend.getSIScaling() / divisor.getSIScaling() );
}
Expand Down
4 changes: 2 additions & 2 deletions opm/input/eclipse/share/keywords/900_OPM/G/GASJT
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
{
"name": "JOULE_THOMSON_COEFFICIENT",
"value_type": "DOUBLE",
"dimension": "Temperature/Pressure",
"dimension": "AbsoluteTemperature/Pressure",
"default": 0,
"comment": "if defaulted the JT coefficient is calculated"
"comment": "if defaulted the JT coefficient is calculated. Unit Temperature can not be used due to conversion offset"
}
]
}
4 changes: 2 additions & 2 deletions opm/input/eclipse/share/keywords/900_OPM/O/OILJT
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
{
"name": "JOULE_THOMSON_COEFFICIENT",
"value_type": "DOUBLE",
"dimension": "Temperature/Pressure",
"dimension": "AbsoluteTemperature/Pressure",
"default": 0,
"comment": "if defaulted the JT coefficient is calculated"
"comment": "if defaulted the JT coefficient is calculated. Unit Temperature can not be used due to conversion offset"
}
]
}
3 changes: 2 additions & 1 deletion opm/input/eclipse/share/keywords/900_OPM/T/THERMEXR
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"description": "The THERMEXR item is used to set the thermal expansion ratio for a cell in mechanics models.",
"data": {
"value_type": "DOUBLE",
"dimension": "1/Temperature"
"dimension": "1/AbsoluteTemperature",
"comment": "Unit Temperature can not be used due to conversion offset"
}
}
4 changes: 2 additions & 2 deletions opm/input/eclipse/share/keywords/900_OPM/W/WATJT
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
{
"name": "JOULE_THOMSON_COEFFICIENT",
"value_type": "DOUBLE",
"dimension": "Temperature/Pressure",
"dimension": "AbsoluteTemperature/Pressure",
"default": 0,
"comment": "if defaulted the JT coefficient is calculated"
"comment": "if defaulted the JT coefficient is calculated. Unit Temperature can not be used due to conversion offset"
}
]
}

0 comments on commit f900ed4

Please sign in to comment.