2012-05-18 09:45:23 +02:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//
|
2014-09-23 15:04:57 +02:00
|
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2019-06-19 13:41:42 +02:00
|
|
|
|
//
|
2012-05-18 09:45:23 +02: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.
|
2019-06-19 13:41:42 +02:00
|
|
|
|
//
|
2012-05-18 09:45:23 +02:00
|
|
|
|
// 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.
|
2019-06-19 13:41:42 +02:00
|
|
|
|
//
|
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2012-05-18 09:45:23 +02:00
|
|
|
|
// for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
2014-08-27 14:05:29 +02:00
|
|
|
|
#include "RifReaderEclipseOutput.h"
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2017-08-29 14:28:17 +02:00
|
|
|
|
#include "RiaApplication.h"
|
2019-03-19 10:49:09 +01:00
|
|
|
|
#include "RiaCellDividingTools.h"
|
2017-03-23 07:00:00 +01:00
|
|
|
|
#include "RiaLogging.h"
|
2017-08-29 14:28:17 +02:00
|
|
|
|
#include "RiaPreferences.h"
|
2017-03-23 07:00:00 +01:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
#include "RiaStringEncodingTools.h"
|
2019-06-19 15:05:54 +02:00
|
|
|
|
#include "RifActiveCellsReader.h"
|
2017-01-17 15:11:02 +01:00
|
|
|
|
#include "RifEclipseInputFileTools.h"
|
2012-06-26 16:10:41 +02:00
|
|
|
|
#include "RifEclipseOutputFileTools.h"
|
2017-08-25 09:13:28 +02:00
|
|
|
|
#include "RifHdf5ReaderInterface.h"
|
2017-08-29 14:28:17 +02:00
|
|
|
|
#include "RifReaderSettings.h"
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2017-03-23 07:00:00 +01:00
|
|
|
|
#ifdef USE_HDF5
|
|
|
|
|
|
#include "RifHdf5Reader.h"
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2017-01-17 15:11:02 +01:00
|
|
|
|
#include "RigActiveCellInfo.h"
|
|
|
|
|
|
#include "RigCaseCellResultsData.h"
|
|
|
|
|
|
#include "RigEclipseCaseData.h"
|
2019-03-12 18:23:45 +01:00
|
|
|
|
#include "RigEclipseResultInfo.h"
|
|
|
|
|
|
#include "RigEquil.h"
|
2017-01-17 15:11:02 +01:00
|
|
|
|
#include "RigMainGrid.h"
|
2017-10-13 13:44:53 +02:00
|
|
|
|
#include "RigSimWellData.h"
|
2017-01-17 15:11:02 +01:00
|
|
|
|
|
2014-08-27 14:05:29 +02:00
|
|
|
|
#include "cafProgressInfo.h"
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2017-01-17 15:11:02 +01:00
|
|
|
|
#include "cvfTrace.h"
|
|
|
|
|
|
|
2016-05-26 14:49:13 +02:00
|
|
|
|
#include "ert/ecl/ecl_kw_magic.h"
|
2019-06-19 13:41:42 +02:00
|
|
|
|
#include "ert/ecl/ecl_nnc_data.h"
|
2017-01-17 15:11:02 +01:00
|
|
|
|
#include "ert/ecl/ecl_nnc_export.h"
|
2017-06-22 16:03:55 +02:00
|
|
|
|
#include "ert/ecl/ecl_nnc_geometry.h"
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2017-10-13 16:55:04 +02:00
|
|
|
|
#include <QDateTime>
|
2018-06-11 09:58:34 +02:00
|
|
|
|
#include <QFileInfo>
|
2017-10-13 16:55:04 +02:00
|
|
|
|
|
2017-01-17 15:11:02 +01:00
|
|
|
|
#include <cmath> // Needed for HUGE_VAL on Linux
|
2014-08-27 14:05:29 +02:00
|
|
|
|
#include <iostream>
|
2013-08-26 14:56:34 +02:00
|
|
|
|
#include <map>
|
2014-08-27 14:05:29 +02:00
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
/// ECLIPSE cell numbering layout:
|
|
|
|
|
|
/// Lower layer: Upper layer
|
2013-12-18 15:36:28 +01:00
|
|
|
|
/// Low Depth High Depth
|
|
|
|
|
|
/// Low K High K
|
|
|
|
|
|
/// Shallow Deep
|
2012-05-18 09:45:23 +02:00
|
|
|
|
/// 2---3 6---7
|
|
|
|
|
|
/// | | | |
|
|
|
|
|
|
/// 0---1 4---5
|
|
|
|
|
|
///
|
|
|
|
|
|
///
|
|
|
|
|
|
///
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
// The indexing conventions for vertices in ECLIPSE
|
|
|
|
|
|
//
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// 2-------------3
|
|
|
|
|
|
// /| /|
|
|
|
|
|
|
// / | / | /j
|
|
|
|
|
|
// / | / | /
|
|
|
|
|
|
// 0-------------1 | *---i
|
|
|
|
|
|
// | | | | |
|
2013-12-18 15:36:28 +01:00
|
|
|
|
// | 6---------|---7 |
|
|
|
|
|
|
// | / | / |k
|
2012-05-18 09:45:23 +02:00
|
|
|
|
// | / | /
|
|
|
|
|
|
// |/ |/
|
2013-12-18 15:36:28 +01:00
|
|
|
|
// 4-------------5
|
2012-05-18 09:45:23 +02:00
|
|
|
|
// vertex indices
|
|
|
|
|
|
//
|
|
|
|
|
|
// The indexing conventions for vertices in ResInsight
|
|
|
|
|
|
//
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// 7-------------6 |k
|
|
|
|
|
|
// /| /| | /j
|
|
|
|
|
|
// / | / | |/
|
|
|
|
|
|
// / | / | *---i
|
2012-05-18 09:45:23 +02:00
|
|
|
|
// 4-------------5 |
|
|
|
|
|
|
// | | | |
|
|
|
|
|
|
// | 3---------|---2
|
|
|
|
|
|
// | / | /
|
|
|
|
|
|
// | / | /
|
|
|
|
|
|
// |/ |/
|
|
|
|
|
|
// 0-------------1
|
|
|
|
|
|
// vertex indices
|
|
|
|
|
|
//
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
static const size_t cellMappingECLRi[8] = {0, 1, 3, 2, 4, 5, 7, 6};
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
|
|
//**************************************************************************************************
|
|
|
|
|
|
// Static functions
|
|
|
|
|
|
//**************************************************************************************************
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
bool transferGridCellData(RigMainGrid* mainGrid,
|
|
|
|
|
|
RigActiveCellInfo* activeCellInfo,
|
|
|
|
|
|
RigActiveCellInfo* fractureActiveCellInfo,
|
|
|
|
|
|
RigGridBase* localGrid,
|
|
|
|
|
|
const ecl_grid_type* localEclGrid,
|
|
|
|
|
|
size_t matrixActiveStartIndex,
|
|
|
|
|
|
size_t fractureActiveStartIndex)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2013-03-13 11:50:31 +01:00
|
|
|
|
CVF_ASSERT(activeCellInfo && fractureActiveCellInfo);
|
2013-02-12 11:15:36 +01:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
int cellCount = ecl_grid_get_global_size(localEclGrid);
|
2015-11-24 14:21:02 +01:00
|
|
|
|
size_t cellStartIndex = mainGrid->globalCellArray().size();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
size_t nodeStartIndex = mainGrid->nodes().size();
|
|
|
|
|
|
|
|
|
|
|
|
RigCell defaultCell;
|
|
|
|
|
|
defaultCell.setHostGrid(localGrid);
|
2015-11-24 14:21:02 +01:00
|
|
|
|
mainGrid->globalCellArray().resize(cellStartIndex + cellCount, defaultCell);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
mainGrid->nodes().resize(nodeStartIndex + cellCount * 8, cvf::Vec3d(0, 0, 0));
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
int progTicks = 100;
|
|
|
|
|
|
int cellsPrProgressTick = std::max(1, cellCount / progTicks);
|
2012-09-11 09:22:36 +02:00
|
|
|
|
caf::ProgressInfo progInfo(progTicks, "");
|
2019-03-12 11:02:06 +01:00
|
|
|
|
|
2012-06-26 16:10:41 +02:00
|
|
|
|
size_t computedCellCount = 0;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
// Loop over cells and fill them with data
|
|
|
|
|
|
|
2012-09-11 09:22:36 +02:00
|
|
|
|
#pragma omp parallel for
|
2014-08-08 09:50:57 +02:00
|
|
|
|
for (int gridLocalCellIndex = 0; gridLocalCellIndex < cellCount; ++gridLocalCellIndex)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2015-11-24 14:21:02 +01:00
|
|
|
|
RigCell& cell = mainGrid->globalCellArray()[cellStartIndex + gridLocalCellIndex];
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2014-08-22 08:01:31 +02:00
|
|
|
|
cell.setGridLocalCellIndex(gridLocalCellIndex);
|
2013-01-30 15:02:28 +01:00
|
|
|
|
|
2013-02-01 15:33:21 +01:00
|
|
|
|
// Active cell index
|
|
|
|
|
|
|
2014-08-08 09:50:57 +02:00
|
|
|
|
int matrixActiveIndex = ecl_grid_get_active_index1(localEclGrid, gridLocalCellIndex);
|
2013-01-30 15:02:28 +01:00
|
|
|
|
if (matrixActiveIndex != -1)
|
|
|
|
|
|
{
|
2014-08-08 09:50:57 +02:00
|
|
|
|
activeCellInfo->setCellResultIndex(cellStartIndex + gridLocalCellIndex, matrixActiveStartIndex + matrixActiveIndex);
|
2013-01-30 15:02:28 +01:00
|
|
|
|
}
|
2013-01-30 09:30:48 +01:00
|
|
|
|
|
2014-08-08 09:50:57 +02:00
|
|
|
|
int fractureActiveIndex = ecl_grid_get_active_fracture_index1(localEclGrid, gridLocalCellIndex);
|
2013-01-30 15:02:28 +01:00
|
|
|
|
if (fractureActiveIndex != -1)
|
2013-01-30 09:30:48 +01:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
fractureActiveCellInfo->setCellResultIndex(cellStartIndex + gridLocalCellIndex,
|
|
|
|
|
|
fractureActiveStartIndex + fractureActiveIndex);
|
2013-01-30 15:02:28 +01:00
|
|
|
|
}
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2013-02-01 15:33:21 +01:00
|
|
|
|
// Parent cell index
|
|
|
|
|
|
|
2014-08-08 09:50:57 +02:00
|
|
|
|
int parentCellIndex = ecl_grid_get_parent_cell1(localEclGrid, gridLocalCellIndex);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
if (parentCellIndex == -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
cell.setParentCellIndex(cvf::UNDEFINED_SIZE_T);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
cell.setParentCellIndex(parentCellIndex);
|
|
|
|
|
|
}
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
|
// Corner coordinates
|
|
|
|
|
|
int cIdx;
|
|
|
|
|
|
for (cIdx = 0; cIdx < 8; ++cIdx)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
double* point = mainGrid->nodes()[nodeStartIndex + gridLocalCellIndex * 8 + cellMappingECLRi[cIdx]].ptr();
|
2014-10-09 20:13:04 +02:00
|
|
|
|
ecl_grid_get_cell_corner_xyz1(localEclGrid, gridLocalCellIndex, cIdx, &(point[0]), &(point[1]), &(point[2]));
|
2019-06-19 13:41:42 +02:00
|
|
|
|
point[2] = -point[2]; // Flipping Z making depth become negative z values
|
|
|
|
|
|
cell.cornerIndices()[cIdx] = nodeStartIndex + gridLocalCellIndex * 8 + cIdx;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Sub grid in cell
|
2014-08-08 09:50:57 +02:00
|
|
|
|
const ecl_grid_type* subGrid = ecl_grid_get_cell_lgr1(localEclGrid, gridLocalCellIndex);
|
2018-02-18 18:56:43 +01:00
|
|
|
|
if (subGrid != nullptr)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2013-09-05 13:03:53 +02:00
|
|
|
|
int subGridId = ecl_grid_get_lgr_nr(subGrid);
|
|
|
|
|
|
CVF_ASSERT(subGridId > 0);
|
|
|
|
|
|
cell.setSubGrid(static_cast<RigLocalGrid*>(mainGrid->gridById(subGridId)));
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
2012-06-26 16:10:41 +02:00
|
|
|
|
|
2013-02-01 15:33:21 +01:00
|
|
|
|
// Mark inactive long pyramid looking cells as invalid
|
2013-02-11 15:12:53 +01:00
|
|
|
|
// Forslag
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// if (!invalid && (cell.isInCoarseCell() || (!cell.isActiveInMatrixModel() && !cell.isActiveInFractureModel()) ) )
|
2013-08-26 21:56:40 +02:00
|
|
|
|
cell.setInvalid(cell.isLongPyramidCell());
|
2013-01-30 15:02:28 +01:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
#pragma omp critical
|
|
|
|
|
|
{
|
|
|
|
|
|
computedCellCount++;
|
|
|
|
|
|
if (computedCellCount % cellsPrProgressTick == 0) progInfo.incrementProgress();
|
|
|
|
|
|
}
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
2012-06-26 16:10:41 +02:00
|
|
|
|
return true;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
//
|
|
|
|
|
|
// Class RigReaderInterfaceECL
|
|
|
|
|
|
//
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
/// Constructor
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2012-06-26 16:10:41 +02:00
|
|
|
|
RifReaderEclipseOutput::RifReaderEclipseOutput()
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2013-02-27 14:30:32 +01:00
|
|
|
|
m_fileName.clear();
|
2013-04-10 11:02:10 +02:00
|
|
|
|
m_filesWithSameBaseName.clear();
|
2013-02-27 14:30:32 +01:00
|
|
|
|
|
2018-02-18 18:56:43 +01:00
|
|
|
|
m_eclipseCase = nullptr;
|
2013-02-27 14:30:32 +01:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
m_ecl_init_file = nullptr;
|
2018-02-18 18:56:43 +01:00
|
|
|
|
m_dynamicResultsAccess = nullptr;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
/// Destructor
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2012-06-26 16:10:41 +02:00
|
|
|
|
RifReaderEclipseOutput::~RifReaderEclipseOutput()
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2013-02-27 14:13:37 +01:00
|
|
|
|
if (m_ecl_init_file)
|
2013-02-27 11:27:02 +01:00
|
|
|
|
{
|
2013-02-27 14:13:37 +01:00
|
|
|
|
ecl_file_close(m_ecl_init_file);
|
2013-02-27 11:27:02 +01:00
|
|
|
|
}
|
2018-02-18 18:56:43 +01:00
|
|
|
|
m_ecl_init_file = nullptr;
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2013-02-27 14:13:37 +01:00
|
|
|
|
if (m_dynamicResultsAccess.notNull())
|
|
|
|
|
|
{
|
|
|
|
|
|
m_dynamicResultsAccess->close();
|
|
|
|
|
|
}
|
2013-04-29 13:13:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
/// Read geometry from file given by name into given reservoir object
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-10 09:51:39 +01:00
|
|
|
|
bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid, RigEclipseCaseData* eclipseCase)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2013-02-13 13:24:39 +01:00
|
|
|
|
CVF_ASSERT(eclipseCase);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
|
|
if (!mainEclGrid)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Some error
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL);
|
2017-08-11 14:05:59 +02:00
|
|
|
|
RigActiveCellInfo* fractureActiveCellInfo = eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL);
|
2013-03-13 11:50:31 +01:00
|
|
|
|
|
|
|
|
|
|
CVF_ASSERT(activeCellInfo && fractureActiveCellInfo);
|
2013-02-12 11:15:36 +01:00
|
|
|
|
|
2013-02-13 13:24:39 +01:00
|
|
|
|
RigMainGrid* mainGrid = eclipseCase->mainGrid();
|
2013-12-20 14:29:08 +01:00
|
|
|
|
CVF_ASSERT(mainGrid);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
cvf::Vec3st gridPointDim(0, 0, 0);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
gridPointDim.x() = ecl_grid_get_nx(mainEclGrid) + 1;
|
|
|
|
|
|
gridPointDim.y() = ecl_grid_get_ny(mainEclGrid) + 1;
|
|
|
|
|
|
gridPointDim.z() = ecl_grid_get_nz(mainEclGrid) + 1;
|
|
|
|
|
|
mainGrid->setGridPointDimensions(gridPointDim);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-12-20 14:29:08 +01:00
|
|
|
|
// std::string mainGridName = ecl_grid_get_name(mainEclGrid);
|
|
|
|
|
|
// ERT returns file path to grid file as name for main grid
|
|
|
|
|
|
mainGrid->setGridName("Main grid");
|
|
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
mainGrid->setDualPorosity(ecl_grid_dual_grid(mainEclGrid));
|
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
|
// Get and set grid and lgr metadata
|
|
|
|
|
|
|
|
|
|
|
|
size_t totalCellCount = static_cast<size_t>(ecl_grid_get_global_size(mainEclGrid));
|
|
|
|
|
|
|
|
|
|
|
|
int numLGRs = ecl_grid_get_num_lgr(mainEclGrid);
|
|
|
|
|
|
int lgrIdx;
|
|
|
|
|
|
for (lgrIdx = 0; lgrIdx < numLGRs; ++lgrIdx)
|
|
|
|
|
|
{
|
|
|
|
|
|
ecl_grid_type* localEclGrid = ecl_grid_iget_lgr(mainEclGrid, lgrIdx);
|
|
|
|
|
|
|
|
|
|
|
|
std::string lgrName = ecl_grid_get_name(localEclGrid);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
int lgrId = ecl_grid_get_lgr_nr(localEclGrid);
|
2013-09-05 13:03:53 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
cvf::Vec3st gridPointDim(0, 0, 0);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
gridPointDim.x() = ecl_grid_get_nx(localEclGrid) + 1;
|
|
|
|
|
|
gridPointDim.y() = ecl_grid_get_ny(localEclGrid) + 1;
|
|
|
|
|
|
gridPointDim.z() = ecl_grid_get_nz(localEclGrid) + 1;
|
|
|
|
|
|
|
|
|
|
|
|
RigLocalGrid* localGrid = new RigLocalGrid(mainGrid);
|
2013-09-05 13:03:53 +02:00
|
|
|
|
localGrid->setGridId(lgrId);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
mainGrid->addLocalGrid(localGrid);
|
|
|
|
|
|
|
|
|
|
|
|
localGrid->setIndexToStartOfCells(totalCellCount);
|
|
|
|
|
|
localGrid->setGridName(lgrName);
|
|
|
|
|
|
localGrid->setGridPointDimensions(gridPointDim);
|
|
|
|
|
|
|
|
|
|
|
|
totalCellCount += ecl_grid_get_global_size(localEclGrid);
|
|
|
|
|
|
}
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2014-08-08 10:27:29 +02:00
|
|
|
|
activeCellInfo->setReservoirCellCount(totalCellCount);
|
|
|
|
|
|
fractureActiveCellInfo->setReservoirCellCount(totalCellCount);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
|
|
// Reserve room for the cells and nodes and fill them with data
|
|
|
|
|
|
|
2015-11-24 14:21:02 +01:00
|
|
|
|
mainGrid->globalCellArray().reserve(totalCellCount);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
mainGrid->nodes().reserve(8 * totalCellCount);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2012-09-11 09:22:36 +02:00
|
|
|
|
caf::ProgressInfo progInfo(3 + numLGRs, "");
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
{
|
|
|
|
|
|
auto task = progInfo.task("Loading Main Grid Data", 3);
|
|
|
|
|
|
transferGridCellData(mainGrid, activeCellInfo, fractureActiveCellInfo, mainGrid, mainEclGrid, 0, 0);
|
|
|
|
|
|
}
|
2012-06-26 16:10:41 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
size_t globalMatrixActiveSize = ecl_grid_get_nactive(mainEclGrid);
|
2013-01-30 09:30:48 +01:00
|
|
|
|
size_t globalFractureActiveSize = ecl_grid_get_nactive_fracture(mainEclGrid);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2013-02-12 11:15:36 +01:00
|
|
|
|
activeCellInfo->setGridCount(1 + numLGRs);
|
2013-03-13 11:50:31 +01:00
|
|
|
|
fractureActiveCellInfo->setGridCount(1 + numLGRs);
|
2013-02-12 11:15:36 +01:00
|
|
|
|
|
2013-03-13 11:50:31 +01:00
|
|
|
|
activeCellInfo->setGridActiveCellCounts(0, globalMatrixActiveSize);
|
|
|
|
|
|
fractureActiveCellInfo->setGridActiveCellCounts(0, globalFractureActiveSize);
|
|
|
|
|
|
|
2013-05-21 11:10:59 +02:00
|
|
|
|
transferCoarseningInfo(mainEclGrid, mainGrid);
|
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
|
for (lgrIdx = 0; lgrIdx < numLGRs; ++lgrIdx)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
auto task = progInfo.task("LGR number " + QString::number(lgrIdx + 1), 1);
|
2012-06-26 16:10:41 +02:00
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
|
ecl_grid_type* localEclGrid = ecl_grid_iget_lgr(mainEclGrid, lgrIdx);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RigLocalGrid* localGrid = static_cast<RigLocalGrid*>(mainGrid->gridByIndex(lgrIdx + 1));
|
2013-02-01 15:33:21 +01:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
transferGridCellData(mainGrid,
|
|
|
|
|
|
activeCellInfo,
|
|
|
|
|
|
fractureActiveCellInfo,
|
|
|
|
|
|
localGrid,
|
|
|
|
|
|
localEclGrid,
|
|
|
|
|
|
globalMatrixActiveSize,
|
|
|
|
|
|
globalFractureActiveSize);
|
2013-02-12 11:15:36 +01:00
|
|
|
|
|
|
|
|
|
|
int matrixActiveCellCount = ecl_grid_get_nactive(localEclGrid);
|
|
|
|
|
|
globalMatrixActiveSize += matrixActiveCellCount;
|
2013-02-01 15:33:21 +01:00
|
|
|
|
|
2013-02-12 11:15:36 +01:00
|
|
|
|
int fractureActiveCellCount = ecl_grid_get_nactive_fracture(localEclGrid);
|
|
|
|
|
|
globalFractureActiveSize += fractureActiveCellCount;
|
2013-02-01 15:33:21 +01:00
|
|
|
|
|
2013-03-13 11:50:31 +01:00
|
|
|
|
activeCellInfo->setGridActiveCellCounts(lgrIdx + 1, matrixActiveCellCount);
|
|
|
|
|
|
fractureActiveCellInfo->setGridActiveCellCounts(lgrIdx + 1, fractureActiveCellCount);
|
2013-05-21 11:10:59 +02:00
|
|
|
|
|
|
|
|
|
|
transferCoarseningInfo(localEclGrid, localGrid);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-04 11:42:10 +01:00
|
|
|
|
mainGrid->initAllSubGridsParentGridPointer();
|
2013-02-12 11:15:36 +01:00
|
|
|
|
activeCellInfo->computeDerivedData();
|
2013-03-13 11:50:31 +01:00
|
|
|
|
fractureActiveCellInfo->computeDerivedData();
|
2013-02-12 11:15:36 +01:00
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
|
return true;
|
2019-03-18 12:52:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
/// Open file and read geometry into given reservoir object
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-10 09:51:39 +01:00
|
|
|
|
bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* eclipseCase)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2013-02-13 13:24:39 +01:00
|
|
|
|
CVF_ASSERT(eclipseCase);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
caf::ProgressInfo progress(100, "Reading Grid");
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2018-06-11 09:58:34 +02:00
|
|
|
|
if (!RifEclipseOutputFileTools::isValidEclipseFileName(fileName))
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
QString errorMessage = QFileInfo(fileName).fileName() +
|
|
|
|
|
|
QString(" is not a valid Eclipse file name.\n"
|
|
|
|
|
|
"Please make sure the file does not contain a mix of upper and lower case letters.");
|
2018-06-11 09:58:34 +02:00
|
|
|
|
RiaLogging::error(errorMessage);
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
|
QStringList fileSet;
|
2018-11-13 09:28:13 +01:00
|
|
|
|
{
|
2019-03-12 11:02:06 +01:00
|
|
|
|
auto task = progress.task("Get set of files");
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
if (!RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(fileName, &fileSet)) return false;
|
2018-11-13 09:28:13 +01:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
m_fileName = fileName;
|
2018-11-13 09:28:13 +01:00
|
|
|
|
}
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
ecl_grid_type* mainEclGrid = nullptr;
|
|
|
|
|
|
{
|
|
|
|
|
|
auto task = progress.task("Open Init File and Load Main Grid", 19);
|
|
|
|
|
|
// Keep the set of files of interest
|
|
|
|
|
|
m_filesWithSameBaseName = fileSet;
|
2012-06-26 16:10:41 +02:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
openInitFile();
|
2013-02-06 13:44:27 +01:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
// Read geometry
|
|
|
|
|
|
// Todo: Needs to check existence of file before calling ert, else it will abort
|
2019-06-20 15:00:01 +02:00
|
|
|
|
mainEclGrid = loadAllGrids();
|
2019-03-12 11:02:06 +01:00
|
|
|
|
if (!mainEclGrid)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString errorMessage = QString(" Failed to create a main grid from file\n%1").arg(m_fileName);
|
|
|
|
|
|
RiaLogging::error(errorMessage);
|
2012-06-26 16:10:41 +02:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2013-12-03 20:30:32 +01:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
{
|
|
|
|
|
|
auto task = progress.task("Transferring grid geometry", 10);
|
|
|
|
|
|
if (!transferGeometry(mainEclGrid, eclipseCase)) return false;
|
|
|
|
|
|
}
|
2013-12-03 20:30:32 +01:00
|
|
|
|
|
|
|
|
|
|
{
|
2019-04-04 15:19:30 +02:00
|
|
|
|
auto task = progress.task("Reading faults", 10);
|
2013-12-17 11:37:58 +01:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
if (isFaultImportEnabled())
|
|
|
|
|
|
{
|
|
|
|
|
|
cvf::Collection<RigFault> faults;
|
2014-01-08 10:07:42 +01:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
importFaults(fileSet, &faults);
|
2013-12-03 20:30:32 +01:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
RigMainGrid* mainGrid = eclipseCase->mainGrid();
|
|
|
|
|
|
mainGrid->setFaults(faults);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2013-02-06 13:44:27 +01:00
|
|
|
|
|
2013-08-26 13:56:42 +02:00
|
|
|
|
m_eclipseCase = eclipseCase;
|
2012-06-26 16:10:41 +02:00
|
|
|
|
|
2014-07-30 09:13:47 +02:00
|
|
|
|
{
|
2019-03-12 11:02:06 +01:00
|
|
|
|
auto task = progress.task("Reading Results Meta data", 25);
|
|
|
|
|
|
buildMetaData(mainEclGrid);
|
|
|
|
|
|
}
|
2017-06-26 10:25:08 +02:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
{
|
|
|
|
|
|
auto task = progress.task("Handling NCC data", 20);
|
|
|
|
|
|
if (isNNCsEnabled())
|
2017-10-06 10:00:40 +02:00
|
|
|
|
{
|
2019-03-12 11:02:06 +01:00
|
|
|
|
caf::ProgressInfo nncProgress(10, "");
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
{
|
|
|
|
|
|
auto subNncTask = nncProgress.task("Reading static NNC data");
|
|
|
|
|
|
transferStaticNNCData(mainEclGrid, m_ecl_init_file, eclipseCase->mainGrid());
|
|
|
|
|
|
}
|
2013-12-03 20:30:32 +01:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
// This test should probably be improved to test more directly for presence of NNC data
|
|
|
|
|
|
if (m_eclipseCase->results(RiaDefines::MATRIX_MODEL)->hasFlowDiagUsableFluxes())
|
|
|
|
|
|
{
|
|
|
|
|
|
auto subNncTask = nncProgress.task("Reading dynamic NNC data");
|
|
|
|
|
|
transferDynamicNNCData(mainEclGrid, eclipseCase->mainGrid());
|
|
|
|
|
|
}
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2019-03-12 11:02:06 +01:00
|
|
|
|
{
|
|
|
|
|
|
auto subNncTask = nncProgress.task("Processing connections", 8);
|
|
|
|
|
|
eclipseCase->mainGrid()->nncData()->processConnections(*(eclipseCase->mainGrid()));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-11-06 09:35:39 +01:00
|
|
|
|
}
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2014-11-06 09:35:39 +01:00
|
|
|
|
{
|
2019-03-12 11:02:06 +01:00
|
|
|
|
auto task = progress.task("Handling well information", 10);
|
|
|
|
|
|
if (!RiaApplication::instance()->preferences()->readerSettings()->skipWellData())
|
|
|
|
|
|
{
|
|
|
|
|
|
readWellCells(mainEclGrid, isImportOfCompleteMswDataEnabled());
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
RiaLogging::info("Skipping import of simulation well data");
|
|
|
|
|
|
}
|
2014-07-30 09:13:47 +02:00
|
|
|
|
}
|
2013-12-11 14:55:14 +01:00
|
|
|
|
|
2017-08-30 08:03:31 +02:00
|
|
|
|
{
|
2019-03-12 11:02:06 +01:00
|
|
|
|
auto task = progress.task("Releasing reader memory", 5);
|
|
|
|
|
|
ecl_grid_free(mainEclGrid);
|
2017-08-30 08:03:31 +02:00
|
|
|
|
}
|
2013-02-05 10:51:32 +01:00
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-03-23 07:00:00 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2017-03-23 07:00:00 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName)
|
|
|
|
|
|
{
|
|
|
|
|
|
CVF_ASSERT(m_eclipseCase);
|
|
|
|
|
|
|
2017-08-14 10:47:44 +02:00
|
|
|
|
RigCaseCellResultsData* matrixModelResults = m_eclipseCase->results(RiaDefines::MATRIX_MODEL);
|
2017-03-23 07:00:00 +01:00
|
|
|
|
CVF_ASSERT(matrixModelResults);
|
|
|
|
|
|
|
2017-08-11 15:37:46 +02:00
|
|
|
|
if (fileName.isEmpty())
|
|
|
|
|
|
{
|
|
|
|
|
|
RiaLogging::info("HDF: Removing all existing Sour Sim data ...");
|
|
|
|
|
|
matrixModelResults->eraseAllSourSimData();
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-03-31 11:37:07 +02:00
|
|
|
|
RiaLogging::info(QString("HDF: Start import of data from : ").arg(fileName));
|
|
|
|
|
|
|
|
|
|
|
|
RiaLogging::info("HDF: Removing all existing Sour Sim data ...");
|
|
|
|
|
|
matrixModelResults->eraseAllSourSimData();
|
|
|
|
|
|
|
2017-08-25 06:51:56 +02:00
|
|
|
|
std::vector<RigEclipseTimeStepInfo> timeStepInfos = createFilteredTimeStepInfos();
|
2017-03-31 11:37:07 +02:00
|
|
|
|
|
2017-08-31 09:12:23 +02:00
|
|
|
|
std::unique_ptr<RifHdf5ReaderInterface> hdf5ReaderInterface;
|
2017-03-23 07:00:00 +01:00
|
|
|
|
#ifdef USE_HDF5
|
2017-08-31 09:12:23 +02:00
|
|
|
|
hdf5ReaderInterface = std::unique_ptr<RifHdf5ReaderInterface>(new RifHdf5Reader(fileName));
|
2017-03-23 07:00:00 +01:00
|
|
|
|
#endif // USE_HDF5
|
|
|
|
|
|
|
2017-08-31 09:12:23 +02:00
|
|
|
|
if (!hdf5ReaderInterface)
|
2017-03-31 11:37:07 +02:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2017-03-23 07:00:00 +01:00
|
|
|
|
|
2017-08-31 09:12:23 +02:00
|
|
|
|
std::vector<QDateTime> sourSimTimeSteps = hdf5ReaderInterface->timeSteps();
|
2017-10-23 20:12:21 +02:00
|
|
|
|
if (sourSimTimeSteps.size() == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
RiaLogging::error("HDF: No data available from SourSim");
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2017-08-25 06:51:56 +02:00
|
|
|
|
if (timeStepInfos.size() > 0)
|
|
|
|
|
|
{
|
2017-10-23 20:12:21 +02:00
|
|
|
|
if (allTimeSteps().size() != sourSimTimeSteps.size())
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RiaLogging::error(QString("HDF: Time step count mismatch, Eclipse : %1 ; HDF : %2 ")
|
|
|
|
|
|
.arg(allTimeSteps().size())
|
|
|
|
|
|
.arg(sourSimTimeSteps.size()));
|
2017-08-25 06:51:56 +02:00
|
|
|
|
|
2017-10-23 20:12:21 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool isTimeStampsEqual = true;
|
2017-08-25 06:51:56 +02:00
|
|
|
|
for (size_t i = 0; i < timeStepInfos.size(); i++)
|
2017-03-23 07:00:00 +01:00
|
|
|
|
{
|
2017-08-25 06:51:56 +02:00
|
|
|
|
size_t indexOnFile = timeStepIndexOnFile(i);
|
2017-10-23 20:12:21 +02:00
|
|
|
|
if (indexOnFile < sourSimTimeSteps.size())
|
2017-03-23 07:00:00 +01:00
|
|
|
|
{
|
2017-10-23 20:12:21 +02:00
|
|
|
|
if (!isEclipseAndSoursimTimeStepsEqual(timeStepInfos[i].m_date, sourSimTimeSteps[indexOnFile]))
|
|
|
|
|
|
{
|
|
|
|
|
|
isTimeStampsEqual = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RiaLogging::error(QString("HDF: Time step count mismatch, Eclipse : %1 ; HDF : %2 ")
|
|
|
|
|
|
.arg(timeStepInfos.size())
|
|
|
|
|
|
.arg(sourSimTimeSteps.size()));
|
2017-10-23 20:12:21 +02:00
|
|
|
|
|
|
|
|
|
|
// We have less soursim time steps than eclipse time steps
|
2017-04-24 13:03:52 +02:00
|
|
|
|
isTimeStampsEqual = false;
|
2017-03-23 07:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-04-24 13:03:52 +02:00
|
|
|
|
|
|
|
|
|
|
if (!isTimeStampsEqual) return;
|
2017-03-23 07:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// Use time steps from HDF to define the time steps
|
2017-08-31 09:12:23 +02:00
|
|
|
|
QDateTime firstDate = sourSimTimeSteps[0];
|
2017-08-14 10:47:44 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
std::vector<double> daysSinceSimulationStart;
|
2017-08-25 06:51:56 +02:00
|
|
|
|
|
2017-08-31 09:12:23 +02:00
|
|
|
|
for (auto d : sourSimTimeSteps)
|
2017-08-14 10:47:44 +02:00
|
|
|
|
{
|
|
|
|
|
|
daysSinceSimulationStart.push_back(firstDate.daysTo(d));
|
|
|
|
|
|
}
|
2017-03-23 07:00:00 +01:00
|
|
|
|
|
2017-08-14 10:47:44 +02:00
|
|
|
|
std::vector<int> reportNumbers;
|
|
|
|
|
|
if (m_dynamicResultsAccess.notNull())
|
|
|
|
|
|
{
|
|
|
|
|
|
reportNumbers = m_dynamicResultsAccess->reportNumbers();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2017-03-24 11:17:12 +01:00
|
|
|
|
{
|
2017-08-31 09:12:23 +02:00
|
|
|
|
for (size_t i = 0; i < sourSimTimeSteps.size(); i++)
|
2017-08-14 10:47:44 +02:00
|
|
|
|
{
|
|
|
|
|
|
reportNumbers.push_back(static_cast<int>(i));
|
|
|
|
|
|
}
|
2017-03-24 11:17:12 +01:00
|
|
|
|
}
|
2017-08-14 10:47:44 +02:00
|
|
|
|
|
2017-08-31 09:12:23 +02:00
|
|
|
|
timeStepInfos = RigEclipseTimeStepInfo::createTimeStepInfos(sourSimTimeSteps, reportNumbers, daysSinceSimulationStart);
|
2017-03-23 07:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-08-31 09:12:23 +02:00
|
|
|
|
QStringList resultNames = hdf5ReaderInterface->propertyNames();
|
2019-01-28 16:18:28 +01:00
|
|
|
|
|
2017-03-23 07:00:00 +01:00
|
|
|
|
for (int i = 0; i < resultNames.size(); ++i)
|
|
|
|
|
|
{
|
2019-01-28 16:18:28 +01:00
|
|
|
|
RigEclipseResultAddress resAddr(RiaDefines::SOURSIMRL, resultNames[i]);
|
|
|
|
|
|
matrixModelResults->createResultEntry(resAddr, false);
|
|
|
|
|
|
matrixModelResults->setTimeStepInfos(resAddr, timeStepInfos);
|
2017-03-23 07:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-08-31 09:12:23 +02:00
|
|
|
|
m_hdfReaderInterface = std::move(hdf5ReaderInterface);
|
2017-03-23 07:00:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-08-25 06:51:56 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2017-08-25 06:51:56 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
void RifReaderEclipseOutput::setFileDataAccess(RifEclipseRestartDataAccess* restartDataAccess)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_dynamicResultsAccess = restartDataAccess;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-03-19 13:52:48 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
///
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
const size_t* RifReaderEclipseOutput::eclipseCellIndexMapping()
|
|
|
|
|
|
{
|
|
|
|
|
|
return cellMappingECLRi;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-10-21 08:48:33 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2016-10-21 08:48:33 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
void RifReaderEclipseOutput::importFaults(const QStringList& fileSet, cvf::Collection<RigFault>* faults)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (this->filenamesWithFaults().size() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (size_t i = 0; i < this->filenamesWithFaults().size(); i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString faultFilename = this->filenamesWithFaults()[i];
|
|
|
|
|
|
|
2016-10-21 09:33:03 +02:00
|
|
|
|
RifEclipseInputFileTools::parseAndReadFaults(faultFilename, faults);
|
2016-10-21 08:48:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
foreach (QString fname, fileSet)
|
2016-10-21 08:48:33 +02:00
|
|
|
|
{
|
|
|
|
|
|
if (fname.endsWith(".DATA"))
|
|
|
|
|
|
{
|
|
|
|
|
|
std::vector<QString> filenamesWithFaults;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RifEclipseInputFileTools::readFaultsInGridSection(
|
|
|
|
|
|
fname, faults, &filenamesWithFaults, faultIncludeFileAbsolutePathPrefix());
|
2016-10-21 08:48:33 +02:00
|
|
|
|
|
|
|
|
|
|
std::sort(filenamesWithFaults.begin(), filenamesWithFaults.end());
|
|
|
|
|
|
std::vector<QString>::iterator last = std::unique(filenamesWithFaults.begin(), filenamesWithFaults.end());
|
|
|
|
|
|
filenamesWithFaults.erase(last, filenamesWithFaults.end());
|
|
|
|
|
|
|
|
|
|
|
|
this->setFilenamesWithFaults(filenamesWithFaults);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-10-21 09:33:03 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2019-03-12 18:23:45 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-04-04 15:19:30 +02:00
|
|
|
|
void RifReaderEclipseOutput::importEquilData(const QString& deckFileName,
|
|
|
|
|
|
const QString& includeStatementAbsolutePathPrefix,
|
|
|
|
|
|
RigEclipseCaseData* eclipseCase)
|
2019-03-12 18:23:45 +01:00
|
|
|
|
{
|
2019-04-04 15:19:30 +02:00
|
|
|
|
QFile data(deckFileName);
|
|
|
|
|
|
if (data.open(QFile::ReadOnly))
|
2019-03-12 18:23:45 +01:00
|
|
|
|
{
|
2019-04-04 15:19:30 +02:00
|
|
|
|
const QString keyword("EQUIL");
|
|
|
|
|
|
const QString keywordToStopParsing("SCHEDULE");
|
|
|
|
|
|
const qint64 startPositionInFile = 0;
|
|
|
|
|
|
std::vector<std::pair<QString, QString>> pathAliasDefinitions;
|
|
|
|
|
|
QStringList keywordContent;
|
|
|
|
|
|
std::vector<QString> fileNamesContainingKeyword;
|
|
|
|
|
|
bool isStopParsingKeywordDetected = false;
|
|
|
|
|
|
|
|
|
|
|
|
RifEclipseInputFileTools::readKeywordAndParseIncludeStatementsRecursively(keyword,
|
2019-06-19 13:41:42 +02:00
|
|
|
|
keywordToStopParsing,
|
|
|
|
|
|
data,
|
|
|
|
|
|
startPositionInFile,
|
|
|
|
|
|
pathAliasDefinitions,
|
|
|
|
|
|
&keywordContent,
|
|
|
|
|
|
&fileNamesContainingKeyword,
|
|
|
|
|
|
&isStopParsingKeywordDetected,
|
|
|
|
|
|
includeStatementAbsolutePathPrefix);
|
2019-04-04 15:19:30 +02:00
|
|
|
|
std::vector<RigEquil> equilItems;
|
|
|
|
|
|
for (const auto& s : keywordContent)
|
2019-03-12 18:23:45 +01:00
|
|
|
|
{
|
2019-04-04 15:19:30 +02:00
|
|
|
|
RigEquil equilRec = RigEquil::parseString(s);
|
2019-03-12 18:23:45 +01:00
|
|
|
|
|
2019-04-04 15:19:30 +02:00
|
|
|
|
equilItems.push_back(equilRec);
|
2019-03-12 18:23:45 +01:00
|
|
|
|
}
|
2019-04-04 15:19:30 +02:00
|
|
|
|
|
|
|
|
|
|
eclipseCase->setEquilData(equilItems);
|
2019-03-12 18:23:45 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2016-10-21 09:33:03 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
void RifReaderEclipseOutput::transferStaticNNCData(const ecl_grid_type* mainEclGrid,
|
|
|
|
|
|
ecl_file_type* init_file,
|
|
|
|
|
|
RigMainGrid* mainGrid)
|
2013-12-10 22:44:40 +01:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (!m_ecl_init_file) return;
|
2013-12-10 22:44:40 +01:00
|
|
|
|
|
|
|
|
|
|
CVF_ASSERT(mainEclGrid && mainGrid);
|
|
|
|
|
|
|
|
|
|
|
|
// Get the data from ERT
|
2017-06-22 16:03:55 +02:00
|
|
|
|
ecl_nnc_geometry_type* nnc_geo = ecl_nnc_geometry_alloc(mainEclGrid);
|
2017-11-14 10:35:18 +01:00
|
|
|
|
if (nnc_geo)
|
|
|
|
|
|
{
|
|
|
|
|
|
ecl_nnc_data_type* tran_data = ecl_nnc_data_alloc_tran(mainEclGrid, nnc_geo, ecl_file_get_global_view(init_file));
|
|
|
|
|
|
if (tran_data)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
int numNNC = ecl_nnc_data_get_size(tran_data);
|
2017-11-14 10:35:18 +01:00
|
|
|
|
int geometrySize = ecl_nnc_geometry_size(nnc_geo);
|
|
|
|
|
|
CVF_ASSERT(numNNC == geometrySize);
|
2017-06-22 16:03:55 +02:00
|
|
|
|
|
2017-11-14 10:35:18 +01:00
|
|
|
|
if (numNNC > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Transform to our own data structures
|
2013-12-10 22:44:40 +01:00
|
|
|
|
|
2017-11-14 10:35:18 +01:00
|
|
|
|
mainGrid->nncData()->connections().resize(numNNC);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
std::vector<double>& transmissibilityValues =
|
|
|
|
|
|
mainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameCombTrans());
|
2017-11-14 10:35:18 +01:00
|
|
|
|
const double* transValues = ecl_nnc_data_get_values(tran_data);
|
2013-12-10 22:44:40 +01:00
|
|
|
|
|
2017-11-14 10:35:18 +01:00
|
|
|
|
for (int nIdx = 0; nIdx < numNNC; ++nIdx)
|
|
|
|
|
|
{
|
|
|
|
|
|
const ecl_nnc_pair_type* geometry_pair = ecl_nnc_geometry_iget(nnc_geo, nIdx);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RigGridBase* grid1 = mainGrid->gridByIndex(geometry_pair->grid_nr1);
|
|
|
|
|
|
mainGrid->nncData()->connections()[nIdx].m_c1GlobIdx =
|
|
|
|
|
|
grid1->reservoirCellIndex(geometry_pair->global_index1);
|
|
|
|
|
|
RigGridBase* grid2 = mainGrid->gridByIndex(geometry_pair->grid_nr2);
|
|
|
|
|
|
mainGrid->nncData()->connections()[nIdx].m_c2GlobIdx =
|
|
|
|
|
|
grid2->reservoirCellIndex(geometry_pair->global_index2);
|
2017-06-22 16:03:55 +02:00
|
|
|
|
|
2017-11-14 10:35:18 +01:00
|
|
|
|
transmissibilityValues[nIdx] = transValues[nIdx];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2013-12-10 22:44:40 +01:00
|
|
|
|
|
2017-11-14 10:35:18 +01:00
|
|
|
|
ecl_nnc_data_free(tran_data);
|
2017-06-22 16:03:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-11-14 10:35:18 +01:00
|
|
|
|
ecl_nnc_geometry_free(nnc_geo);
|
|
|
|
|
|
}
|
2013-12-10 22:44:40 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-06-26 10:25:08 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2017-06-26 10:25:08 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
void RifReaderEclipseOutput::transferDynamicNNCData(const ecl_grid_type* mainEclGrid, RigMainGrid* mainGrid)
|
|
|
|
|
|
{
|
|
|
|
|
|
CVF_ASSERT(mainEclGrid && mainGrid);
|
|
|
|
|
|
|
2017-07-04 13:50:22 +02:00
|
|
|
|
if (m_dynamicResultsAccess.isNull()) return;
|
|
|
|
|
|
|
2017-06-26 10:25:08 +02:00
|
|
|
|
size_t timeStepCount = m_dynamicResultsAccess->timeStepCount();
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
std::vector<std::vector<double>>& waterFluxData =
|
|
|
|
|
|
mainGrid->nncData()->makeDynamicConnectionScalarResult(RigNNCData::propertyNameFluxWat(), timeStepCount);
|
|
|
|
|
|
std::vector<std::vector<double>>& oilFluxData =
|
|
|
|
|
|
mainGrid->nncData()->makeDynamicConnectionScalarResult(RigNNCData::propertyNameFluxOil(), timeStepCount);
|
|
|
|
|
|
std::vector<std::vector<double>>& gasFluxData =
|
|
|
|
|
|
mainGrid->nncData()->makeDynamicConnectionScalarResult(RigNNCData::propertyNameFluxGas(), timeStepCount);
|
2017-06-26 10:25:08 +02:00
|
|
|
|
|
|
|
|
|
|
for (size_t timeStep = 0; timeStep < timeStepCount; ++timeStep)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
m_dynamicResultsAccess->dynamicNNCResults(
|
|
|
|
|
|
mainEclGrid, timeStep, &waterFluxData[timeStep], &oilFluxData[timeStep], &gasFluxData[timeStep]);
|
2017-06-26 10:25:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-02-27 11:27:02 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2013-02-27 11:27:02 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
bool RifReaderEclipseOutput::openAndReadActiveCellData(const QString& fileName,
|
|
|
|
|
|
const std::vector<QDateTime>& mainCaseTimeSteps,
|
|
|
|
|
|
RigEclipseCaseData* eclipseCase)
|
2013-02-27 11:27:02 +01:00
|
|
|
|
{
|
|
|
|
|
|
CVF_ASSERT(eclipseCase);
|
2013-02-27 11:54:32 +01:00
|
|
|
|
|
|
|
|
|
|
// It is required to have a main grid before reading active cell data
|
|
|
|
|
|
if (!eclipseCase->mainGrid())
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-02-27 11:27:02 +01:00
|
|
|
|
// Get set of files
|
|
|
|
|
|
QStringList fileSet;
|
2013-04-10 11:02:10 +02:00
|
|
|
|
if (!RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(fileName, &fileSet)) return false;
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
|
|
|
|
|
// Keep the set of files of interest
|
2013-04-10 11:02:10 +02:00
|
|
|
|
m_filesWithSameBaseName = fileSet;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
m_eclipseCase = eclipseCase;
|
|
|
|
|
|
m_fileName = fileName;
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2013-02-27 14:13:37 +01:00
|
|
|
|
if (!readActiveCellInfo())
|
2013-02-27 11:54:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2017-08-25 06:51:56 +02:00
|
|
|
|
ensureDynamicResultAccessIsPresent();
|
2013-04-22 13:24:49 +02:00
|
|
|
|
if (m_dynamicResultsAccess.notNull())
|
|
|
|
|
|
{
|
|
|
|
|
|
m_dynamicResultsAccess->setTimeSteps(mainCaseTimeSteps);
|
|
|
|
|
|
}
|
2013-03-05 13:10:26 +01:00
|
|
|
|
|
2013-02-27 11:27:02 +01:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2013-03-07 13:13:34 +01:00
|
|
|
|
/// See also RigStatistics::computeActiveCellUnion()
|
2013-02-27 11:27:02 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-02-27 14:13:37 +01:00
|
|
|
|
bool RifReaderEclipseOutput::readActiveCellInfo()
|
2013-02-27 11:27:02 +01:00
|
|
|
|
{
|
2013-03-08 08:24:40 +01:00
|
|
|
|
CVF_ASSERT(m_eclipseCase);
|
2013-02-27 14:13:37 +01:00
|
|
|
|
CVF_ASSERT(m_eclipseCase->mainGrid());
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
std::vector<std::vector<int>> actnumValuesPerGrid;
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
{
|
|
|
|
|
|
// If INIT file is present and PORV is found, use PORV as basis for active cells
|
|
|
|
|
|
QString initFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_INIT_FILE);
|
|
|
|
|
|
if (initFileName.size() > 0)
|
2013-02-27 11:27:02 +01:00
|
|
|
|
{
|
2019-06-19 15:05:54 +02:00
|
|
|
|
ecl_file_type* ecl_file =
|
|
|
|
|
|
ecl_file_open(RiaStringEncodingTools::toNativeEncoded(initFileName).data(), ECL_FILE_CLOSE_STREAM);
|
|
|
|
|
|
if (ecl_file)
|
2013-02-27 11:27:02 +01:00
|
|
|
|
{
|
2019-06-19 15:05:54 +02:00
|
|
|
|
bool isDualPorosity = m_eclipseCase->mainGrid()->isDualPorosity();
|
|
|
|
|
|
actnumValuesPerGrid = RifActiveCellsReader::activeCellsFromPorvKeyword(ecl_file, isDualPorosity);
|
|
|
|
|
|
ecl_file_close(ecl_file);
|
2013-02-27 11:27:02 +01:00
|
|
|
|
}
|
2019-06-19 15:05:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
if (actnumValuesPerGrid.empty())
|
|
|
|
|
|
{
|
|
|
|
|
|
// Try ACTNUM from grid file as basis for active cells
|
|
|
|
|
|
QString egridFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_EGRID_FILE);
|
|
|
|
|
|
if (egridFileName.size() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
ecl_file_type* ecl_file =
|
|
|
|
|
|
ecl_file_open(RiaStringEncodingTools::toNativeEncoded(egridFileName).data(), ECL_FILE_CLOSE_STREAM);
|
|
|
|
|
|
if (ecl_file)
|
2013-02-27 11:54:32 +01:00
|
|
|
|
{
|
2019-06-19 15:05:54 +02:00
|
|
|
|
actnumValuesPerGrid = RifActiveCellsReader::activeCellsFromActnumKeyword(ecl_file);
|
|
|
|
|
|
ecl_file_close(ecl_file);
|
2013-02-27 11:54:32 +01:00
|
|
|
|
}
|
2019-06-19 15:05:54 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2013-02-27 11:54:32 +01:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
size_t reservoirCellCount = 0;
|
|
|
|
|
|
for (const auto& actnumValues : actnumValuesPerGrid)
|
|
|
|
|
|
{
|
|
|
|
|
|
reservoirCellCount += actnumValues.size();
|
|
|
|
|
|
}
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
// Check if number of cells is matching
|
|
|
|
|
|
if (m_eclipseCase->mainGrid()->globalCellArray().size() != reservoirCellCount)
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
RigActiveCellInfo* activeCellInfo = m_eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL);
|
|
|
|
|
|
RigActiveCellInfo* fractureActiveCellInfo = m_eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL);
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
activeCellInfo->setReservoirCellCount(reservoirCellCount);
|
|
|
|
|
|
fractureActiveCellInfo->setReservoirCellCount(reservoirCellCount);
|
|
|
|
|
|
activeCellInfo->setGridCount(actnumValuesPerGrid.size());
|
|
|
|
|
|
fractureActiveCellInfo->setGridCount(actnumValuesPerGrid.size());
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
size_t cellIdx = 0;
|
|
|
|
|
|
size_t globalActiveMatrixIndex = 0;
|
|
|
|
|
|
size_t globalActiveFractureIndex = 0;
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
for (size_t gridIndex = 0; gridIndex < actnumValuesPerGrid.size(); gridIndex++)
|
|
|
|
|
|
{
|
|
|
|
|
|
size_t activeMatrixIndex = 0;
|
|
|
|
|
|
size_t activeFractureIndex = 0;
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
std::vector<int>& actnumValues = actnumValuesPerGrid[gridIndex];
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
for (int actnumValue : actnumValues)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (actnumValue == 1 || actnumValue == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
activeCellInfo->setCellResultIndex(cellIdx, globalActiveMatrixIndex++);
|
|
|
|
|
|
activeMatrixIndex++;
|
2013-02-27 11:27:02 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
if (actnumValue == 2 || actnumValue == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
fractureActiveCellInfo->setCellResultIndex(cellIdx, globalActiveFractureIndex++);
|
|
|
|
|
|
activeFractureIndex++;
|
|
|
|
|
|
}
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
cellIdx++;
|
|
|
|
|
|
}
|
2013-02-27 11:27:02 +01:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
activeCellInfo->setGridActiveCellCounts(gridIndex, activeMatrixIndex);
|
|
|
|
|
|
fractureActiveCellInfo->setGridActiveCellCounts(gridIndex, activeFractureIndex);
|
2013-02-27 11:27:02 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
activeCellInfo->computeDerivedData();
|
|
|
|
|
|
fractureActiveCellInfo->computeDerivedData();
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
2013-02-27 11:27:02 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
/// Build meta data - get states and results info
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-08-15 14:47:32 +02:00
|
|
|
|
void RifReaderEclipseOutput::buildMetaData(ecl_grid_type* grid)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2013-03-08 08:24:40 +01:00
|
|
|
|
CVF_ASSERT(m_eclipseCase);
|
2013-04-10 11:02:10 +02:00
|
|
|
|
CVF_ASSERT(m_filesWithSameBaseName.size() > 0);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
caf::ProgressInfo progInfo(m_filesWithSameBaseName.size() + 3, "");
|
2013-02-06 13:44:27 +01:00
|
|
|
|
|
2013-04-10 11:02:10 +02:00
|
|
|
|
progInfo.setNextProgressIncrement(m_filesWithSameBaseName.size());
|
2012-06-26 16:10:41 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RigCaseCellResultsData* matrixModelResults = m_eclipseCase->results(RiaDefines::MATRIX_MODEL);
|
2017-08-11 14:05:59 +02:00
|
|
|
|
RigCaseCellResultsData* fractureModelResults = m_eclipseCase->results(RiaDefines::FRACTURE_MODEL);
|
2013-04-22 14:51:47 +02:00
|
|
|
|
|
2017-08-11 15:10:08 +02:00
|
|
|
|
std::vector<RigEclipseTimeStepInfo> timeStepInfos;
|
2013-04-22 14:51:47 +02:00
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
|
// Create access object for dynamic results
|
2017-08-25 06:51:56 +02:00
|
|
|
|
ensureDynamicResultAccessIsPresent();
|
2013-04-22 14:51:47 +02:00
|
|
|
|
if (m_dynamicResultsAccess.notNull())
|
2013-01-30 14:13:50 +01:00
|
|
|
|
{
|
2013-04-22 14:51:47 +02:00
|
|
|
|
m_dynamicResultsAccess->open();
|
2013-03-05 13:10:26 +01:00
|
|
|
|
|
2013-04-22 14:51:47 +02:00
|
|
|
|
progInfo.incrementProgress();
|
2013-02-06 13:44:27 +01:00
|
|
|
|
|
2017-08-11 12:33:10 +02:00
|
|
|
|
timeStepInfos = createFilteredTimeStepInfos();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
QStringList resultNames;
|
2013-02-05 10:51:32 +01:00
|
|
|
|
std::vector<size_t> resultNamesDataItemCounts;
|
|
|
|
|
|
m_dynamicResultsAccess->resultNames(&resultNames, &resultNamesDataItemCounts);
|
|
|
|
|
|
|
2013-02-01 14:39:32 +01:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
QStringList matrixResultNames =
|
|
|
|
|
|
validKeywordsForPorosityModel(resultNames,
|
|
|
|
|
|
resultNamesDataItemCounts,
|
|
|
|
|
|
m_eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL),
|
|
|
|
|
|
m_eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL),
|
|
|
|
|
|
RiaDefines::MATRIX_MODEL,
|
|
|
|
|
|
m_dynamicResultsAccess->timeStepCount());
|
2013-02-01 14:39:32 +01:00
|
|
|
|
|
2013-02-05 10:51:32 +01:00
|
|
|
|
for (int i = 0; i < matrixResultNames.size(); ++i)
|
2013-02-01 14:39:32 +01:00
|
|
|
|
{
|
2019-01-28 16:18:28 +01:00
|
|
|
|
RigEclipseResultAddress resAddr(RiaDefines::DYNAMIC_NATIVE, matrixResultNames[i]);
|
|
|
|
|
|
matrixModelResults->createResultEntry(resAddr, false);
|
|
|
|
|
|
matrixModelResults->setTimeStepInfos(resAddr, timeStepInfos);
|
2013-02-01 14:39:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2012-06-26 16:10:41 +02:00
|
|
|
|
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
QStringList fractureResultNames =
|
|
|
|
|
|
validKeywordsForPorosityModel(resultNames,
|
|
|
|
|
|
resultNamesDataItemCounts,
|
|
|
|
|
|
m_eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL),
|
|
|
|
|
|
m_eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL),
|
|
|
|
|
|
RiaDefines::FRACTURE_MODEL,
|
|
|
|
|
|
m_dynamicResultsAccess->timeStepCount());
|
2013-02-01 14:39:32 +01:00
|
|
|
|
|
2013-02-05 10:51:32 +01:00
|
|
|
|
for (int i = 0; i < fractureResultNames.size(); ++i)
|
2013-02-01 14:39:32 +01:00
|
|
|
|
{
|
2019-01-28 16:18:28 +01:00
|
|
|
|
RigEclipseResultAddress resAddr(RiaDefines::DYNAMIC_NATIVE, fractureResultNames[i]);
|
|
|
|
|
|
fractureModelResults->createResultEntry(resAddr, false);
|
|
|
|
|
|
fractureModelResults->setTimeStepInfos(resAddr, timeStepInfos);
|
2013-02-01 14:39:32 +01:00
|
|
|
|
}
|
2012-06-26 16:10:41 +02:00
|
|
|
|
}
|
2018-08-15 14:47:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
progInfo.incrementProgress();
|
|
|
|
|
|
|
|
|
|
|
|
openInitFile();
|
2014-08-27 14:05:29 +02:00
|
|
|
|
|
2018-08-15 14:47:32 +02:00
|
|
|
|
// Unit system
|
|
|
|
|
|
{
|
2014-08-27 14:05:29 +02:00
|
|
|
|
// Default units type is METRIC
|
2017-06-20 10:40:39 +02:00
|
|
|
|
RiaEclipseUnitTools::UnitSystem unitsType = RiaEclipseUnitTools::UNITS_METRIC;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
int unitsTypeValue;
|
2018-08-15 14:47:32 +02:00
|
|
|
|
|
|
|
|
|
|
if (m_dynamicResultsAccess.notNull())
|
|
|
|
|
|
{
|
|
|
|
|
|
unitsTypeValue = m_dynamicResultsAccess->readUnitsType();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2014-08-27 14:05:29 +02:00
|
|
|
|
{
|
2018-08-15 14:47:32 +02:00
|
|
|
|
if (m_ecl_init_file)
|
2014-08-27 14:05:29 +02:00
|
|
|
|
{
|
2018-08-15 14:47:32 +02:00
|
|
|
|
unitsTypeValue = RifEclipseOutputFileTools::readUnitsType(m_ecl_init_file);
|
2014-08-27 14:05:29 +02:00
|
|
|
|
}
|
2018-08-15 14:47:32 +02:00
|
|
|
|
else
|
2014-08-27 14:05:29 +02:00
|
|
|
|
{
|
2018-08-15 14:47:32 +02:00
|
|
|
|
unitsTypeValue = ecl_grid_get_unit_system(grid);
|
2014-08-27 14:05:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-08-15 14:47:32 +02:00
|
|
|
|
if (unitsTypeValue == 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
unitsType = RiaEclipseUnitTools::UNITS_FIELD;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (unitsTypeValue == 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
unitsType = RiaEclipseUnitTools::UNITS_LAB;
|
|
|
|
|
|
}
|
2014-08-27 14:05:29 +02:00
|
|
|
|
m_eclipseCase->setUnitsType(unitsType);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2013-02-06 13:44:27 +01:00
|
|
|
|
progInfo.incrementProgress();
|
2012-06-26 16:10:41 +02:00
|
|
|
|
|
2013-03-05 13:10:26 +01:00
|
|
|
|
if (m_ecl_init_file)
|
2013-02-27 14:13:37 +01:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
QStringList resultNames;
|
|
|
|
|
|
std::vector<size_t> resultNamesDataItemCounts;
|
|
|
|
|
|
std::vector<ecl_file_type*> filesUsedToFindAvailableKeywords;
|
2016-07-14 13:35:32 +02:00
|
|
|
|
filesUsedToFindAvailableKeywords.push_back(m_ecl_init_file);
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RifEclipseOutputFileTools::findKeywordsAndItemCount(
|
|
|
|
|
|
filesUsedToFindAvailableKeywords, &resultNames, &resultNamesDataItemCounts);
|
2012-08-31 19:12:47 +02:00
|
|
|
|
|
2017-08-11 15:10:08 +02:00
|
|
|
|
std::vector<RigEclipseTimeStepInfo> staticTimeStepInfo;
|
2017-08-11 09:21:32 +02:00
|
|
|
|
if (!timeStepInfos.empty())
|
2012-06-26 16:10:41 +02:00
|
|
|
|
{
|
2017-08-11 09:21:32 +02:00
|
|
|
|
staticTimeStepInfo.push_back(timeStepInfos.front());
|
2017-01-12 12:04:54 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
QStringList matrixResultNames =
|
|
|
|
|
|
validKeywordsForPorosityModel(resultNames,
|
|
|
|
|
|
resultNamesDataItemCounts,
|
|
|
|
|
|
m_eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL),
|
|
|
|
|
|
m_eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL),
|
|
|
|
|
|
RiaDefines::MATRIX_MODEL,
|
|
|
|
|
|
1);
|
|
|
|
|
|
|
2013-08-26 21:56:40 +02:00
|
|
|
|
// Add ACTNUM
|
|
|
|
|
|
matrixResultNames += "ACTNUM";
|
|
|
|
|
|
|
2013-03-05 13:10:26 +01:00
|
|
|
|
for (int i = 0; i < matrixResultNames.size(); ++i)
|
|
|
|
|
|
{
|
2019-01-28 16:18:28 +01:00
|
|
|
|
RigEclipseResultAddress resAddr(RiaDefines::STATIC_NATIVE, matrixResultNames[i]);
|
|
|
|
|
|
matrixModelResults->createResultEntry(resAddr, false);
|
|
|
|
|
|
matrixModelResults->setTimeStepInfos(resAddr, staticTimeStepInfo);
|
2013-03-05 13:10:26 +01:00
|
|
|
|
}
|
2012-06-26 16:10:41 +02:00
|
|
|
|
}
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2013-02-27 14:13:37 +01:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
QStringList fractureResultNames =
|
|
|
|
|
|
validKeywordsForPorosityModel(resultNames,
|
|
|
|
|
|
resultNamesDataItemCounts,
|
|
|
|
|
|
m_eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL),
|
|
|
|
|
|
m_eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL),
|
|
|
|
|
|
RiaDefines::FRACTURE_MODEL,
|
|
|
|
|
|
1);
|
2013-08-26 21:56:40 +02:00
|
|
|
|
// Add ACTNUM
|
|
|
|
|
|
fractureResultNames += "ACTNUM";
|
|
|
|
|
|
|
2013-03-05 13:10:26 +01:00
|
|
|
|
for (int i = 0; i < fractureResultNames.size(); ++i)
|
|
|
|
|
|
{
|
2019-01-28 16:18:28 +01:00
|
|
|
|
RigEclipseResultAddress resAddr(RiaDefines::STATIC_NATIVE, fractureResultNames[i]);
|
|
|
|
|
|
fractureModelResults->createResultEntry(resAddr, false);
|
|
|
|
|
|
fractureModelResults->setTimeStepInfos(resAddr, staticTimeStepInfo);
|
2013-03-05 13:10:26 +01:00
|
|
|
|
}
|
2013-02-27 14:13:37 +01:00
|
|
|
|
}
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
/// Create results access object (.UNRST or .X0001 ... .XNNNN)
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-08-25 06:51:56 +02:00
|
|
|
|
void RifReaderEclipseOutput::ensureDynamicResultAccessIsPresent()
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2017-08-25 06:51:56 +02:00
|
|
|
|
if (m_dynamicResultsAccess.isNull())
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2017-08-25 06:51:56 +02:00
|
|
|
|
m_dynamicResultsAccess = RifEclipseOutputFileTools::createDynamicResultAccess(m_fileName);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
/// Get all values of a given static result as doubles
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
bool RifReaderEclipseOutput::staticResult(const QString& result,
|
|
|
|
|
|
RiaDefines::PorosityModelType matrixOrFracture,
|
|
|
|
|
|
std::vector<double>* values)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
|
|
|
|
|
CVF_ASSERT(values);
|
2013-02-27 14:13:37 +01:00
|
|
|
|
|
2013-08-26 21:56:40 +02:00
|
|
|
|
if (result.compare("ACTNUM", Qt::CaseInsensitive) == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
RigActiveCellInfo* activeCellInfo = m_eclipseCase->activeCellInfo(matrixOrFracture);
|
2014-08-08 10:27:29 +02:00
|
|
|
|
values->resize(activeCellInfo->reservoirActiveCellCount(), 1.0);
|
2013-08-26 21:56:40 +02:00
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-04-22 14:51:47 +02:00
|
|
|
|
openInitFile();
|
2013-02-27 14:13:37 +01:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (m_ecl_init_file)
|
2013-04-22 14:51:47 +02:00
|
|
|
|
{
|
|
|
|
|
|
std::vector<double> fileValues;
|
2013-02-05 10:51:32 +01:00
|
|
|
|
|
2018-11-26 09:53:43 +01:00
|
|
|
|
size_t numOccurrences = ecl_file_get_num_named_kw(m_ecl_init_file, result.toLatin1().data());
|
2013-04-22 14:51:47 +02:00
|
|
|
|
size_t i;
|
|
|
|
|
|
for (i = 0; i < numOccurrences; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::vector<double> partValues;
|
|
|
|
|
|
RifEclipseOutputFileTools::keywordData(m_ecl_init_file, result, i, &partValues);
|
|
|
|
|
|
fileValues.insert(fileValues.end(), partValues.begin(), partValues.end());
|
|
|
|
|
|
}
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2013-04-22 14:51:47 +02:00
|
|
|
|
extractResultValuesBasedOnPorosityModel(matrixOrFracture, values, fileValues);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2012-05-18 09:45:23 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-07-07 13:31:14 +02:00
|
|
|
|
void RifReaderEclipseOutput::sourSimRlResult(const QString& result, size_t stepIndex, std::vector<double>* values)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2017-07-07 13:31:14 +02:00
|
|
|
|
values->clear();
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (!m_hdfReaderInterface) return;
|
2017-07-07 13:31:14 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (m_eclipseCase->mainGrid()->gridCount() == 0)
|
2017-03-23 07:00:00 +01:00
|
|
|
|
{
|
2017-07-07 13:31:14 +02:00
|
|
|
|
RiaLogging::error("No grids available");
|
2017-03-24 11:17:12 +01:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
return;
|
2017-07-07 13:31:14 +02:00
|
|
|
|
}
|
2017-03-24 11:17:12 +01:00
|
|
|
|
|
2017-07-07 13:31:14 +02:00
|
|
|
|
size_t activeCellCount = cvf::UNDEFINED_SIZE_T;
|
|
|
|
|
|
{
|
2017-08-14 10:47:44 +02:00
|
|
|
|
RigActiveCellInfo* fracActCellInfo = m_eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL);
|
2017-07-07 13:31:14 +02:00
|
|
|
|
fracActCellInfo->gridActiveCellCounts(0, activeCellCount);
|
|
|
|
|
|
}
|
2017-03-24 11:17:12 +01:00
|
|
|
|
|
2017-08-25 06:51:56 +02:00
|
|
|
|
size_t fileIndex = timeStepIndexOnFile(stepIndex);
|
|
|
|
|
|
|
2017-09-07 22:05:20 +02:00
|
|
|
|
m_hdfReaderInterface->dynamicResult(result, fileIndex, values);
|
2017-03-24 11:17:12 +01:00
|
|
|
|
|
2017-07-07 13:31:14 +02:00
|
|
|
|
if (activeCellCount != values->size())
|
|
|
|
|
|
{
|
|
|
|
|
|
values->clear();
|
2017-03-24 11:17:12 +01:00
|
|
|
|
|
2017-07-07 13:31:14 +02:00
|
|
|
|
RiaLogging::error("SourSimRL results does not match the number of active cells in the grid");
|
2017-03-23 07:00:00 +01:00
|
|
|
|
}
|
2017-07-07 13:31:14 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2017-08-28 15:17:03 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
std::vector<QDateTime> RifReaderEclipseOutput::allTimeSteps() const
|
|
|
|
|
|
{
|
|
|
|
|
|
std::vector<QDateTime> steps;
|
|
|
|
|
|
if (m_dynamicResultsAccess.notNull())
|
|
|
|
|
|
{
|
|
|
|
|
|
std::vector<double> dymmy;
|
|
|
|
|
|
m_dynamicResultsAccess->timeSteps(&steps, &dymmy);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return steps;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-07-07 13:31:14 +02:00
|
|
|
|
/// Get dynamic result at given step index. Will concatenate values for the main grid and all sub grids.
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
bool RifReaderEclipseOutput::dynamicResult(const QString& result,
|
|
|
|
|
|
RiaDefines::PorosityModelType matrixOrFracture,
|
|
|
|
|
|
size_t stepIndex,
|
|
|
|
|
|
std::vector<double>* values)
|
2017-07-07 13:31:14 +02:00
|
|
|
|
{
|
2017-08-25 06:51:56 +02:00
|
|
|
|
ensureDynamicResultAccessIsPresent();
|
2013-03-05 13:10:26 +01:00
|
|
|
|
|
2013-04-22 13:24:49 +02:00
|
|
|
|
if (m_dynamicResultsAccess.notNull())
|
2013-03-05 13:10:26 +01:00
|
|
|
|
{
|
2017-08-10 13:08:38 +02:00
|
|
|
|
size_t indexOnFile = timeStepIndexOnFile(stepIndex);
|
|
|
|
|
|
|
2013-04-22 13:24:49 +02:00
|
|
|
|
std::vector<double> fileValues;
|
2018-10-23 15:28:04 +02:00
|
|
|
|
if (!m_dynamicResultsAccess->results(result, indexOnFile, m_eclipseCase->mainGrid()->gridCountOnFile(), &fileValues))
|
2013-04-22 13:24:49 +02:00
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2013-02-05 10:51:32 +01:00
|
|
|
|
|
2013-04-22 13:24:49 +02:00
|
|
|
|
extractResultValuesBasedOnPorosityModel(matrixOrFracture, values, fileValues);
|
2013-02-05 10:51:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2013-08-28 15:36:29 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
/// Helper struct to store info on how a well-to-grid connection contributes to the position of
|
2013-08-28 15:36:29 +02:00
|
|
|
|
/// well segments without any connections.
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-08-26 14:56:34 +02:00
|
|
|
|
struct SegmentPositionContribution
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
SegmentPositionContribution(int connectionSegmentId,
|
|
|
|
|
|
cvf::Vec3d connectionPosition,
|
|
|
|
|
|
double lengthFromConnection,
|
|
|
|
|
|
bool isInsolating,
|
|
|
|
|
|
int segmentIdUnder,
|
|
|
|
|
|
int segmentIdAbove,
|
|
|
|
|
|
bool isFromAbove)
|
|
|
|
|
|
: m_connectionSegmentId(connectionSegmentId)
|
|
|
|
|
|
, m_lengthFromConnection(lengthFromConnection)
|
|
|
|
|
|
, m_isInsolating(isInsolating)
|
|
|
|
|
|
, m_connectionPosition(connectionPosition)
|
|
|
|
|
|
, m_segmentIdUnder(segmentIdUnder)
|
|
|
|
|
|
, m_segmentIdAbove(segmentIdAbove)
|
|
|
|
|
|
, m_isFromAbove(isFromAbove)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int m_connectionSegmentId;
|
|
|
|
|
|
double m_lengthFromConnection;
|
|
|
|
|
|
bool m_isInsolating;
|
|
|
|
|
|
cvf::Vec3d m_connectionPosition;
|
|
|
|
|
|
int m_segmentIdUnder;
|
|
|
|
|
|
int m_segmentIdAbove;
|
|
|
|
|
|
bool m_isFromAbove;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
size_t localGridCellIndexFromErtConnection(const RigGridBase* grid,
|
|
|
|
|
|
const well_conn_type* ert_connection,
|
|
|
|
|
|
const char* wellNameForErrorMsgs)
|
2013-08-26 14:03:01 +02:00
|
|
|
|
{
|
|
|
|
|
|
CVF_ASSERT(ert_connection);
|
|
|
|
|
|
CVF_ASSERT(grid);
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
int cellI = well_conn_get_i(ert_connection);
|
|
|
|
|
|
int cellJ = well_conn_get_j(ert_connection);
|
|
|
|
|
|
int cellK = well_conn_get_k(ert_connection);
|
2013-08-26 14:03:01 +02:00
|
|
|
|
|
|
|
|
|
|
// If a well is defined in fracture region, the K-value is from (cellCountK - 1) -> cellCountK*2 - 1
|
|
|
|
|
|
// Adjust K so index is always in valid grid region
|
|
|
|
|
|
if (cellK >= static_cast<int>(grid->cellCountK()))
|
|
|
|
|
|
{
|
|
|
|
|
|
cellK -= static_cast<int>(grid->cellCountK());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-09-08 15:21:40 +02:00
|
|
|
|
// See description for keyword ICON at page 54/55 of Rile Formats Reference Manual 2010.2
|
|
|
|
|
|
/*
|
2017-12-04 16:37:53 +01:00
|
|
|
|
Integer completion data array
|
|
|
|
|
|
ICON(NICONZ,NCWMAX,NWELLS) with dimensions
|
|
|
|
|
|
defined by INTEHEAD. The following items are required for each completion in each well:
|
|
|
|
|
|
Item 1 - Well connection index ICON(1,IC,IWELL) = IC (set to -IC if connection is not in current LGR)
|
|
|
|
|
|
Item 2 - I-coordinate (<= 0 if not in this LGR)
|
|
|
|
|
|
Item 3 - J-coordinate (<= 0 if not in this LGR)
|
|
|
|
|
|
Item 4 - K-coordinate (<= 0 if not in this LGR)
|
|
|
|
|
|
Item 6 - Connection status > 0 open, <= 0 shut
|
|
|
|
|
|
Item 14 - Penetration direction (1=x, 2=y, 3=z, 4=fractured in x-direction, 5=fractured in y-direction)
|
|
|
|
|
|
If undefined or zero, assume Z
|
|
|
|
|
|
Item 15 - Segment number containing connection (for multi-segment wells, =0 for ordinary wells)
|
|
|
|
|
|
Undefined items in this array may be set to zero.
|
2016-09-08 15:21:40 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// The K value might also be -1. It is not yet known why, or what it is supposed to mean,
|
2013-08-26 14:03:01 +02:00
|
|
|
|
// but for now we will interpret as 0.
|
|
|
|
|
|
// TODO: Ask Joakim Haave regarding this.
|
2016-09-08 15:21:40 +02:00
|
|
|
|
if (cellK < 0)
|
|
|
|
|
|
{
|
2019-06-19 15:05:54 +02:00
|
|
|
|
// cvf::Trace::show("Well Connection for grid " + cvf::String(grid->gridName()) + "\n - Detected negative K value
|
|
|
|
|
|
// (K=" + cvf::String(cellK) + ") for well : " + cvf::String(wellName) + " K clamped to 0");
|
2016-09-08 15:21:40 +02:00
|
|
|
|
|
|
|
|
|
|
cellK = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Introduced based on discussion with H<>kon H<>gst<73>l 08.09.2016
|
2016-09-28 15:07:19 +02:00
|
|
|
|
if (cellK >= static_cast<int>(grid->cellCountK()))
|
2016-09-08 15:21:40 +02:00
|
|
|
|
{
|
2017-03-06 11:17:47 +01:00
|
|
|
|
int maxCellK = static_cast<int>(grid->cellCountK());
|
2017-12-04 16:37:53 +01:00
|
|
|
|
if (wellNameForErrorMsgs)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
cvf::Trace::show("Well Connection for grid " + cvf::String(grid->gridName()) +
|
|
|
|
|
|
"\n - Ignored connection with invalid K value (K=" + cvf::String(cellK) +
|
|
|
|
|
|
", max K = " + cvf::String(maxCellK) + ") for well : " + cvf::String(wellNameForErrorMsgs));
|
2017-12-04 16:37:53 +01:00
|
|
|
|
}
|
|
|
|
|
|
return cvf::UNDEFINED_SIZE_T;
|
2016-09-08 15:21:40 +02:00
|
|
|
|
}
|
2017-12-04 16:37:53 +01:00
|
|
|
|
|
|
|
|
|
|
return grid->cellIndexFromIJK(cellI, cellJ, cellK);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2017-12-04 16:37:53 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RigWellResultPoint RifReaderEclipseOutput::createWellResultPoint(const RigGridBase* grid,
|
|
|
|
|
|
const well_conn_type* ert_connection,
|
|
|
|
|
|
int ertBranchId,
|
|
|
|
|
|
int ertSegmentId,
|
|
|
|
|
|
const char* wellName)
|
2017-12-04 16:37:53 +01:00
|
|
|
|
{
|
|
|
|
|
|
CVF_ASSERT(ert_connection);
|
|
|
|
|
|
CVF_ASSERT(grid);
|
|
|
|
|
|
|
|
|
|
|
|
size_t gridCellIndex = localGridCellIndexFromErtConnection(grid, ert_connection, wellName);
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
bool isCellOpen = well_conn_open(ert_connection);
|
|
|
|
|
|
double volumeRate = well_conn_get_volume_rate(ert_connection);
|
|
|
|
|
|
double oilRate = well_conn_get_oil_rate(ert_connection);
|
|
|
|
|
|
double gasRate = well_conn_get_gas_rate(ert_connection);
|
|
|
|
|
|
double waterRate = well_conn_get_water_rate(ert_connection);
|
2018-04-05 13:41:20 +02:00
|
|
|
|
double connectionFactor = well_conn_get_connection_factor(ert_connection);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2017-12-04 16:37:53 +01:00
|
|
|
|
RigWellResultPoint resultPoint;
|
|
|
|
|
|
|
|
|
|
|
|
if (gridCellIndex != cvf::UNDEFINED_SIZE_T)
|
2016-10-21 08:08:07 +02:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
resultPoint.m_gridIndex = grid->gridIndex();
|
2017-12-04 16:37:53 +01:00
|
|
|
|
resultPoint.m_gridCellIndex = gridCellIndex;
|
2013-08-26 14:03:01 +02:00
|
|
|
|
|
2016-10-21 08:08:07 +02:00
|
|
|
|
resultPoint.m_isOpen = isCellOpen;
|
2013-08-26 14:03:01 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
resultPoint.m_ertBranchId = ertBranchId;
|
2016-10-21 08:08:07 +02:00
|
|
|
|
resultPoint.m_ertSegmentId = ertSegmentId;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
resultPoint.m_flowRate = volumeRate;
|
|
|
|
|
|
resultPoint.m_oilRate = oilRate;
|
|
|
|
|
|
resultPoint.m_waterRate = waterRate;
|
|
|
|
|
|
|
|
|
|
|
|
resultPoint.m_gasRate =
|
|
|
|
|
|
RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents(m_eclipseCase->unitsType(), gasRate);
|
2018-04-05 13:41:20 +02:00
|
|
|
|
|
|
|
|
|
|
resultPoint.m_connectionFactor = connectionFactor;
|
2016-10-21 08:08:07 +02:00
|
|
|
|
}
|
2013-08-26 14:03:01 +02:00
|
|
|
|
|
|
|
|
|
|
return resultPoint;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-08-26 14:56:34 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
/// Inverse distance interpolation of the supplied points and distance weights for
|
2013-08-28 15:36:29 +02:00
|
|
|
|
/// the contributing points which are closest above, and closest below
|
2013-08-26 14:56:34 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-11-27 16:37:26 +01:00
|
|
|
|
cvf::Vec3d interpolate3DPosition(const std::vector<SegmentPositionContribution>& positions)
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
2013-08-26 15:16:20 +02:00
|
|
|
|
std::vector<SegmentPositionContribution> filteredPositions;
|
|
|
|
|
|
filteredPositions.reserve(positions.size());
|
2013-08-26 15:28:34 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
double minDistFromContribAbove = HUGE_VAL;
|
|
|
|
|
|
double minDistFromContribBelow = HUGE_VAL;
|
2013-08-26 15:28:34 +02:00
|
|
|
|
std::vector<SegmentPositionContribution> contrFromAbove;
|
|
|
|
|
|
std::vector<SegmentPositionContribution> contrFromBelow;
|
|
|
|
|
|
|
2013-08-26 15:16:20 +02:00
|
|
|
|
for (size_t i = 0; i < positions.size(); i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (positions[i].m_connectionPosition != cvf::Vec3d::UNDEFINED)
|
|
|
|
|
|
{
|
2013-08-26 15:28:34 +02:00
|
|
|
|
if (positions[i].m_isFromAbove && positions[i].m_lengthFromConnection < minDistFromContribAbove)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (contrFromAbove.size())
|
|
|
|
|
|
contrFromAbove[0] = positions[i];
|
|
|
|
|
|
else
|
|
|
|
|
|
contrFromAbove.push_back(positions[i]);
|
2013-08-26 15:28:34 +02:00
|
|
|
|
|
|
|
|
|
|
minDistFromContribAbove = positions[i].m_lengthFromConnection;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (!positions[i].m_isFromAbove && positions[i].m_lengthFromConnection < minDistFromContribBelow)
|
2013-08-26 15:28:34 +02:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (contrFromBelow.size())
|
|
|
|
|
|
contrFromBelow[0] = positions[i];
|
|
|
|
|
|
else
|
|
|
|
|
|
contrFromBelow.push_back(positions[i]);
|
2013-08-26 15:28:34 +02:00
|
|
|
|
|
|
|
|
|
|
minDistFromContribBelow = positions[i].m_lengthFromConnection;
|
|
|
|
|
|
}
|
2013-08-26 15:16:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-08-26 15:28:34 +02:00
|
|
|
|
filteredPositions = contrFromAbove;
|
|
|
|
|
|
filteredPositions.insert(filteredPositions.end(), contrFromBelow.begin(), contrFromBelow.end());
|
|
|
|
|
|
|
2013-08-26 15:16:20 +02:00
|
|
|
|
std::vector<double> nominators(filteredPositions.size(), 0.0);
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
double denominator = 0.0;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
cvf::Vec3d interpolatedValue = cvf::Vec3d::ZERO;
|
|
|
|
|
|
|
2013-08-26 15:16:20 +02:00
|
|
|
|
for (size_t i = 0; i < filteredPositions.size(); i++)
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
|
|
|
|
|
#if 0 // Pure average test
|
|
|
|
|
|
nominators[i] = 1.0;
|
|
|
|
|
|
#else
|
2017-03-06 11:17:47 +01:00
|
|
|
|
double distance = filteredPositions[i].m_lengthFromConnection;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
|
|
|
|
|
if (distance < 1e-6)
|
|
|
|
|
|
{
|
2013-08-26 15:16:20 +02:00
|
|
|
|
return filteredPositions[i].m_connectionPosition;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
}
|
2013-08-26 15:22:55 +02:00
|
|
|
|
else if (distance < 1.0)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// distance = 1.0;
|
2013-08-26 15:22:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
distance = 1.0 / distance;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
nominators[i] = distance;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
denominator += distance;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
}
|
|
|
|
|
|
#if 0 // Pure average test
|
|
|
|
|
|
denominator = positions.size(); // Pure average test
|
|
|
|
|
|
#endif
|
2013-08-26 15:16:20 +02:00
|
|
|
|
for (size_t i = 0; i < filteredPositions.size(); i++)
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
interpolatedValue += (nominators[i] / denominator) * filteredPositions[i].m_connectionPosition;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return interpolatedValue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-08-26 15:16:20 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2013-08-26 15:16:20 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
void propagatePosContribDownwards(std::map<int, std::vector<SegmentPositionContribution>>& segmentIdToPositionContrib,
|
|
|
|
|
|
const well_segment_collection_type* allErtSegments,
|
|
|
|
|
|
int ertSegmentId,
|
|
|
|
|
|
std::vector<SegmentPositionContribution> posContrib)
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
std::map<int, std::vector<SegmentPositionContribution>>::iterator posContribIt;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
posContribIt = segmentIdToPositionContrib.find(ertSegmentId);
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (posContribIt != segmentIdToPositionContrib.end())
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
|
|
|
|
|
// Create a set of the segments below this, that has to be followed.
|
|
|
|
|
|
|
|
|
|
|
|
std::set<int> segmentIdsBelow;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
for (size_t i = 0; i < posContribIt->second.size(); ++i)
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
|
|
|
|
|
segmentIdsBelow.insert(posContribIt->second[i].m_segmentIdUnder);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-08-26 15:10:34 +02:00
|
|
|
|
// Get the segment length to add to the contributions
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
well_segment_type* segment = well_segment_collection_get(allErtSegments, posContribIt->first);
|
|
|
|
|
|
double sementLength = well_segment_get_length(segment);
|
2013-08-26 15:10:34 +02:00
|
|
|
|
|
|
|
|
|
|
// If we do not have the contribution represented, add it, and accumulate the length
|
2013-08-26 14:56:34 +02:00
|
|
|
|
// If it is already present, do not touch
|
|
|
|
|
|
for (size_t i = 0; i < posContrib.size(); ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool foundContribution = false;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
for (size_t j = 0; j < posContribIt->second.size(); ++j)
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
|
|
|
|
|
if (posContribIt->second[j].m_connectionSegmentId == posContrib[i].m_connectionSegmentId)
|
|
|
|
|
|
{
|
|
|
|
|
|
foundContribution = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (!foundContribution)
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
|
|
|
|
|
posContrib[i].m_lengthFromConnection += sementLength;
|
2013-08-26 15:28:34 +02:00
|
|
|
|
posContrib[i].m_isFromAbove = true;
|
2013-08-26 15:10:34 +02:00
|
|
|
|
posContribIt->second.push_back(posContrib[i]);
|
2013-08-26 14:56:34 +02:00
|
|
|
|
}
|
2013-08-26 15:28:34 +02:00
|
|
|
|
posContrib[i].m_segmentIdAbove = ertSegmentId;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (std::set<int>::iterator it = segmentIdsBelow.begin(); it != segmentIdsBelow.end(); ++it)
|
|
|
|
|
|
{
|
|
|
|
|
|
propagatePosContribDownwards(segmentIdToPositionContrib, allErtSegments, (*it), posContrib);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2013-08-26 13:56:42 +02:00
|
|
|
|
|
2017-12-04 11:42:10 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
/// Helper class to determine whether a well connection is present in a sub cell
|
|
|
|
|
|
// for a specific well. Connections must be tested from innermost lgr to outermost since
|
|
|
|
|
|
// it accumulates the outer cells having subcell connections as it goes.
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
class WellResultPointHasSubCellConnectionCalculator
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
2019-06-19 13:41:42 +02:00
|
|
|
|
explicit WellResultPointHasSubCellConnectionCalculator(const RigMainGrid* mainGrid, well_state_type* ert_well_state)
|
|
|
|
|
|
: m_mainGrid(mainGrid)
|
2017-12-04 16:37:53 +01:00
|
|
|
|
{
|
2018-10-23 15:28:04 +02:00
|
|
|
|
int lastGridNr = static_cast<int>(m_mainGrid->gridCountOnFile()) - 1;
|
2017-12-04 16:37:53 +01:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
for (int gridNr = lastGridNr; gridNr >= 0; --gridNr)
|
2017-12-04 16:37:53 +01:00
|
|
|
|
{
|
|
|
|
|
|
const well_conn_type* ert_wellhead = well_state_iget_wellhead(ert_well_state, static_cast<int>(gridNr));
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (ert_wellhead)
|
2017-12-04 16:37:53 +01:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
size_t localGridCellidx =
|
|
|
|
|
|
localGridCellIndexFromErtConnection(m_mainGrid->gridByIndex(gridNr), ert_wellhead, nullptr);
|
2017-12-04 16:37:53 +01:00
|
|
|
|
this->insertTheParentCells(gridNr, localGridCellidx);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
std::string gridname = gridNr == 0 ? ECL_GRID_GLOBAL_GRID : m_mainGrid->gridByIndex(gridNr)->gridName();
|
2017-12-04 16:37:53 +01:00
|
|
|
|
const well_conn_collection_type* connections = well_state_get_grid_connections(ert_well_state, gridname.data());
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (connections)
|
2017-12-04 16:37:53 +01:00
|
|
|
|
{
|
|
|
|
|
|
int connectionCount = well_conn_collection_get_size(connections);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (connectionCount)
|
2017-12-04 16:37:53 +01:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
for (int connIdx = 0; connIdx < connectionCount; connIdx++)
|
2017-12-04 16:37:53 +01:00
|
|
|
|
{
|
|
|
|
|
|
well_conn_type* ert_connection = well_conn_collection_iget(connections, connIdx);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
|
|
|
|
|
size_t localGridCellidx =
|
|
|
|
|
|
localGridCellIndexFromErtConnection(m_mainGrid->gridByIndex(gridNr), ert_connection, nullptr);
|
2017-12-04 16:37:53 +01:00
|
|
|
|
this->insertTheParentCells(gridNr, localGridCellidx);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-12-04 11:42:10 +01:00
|
|
|
|
|
|
|
|
|
|
bool hasSubCellConnection(const RigWellResultPoint& wellResultPoint)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!wellResultPoint.isCell()) return false;
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
size_t gridIndex = wellResultPoint.m_gridIndex;
|
2017-12-04 11:42:10 +01:00
|
|
|
|
size_t gridCellIndex = wellResultPoint.m_gridCellIndex;
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
size_t reservoirCellIdx = m_mainGrid->reservoirCellIndexByGridAndGridLocalCellIndex(gridIndex, gridCellIndex);
|
2017-12-04 11:42:10 +01:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (m_gridCellsWithSubCellWellConnections.count(reservoirCellIdx))
|
2017-12-04 16:37:53 +01:00
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
2019-06-19 13:41:42 +02:00
|
|
|
|
void insertTheParentCells(size_t gridIndex, size_t gridCellIndex)
|
2017-12-04 16:37:53 +01:00
|
|
|
|
{
|
|
|
|
|
|
if (gridCellIndex == cvf::UNDEFINED_SIZE_T) return;
|
|
|
|
|
|
|
2017-12-04 11:42:10 +01:00
|
|
|
|
// Traverse parent gridcells, and add them to the map
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
while (gridIndex > 0) // is lgr
|
2017-12-04 11:42:10 +01:00
|
|
|
|
{
|
|
|
|
|
|
const RigCell& connectionCell = m_mainGrid->cellByGridAndGridLocalCellIdx(gridIndex, gridCellIndex);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RigGridBase* hostGrid = connectionCell.hostGrid();
|
2017-12-04 11:42:10 +01:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RigLocalGrid* lgrHost = static_cast<RigLocalGrid*>(hostGrid);
|
|
|
|
|
|
gridIndex = lgrHost->parentGrid()->gridIndex();
|
|
|
|
|
|
gridCellIndex = connectionCell.parentCellIndex();
|
2017-12-04 11:42:10 +01:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
size_t parentReservoirCellIdx = m_mainGrid->reservoirCellIndexByGridAndGridLocalCellIndex(gridIndex, gridCellIndex);
|
2017-12-04 11:42:10 +01:00
|
|
|
|
m_gridCellsWithSubCellWellConnections.insert(parentReservoirCellIdx);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
std::set<size_t> m_gridCellsWithSubCellWellConnections;
|
2017-12-04 11:42:10 +01:00
|
|
|
|
const RigMainGrid* m_mainGrid;
|
|
|
|
|
|
};
|
2012-05-18 09:45:23 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
///
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2014-10-24 11:19:54 +02:00
|
|
|
|
void RifReaderEclipseOutput::readWellCells(const ecl_grid_type* mainEclGrid, bool importCompleteMswData)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2013-03-08 08:24:40 +01:00
|
|
|
|
CVF_ASSERT(m_eclipseCase);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
|
|
if (m_dynamicResultsAccess.isNull()) return;
|
|
|
|
|
|
|
2013-08-26 13:56:42 +02:00
|
|
|
|
well_info_type* ert_well_info = well_info_alloc(mainEclGrid);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
if (!ert_well_info) return;
|
|
|
|
|
|
|
2014-10-24 11:19:54 +02:00
|
|
|
|
m_dynamicResultsAccess->readWellData(ert_well_info, importCompleteMswData);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
std::vector<double> daysSinceSimulationStart;
|
2017-04-26 09:39:17 +02:00
|
|
|
|
std::vector<QDateTime> timeSteps;
|
|
|
|
|
|
m_dynamicResultsAccess->timeSteps(&timeSteps, &daysSinceSimulationStart);
|
2014-10-29 09:34:57 +01:00
|
|
|
|
std::vector<int> reportNumbers = m_dynamicResultsAccess->reportNumbers();
|
2017-01-12 12:04:54 +01:00
|
|
|
|
|
2014-10-29 09:34:57 +01:00
|
|
|
|
bool sameCount = false;
|
|
|
|
|
|
if (timeSteps.size() == reportNumbers.size())
|
|
|
|
|
|
{
|
|
|
|
|
|
sameCount = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
|
std::vector<RigGridBase*> grids;
|
2013-02-27 14:13:37 +01:00
|
|
|
|
m_eclipseCase->allGrids(&grids);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2017-10-13 13:44:53 +02:00
|
|
|
|
cvf::Collection<RigSimWellData> wells;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
caf::ProgressInfo progress(well_info_get_num_wells(ert_well_info), "");
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
|
|
int wellIdx;
|
|
|
|
|
|
for (wellIdx = 0; wellIdx < well_info_get_num_wells(ert_well_info); wellIdx++)
|
|
|
|
|
|
{
|
|
|
|
|
|
const char* wellName = well_info_iget_well_name(ert_well_info, wellIdx);
|
|
|
|
|
|
CVF_ASSERT(wellName);
|
|
|
|
|
|
|
2017-10-13 13:44:53 +02:00
|
|
|
|
cvf::ref<RigSimWellData> simWellData = new RigSimWellData;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
simWellData->m_wellName = wellName;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
well_ts_type* ert_well_time_series = well_info_get_ts(ert_well_info, wellName);
|
|
|
|
|
|
int timeStepCount = well_ts_get_size(ert_well_time_series);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2017-10-13 13:44:53 +02:00
|
|
|
|
simWellData->m_wellCellsTimeSteps.resize(timeStepCount);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
|
|
int timeIdx;
|
|
|
|
|
|
for (timeIdx = 0; timeIdx < timeStepCount; timeIdx++)
|
|
|
|
|
|
{
|
|
|
|
|
|
well_state_type* ert_well_state = well_ts_iget_state(ert_well_time_series, timeIdx);
|
|
|
|
|
|
|
2017-10-13 13:44:53 +02:00
|
|
|
|
RigWellResultFrame& wellResFrame = simWellData->m_wellCellsTimeSteps[timeIdx];
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
|
|
// Build timestamp for well
|
2014-10-29 09:34:57 +01:00
|
|
|
|
bool haveFoundTimeStamp = false;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2014-10-29 09:34:57 +01:00
|
|
|
|
if (sameCount)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
2014-10-29 09:34:57 +01:00
|
|
|
|
int reportNr = well_state_get_report_nr(ert_well_state);
|
|
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < reportNumbers.size(); i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (reportNumbers[i] == reportNr)
|
|
|
|
|
|
{
|
|
|
|
|
|
wellResFrame.m_timestamp = timeSteps[i];
|
2019-06-19 13:41:42 +02:00
|
|
|
|
haveFoundTimeStamp = true;
|
2014-10-29 09:34:57 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!haveFoundTimeStamp)
|
|
|
|
|
|
{
|
|
|
|
|
|
// This fallback will not work for timesteps before 1970.
|
|
|
|
|
|
|
|
|
|
|
|
// Also see RifEclipseOutputFileAccess::timeStepsText for accessing time_t structures
|
2019-06-19 13:41:42 +02:00
|
|
|
|
time_t stepTime = well_state_get_sim_time(ert_well_state);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
wellResFrame.m_timestamp = QDateTime::fromTime_t(stepTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Production type
|
|
|
|
|
|
well_type_enum ert_well_type = well_state_get_type(ert_well_state);
|
2017-11-24 12:36:12 +01:00
|
|
|
|
if (ert_well_type == ECL_WELL_PRODUCER)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
|
|
|
|
|
wellResFrame.m_productionType = RigWellResultFrame::PRODUCER;
|
|
|
|
|
|
}
|
2017-11-24 12:36:12 +01:00
|
|
|
|
else if (ert_well_type == ECL_WELL_WATER_INJECTOR)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
|
|
|
|
|
wellResFrame.m_productionType = RigWellResultFrame::WATER_INJECTOR;
|
|
|
|
|
|
}
|
2017-11-24 12:36:12 +01:00
|
|
|
|
else if (ert_well_type == ECL_WELL_GAS_INJECTOR)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
|
|
|
|
|
wellResFrame.m_productionType = RigWellResultFrame::GAS_INJECTOR;
|
|
|
|
|
|
}
|
2017-11-24 12:36:12 +01:00
|
|
|
|
else if (ert_well_type == ECL_WELL_OIL_INJECTOR)
|
2012-05-18 09:45:23 +02:00
|
|
|
|
{
|
|
|
|
|
|
wellResFrame.m_productionType = RigWellResultFrame::OIL_INJECTOR;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
wellResFrame.m_productionType = RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
wellResFrame.m_isOpen = well_state_is_open(ert_well_state);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2014-10-24 11:19:54 +02:00
|
|
|
|
if (importCompleteMswData && well_state_is_MSW(ert_well_state))
|
2013-08-26 14:03:01 +02:00
|
|
|
|
{
|
2017-10-13 13:44:53 +02:00
|
|
|
|
simWellData->setMultiSegmentWell(true);
|
2013-08-26 13:56:42 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// how do we handle LGR-s ?
|
2013-08-26 14:56:34 +02:00
|
|
|
|
// 1. Create separate visual branches for each Grid, with its own wellhead
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// 2. Always use the connections to the grid with the highest number (innermost LGR).
|
2013-08-26 14:56:34 +02:00
|
|
|
|
// 3. Handle both and switch between them according to visual settings of grid visualization
|
|
|
|
|
|
// Will there ever exist connections to different grids for the same segment ?
|
2013-08-26 15:28:34 +02:00
|
|
|
|
// We have currently selected 2.
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
|
|
|
|
|
// Set the wellhead
|
|
|
|
|
|
|
|
|
|
|
|
int lastGridNr = static_cast<int>(grids.size()) - 1;
|
|
|
|
|
|
for (int gridNr = lastGridNr; gridNr >= 0; --gridNr)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// If several grids have a wellhead definition for this well, we use the last one.
|
2013-08-26 14:56:34 +02:00
|
|
|
|
// (Possibly the innermost LGR)
|
|
|
|
|
|
|
|
|
|
|
|
const well_conn_type* ert_wellhead = well_state_iget_wellhead(ert_well_state, static_cast<int>(gridNr));
|
|
|
|
|
|
if (ert_wellhead)
|
|
|
|
|
|
{
|
2016-09-08 15:21:40 +02:00
|
|
|
|
wellResFrame.m_wellHead = createWellResultPoint(grids[gridNr], ert_wellhead, -1, -1, wellName);
|
2016-01-07 14:24:59 +01:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// HACK: Ert returns open as "this is equally wrong as closed for well heads".
|
2016-01-07 14:24:59 +01:00
|
|
|
|
// Well heads are not open jfr mail communication with HHGS and JH Statoil 07.01.2016
|
2019-06-19 13:41:42 +02:00
|
|
|
|
wellResFrame.m_wellHead.m_isOpen = false;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
well_branch_collection_type* branches = well_state_get_branches(ert_well_state);
|
|
|
|
|
|
int branchCount = well_branch_collection_get_size(branches);
|
|
|
|
|
|
wellResFrame.m_wellResultBranches.resize(branchCount);
|
|
|
|
|
|
std::map<int, std::vector<SegmentPositionContribution>> segmentIdToPositionContrib;
|
|
|
|
|
|
std::vector<int> upperSegmentIdsOfUnpositionedSegementGroup;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2013-08-26 15:28:34 +02:00
|
|
|
|
// For each branch, go from bottom segment upwards and transfer their connections to WellResultpoints.
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// If they have no connections, create a resultpoint representing their bottom position, which will
|
2013-08-26 15:28:34 +02:00
|
|
|
|
// receive an actual position at a later stage.
|
|
|
|
|
|
// I addition, distribute contributions for calculating segment bottom positions from bottom and up.
|
|
|
|
|
|
|
2013-08-26 14:56:34 +02:00
|
|
|
|
for (int bIdx = 0; bIdx < well_branch_collection_get_size(branches); bIdx++)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RigWellResultBranch& wellResultBranch = wellResFrame.m_wellResultBranches[bIdx];
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
|
|
|
|
|
const well_segment_type* segment = well_branch_collection_iget_start_segment(branches, bIdx);
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
int branchId = well_segment_get_branch_id(segment);
|
2013-08-26 14:56:34 +02:00
|
|
|
|
wellResultBranch.m_ertBranchId = branchId;
|
|
|
|
|
|
|
|
|
|
|
|
// Data for segment position calculation
|
2019-06-19 13:41:42 +02:00
|
|
|
|
int lastConnectionSegmentId = -1;
|
|
|
|
|
|
cvf::Vec3d lastConnectionPos = cvf::Vec3d::UNDEFINED;
|
|
|
|
|
|
cvf::Vec3d lastConnectionCellCorner = cvf::Vec3d::UNDEFINED;
|
|
|
|
|
|
double lastConnectionCellSize = 0;
|
|
|
|
|
|
double accLengthFromLastConnection = 0;
|
|
|
|
|
|
int segmentIdBelow = -1;
|
|
|
|
|
|
bool segmentBelowHasConnections = false;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
|
|
|
|
|
while (segment && branchId == well_segment_get_branch_id(segment))
|
|
|
|
|
|
{
|
|
|
|
|
|
// Loop backwards, making us select the connection in the innermost lgr as the truth
|
|
|
|
|
|
bool segmentHasConnections = false;
|
|
|
|
|
|
|
|
|
|
|
|
for (int gridNr = lastGridNr; gridNr >= 0; --gridNr)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::string gridName = this->ertGridName(gridNr);
|
|
|
|
|
|
|
|
|
|
|
|
// If this segment has connections in any grid, transfer the innermost ones
|
|
|
|
|
|
|
|
|
|
|
|
if (well_segment_has_grid_connections(segment, gridName.data()))
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
const well_conn_collection_type* connections =
|
|
|
|
|
|
well_segment_get_connections(segment, gridName.data());
|
2013-08-26 14:56:34 +02:00
|
|
|
|
int connectionCount = well_conn_collection_get_size(connections);
|
|
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
// Loop backwards to put the deepest connections first in the array. (The segments are
|
|
|
|
|
|
// also traversed deep to shallow)
|
2019-06-19 13:41:42 +02:00
|
|
|
|
for (int connIdx = connectionCount - 1; connIdx >= 0; connIdx--)
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
|
|
|
|
|
well_conn_type* ert_connection = well_conn_collection_iget(connections, connIdx);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
wellResultBranch.m_branchResultPoints.push_back(createWellResultPoint(
|
|
|
|
|
|
grids[gridNr], ert_connection, branchId, well_segment_get_id(segment), wellName));
|
2013-08-26 14:56:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
segmentHasConnections = true;
|
|
|
|
|
|
|
|
|
|
|
|
// Prepare data for segment position calculation
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
well_conn_type* ert_connection = well_conn_collection_iget(connections, 0);
|
|
|
|
|
|
RigWellResultPoint point = createWellResultPoint(
|
|
|
|
|
|
grids[gridNr], ert_connection, branchId, well_segment_get_id(segment), wellName);
|
|
|
|
|
|
lastConnectionPos = grids[gridNr]->cell(point.m_gridCellIndex).center();
|
2013-08-26 15:28:34 +02:00
|
|
|
|
cvf::Vec3d cellVxes[8];
|
|
|
|
|
|
grids[gridNr]->cellCornerVertices(point.m_gridCellIndex, cellVxes);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
lastConnectionCellCorner = cellVxes[0];
|
|
|
|
|
|
lastConnectionCellSize = (lastConnectionPos - cellVxes[0]).length();
|
2013-08-28 10:22:30 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
lastConnectionSegmentId = well_segment_get_id(segment);
|
|
|
|
|
|
accLengthFromLastConnection = well_segment_get_length(segment) / (connectionCount + 1);
|
|
|
|
|
|
if (!segmentBelowHasConnections)
|
|
|
|
|
|
upperSegmentIdsOfUnpositionedSegementGroup.push_back(segmentIdBelow);
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
|
|
|
|
|
break; // Stop looping over grids
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2019-06-19 15:05:54 +02:00
|
|
|
|
// If the segment did not have connections at all, we need to create a resultpoint representing
|
|
|
|
|
|
// the bottom of the segment and store it as an unpositioned segment
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
|
|
|
|
|
if (!segmentHasConnections)
|
|
|
|
|
|
{
|
|
|
|
|
|
RigWellResultPoint data;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
data.m_ertBranchId = branchId;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
data.m_ertSegmentId = well_segment_get_id(segment);
|
|
|
|
|
|
|
|
|
|
|
|
wellResultBranch.m_branchResultPoints.push_back(data);
|
|
|
|
|
|
|
|
|
|
|
|
// Store data for segment position calculation
|
2013-08-26 15:28:34 +02:00
|
|
|
|
bool isAnInsolationContribution = accLengthFromLastConnection < lastConnectionCellSize;
|
2013-08-26 15:10:34 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
segmentIdToPositionContrib[well_segment_get_id(segment)].push_back(
|
|
|
|
|
|
SegmentPositionContribution(lastConnectionSegmentId,
|
|
|
|
|
|
lastConnectionPos,
|
|
|
|
|
|
accLengthFromLastConnection,
|
|
|
|
|
|
isAnInsolationContribution,
|
|
|
|
|
|
segmentIdBelow,
|
|
|
|
|
|
-1,
|
|
|
|
|
|
false));
|
2013-08-26 15:10:34 +02:00
|
|
|
|
accLengthFromLastConnection += well_segment_get_length(segment);
|
2013-08-26 14:56:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
segmentIdBelow = well_segment_get_id(segment);
|
2013-08-26 14:56:34 +02:00
|
|
|
|
segmentBelowHasConnections = segmentHasConnections;
|
|
|
|
|
|
|
|
|
|
|
|
if (well_segment_get_outlet_id(segment) == -1)
|
|
|
|
|
|
{
|
2018-02-18 18:56:43 +01:00
|
|
|
|
segment = nullptr;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
segment = well_segment_get_outlet(segment);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-08-26 15:28:34 +02:00
|
|
|
|
// Add resultpoint representing the outlet segment (bottom), if not the branch ends at the wellhead.
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
|
|
|
|
|
const well_segment_type* outletSegment = segment;
|
|
|
|
|
|
|
|
|
|
|
|
if (outletSegment)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool outletSegmentHasConnections = false;
|
|
|
|
|
|
|
|
|
|
|
|
for (int gridNr = lastGridNr; gridNr >= 0; --gridNr)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::string gridName = this->ertGridName(gridNr);
|
|
|
|
|
|
|
|
|
|
|
|
// If this segment has connections in any grid, use the deepest innermost one
|
|
|
|
|
|
|
|
|
|
|
|
if (well_segment_has_grid_connections(outletSegment, gridName.data()))
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
const well_conn_collection_type* connections =
|
|
|
|
|
|
well_segment_get_connections(outletSegment, gridName.data());
|
2013-08-26 14:56:34 +02:00
|
|
|
|
int connectionCount = well_conn_collection_get_size(connections);
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// Select the deepest connection
|
|
|
|
|
|
well_conn_type* ert_connection = well_conn_collection_iget(connections, connectionCount - 1);
|
|
|
|
|
|
wellResultBranch.m_branchResultPoints.push_back(createWellResultPoint(
|
|
|
|
|
|
grids[gridNr], ert_connection, branchId, well_segment_get_id(outletSegment), wellName));
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
|
|
|
|
|
outletSegmentHasConnections = true;
|
|
|
|
|
|
break; // Stop looping over grids
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!outletSegmentHasConnections)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Store the result point
|
|
|
|
|
|
|
|
|
|
|
|
RigWellResultPoint data;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
data.m_ertBranchId = well_segment_get_branch_id(outletSegment);
|
2013-08-26 14:56:34 +02:00
|
|
|
|
data.m_ertSegmentId = well_segment_get_id(outletSegment);
|
|
|
|
|
|
wellResultBranch.m_branchResultPoints.push_back(data);
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// Store data for segment position calculation,
|
2013-08-28 15:36:29 +02:00
|
|
|
|
// and propagate it upwards until we meet a segment with connections
|
2013-08-26 15:28:34 +02:00
|
|
|
|
|
2013-08-28 15:36:29 +02:00
|
|
|
|
bool isAnInsolationContribution = accLengthFromLastConnection < lastConnectionCellSize;
|
2013-08-26 15:28:34 +02:00
|
|
|
|
|
2013-08-28 15:36:29 +02:00
|
|
|
|
cvf::Vec3d lastConnectionPosWOffset = lastConnectionPos;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (isAnInsolationContribution)
|
|
|
|
|
|
lastConnectionPosWOffset += 0.4 * (lastConnectionCellCorner - lastConnectionPos);
|
|
|
|
|
|
|
|
|
|
|
|
segmentIdToPositionContrib[well_segment_get_id(outletSegment)].push_back(
|
|
|
|
|
|
SegmentPositionContribution(lastConnectionSegmentId,
|
|
|
|
|
|
lastConnectionPosWOffset,
|
|
|
|
|
|
accLengthFromLastConnection,
|
|
|
|
|
|
isAnInsolationContribution,
|
|
|
|
|
|
segmentIdBelow,
|
|
|
|
|
|
-1,
|
|
|
|
|
|
false));
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2013-08-28 15:36:29 +02:00
|
|
|
|
/// Loop further to add this position contribution until a segment with connections is found
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2013-08-28 15:36:29 +02:00
|
|
|
|
accLengthFromLastConnection += well_segment_get_length(outletSegment);
|
|
|
|
|
|
segmentIdBelow = well_segment_get_id(outletSegment);
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2018-02-18 18:56:43 +01:00
|
|
|
|
const well_segment_type* aboveOutletSegment = nullptr;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2013-08-28 15:36:29 +02:00
|
|
|
|
if (well_segment_get_outlet_id(outletSegment) == -1)
|
|
|
|
|
|
{
|
2018-02-18 18:56:43 +01:00
|
|
|
|
aboveOutletSegment = nullptr;
|
2013-08-28 15:36:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
aboveOutletSegment = well_segment_get_outlet(outletSegment);
|
|
|
|
|
|
}
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
while (aboveOutletSegment)
|
2013-08-28 15:36:29 +02:00
|
|
|
|
{
|
|
|
|
|
|
// Loop backwards, just because we do that the other places
|
|
|
|
|
|
bool segmentHasConnections = false;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2013-08-28 15:36:29 +02:00
|
|
|
|
for (int gridNr = lastGridNr; gridNr >= 0; --gridNr)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::string gridName = this->ertGridName(gridNr);
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2013-08-28 15:36:29 +02:00
|
|
|
|
// If this segment has connections in any grid, stop traversal
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2013-08-28 15:36:29 +02:00
|
|
|
|
if (well_segment_has_grid_connections(aboveOutletSegment, gridName.data()))
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
2013-08-28 15:36:29 +02:00
|
|
|
|
segmentHasConnections = true;
|
|
|
|
|
|
break;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
}
|
2013-08-28 15:36:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!segmentHasConnections)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
segmentIdToPositionContrib[well_segment_get_id(aboveOutletSegment)].push_back(
|
|
|
|
|
|
SegmentPositionContribution(lastConnectionSegmentId,
|
|
|
|
|
|
lastConnectionPos,
|
|
|
|
|
|
accLengthFromLastConnection,
|
|
|
|
|
|
isAnInsolationContribution,
|
|
|
|
|
|
segmentIdBelow,
|
|
|
|
|
|
-1,
|
|
|
|
|
|
false));
|
2013-08-28 15:36:29 +02:00
|
|
|
|
accLengthFromLastConnection += well_segment_get_length(aboveOutletSegment);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2019-06-19 15:05:54 +02:00
|
|
|
|
break; // We have found a segment with connections. We do not need to propagate
|
|
|
|
|
|
// position contributions further
|
2013-08-28 15:36:29 +02:00
|
|
|
|
}
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2013-08-28 15:36:29 +02:00
|
|
|
|
segmentIdBelow = well_segment_get_id(aboveOutletSegment);
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2013-08-28 15:36:29 +02:00
|
|
|
|
if (well_segment_get_outlet_id(aboveOutletSegment) == -1)
|
|
|
|
|
|
{
|
2018-02-18 18:56:43 +01:00
|
|
|
|
aboveOutletSegment = nullptr;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
}
|
2013-08-28 15:36:29 +02:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
aboveOutletSegment = well_segment_get_outlet(aboveOutletSegment);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2013-08-26 14:56:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// Add wellhead as result point Nope. Not Yet, but it is a good idea.
|
2013-08-26 15:10:34 +02:00
|
|
|
|
// The centerline calculations would be a bit simpler, I think.
|
2013-08-26 14:56:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Reverse the order of the resultpoints in this branch, making the deepest come last
|
|
|
|
|
|
|
|
|
|
|
|
std::reverse(wellResultBranch.m_branchResultPoints.begin(), wellResultBranch.m_branchResultPoints.end());
|
2013-08-28 15:36:29 +02:00
|
|
|
|
} // End of the branch loop
|
|
|
|
|
|
|
2013-08-26 14:56:34 +02:00
|
|
|
|
// Propagate position contributions from connections above unpositioned segments downwards
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
well_segment_collection_type* allErtSegments = well_state_get_segments(ert_well_state);
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
for (size_t bIdx = 0; bIdx < wellResFrame.m_wellResultBranches.size(); ++bIdx)
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RigWellResultBranch& wellResultBranch = wellResFrame.m_wellResultBranches[bIdx];
|
|
|
|
|
|
bool previousResultPointWasCell = false;
|
|
|
|
|
|
if (bIdx == 0) previousResultPointWasCell = true; // Wellhead
|
2013-08-26 15:10:34 +02:00
|
|
|
|
|
2013-08-26 15:28:34 +02:00
|
|
|
|
// Go downwards until we find a none-cell resultpoint just after a cell-resultpoint
|
|
|
|
|
|
// When we do, start propagating
|
|
|
|
|
|
|
2013-08-26 14:56:34 +02:00
|
|
|
|
for (size_t rpIdx = 0; rpIdx < wellResultBranch.m_branchResultPoints.size(); ++rpIdx)
|
|
|
|
|
|
{
|
2013-08-26 15:10:34 +02:00
|
|
|
|
RigWellResultPoint resPoint = wellResultBranch.m_branchResultPoints[rpIdx];
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (resPoint.isCell())
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
|
|
|
|
|
previousResultPointWasCell = true;
|
|
|
|
|
|
}
|
2013-08-26 15:10:34 +02:00
|
|
|
|
else
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
2013-08-26 15:10:34 +02:00
|
|
|
|
if (previousResultPointWasCell)
|
|
|
|
|
|
{
|
|
|
|
|
|
RigWellResultPoint prevResPoint;
|
|
|
|
|
|
if (bIdx == 0 && rpIdx == 0)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
prevResPoint = wellResFrame.m_wellHead;
|
2013-08-26 15:10:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
prevResPoint = wellResultBranch.m_branchResultPoints[rpIdx - 1];
|
2013-08-26 15:10:34 +02:00
|
|
|
|
}
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
cvf::Vec3d lastConnectionPos =
|
|
|
|
|
|
grids[prevResPoint.m_gridIndex]->cell(prevResPoint.m_gridCellIndex).center();
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
SegmentPositionContribution posContrib(prevResPoint.m_ertSegmentId,
|
|
|
|
|
|
lastConnectionPos,
|
|
|
|
|
|
0.0,
|
|
|
|
|
|
false,
|
|
|
|
|
|
-1,
|
|
|
|
|
|
prevResPoint.m_ertSegmentId,
|
|
|
|
|
|
true);
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2013-08-26 15:10:34 +02:00
|
|
|
|
int ertSegmentId = resPoint.m_ertSegmentId;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
std::map<int, std::vector<SegmentPositionContribution>>::iterator posContribIt;
|
2013-08-26 15:10:34 +02:00
|
|
|
|
posContribIt = segmentIdToPositionContrib.find(ertSegmentId);
|
|
|
|
|
|
CVF_ASSERT(posContribIt != segmentIdToPositionContrib.end());
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
std::vector<SegmentPositionContribution> posContributions = posContribIt->second;
|
2013-08-26 15:28:34 +02:00
|
|
|
|
for (size_t i = 0; i < posContributions.size(); ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
posContributions[i].m_segmentIdAbove = prevResPoint.m_ertSegmentId;
|
|
|
|
|
|
}
|
2013-08-26 15:10:34 +02:00
|
|
|
|
posContributions.push_back(posContrib);
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
propagatePosContribDownwards(
|
|
|
|
|
|
segmentIdToPositionContrib, allErtSegments, ertSegmentId, posContributions);
|
2013-08-26 15:10:34 +02:00
|
|
|
|
}
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2013-08-26 15:10:34 +02:00
|
|
|
|
previousResultPointWasCell = false;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Calculate the bottom position of all the unpositioned segments
|
2013-08-26 15:28:34 +02:00
|
|
|
|
// Then do the calculation based on the refined contributions
|
2013-08-26 14:56:34 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
std::map<int, std::vector<SegmentPositionContribution>>::iterator posContribIt =
|
|
|
|
|
|
segmentIdToPositionContrib.begin();
|
2013-08-26 14:56:34 +02:00
|
|
|
|
std::map<int, cvf::Vec3d> bottomPositions;
|
|
|
|
|
|
while (posContribIt != segmentIdToPositionContrib.end())
|
|
|
|
|
|
{
|
|
|
|
|
|
bottomPositions[posContribIt->first] = interpolate3DPosition(posContribIt->second);
|
2015-11-27 16:37:26 +01:00
|
|
|
|
++posContribIt;
|
2013-08-26 14:56:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Distribute the positions to the resultpoints stored in the wellResultBranch.m_branchResultPoints
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
for (size_t bIdx = 0; bIdx < wellResFrame.m_wellResultBranches.size(); ++bIdx)
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RigWellResultBranch& wellResultBranch = wellResFrame.m_wellResultBranches[bIdx];
|
2013-08-26 14:56:34 +02:00
|
|
|
|
for (size_t rpIdx = 0; rpIdx < wellResultBranch.m_branchResultPoints.size(); ++rpIdx)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RigWellResultPoint& resPoint = wellResultBranch.m_branchResultPoints[rpIdx];
|
|
|
|
|
|
if (!resPoint.isCell())
|
2013-08-26 14:56:34 +02:00
|
|
|
|
{
|
|
|
|
|
|
resPoint.m_bottomPosition = bottomPositions[resPoint.m_ertSegmentId];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-08-28 15:36:29 +02:00
|
|
|
|
} // End of the MSW section
|
2017-12-04 11:42:10 +01:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// Code handling None-MSW Wells ... Normal wells that is.
|
|
|
|
|
|
|
2017-12-04 16:37:53 +01:00
|
|
|
|
WellResultPointHasSubCellConnectionCalculator subCellConnCalc(m_eclipseCase->mainGrid(), ert_well_state);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
int lastGridNr = static_cast<int>(grids.size()) - 1;
|
|
|
|
|
|
for (int gridNr = 0; gridNr <= lastGridNr; ++gridNr)
|
2017-12-04 11:42:10 +01:00
|
|
|
|
{
|
|
|
|
|
|
const well_conn_type* ert_wellhead = well_state_iget_wellhead(ert_well_state, static_cast<int>(gridNr));
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (ert_wellhead)
|
2017-12-04 11:42:10 +01:00
|
|
|
|
{
|
|
|
|
|
|
RigWellResultPoint wellHeadRp = createWellResultPoint(grids[gridNr], ert_wellhead, -1, -1, wellName);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
// HACK: Ert returns open as "this is equally wrong as closed for well heads".
|
2017-12-04 11:42:10 +01:00
|
|
|
|
// Well heads are not open jfr mail communication with HHGS and JH Statoil 07.01.2016
|
|
|
|
|
|
wellHeadRp.m_isOpen = false;
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (!subCellConnCalc.hasSubCellConnection(wellHeadRp)) wellResFrame.m_wellHead = wellHeadRp;
|
2017-12-04 11:42:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
const well_conn_collection_type* connections =
|
|
|
|
|
|
well_state_get_grid_connections(ert_well_state, this->ertGridName(gridNr).data());
|
2017-12-04 11:42:10 +01:00
|
|
|
|
|
|
|
|
|
|
// Import all well result cells for all connections
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (connections)
|
2017-12-04 11:42:10 +01:00
|
|
|
|
{
|
|
|
|
|
|
int connectionCount = well_conn_collection_get_size(connections);
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (connectionCount)
|
2017-12-04 11:42:10 +01:00
|
|
|
|
{
|
|
|
|
|
|
wellResFrame.m_wellResultBranches.push_back(RigWellResultBranch());
|
|
|
|
|
|
RigWellResultBranch& wellResultBranch = wellResFrame.m_wellResultBranches.back();
|
|
|
|
|
|
|
|
|
|
|
|
wellResultBranch.m_ertBranchId = 0; // Normal wells have only one branch
|
|
|
|
|
|
|
|
|
|
|
|
size_t existingCellCount = wellResultBranch.m_branchResultPoints.size();
|
|
|
|
|
|
wellResultBranch.m_branchResultPoints.resize(existingCellCount + connectionCount);
|
|
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
for (int connIdx = 0; connIdx < connectionCount; connIdx++)
|
2017-12-04 11:42:10 +01:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
well_conn_type* ert_connection = well_conn_collection_iget(connections, connIdx);
|
|
|
|
|
|
RigWellResultPoint wellRp =
|
|
|
|
|
|
createWellResultPoint(grids[gridNr], ert_connection, -1, -1, wellName);
|
2017-12-04 11:42:10 +01:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (!subCellConnCalc.hasSubCellConnection(wellRp))
|
|
|
|
|
|
{
|
|
|
|
|
|
wellResultBranch.m_branchResultPoints[existingCellCount + connIdx] = wellRp;
|
2017-12-04 11:42:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-08-11 12:33:10 +02:00
|
|
|
|
std::vector<QDateTime> filteredTimeSteps;
|
|
|
|
|
|
{
|
2017-08-11 15:10:08 +02:00
|
|
|
|
std::vector<RigEclipseTimeStepInfo> filteredTimeStepInfos = createFilteredTimeStepInfos();
|
2017-08-11 12:33:10 +02:00
|
|
|
|
for (auto a : filteredTimeStepInfos)
|
|
|
|
|
|
{
|
|
|
|
|
|
filteredTimeSteps.push_back(a.m_date);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-10-13 13:44:53 +02:00
|
|
|
|
simWellData->computeMappingFromResultTimeIndicesToWellTimeIndices(filteredTimeSteps);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
2017-10-13 13:44:53 +02:00
|
|
|
|
wells.push_back(simWellData.p());
|
2013-02-06 13:44:27 +01:00
|
|
|
|
|
|
|
|
|
|
progress.incrementProgress();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
well_info_free(ert_well_info);
|
|
|
|
|
|
|
2017-10-13 13:44:53 +02:00
|
|
|
|
m_eclipseCase->setSimWellData(wells);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2013-02-05 10:51:32 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2013-02-05 10:51:32 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringList& keywords,
|
|
|
|
|
|
const std::vector<size_t>& keywordDataItemCounts,
|
|
|
|
|
|
const RigActiveCellInfo* matrixActiveCellInfo,
|
|
|
|
|
|
const RigActiveCellInfo* fractureActiveCellInfo,
|
|
|
|
|
|
RiaDefines::PorosityModelType porosityModel,
|
|
|
|
|
|
size_t timeStepCount) const
|
2013-02-05 10:51:32 +01:00
|
|
|
|
{
|
2016-08-12 14:24:41 +02:00
|
|
|
|
CVF_ASSERT(matrixActiveCellInfo);
|
2013-02-12 11:15:36 +01:00
|
|
|
|
|
2013-03-02 10:18:27 +01:00
|
|
|
|
if (keywords.size() != static_cast<int>(keywordDataItemCounts.size()))
|
2013-02-05 10:51:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
return QStringList();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-08-11 14:05:59 +02:00
|
|
|
|
if (porosityModel == RiaDefines::FRACTURE_MODEL)
|
2013-02-05 10:51:32 +01:00
|
|
|
|
{
|
2014-08-08 10:27:29 +02:00
|
|
|
|
if (fractureActiveCellInfo->reservoirActiveCellCount() == 0)
|
2013-02-05 10:51:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
return QStringList();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QStringList keywordsWithCorrectNumberOfDataItems;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2013-02-05 10:51:32 +01:00
|
|
|
|
for (int i = 0; i < keywords.size(); i++)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
QString keyword = keywords[i];
|
|
|
|
|
|
size_t keywordDataItemCount = keywordDataItemCounts[i];
|
2013-02-05 10:51:32 +01:00
|
|
|
|
|
2016-08-12 14:24:41 +02:00
|
|
|
|
bool validKeyword = false;
|
|
|
|
|
|
|
|
|
|
|
|
size_t timeStepsAllCellsRest = keywordDataItemCount % matrixActiveCellInfo->reservoirCellCount();
|
|
|
|
|
|
if (timeStepsAllCellsRest == 0 && keywordDataItemCount <= timeStepCount * matrixActiveCellInfo->reservoirCellCount())
|
|
|
|
|
|
{
|
|
|
|
|
|
// Found result for all cells for N time steps, usually a static dataset for one time step
|
|
|
|
|
|
validKeyword = true;
|
|
|
|
|
|
}
|
2019-06-19 13:41:42 +02:00
|
|
|
|
else
|
2013-02-27 11:27:02 +01:00
|
|
|
|
{
|
2016-08-12 14:24:41 +02:00
|
|
|
|
size_t timeStepsMatrixRest = keywordDataItemCount % matrixActiveCellInfo->reservoirActiveCellCount();
|
|
|
|
|
|
|
|
|
|
|
|
size_t timeStepsFractureRest = 0;
|
|
|
|
|
|
if (fractureActiveCellInfo->reservoirActiveCellCount() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
timeStepsFractureRest = keywordDataItemCount % fractureActiveCellInfo->reservoirActiveCellCount();
|
|
|
|
|
|
}
|
2013-10-18 14:26:49 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
size_t sumFractureMatrixActiveCellCount =
|
|
|
|
|
|
matrixActiveCellInfo->reservoirActiveCellCount() + fractureActiveCellInfo->reservoirActiveCellCount();
|
2016-08-12 14:24:41 +02:00
|
|
|
|
size_t timeStepsMatrixAndFractureRest = keywordDataItemCount % sumFractureMatrixActiveCellCount;
|
2013-02-05 10:51:32 +01:00
|
|
|
|
|
2017-08-11 14:05:59 +02:00
|
|
|
|
if (porosityModel == RiaDefines::MATRIX_MODEL && timeStepsMatrixRest == 0)
|
2013-02-05 10:51:32 +01:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (keywordDataItemCount <=
|
|
|
|
|
|
timeStepCount * std::max(matrixActiveCellInfo->reservoirActiveCellCount(), sumFractureMatrixActiveCellCount))
|
2013-10-18 14:26:49 +02:00
|
|
|
|
{
|
2016-08-12 14:24:41 +02:00
|
|
|
|
validKeyword = true;
|
2013-10-18 14:26:49 +02:00
|
|
|
|
}
|
2013-02-27 11:27:02 +01:00
|
|
|
|
}
|
2019-06-19 13:41:42 +02:00
|
|
|
|
else if (porosityModel == RiaDefines::FRACTURE_MODEL && fractureActiveCellInfo->reservoirActiveCellCount() > 0 &&
|
|
|
|
|
|
timeStepsFractureRest == 0)
|
2013-02-27 11:27:02 +01:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (keywordDataItemCount <= timeStepCount * std::max(fractureActiveCellInfo->reservoirActiveCellCount(),
|
|
|
|
|
|
sumFractureMatrixActiveCellCount))
|
2013-02-05 10:51:32 +01:00
|
|
|
|
{
|
2016-08-12 14:24:41 +02:00
|
|
|
|
validKeyword = true;
|
2013-02-05 10:51:32 +01:00
|
|
|
|
}
|
2016-07-14 13:35:32 +02:00
|
|
|
|
}
|
2016-08-12 14:24:41 +02:00
|
|
|
|
else if (timeStepsMatrixAndFractureRest == 0)
|
2016-07-14 13:35:32 +02:00
|
|
|
|
{
|
2016-08-12 14:24:41 +02:00
|
|
|
|
if (keywordDataItemCount <= timeStepCount * sumFractureMatrixActiveCellCount)
|
2013-10-18 14:26:49 +02:00
|
|
|
|
{
|
2016-08-12 14:24:41 +02:00
|
|
|
|
validKeyword = true;
|
2013-10-18 14:26:49 +02:00
|
|
|
|
}
|
2013-02-05 10:51:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2016-07-14 13:35:32 +02:00
|
|
|
|
|
2016-08-22 17:00:57 +02:00
|
|
|
|
// Check for INIT values that has only values for main grid active cells
|
|
|
|
|
|
if (!validKeyword)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (timeStepCount == 1)
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
size_t mainGridMatrixActiveCellCount;
|
|
|
|
|
|
matrixActiveCellInfo->gridActiveCellCounts(0, mainGridMatrixActiveCellCount);
|
|
|
|
|
|
size_t mainGridFractureActiveCellCount;
|
|
|
|
|
|
fractureActiveCellInfo->gridActiveCellCounts(0, mainGridFractureActiveCellCount);
|
|
|
|
|
|
|
|
|
|
|
|
if (keywordDataItemCount == mainGridMatrixActiveCellCount ||
|
|
|
|
|
|
keywordDataItemCount == mainGridFractureActiveCellCount ||
|
|
|
|
|
|
keywordDataItemCount == mainGridMatrixActiveCellCount + mainGridFractureActiveCellCount)
|
2016-08-22 17:00:57 +02:00
|
|
|
|
{
|
|
|
|
|
|
validKeyword = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-08-12 14:24:41 +02:00
|
|
|
|
if (validKeyword)
|
|
|
|
|
|
{
|
|
|
|
|
|
keywordsWithCorrectNumberOfDataItems.push_back(keyword);
|
2013-02-05 10:51:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return keywordsWithCorrectNumberOfDataItems;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2013-02-05 10:51:32 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-08-11 15:10:08 +02:00
|
|
|
|
std::vector<RigEclipseTimeStepInfo> RifReaderEclipseOutput::createFilteredTimeStepInfos()
|
2017-08-11 12:33:10 +02:00
|
|
|
|
{
|
2017-08-11 15:10:08 +02:00
|
|
|
|
std::vector<RigEclipseTimeStepInfo> timeStepInfos;
|
2017-08-11 12:33:10 +02:00
|
|
|
|
|
|
|
|
|
|
if (m_dynamicResultsAccess.notNull())
|
|
|
|
|
|
{
|
|
|
|
|
|
std::vector<QDateTime> timeStepsOnFile;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
std::vector<double> daysSinceSimulationStartOnFile;
|
|
|
|
|
|
std::vector<int> reportNumbersOnFile;
|
2017-08-11 12:33:10 +02:00
|
|
|
|
|
|
|
|
|
|
m_dynamicResultsAccess->timeSteps(&timeStepsOnFile, &daysSinceSimulationStartOnFile);
|
|
|
|
|
|
reportNumbersOnFile = m_dynamicResultsAccess->reportNumbers();
|
|
|
|
|
|
|
2018-01-29 08:44:30 +01:00
|
|
|
|
if (timeStepsOnFile.size() != daysSinceSimulationStartOnFile.size()) return timeStepInfos;
|
|
|
|
|
|
if (timeStepsOnFile.size() != reportNumbersOnFile.size()) return timeStepInfos;
|
|
|
|
|
|
|
2017-08-11 12:33:10 +02:00
|
|
|
|
for (size_t i = 0; i < timeStepsOnFile.size(); i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (this->isTimeStepIncludedByFilter(i))
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
timeStepInfos.push_back(
|
|
|
|
|
|
RigEclipseTimeStepInfo(timeStepsOnFile[i], reportNumbersOnFile[i], daysSinceSimulationStartOnFile[i]));
|
2017-08-11 12:33:10 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return timeStepInfos;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-08-25 06:51:56 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2017-08-25 06:51:56 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-08-30 07:11:09 +02:00
|
|
|
|
bool RifReaderEclipseOutput::isEclipseAndSoursimTimeStepsEqual(const QDateTime& eclipseDateTime, const QDateTime& sourSimDateTime)
|
2017-08-25 06:51:56 +02:00
|
|
|
|
{
|
2017-08-30 07:11:09 +02:00
|
|
|
|
// Compare date down to and including seconds
|
|
|
|
|
|
// Compare of complete date time objects will often result in differences
|
2017-08-25 06:51:56 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
const int secondsThreshold = 4;
|
2017-08-31 09:12:23 +02:00
|
|
|
|
const QString dateStr("yyyy.MMM.dd hh:mm:ss:zzz");
|
|
|
|
|
|
|
|
|
|
|
|
int secondsDiff = eclipseDateTime.secsTo(sourSimDateTime);
|
|
|
|
|
|
if (secondsDiff > secondsThreshold)
|
|
|
|
|
|
{
|
|
|
|
|
|
RiaLogging::error("HDF: Time steps does not match");
|
|
|
|
|
|
|
|
|
|
|
|
RiaLogging::error(QString(" %1 - Eclipse").arg(eclipseDateTime.toString(dateStr)));
|
|
|
|
|
|
RiaLogging::error(QString(" %1 - SourSim").arg(sourSimDateTime.toString(dateStr)));
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (eclipseDateTime.time().second() != sourSimDateTime.time().second())
|
|
|
|
|
|
{
|
|
|
|
|
|
RiaLogging::warning("HDF: Time steps differ, but within time step compare threshold");
|
|
|
|
|
|
RiaLogging::warning(QString(" %1 - Eclipse").arg(eclipseDateTime.toString(dateStr)));
|
|
|
|
|
|
RiaLogging::warning(QString(" %1 - SourSim").arg(sourSimDateTime.toString(dateStr)));
|
|
|
|
|
|
}
|
2017-08-30 07:11:09 +02:00
|
|
|
|
|
|
|
|
|
|
return true;
|
2017-08-25 06:51:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-11-13 09:28:13 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2018-11-13 09:28:13 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-20 15:00:01 +02:00
|
|
|
|
ecl_grid_type* RifReaderEclipseOutput::loadAllGrids() const
|
2018-11-13 09:28:13 +01:00
|
|
|
|
{
|
2019-06-20 15:00:01 +02:00
|
|
|
|
ecl_grid_type* mainEclGrid = ecl_grid_alloc(RiaStringEncodingTools::toNativeEncoded(m_fileName).data());
|
2018-11-13 09:28:13 +01:00
|
|
|
|
|
2019-06-20 15:00:01 +02:00
|
|
|
|
if (m_ecl_init_file)
|
2018-11-13 09:28:13 +01:00
|
|
|
|
{
|
2019-06-20 15:00:01 +02:00
|
|
|
|
// TODO : ecl_grid_alloc() will automatically read ACTNUM from EGRID file, and reading of active cell information can be
|
|
|
|
|
|
// skipped if PORV is available
|
2018-11-13 09:28:13 +01:00
|
|
|
|
|
2019-06-20 15:00:01 +02:00
|
|
|
|
bool isDualPorosity = ecl_grid_dual_grid(mainEclGrid);
|
|
|
|
|
|
auto activeCells = RifActiveCellsReader::activeCellsFromPorvKeyword(m_ecl_init_file, isDualPorosity);
|
2018-11-13 09:28:13 +01:00
|
|
|
|
|
2019-06-20 15:00:01 +02:00
|
|
|
|
if (!activeCells.empty())
|
2018-11-13 09:28:13 +01:00
|
|
|
|
{
|
2019-06-20 15:00:01 +02:00
|
|
|
|
RifActiveCellsReader::applyActiveCellsToAllGrids(mainEclGrid, activeCells);
|
2018-11-13 09:28:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return mainEclGrid;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-02-05 10:51:32 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2013-02-05 10:51:32 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel(RiaDefines::PorosityModelType matrixOrFracture,
|
|
|
|
|
|
std::vector<double>* destinationResultValues,
|
|
|
|
|
|
const std::vector<double>& sourceResultValues)
|
2013-02-05 10:51:32 +01:00
|
|
|
|
{
|
2016-08-12 14:24:41 +02:00
|
|
|
|
if (sourceResultValues.size() == 0) return;
|
2013-02-05 10:51:32 +01:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RigActiveCellInfo* fracActCellInfo = m_eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL);
|
2013-02-05 10:51:32 +01:00
|
|
|
|
|
2017-08-11 14:05:59 +02:00
|
|
|
|
if (matrixOrFracture == RiaDefines::MATRIX_MODEL && fracActCellInfo->reservoirActiveCellCount() == 0)
|
2013-03-13 11:50:31 +01:00
|
|
|
|
{
|
|
|
|
|
|
destinationResultValues->insert(destinationResultValues->end(), sourceResultValues.begin(), sourceResultValues.end());
|
2013-02-05 10:51:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
RigActiveCellInfo* actCellInfo = m_eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL);
|
2013-03-13 11:50:31 +01:00
|
|
|
|
|
2013-02-05 10:51:32 +01:00
|
|
|
|
size_t sourceStartPosition = 0;
|
|
|
|
|
|
|
2013-02-27 14:13:37 +01:00
|
|
|
|
for (size_t i = 0; i < m_eclipseCase->mainGrid()->gridCount(); i++)
|
2013-02-05 10:51:32 +01:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
if (m_eclipseCase->mainGrid()->gridByIndex(i)->isTempGrid()) continue;
|
2018-10-19 10:40:54 +02:00
|
|
|
|
|
2019-06-19 13:41:42 +02:00
|
|
|
|
size_t matrixActiveCellCount = 0;
|
2013-02-12 11:15:36 +01:00
|
|
|
|
size_t fractureActiveCellCount = 0;
|
2019-06-19 13:41:42 +02:00
|
|
|
|
|
2013-03-13 11:50:31 +01:00
|
|
|
|
actCellInfo->gridActiveCellCounts(i, matrixActiveCellCount);
|
|
|
|
|
|
fracActCellInfo->gridActiveCellCounts(i, fractureActiveCellCount);
|
2013-02-05 10:51:32 +01:00
|
|
|
|
|
2017-08-11 14:05:59 +02:00
|
|
|
|
if (matrixOrFracture == RiaDefines::MATRIX_MODEL)
|
2013-03-13 11:50:31 +01:00
|
|
|
|
{
|
2019-06-19 13:41:42 +02:00
|
|
|
|
destinationResultValues->insert(destinationResultValues->end(),
|
|
|
|
|
|
sourceResultValues.begin() + sourceStartPosition,
|
2013-03-13 11:50:31 +01:00
|
|
|
|
sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2019-04-24 12:39:47 +02:00
|
|
|
|
if ((matrixActiveCellCount + fractureActiveCellCount) > sourceResultValues.size())
|
|
|
|
|
|
{
|
|
|
|
|
|
// Special handling of the situation where we only have data for one fracture mode
|
|
|
|
|
|
matrixActiveCellCount = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
destinationResultValues->insert(destinationResultValues->end(),
|
|
|
|
|
|
sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount,
|
|
|
|
|
|
sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount +
|
|
|
|
|
|
fractureActiveCellCount);
|
2013-03-13 11:50:31 +01:00
|
|
|
|
}
|
2013-02-05 10:51:32 +01:00
|
|
|
|
|
|
|
|
|
|
sourceStartPosition += (matrixActiveCellCount + fractureActiveCellCount);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-02-27 14:13:37 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2013-02-27 14:13:37 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-04-22 14:51:47 +02:00
|
|
|
|
void RifReaderEclipseOutput::openInitFile()
|
2013-02-27 14:13:37 +01:00
|
|
|
|
{
|
|
|
|
|
|
if (m_ecl_init_file)
|
|
|
|
|
|
{
|
2013-04-22 14:51:47 +02:00
|
|
|
|
return;
|
2013-02-27 14:13:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2013-04-10 11:02:10 +02:00
|
|
|
|
QString initFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_INIT_FILE);
|
2013-02-27 14:13:37 +01:00
|
|
|
|
if (initFileName.size() > 0)
|
|
|
|
|
|
{
|
2018-02-02 15:44:28 +01:00
|
|
|
|
m_ecl_init_file = ecl_file_open(RiaStringEncodingTools::toNativeEncoded(initFileName).data(), ECL_FILE_CLOSE_STREAM);
|
2013-02-27 14:13:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-05-21 11:10:59 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2013-05-21 11:10:59 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
void RifReaderEclipseOutput::transferCoarseningInfo(const ecl_grid_type* eclGrid, RigGridBase* grid)
|
|
|
|
|
|
{
|
|
|
|
|
|
int coarseGroupCount = ecl_grid_get_num_coarse_groups(eclGrid);
|
|
|
|
|
|
for (int i = 0; i < coarseGroupCount; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
ecl_coarse_cell_type* coarse_cell = ecl_grid_iget_coarse_group(eclGrid, i);
|
|
|
|
|
|
CVF_ASSERT(coarse_cell);
|
|
|
|
|
|
|
|
|
|
|
|
size_t i1 = static_cast<size_t>(ecl_coarse_cell_get_i1(coarse_cell));
|
|
|
|
|
|
size_t i2 = static_cast<size_t>(ecl_coarse_cell_get_i2(coarse_cell));
|
|
|
|
|
|
size_t j1 = static_cast<size_t>(ecl_coarse_cell_get_j1(coarse_cell));
|
|
|
|
|
|
size_t j2 = static_cast<size_t>(ecl_coarse_cell_get_j2(coarse_cell));
|
|
|
|
|
|
size_t k1 = static_cast<size_t>(ecl_coarse_cell_get_k1(coarse_cell));
|
|
|
|
|
|
size_t k2 = static_cast<size_t>(ecl_coarse_cell_get_k2(coarse_cell));
|
|
|
|
|
|
|
2013-05-21 21:03:05 +02:00
|
|
|
|
grid->addCoarseningBox(i1, i2, j1, j2, k1, k2);
|
2013-05-21 11:10:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-11-10 09:43:51 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2017-11-10 09:43:51 +01:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
std::set<RiaDefines::PhaseType> RifReaderEclipseOutput::availablePhases() const
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_dynamicResultsAccess.notNull())
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_dynamicResultsAccess->availablePhases();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return std::set<RiaDefines::PhaseType>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2013-08-26 14:56:34 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-06-19 13:41:42 +02:00
|
|
|
|
///
|
2013-08-26 14:56:34 +02:00
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
std::string RifReaderEclipseOutput::ertGridName(size_t gridNr)
|
|
|
|
|
|
{
|
|
|
|
|
|
std::string gridName;
|
|
|
|
|
|
if (gridNr == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
gridName = ECL_GRID_GLOBAL_GRID;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
CVF_ASSERT(m_eclipseCase);
|
|
|
|
|
|
CVF_ASSERT(m_eclipseCase->gridCount() > gridNr);
|
|
|
|
|
|
gridName = m_eclipseCase->grid(gridNr)->gridName();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return gridName;
|
|
|
|
|
|
}
|