mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2097 Reservoir Phase Detection : Find available phases from result files
This commit is contained in:
parent
f8a2250f3c
commit
5db08c7b76
@ -102,5 +102,11 @@ namespace RiaDefines
|
|||||||
|
|
||||||
double minimumDefaultValuePlot();
|
double minimumDefaultValuePlot();
|
||||||
double maximumDefaultValuePlot();
|
double maximumDefaultValuePlot();
|
||||||
|
|
||||||
|
enum PhaseType {
|
||||||
|
OIL_PHASE,
|
||||||
|
GAS_PHASE,
|
||||||
|
WATER_PHASE
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -383,6 +383,40 @@ QString RifEclipseOutputFileTools::createIndexFileName(const QString& resultFile
|
|||||||
return indexFileName;
|
return indexFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::set<RiaDefines::PhaseType> RifEclipseOutputFileTools::findAvailablePhases(ecl_file_type* ecl_file)
|
||||||
|
{
|
||||||
|
std::set<RiaDefines::PhaseType> phaseTypes;
|
||||||
|
|
||||||
|
if (ecl_file)
|
||||||
|
{
|
||||||
|
const ecl_kw_type* intehead = ecl_file_iget_named_kw(ecl_file, INTEHEAD_KW, 0);
|
||||||
|
if (intehead)
|
||||||
|
{
|
||||||
|
int phases = ecl_kw_iget_int(intehead, INTEHEAD_PHASE_INDEX);
|
||||||
|
|
||||||
|
if (phases & ECL_OIL_PHASE)
|
||||||
|
{
|
||||||
|
phaseTypes.insert(RiaDefines::OIL_PHASE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (phases & ECL_GAS_PHASE)
|
||||||
|
{
|
||||||
|
phaseTypes.insert(RiaDefines::GAS_PHASE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (phases & ECL_WATER_PHASE)
|
||||||
|
{
|
||||||
|
phaseTypes.insert(RiaDefines::WATER_PHASE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return phaseTypes;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -69,6 +69,8 @@ public:
|
|||||||
|
|
||||||
static QString createIndexFileName(const QString& resultFileName);
|
static QString createIndexFileName(const QString& resultFileName);
|
||||||
|
|
||||||
|
static std::set<RiaDefines::PhaseType> findAvailablePhases(ecl_file_type* ecl_file);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void createReportStepsMetaData(std::vector<ecl_file_type*> ecl_files, std::vector<RifRestartReportStep>* reportSteps);
|
static void createReportStepsMetaData(std::vector<ecl_file_type*> ecl_files, std::vector<RifRestartReportStep>* reportSteps);
|
||||||
};
|
};
|
||||||
|
@ -108,4 +108,6 @@ public:
|
|||||||
|
|
||||||
virtual void readWellData(well_info_type * well_info, bool importCompleteMswData) = 0;
|
virtual void readWellData(well_info_type * well_info, bool importCompleteMswData) = 0;
|
||||||
virtual int readUnitsType() = 0;
|
virtual int readUnitsType() = 0;
|
||||||
|
|
||||||
|
virtual std::set<RiaDefines::PhaseType> availablePhases() const = 0;
|
||||||
};
|
};
|
||||||
|
@ -294,6 +294,13 @@ void RifEclipseRestartFilesetAccess::openTimeStep(size_t timeStep)
|
|||||||
ecl_file_type* ecl_file = ecl_file_open(m_fileNames[index].toAscii().data(), ECL_FILE_CLOSE_STREAM);
|
ecl_file_type* ecl_file = ecl_file_open(m_fileNames[index].toAscii().data(), ECL_FILE_CLOSE_STREAM);
|
||||||
|
|
||||||
m_ecl_files[timeStep] = ecl_file;
|
m_ecl_files[timeStep] = ecl_file;
|
||||||
|
|
||||||
|
if (ecl_file)
|
||||||
|
{
|
||||||
|
auto phases = RifEclipseOutputFileTools::findAvailablePhases(ecl_file);
|
||||||
|
|
||||||
|
m_availablePhases.insert(phases.begin(), phases.end());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,6 +320,14 @@ int RifEclipseRestartFilesetAccess::readUnitsType()
|
|||||||
return RifEclipseOutputFileTools::readUnitsType(ecl_file);
|
return RifEclipseOutputFileTools::readUnitsType(ecl_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::set<RiaDefines::PhaseType> RifEclipseRestartFilesetAccess::availablePhases() const
|
||||||
|
{
|
||||||
|
return m_availablePhases;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -54,6 +54,8 @@ public:
|
|||||||
virtual void readWellData(well_info_type* well_info, bool importCompleteMswData);
|
virtual void readWellData(well_info_type* well_info, bool importCompleteMswData);
|
||||||
virtual int readUnitsType();
|
virtual int readUnitsType();
|
||||||
|
|
||||||
|
virtual std::set<RiaDefines::PhaseType> availablePhases() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void openTimeStep(size_t timeStep);
|
void openTimeStep(size_t timeStep);
|
||||||
|
|
||||||
@ -63,4 +65,5 @@ private:
|
|||||||
std::vector<double> m_daysSinceSimulationStart;
|
std::vector<double> m_daysSinceSimulationStart;
|
||||||
|
|
||||||
std::vector< ecl_file_type* > m_ecl_files;
|
std::vector< ecl_file_type* > m_ecl_files;
|
||||||
|
std::set<RiaDefines::PhaseType> m_availablePhases;
|
||||||
};
|
};
|
||||||
|
@ -128,8 +128,11 @@ bool RifEclipseUnifiedRestartFileAccess::openFile()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!m_ecl_file) return false;
|
if (!m_ecl_file) return false;
|
||||||
|
|
||||||
|
m_availablePhases = RifEclipseOutputFileTools::findAvailablePhases(m_ecl_file);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,6 +349,14 @@ int RifEclipseUnifiedRestartFileAccess::readUnitsType()
|
|||||||
return RifEclipseOutputFileTools::readUnitsType(m_ecl_file);
|
return RifEclipseOutputFileTools::readUnitsType(m_ecl_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::set<RiaDefines::PhaseType> RifEclipseUnifiedRestartFileAccess::availablePhases() const
|
||||||
|
{
|
||||||
|
return m_availablePhases;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -57,6 +57,8 @@ public:
|
|||||||
virtual void readWellData(well_info_type * well_info, bool importCompleteMswData);
|
virtual void readWellData(well_info_type * well_info, bool importCompleteMswData);
|
||||||
virtual int readUnitsType();
|
virtual int readUnitsType();
|
||||||
|
|
||||||
|
virtual std::set<RiaDefines::PhaseType> availablePhases() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool openFile();
|
bool openFile();
|
||||||
bool useResultIndexFile() const;
|
bool useResultIndexFile() const;
|
||||||
@ -69,4 +71,6 @@ private:
|
|||||||
std::vector<QDateTime> m_timeSteps;
|
std::vector<QDateTime> m_timeSteps;
|
||||||
std::vector<double> m_daysSinceSimulationStart;
|
std::vector<double> m_daysSinceSimulationStart;
|
||||||
std::vector<int> m_reportNr;
|
std::vector<int> m_reportNr;
|
||||||
|
|
||||||
|
std::set<RiaDefines::PhaseType> m_availablePhases;
|
||||||
};
|
};
|
||||||
|
@ -2076,6 +2076,19 @@ void RifReaderEclipseOutput::transferCoarseningInfo(const ecl_grid_type* eclGrid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::set<RiaDefines::PhaseType> RifReaderEclipseOutput::availablePhases() const
|
||||||
|
{
|
||||||
|
if (m_dynamicResultsAccess.notNull())
|
||||||
|
{
|
||||||
|
return m_dynamicResultsAccess->availablePhases();
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::set<RiaDefines::PhaseType>();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -68,6 +68,8 @@ public:
|
|||||||
static bool transferGeometry(const ecl_grid_type* mainEclGrid, RigEclipseCaseData* eclipseCase);
|
static bool transferGeometry(const ecl_grid_type* mainEclGrid, RigEclipseCaseData* eclipseCase);
|
||||||
static void transferCoarseningInfo(const ecl_grid_type* eclGrid, RigGridBase* grid);
|
static void transferCoarseningInfo(const ecl_grid_type* eclGrid, RigGridBase* grid);
|
||||||
|
|
||||||
|
virtual std::set<RiaDefines::PhaseType> availablePhases() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool readActiveCellInfo();
|
bool readActiveCellInfo();
|
||||||
void buildMetaData();
|
void buildMetaData();
|
||||||
|
@ -64,6 +64,14 @@ void RifReaderInterface::setTimeStepFilter(const std::vector<size_t>& fileTimeSt
|
|||||||
m_fileTimeStepIndices = fileTimeStepIndices;
|
m_fileTimeStepIndices = fileTimeStepIndices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::set<RiaDefines::PhaseType> RifReaderInterface::availablePhases() const
|
||||||
|
{
|
||||||
|
return std::set<RiaDefines::PhaseType>();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "RiaDefines.h"
|
||||||
#include "RiaPorosityModel.h"
|
#include "RiaPorosityModel.h"
|
||||||
|
|
||||||
#include "cvfBase.h"
|
#include "cvfBase.h"
|
||||||
@ -31,6 +32,7 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
|
||||||
class RigEclipseCaseData;
|
class RigEclipseCaseData;
|
||||||
@ -63,6 +65,8 @@ public:
|
|||||||
|
|
||||||
void setTimeStepFilter(const std::vector<size_t>& fileTimeStepIndices);
|
void setTimeStepFilter(const std::vector<size_t>& fileTimeStepIndices);
|
||||||
|
|
||||||
|
virtual std::set<RiaDefines::PhaseType> availablePhases() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool isTimeStepIncludedByFilter(size_t timeStepIndex) const;
|
bool isTimeStepIncludedByFilter(size_t timeStepIndex) const;
|
||||||
size_t timeStepIndexOnFile(size_t timeStepIndex) const;
|
size_t timeStepIndexOnFile(size_t timeStepIndex) const;
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "RigEclipseCaseData.h"
|
#include "RigEclipseCaseData.h"
|
||||||
|
|
||||||
#include <ert/ecl/ecl_file.h>
|
#include <ert/ecl/ecl_file.h>
|
||||||
|
#include "ert/ecl/ecl_kw_magic.h"
|
||||||
|
|
||||||
#include "RifReaderEclipseOutput.h"
|
#include "RifReaderEclipseOutput.h"
|
||||||
#include "RifEclipseOutputFileTools.h"
|
#include "RifEclipseOutputFileTools.h"
|
||||||
@ -483,3 +484,58 @@ TEST(DISABLED_RigReservoirTest, WellTest)
|
|||||||
|
|
||||||
readerInterfaceEcl->setHdf5FileName(sourSim);
|
readerInterfaceEcl->setHdf5FileName(sourSim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
TEST(RigReservoirTest, TestForPhase)
|
||||||
|
{
|
||||||
|
|
||||||
|
/*
|
||||||
|
cvf::ref<RifReaderEclipseOutput> readerInterfaceEcl = new RifReaderEclipseOutput;
|
||||||
|
cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData(nullptr);
|
||||||
|
|
||||||
|
// Location of test dataset received from Håkon Høgstøl in July 2011 with 10k active cells
|
||||||
|
#ifdef WIN32
|
||||||
|
QString filename("d:/Models/Statoil/soursim/PKMUNK_NOV_TEST_SS.GRID");
|
||||||
|
QString sourSim("d:/Models/Statoil/soursim/result.sourres.00001");
|
||||||
|
#else
|
||||||
|
QString filename("/mnt/hgfs/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.EGRID");
|
||||||
|
QString sourSim("d:/Models/Statoil/soursim/result.sourres");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool result = readerInterfaceEcl->open(filename, reservoir.p());
|
||||||
|
EXPECT_TRUE(result);
|
||||||
|
|
||||||
|
readerInterfaceEcl->setHdf5FileName(sourSim);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
std::string filename = "d:/Models/Statoil/troll_MSW/T07-4A-W2012-16-F3.UNRST";
|
||||||
|
|
||||||
|
//std::string filename = "d:/Models/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.UNRST";
|
||||||
|
//std::string filename = "d:/Models/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.INIT";
|
||||||
|
//std::string filename = "d:/Models/Statoil/TEST10K_FLT_LGR_NNC_TSTEP/TEST10K_FLT_LGR_NNC_TSTEP.UNRST";
|
||||||
|
//std::string filename = "d:/Models/Statoil/gas_case_only_water/TEST_GASWATER.X0000";
|
||||||
|
|
||||||
|
ecl_file_type * f = ecl_file_open(filename.data(), ECL_FILE_CLOSE_STREAM);
|
||||||
|
const ecl_kw_type * intehead = ecl_file_iget_named_kw(f, INTEHEAD_KW, 0);
|
||||||
|
int phases = ecl_kw_iget_int(intehead, INTEHEAD_PHASE_INDEX);
|
||||||
|
|
||||||
|
if (phases & ECL_OIL_PHASE)
|
||||||
|
{
|
||||||
|
qDebug() << "oil";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (phases & ECL_GAS_PHASE)
|
||||||
|
{
|
||||||
|
qDebug() << "gas";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (phases & ECL_WATER_PHASE)
|
||||||
|
{
|
||||||
|
qDebug() << "water";
|
||||||
|
}
|
||||||
|
|
||||||
|
ecl_file_close(f);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user