Read units type from file and set CDARCHY value based on units type

This commit is contained in:
Magne Sjaastad 2014-08-27 14:05:29 +02:00
parent d76dd6a588
commit ffbfb8bdf0
12 changed files with 143 additions and 19 deletions

View File

@ -329,3 +329,26 @@ void RifEclipseOutputFileTools::readGridDimensions(const QString& gridFileName,
stringlist_free( lgr_names ); stringlist_free( lgr_names );
} }
//--------------------------------------------------------------------------------------------------
/// Returns the following integer values from the first INTEHEAD keyword found
/// 1 : METRIC
/// 2 : FIELD
/// 3 : LAB
/// -1 : No INTEHEAD keyword found
//--------------------------------------------------------------------------------------------------
int RifEclipseOutputFileTools::readUnitsType(ecl_file_type* ecl_file)
{
int unitsType = -1;
if (ecl_file)
{
ecl_kw_type* kwINTEHEAD = ecl_file_iget_named_kw(ecl_file, INTEHEAD_KW, 0);
if (kwINTEHEAD)
{
unitsType = ecl_kw_iget_int(kwINTEHEAD, INTEHEAD_UNIT_INDEX);
}
}
return unitsType;
}

View File

@ -56,4 +56,6 @@ public:
static QStringList filterFileNamesOfType(const QStringList& fileSet, ecl_file_enum fileType); static QStringList filterFileNamesOfType(const QStringList& fileSet, ecl_file_enum fileType);
static void readGridDimensions(const QString& gridFileName, std::vector< std::vector<int> >& gridDimensions); static void readGridDimensions(const QString& gridFileName, std::vector< std::vector<int> >& gridDimensions);
static int readUnitsType(ecl_file_type* ecl_file);
}; };

View File

@ -54,4 +54,5 @@ public:
virtual bool results(const QString& resultName, size_t timeStep, size_t gridCount, std::vector<double>* values) = 0; virtual bool results(const QString& resultName, size_t timeStep, size_t gridCount, std::vector<double>* values) = 0;
virtual void readWellData(well_info_type * well_info) = 0; virtual void readWellData(well_info_type * well_info) = 0;
virtual int readUnitsType() = 0;
}; };

View File

@ -240,3 +240,19 @@ void RifEclipseRestartFilesetAccess::openTimeStep(size_t timeStep)
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RifEclipseRestartFilesetAccess::readUnitsType()
{
ecl_file_type* ecl_file = NULL;
if (m_ecl_files.size() > 0)
{
openTimeStep(0);
ecl_file = m_ecl_files[0];
}
return RifEclipseOutputFileTools::readUnitsType(ecl_file);
}

View File

@ -47,6 +47,7 @@ public:
bool results(const QString& resultName, size_t timeStep, size_t gridCount, std::vector<double>* values); bool results(const QString& resultName, size_t timeStep, size_t gridCount, std::vector<double>* values);
virtual void readWellData(well_info_type* well_info); virtual void readWellData(well_info_type* well_info);
virtual int readUnitsType();
private: private:
void openTimeStep(size_t timeStep); void openTimeStep(size_t timeStep);

View File

