mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Read units type from file and set CDARCHY value based on units type
This commit is contained in:
parent
d76dd6a588
commit
ffbfb8bdf0
@ -329,3 +329,26 @@ void RifEclipseOutputFileTools::readGridDimensions(const QString& gridFileName,
|
||||
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;
|
||||
}
|
||||
|
@ -56,4 +56,6 @@ public:
|
||||
static QStringList filterFileNamesOfType(const QStringList& fileSet, ecl_file_enum fileType);
|
||||
|
||||
static void readGridDimensions(const QString& gridFileName, std::vector< std::vector<int> >& gridDimensions);
|
||||
|
||||
static int readUnitsType(ecl_file_type* ecl_file);
|
||||
};
|
||||
|
@ -54,4 +54,5 @@ public:
|
||||
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 int readUnitsType() = 0;
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
bool results(const QString& resultName, size_t timeStep, size_t gridCount, std::vector<double>* values);
|
||||
|
||||
virtual void readWellData(well_info_type* well_info);
|
||||
virtual int readUnitsType();
|
||||
|
||||
private:
|
||||
void openTimeStep(size_t timeStep);
|
||||
|
@ -163,3 +163,13 @@ void RifEclipseUnifiedRestartFileAccess::setRestartFiles(const QStringList& file
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RifEclipseUnifiedRestartFileAccess::readUnitsType()
|
||||
{
|
||||
openFile();
|
||||
|
||||
return RifEclipseOutputFileTools::readUnitsType(m_ecl_file);
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
bool results(const QString& resultName, size_t timeStep, size_t gridCount, std::vector<double>* values);
|
||||
|
||||
virtual void readWellData(well_info_type * well_info);
|
||||
virtual int readUnitsType();
|
||||
|
||||
private:
|
||||
bool openFile();
|
||||
|
@ -16,28 +16,29 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "cvfBase.h"
|
||||
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
|
||||
#include "RifReaderEclipseOutput.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
#include "RifEclipseOutputFileTools.h"
|
||||
#include "RifEclipseUnifiedRestartFileAccess.h"
|
||||
#include "RifEclipseRestartFilesetAccess.h"
|
||||
#include "RifEclipseUnifiedRestartFileAccess.h"
|
||||
#include "RifReaderInterface.h"
|
||||
|
||||
#include <iostream>
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include "ecl_grid.h"
|
||||
#include "well_state.h"
|
||||
#include "ecl_kw_magic.h"
|
||||
#include "ecl_nnc_export.h"
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// ECLIPSE cell numbering layout:
|
||||
@ -676,6 +677,22 @@ void RifReaderEclipseOutput::buildMetaData()
|
||||
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();
|
||||
|
@ -18,20 +18,24 @@
|
||||
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigCaseData.h"
|
||||
#include "RigCell.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include "cvfGeometryTools.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QUuid>
|
||||
#include "cvfGeometryTools.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimReservoirCellResultsStorage, "ReservoirCellResultStorage");
|
||||
|
||||
@ -789,8 +793,7 @@ void RimReservoirCellResultsStorage::computeRiTransComponent(const QString& riTr
|
||||
CVF_ASSERT(false);
|
||||
}
|
||||
|
||||
// Todo: Get the correct one from Unit set read by ERT
|
||||
double cdarchy = 0.008527; // (ECLIPSE 100) (METRIC)
|
||||
double cdarchy = darchysValue();
|
||||
|
||||
// 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());
|
||||
if (m_ownerMainGrid->nncData()->connectionScalarResult(riCombTransScalarResultIndex)) return;
|
||||
|
||||
// Todo: Get the correct one from Unit set read by ERT
|
||||
double cdarchy = 0.008527; // (ECLIPSE 100) (METRIC)
|
||||
double cdarchy = darchysValue();
|
||||
|
||||
// Get the needed result indices we depend on
|
||||
|
||||
@ -1110,7 +1112,6 @@ void RimReservoirCellResultsStorage::computeRiMULTComponent(const QString& riMul
|
||||
|
||||
// Set up which component to compute
|
||||
|
||||
cvf::StructGridInterface::FaceType faceId;
|
||||
QString riTransCompName;
|
||||
QString transCompName;
|
||||
|
||||
@ -1459,6 +1460,40 @@ bool RimReservoirCellResultsStorage::isDataPresent(size_t scalarResultIndex) con
|
||||
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");
|
||||
|
@ -67,11 +67,14 @@ private:
|
||||
void computeSOILForTimeStep(size_t timeStepIndex);
|
||||
void computeRiTransComponent(const QString& riTransComponentResultName);
|
||||
void computeNncCombRiTrans();
|
||||
|
||||
void computeRiMULTComponent(const QString& riMultCompName);
|
||||
void computeNncCombRiMULT();
|
||||
void computeRiTRANSbyAreaComponent(const QString& riTransByAreaCompResultName);
|
||||
void computeNncCombRiTRANSbyArea();
|
||||
|
||||
double darchysValue();
|
||||
|
||||
QString getValidCacheFileName();
|
||||
QString getCacheDirectoryPath();
|
||||
// Fields
|
||||
|
@ -36,6 +36,8 @@ RigCaseData::RigCaseData()
|
||||
|
||||
m_matrixModelResults->setActiveCellInfo(m_activeCellInfo.p());
|
||||
m_fractureModelResults->setActiveCellInfo(m_fractureActiveCellInfo.p());
|
||||
|
||||
m_unitsType = UNITS_METRIC;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -30,8 +30,16 @@
|
||||
class RigCaseCellResultsData;
|
||||
|
||||
|
||||
class RigCaseData: public cvf::Object
|
||||
class RigCaseData : public cvf::Object
|
||||
{
|
||||
public:
|
||||
enum UnitsType
|
||||
{
|
||||
UNITS_METRIC,
|
||||
UNITS_FIELD,
|
||||
UNITS_LAB
|
||||
};
|
||||
|
||||
public:
|
||||
RigCaseData();
|
||||
~RigCaseData();
|
||||
@ -64,6 +72,9 @@ public:
|
||||
|
||||
void computeActiveCellBoundingBoxes();
|
||||
|
||||
UnitsType unitsType() const { return m_unitsType; }
|
||||
void setUnitsType(UnitsType unitsType) { m_unitsType = unitsType; }
|
||||
|
||||
private:
|
||||
void computeActiveCellIJKBBox();
|
||||
void computeWellCellsPrGrid();
|
||||
@ -80,4 +91,6 @@ private:
|
||||
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::UIntArray> m_gridCellToWellIndex; //< Array pr grid with index to well pr cell telling which well a cell is in
|
||||
|
||||
UnitsType m_unitsType;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user