2012-05-18 02:45:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2014-09-23 08:04:57 -05:00
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2012-05-18 02:45:23 -05:00
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-06-26 09:10:41 -05:00
|
|
|
#include "RifReaderMockModel.h"
|
2017-01-09 13:27:46 -06:00
|
|
|
|
|
|
|
#include "RigCaseCellResultsData.h"
|
2017-01-10 02:51:39 -06:00
|
|
|
#include "RigEclipseCaseData.h"
|
2017-08-11 08:10:08 -05:00
|
|
|
#include "RigEclipseResultInfo.h"
|
2017-01-09 13:27:46 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-10 02:51:39 -06:00
|
|
|
bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclipseCase)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-02-13 06:24:39 -06:00
|
|
|
m_reservoirBuilder.populateReservoir(eclipseCase);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-02-13 06:24:39 -06:00
|
|
|
m_reservoir = eclipseCase;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2017-08-11 07:05:59 -05:00
|
|
|
RigCaseCellResultsData* cellResults = eclipseCase->results(RiaDefines::MATRIX_MODEL);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2017-08-11 08:10:08 -05:00
|
|
|
std::vector<RigEclipseTimeStepInfo> timeStepInfos;
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2017-08-11 02:21:32 -05:00
|
|
|
std::vector<QDateTime> dates;
|
|
|
|
std::vector<double> days;
|
|
|
|
std::vector<int> repNumbers;
|
|
|
|
|
|
|
|
for (int i = 0; i < static_cast<int>(m_reservoirBuilder.timeStepCount()); i++)
|
|
|
|
{
|
|
|
|
dates.push_back(QDateTime(QDate(2012+i, 6, 1)));
|
|
|
|
days.push_back(i);
|
|
|
|
repNumbers.push_back(i);
|
|
|
|
}
|
|
|
|
|
2017-08-11 08:10:08 -05:00
|
|
|
timeStepInfos = RigEclipseTimeStepInfo::createTimeStepInfos(dates, repNumbers, days);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
2012-06-26 09:10:41 -05:00
|
|
|
for (size_t i = 0; i < m_reservoirBuilder.resultCount(); i++)
|
|
|
|
{
|
2017-08-24 23:58:47 -05:00
|
|
|
size_t resIdx = cellResults->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, QString("Dynamic_Result_%1").arg(i), false);
|
2017-08-11 02:21:32 -05:00
|
|
|
cellResults->setTimeStepInfos(resIdx, timeStepInfos);
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (m_reservoirBuilder.timeStepCount() == 0) return true;
|
|
|
|
|
2017-08-11 08:10:08 -05:00
|
|
|
std::vector<RigEclipseTimeStepInfo> staticResultTimeStepInfos;
|
2017-08-11 02:21:32 -05:00
|
|
|
staticResultTimeStepInfos.push_back(timeStepInfos[0]);
|
2017-01-12 05:04:54 -06:00
|
|
|
|
2013-01-22 04:34:47 -06:00
|
|
|
for (int i = 0; i < static_cast<int>(m_reservoirBuilder.resultCount()); i++)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
QString varEnd;
|
|
|
|
if (i == 0) varEnd = "X";
|
|
|
|
if (i == 1) varEnd = "Y";
|
|
|
|
int resIndex = 0;
|
|
|
|
if (i > 1) resIndex = i;
|
|
|
|
|
2017-08-24 23:58:47 -05:00
|
|
|
size_t resIdx = cellResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, QString("Static_Result_%1%2").arg(resIndex).arg(varEnd), false);
|
2017-08-11 02:21:32 -05:00
|
|
|
cellResults->setTimeStepInfos(resIdx, staticResultTimeStepInfos);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
2012-06-26 09:10:41 -05:00
|
|
|
|
|
|
|
#define ADD_INPUT_PROPERTY(Name) \
|
|
|
|
{ \
|
|
|
|
size_t resIdx; \
|
|
|
|
QString resultName(Name); \
|
2017-08-24 23:58:47 -05:00
|
|
|
resIdx = cellResults->findOrCreateScalarResultIndex(RiaDefines::INPUT_PROPERTY, resultName, false); \
|
2017-08-11 02:21:32 -05:00
|
|
|
cellResults->setTimeStepInfos(resIdx, staticResultTimeStepInfos); \
|
2012-06-26 09:10:41 -05:00
|
|
|
cellResults->cellScalarResults(resIdx).resize(1); \
|
|
|
|
std::vector<double>& values = cellResults->cellScalarResults(resIdx)[0]; \
|
|
|
|
this->inputProperty(resultName, &values); \
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
2012-06-26 09:10:41 -05:00
|
|
|
ADD_INPUT_PROPERTY("PORO");
|
|
|
|
ADD_INPUT_PROPERTY("PERM");
|
|
|
|
ADD_INPUT_PROPERTY("MULTX");
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2012-06-26 09:10:41 -05:00
|
|
|
bool RifReaderMockModel::inputProperty(const QString& propertyName, std::vector<double>* values)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-03-08 01:24:40 -06:00
|
|
|
return m_reservoirBuilder.inputProperty(m_reservoir, propertyName, values);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-08-11 07:05:59 -05:00
|
|
|
bool RifReaderMockModel::staticResult(const QString& result, RiaDefines::PorosityModelType matrixOrFracture, std::vector<double>* values)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-03-08 01:24:40 -06:00
|
|
|
m_reservoirBuilder.staticResult(m_reservoir, result, values);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-08-11 07:05:59 -05:00
|
|
|
bool RifReaderMockModel::dynamicResult(const QString& result, RiaDefines::PorosityModelType matrixOrFracture, size_t stepIndex, std::vector<double>* values)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-03-08 01:24:40 -06:00
|
|
|
m_reservoirBuilder.dynamicResult(m_reservoir, result, stepIndex, values);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-11-27 09:37:26 -06:00
|
|
|
RifReaderMockModel::RifReaderMockModel() : m_reservoir(NULL)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
m_cellResults.push_back("Dummy results");
|
|
|
|
m_cellProperties.push_back("Dummy static result");
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2012-06-26 09:10:41 -05:00
|
|
|
RifReaderMockModel::~RifReaderMockModel()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2012-06-26 09:10:41 -05:00
|
|
|
void RifReaderMockModel::setWorldCoordinates(cvf::Vec3d minWorldCoordinate, cvf::Vec3d maxWorldCoordinate)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
m_reservoirBuilder.setWorldCoordinates(minWorldCoordinate, maxWorldCoordinate);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2012-06-26 09:10:41 -05:00
|
|
|
void RifReaderMockModel::setGridPointDimensions(const cvf::Vec3st& gridPointDimensions)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
m_reservoirBuilder.setGridPointDimensions(gridPointDimensions);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2012-06-26 09:10:41 -05:00
|
|
|
void RifReaderMockModel::setResultInfo(size_t resultCount, size_t timeStepCount)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
m_reservoirBuilder.setResultInfo(resultCount, timeStepCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2012-06-26 09:10:41 -05:00
|
|
|
void RifReaderMockModel::addLocalGridRefinement(const cvf::Vec3st& minCellPosition, const cvf::Vec3st& maxCellPosition, const cvf::Vec3st& singleCellRefinementFactors)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
m_reservoirBuilder.addLocalGridRefinement(minCellPosition, maxCellPosition, singleCellRefinementFactors);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-10 02:51:39 -06:00
|
|
|
void RifReaderMockModel::populateReservoir(RigEclipseCaseData* eclipseCase)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-02-13 06:24:39 -06:00
|
|
|
m_reservoirBuilder.populateReservoir(eclipseCase);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
2013-10-28 04:32:24 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RifReaderMockModel::enableWellData(bool enableWellData)
|
|
|
|
{
|
|
|
|
m_reservoirBuilder.enableWellData(enableWellData);
|
|
|
|
}
|
|
|
|
|