@ -163,3 +163,13 @@ void RifEclipseUnifiedRestartFileAccess::setRestartFiles(const QStringList& file
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RifEclipseUnifiedRestartFileAccess::readUnitsType()
{
openFile();
return RifEclipseOutputFileTools::readUnitsType(m_ecl_file);
}

View File

@ -48,6 +48,7 @@ public:
bool results(const QString& resultName, size_t timeStep, size_t gridCount, std::vector<double>* values); bool results(const QString& resultName, size_t timeStep, size_t gridCount, std::vector<double>* values);
virtual void readWellData(well_info_type * well_info); virtual void readWellData(well_info_type * well_info);
virtual int readUnitsType();
private: private:
bool openFile(); bool openFile();

View File

@ -16,28 +16,29 @@
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#include "cvfBase.h"
#include "RigMainGrid.h"
#include "RigCaseData.h"
#include "RigCaseCellResultsData.h"
#include "RifReaderEclipseOutput.h" #include "RifReaderEclipseOutput.h"
#include "RigCaseCellResultsData.h"
#include "RigCaseData.h"
#include "RigMainGrid.h"
#include "RifEclipseInputFileTools.h"
#include "RifEclipseOutputFileTools.h" #include "RifEclipseOutputFileTools.h"
#include "RifEclipseUnifiedRestartFileAccess.h"
#include "RifEclipseRestartFilesetAccess.h" #include "RifEclipseRestartFilesetAccess.h"
#include "RifEclipseUnifiedRestartFileAccess.h"
#include "RifReaderInterface.h" #include "RifReaderInterface.h"
#include <iostream> #include "cafProgressInfo.h"
#include "ecl_grid.h" #include "ecl_grid.h"
#include "well_state.h" #include "well_state.h"
#include "ecl_kw_magic.h" #include "ecl_kw_magic.h"
#include "ecl_nnc_export.h" #include "ecl_nnc_export.h"
#include "cafProgressInfo.h" #include <iostream>
#include <map> #include <map>
#include "RifEclipseInputFileTools.h" #include <cmath> // Needed for HUGE_VAL on Linux
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ECLIPSE cell numbering layout: /// ECLIPSE cell numbering layout:
@ -676,6 +677,22 @@ void RifReaderEclipseOutput::buildMetaData()
fractureModelResults->setTimeStepDates(resIndex, m_timeSteps); fractureModelResults->setTimeStepDates(resIndex, m_timeSteps);
} }
} }
// Default units type is METRIC
RigCaseData::UnitsType unitsType = RigCaseData::UNITS_METRIC;
{
int unitsTypeValue = m_dynamicResultsAccess->readUnitsType();
if (unitsTypeValue == 2)
{
unitsType = RigCaseData::UNITS_FIELD;
}
else if (unitsTypeValue == 3)
{
unitsType = RigCaseData::UNITS_LAB;
}
}
m_eclipseCase->setUnitsType(unitsType);
} }
progInfo.incrementProgress(); progInfo.incrementProgress();

View File

