mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-30 09:00:20 -05:00
#13275 Import available phases from INIT and UNRST
This change centralizes the logic for determining available phases from various file formats (ECL, OPM) and data structures (INTEHEAD keyword) into a single, well-defined function. The new `RiaOpmParserTools::phasesFromInteheadValue` function now handles the conversion from an integer phase indicator to a set of `PhaseType` enums. This function is used in both the ECL and OPM readers. Updates the `RifEclipseUnifiedRestartFileAccess` and `RifReaderEclipseOutput` to use `RifEclipseOutputFileTools::findAvailablePhases` to get the available phases
This commit is contained in:
1 parent
bcb930f36a
commit
c00da5e8e1
9 files changed
+139
-22
No files matched your search
@@ -401,4 +401,37 @@ std::string aicdTemplateId()
|
||||
return "ID_NUMBER";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RiaDefines::PhaseType> phasesFromInteheadValue( int phaseIndicator )
|
||||
{
|
||||
std::set<RiaDefines::PhaseType> phases;
|
||||
|
||||
if ( phaseIndicator < 0 ) return phases;
|
||||
|
||||
// Phase indicator from OPM Common specification:
|
||||
// ThirdParty\custom-opm-common\opm-common\opm\output\eclipse\VectorItems\intehead.hpp
|
||||
// PHASE = 14, Phase indicator:
|
||||
// 1: oil, 2: water, 3: O/W, 4: gas, 5: G/O, 6: G/W, 7: O/G/W
|
||||
// Use bitwise logic: oil=bit 0, water=bit 1, gas=bit 2
|
||||
|
||||
if ( phaseIndicator & 1 ) // oil
|
||||
{
|
||||
phases.insert( RiaDefines::PhaseType::OIL_PHASE );
|
||||
}
|
||||
|
||||
if ( phaseIndicator & 2 ) // water
|
||||
{
|
||||
phases.insert( RiaDefines::PhaseType::WATER_PHASE );
|
||||
}
|
||||
|
||||
if ( phaseIndicator & 4 ) // gas
|
||||
{
|
||||
phases.insert( RiaDefines::PhaseType::GAS_PHASE );
|
||||
}
|
||||
|
||||
return phases;
|
||||
}
|
||||
|
||||
} // namespace RiaOpmParserTools
|
||||
Reference in new issue
Block a user