@ -18,20 +18,24 @@
#include "RimReservoirCellResultsStorage.h" #include "RimReservoirCellResultsStorage.h"
#include "RigCaseCellResultsData.h"
#include "RigActiveCellInfo.h" #include "RigActiveCellInfo.h"
#include "RigMainGrid.h" #include "RigCaseCellResultsData.h"
#include "RigCaseData.h"
#include "RigCell.h" #include "RigCell.h"
#include "RigMainGrid.h"
#include "RimCase.h"
#include "RimTools.h" #include "RimTools.h"
#include "cafProgressInfo.h" #include "cafProgressInfo.h"
#include "cvfGeometryTools.h"
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QUuid> #include <QUuid>
#include "cvfGeometryTools.h"
CAF_PDM_SOURCE_INIT(RimReservoirCellResultsStorage, "ReservoirCellResultStorage"); CAF_PDM_SOURCE_INIT(RimReservoirCellResultsStorage, "ReservoirCellResultStorage");
@ -789,8 +793,7 @@ void RimReservoirCellResultsStorage::computeRiTransComponent(const QString& riTr
CVF_ASSERT(false); CVF_ASSERT(false);
} }
// Todo: Get the correct one from Unit set read by ERT double cdarchy = darchysValue();
double cdarchy = 0.008527; // (ECLIPSE 100) (METRIC)
// Get the needed result indices we depend on // Get the needed result indices we depend on
@ -935,8 +938,7 @@ void RimReservoirCellResultsStorage::computeNncCombRiTrans()
size_t riCombTransScalarResultIndex = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedRiTransResultName()); size_t riCombTransScalarResultIndex = m_cellResults->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedRiTransResultName());
if (m_ownerMainGrid->nncData()->connectionScalarResult(riCombTransScalarResultIndex)) return; if (m_ownerMainGrid->nncData()->connectionScalarResult(riCombTransScalarResultIndex)) return;
// Todo: Get the correct one from Unit set read by ERT double cdarchy = darchysValue();
double cdarchy = 0.008527; // (ECLIPSE 100) (METRIC)
// Get the needed result indices we depend on // Get the needed result indices we depend on
@ -1110,7 +1112,6 @@ void RimReservoirCellResultsStorage::computeRiMULTComponent(const QString& riMul
// Set up which component to compute // Set up which component to compute
cvf::StructGridInterface::FaceType faceId;
QString riTransCompName; QString riTransCompName;
QString transCompName; QString transCompName;
@ -1459,6 +1460,40 @@ bool RimReservoirCellResultsStorage::isDataPresent(size_t scalarResultIndex) con
return false; return false;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimReservoirCellResultsStorage::darchysValue()
{
// See "Cartesian transmissibility calculations" in the "Eclipse Technical Description"
// CDARCY Darcys constant
// = 0.00852702 (E300); 0.008527 (ECLIPSE 100) (METRIC)
// = 0.00112712 (E300); 0.001127 (ECLIPSE 100) (FIELD)
// = 3.6 (LAB)
// = 0.00864 (PVT - M)
double darchy = 0.008527; // (ECLIPSE 100) (METRIC)
RimCase* rimCase = NULL;
this->firstAncestorOfType(rimCase);
if (rimCase && rimCase->reservoirData())
{
RigCaseData::UnitsType unitsType = rimCase->reservoirData()->unitsType();
if (unitsType == RigCaseData::UNITS_FIELD)
{
darchy = 0.001127;
}
else if (unitsType == RigCaseData::UNITS_LAB)
{
darchy = 3.6;
}
}
return darchy;
}
CAF_PDM_SOURCE_INIT(RimReservoirCellResultsStorageEntryInfo, "ResultStorageEntryInfo"); CAF_PDM_SOURCE_INIT(RimReservoirCellResultsStorageEntryInfo, "ResultStorageEntryInfo");

View File

@ -67,11 +67,14 @@ private:
void computeSOILForTimeStep(size_t timeStepIndex); void computeSOILForTimeStep(size_t timeStepIndex);
void computeRiTransComponent(const QString& riTransComponentResultName); void computeRiTransComponent(const QString& riTransComponentResultName);
void computeNncCombRiTrans(); void computeNncCombRiTrans();
void computeRiMULTComponent(const QString& riMultCompName); void computeRiMULTComponent(const QString& riMultCompName);
void computeNncCombRiMULT(); void computeNncCombRiMULT();
void computeRiTRANSbyAreaComponent(const QString& riTransByAreaCompResultName); void computeRiTRANSbyAreaComponent(const QString& riTransByAreaCompResultName);
void computeNncCombRiTRANSbyArea(); void computeNncCombRiTRANSbyArea();
double darchysValue();
QString getValidCacheFileName(); QString getValidCacheFileName();
QString getCacheDirectoryPath(); QString getCacheDirectoryPath();
// Fields // Fields

View File

@ -36,6 +36,8 @@ RigCaseData::RigCaseData()
m_matrixModelResults->setActiveCellInfo(m_activeCellInfo.p()); m_matrixModelResults->setActiveCellInfo(m_activeCellInfo.p());
m_fractureModelResults->setActiveCellInfo(m_fractureActiveCellInfo.p()); m_fractureModelResults->setActiveCellInfo(m_fractureActiveCellInfo.p());
m_unitsType = UNITS_METRIC;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -32,6 +32,14 @@ class RigCaseCellResultsData;
class RigCaseData : public cvf::Object class RigCaseData : public cvf::Object
{ {
public:
enum UnitsType
{
UNITS_METRIC,
UNITS_FIELD,
UNITS_LAB
};
public: public:
RigCaseData(); RigCaseData();
~RigCaseData(); ~RigCaseData();
@ -64,6 +72,9 @@ public:
void computeActiveCellBoundingBoxes(); void computeActiveCellBoundingBoxes();
UnitsType unitsType() const { return m_unitsType; }
void setUnitsType(UnitsType unitsType) { m_unitsType = unitsType; }
private: private:
void computeActiveCellIJKBBox(); void computeActiveCellIJKBBox();
void computeWellCellsPrGrid(); void computeWellCellsPrGrid();
@ -80,4 +91,6 @@ private:
cvf::Collection<RigSingleWellResultsData> m_wellResults; //< A WellResults object for each well in the reservoir cvf::Collection<RigSingleWellResultsData> m_wellResults; //< A WellResults object for each well in the reservoir
cvf::Collection<cvf::UByteArray> m_wellCellsInGrid; //< A bool array pr grid with one bool pr cell telling wether the cell is a well cell or not cvf::Collection<cvf::UByteArray> m_wellCellsInGrid; //< A bool array pr grid with one bool pr cell telling wether the cell is a well cell or not
cvf::Collection<cvf::UIntArray> m_gridCellToWellIndex; //< Array pr grid with index to well pr cell telling which well a cell is in cvf::Collection<cvf::UIntArray> m_gridCellToWellIndex; //< Array pr grid with index to well pr cell telling which well a cell is in
UnitsType m_unitsType;
}; };