2012-05-18 02:45:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "cvfBase.h"
|
|
|
|
|
|
|
|
#include "RigMainGrid.h"
|
2013-03-22 10:58:44 -05:00
|
|
|
#include "RigCaseData.h"
|
|
|
|
#include "RigCaseCellResultsData.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2012-06-26 09:10:41 -05:00
|
|
|
#include "RifReaderEclipseOutput.h"
|
|
|
|
#include "RifEclipseOutputFileTools.h"
|
|
|
|
#include "RifEclipseUnifiedRestartFileAccess.h"
|
|
|
|
#include "RifEclipseRestartFilesetAccess.h"
|
2013-02-01 07:39:32 -06:00
|
|
|
#include "RifReaderInterface.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "ecl_grid.h"
|
|
|
|
#include "well_state.h"
|
2013-02-27 04:27:02 -06:00
|
|
|
#include "ecl_kw_magic.h"
|
|
|
|
|
2012-06-26 09:10:41 -05:00
|
|
|
#include "cafProgressInfo.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// ECLIPSE cell numbering layout:
|
|
|
|
/// Lower layer: Upper layer
|
|
|
|
///
|
|
|
|
/// 2---3 6---7
|
|
|
|
/// | | | |
|
|
|
|
/// 0---1 4---5
|
|
|
|
///
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// The indexing conventions for vertices in ECLIPSE
|
|
|
|
//
|
|
|
|
// 6-------------7
|
|
|
|
// /| /|
|
|
|
|
// / | / |
|
|
|
|
// / | / |
|
|
|
|
// 4-------------5 |
|
|
|
|
// | | | |
|
|
|
|
// | 2---------|---3
|
|
|
|
// | / | /
|
|
|
|
// | / | /
|
|
|
|
// |/ |/
|
|
|
|
// 0-------------1
|
|
|
|
// vertex indices
|
|
|
|
//
|
|
|
|
// The indexing conventions for vertices in ResInsight
|
|
|
|
//
|
2013-01-30 08:02:28 -06:00
|
|
|
// 7-------------6 |k
|
|
|
|
// /| /| | /j
|
|
|
|
// / | / | |/
|
|
|
|
// / | / | *---i
|
2012-05-18 02:45:23 -05:00
|
|
|
// 4-------------5 |
|
|
|
|
// | | | |
|
|
|
|
// | 3---------|---2
|
|
|
|
// | / | /
|
|
|
|
// | / | /
|
|
|
|
// |/ |/
|
|
|
|
// 0-------------1
|
|
|
|
// vertex indices
|
|
|
|
//
|
|
|
|
|
|
|
|
static const size_t cellMappingECLRi[8] = { 0, 1, 3, 2, 4, 5, 7, 6 };
|
|
|
|
|
|
|
|
|
|
|
|
//**************************************************************************************************
|
|
|
|
// Static functions
|
|
|
|
//**************************************************************************************************
|
|
|
|
|
2013-03-13 05:50:31 -05: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 02:45:23 -05:00
|
|
|
{
|
2013-03-13 05:50:31 -05:00
|
|
|
CVF_ASSERT(activeCellInfo && fractureActiveCellInfo);
|
2013-02-12 04:15:36 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
int cellCount = ecl_grid_get_global_size(localEclGrid);
|
|
|
|
size_t cellStartIndex = mainGrid->cells().size();
|
|
|
|
size_t nodeStartIndex = mainGrid->nodes().size();
|
|
|
|
|
|
|
|
RigCell defaultCell;
|
|
|
|
defaultCell.setHostGrid(localGrid);
|
|
|
|
mainGrid->cells().resize(cellStartIndex + cellCount, defaultCell);
|
|
|
|
|
|
|
|
mainGrid->nodes().resize(nodeStartIndex + cellCount*8, cvf::Vec3d(0,0,0));
|
|
|
|
|
2012-09-11 02:22:36 -05:00
|
|
|
int progTicks = 100;
|
|
|
|
double cellsPrProgressTick = cellCount/(float)progTicks;
|
|
|
|
caf::ProgressInfo progInfo(progTicks, "");
|
2012-06-26 09:10:41 -05:00
|
|
|
size_t computedCellCount = 0;
|
2012-05-18 02:45:23 -05:00
|
|
|
// Loop over cells and fill them with data
|
|
|
|
|
2012-09-11 02:22:36 -05:00
|
|
|
#pragma omp parallel for
|
2013-02-12 04:15:36 -06:00
|
|
|
for (int localCellIdx = 0; localCellIdx < cellCount; ++localCellIdx)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-02-12 04:15:36 -06:00
|
|
|
RigCell& cell = mainGrid->cells()[cellStartIndex + localCellIdx];
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-08-26 06:56:42 -05:00
|
|
|
bool invalid = ecl_grid_cell_invalid1(localEclGrid, localCellIdx);
|
|
|
|
cell.setInvalid(invalid);
|
2013-02-12 04:15:36 -06:00
|
|
|
cell.setCellIndex(localCellIdx);
|
2013-01-30 08:02:28 -06:00
|
|
|
|
2013-02-01 08:33:21 -06:00
|
|
|
// Active cell index
|
|
|
|
|
2013-02-12 04:15:36 -06:00
|
|
|
int matrixActiveIndex = ecl_grid_get_active_index1(localEclGrid, localCellIdx);
|
2013-01-30 08:02:28 -06:00
|
|
|
if (matrixActiveIndex != -1)
|
|
|
|
{
|
2013-03-22 03:32:42 -05:00
|
|
|
activeCellInfo->setCellResultIndex(cellStartIndex + localCellIdx, matrixActiveStartIndex + matrixActiveIndex);
|
2013-01-30 08:02:28 -06:00
|
|
|
}
|
2013-01-30 02:30:48 -06:00
|
|
|
|
2013-02-12 04:15:36 -06:00
|
|
|
int fractureActiveIndex = ecl_grid_get_active_fracture_index1(localEclGrid, localCellIdx);
|
2013-01-30 08:02:28 -06:00
|
|
|
if (fractureActiveIndex != -1)
|
2013-01-30 02:30:48 -06:00
|
|
|
{
|
2013-03-22 03:32:42 -05:00
|
|
|
fractureActiveCellInfo->setCellResultIndex(cellStartIndex + localCellIdx, fractureActiveStartIndex + fractureActiveIndex);
|
2013-01-30 08:02:28 -06:00
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-02-01 08:33:21 -06:00
|
|
|
// Parent cell index
|
|
|
|
|
2013-02-12 04:15:36 -06:00
|
|
|
int parentCellIndex = ecl_grid_get_parent_cell1(localEclGrid, localCellIdx);
|
2012-05-18 02:45:23 -05:00
|
|
|
if (parentCellIndex == -1)
|
|
|
|
{
|
|
|
|
cell.setParentCellIndex(cvf::UNDEFINED_SIZE_T);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cell.setParentCellIndex(parentCellIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Corner coordinates
|
|
|
|
int cIdx;
|
|
|
|
for (cIdx = 0; cIdx < 8; ++cIdx)
|
|
|
|
{
|
2013-02-12 04:15:36 -06:00
|
|
|
double * point = mainGrid->nodes()[nodeStartIndex + localCellIdx * 8 + cellMappingECLRi[cIdx]].ptr();
|
|
|
|
ecl_grid_get_corner_xyz1(localEclGrid, localCellIdx, cIdx, &(point[0]), &(point[1]), &(point[2]));
|
2012-05-18 02:45:23 -05:00
|
|
|
point[2] = -point[2];
|
2013-02-12 04:15:36 -06:00
|
|
|
cell.cornerIndices()[cIdx] = nodeStartIndex + localCellIdx*8 + cIdx;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Sub grid in cell
|
2013-02-12 04:15:36 -06:00
|
|
|
const ecl_grid_type* subGrid = ecl_grid_get_cell_lgr1(localEclGrid, localCellIdx);
|
2012-05-18 02:45:23 -05:00
|
|
|
if (subGrid != NULL)
|
|
|
|
{
|
|
|
|
int subGridFileIndex = ecl_grid_get_grid_nr(subGrid);
|
|
|
|
CVF_ASSERT(subGridFileIndex > 0);
|
|
|
|
cell.setSubGrid(static_cast<RigLocalGrid*>(mainGrid->gridByIndex(subGridFileIndex)));
|
|
|
|
}
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2013-02-01 08:33:21 -06:00
|
|
|
// Mark inactive long pyramid looking cells as invalid
|
2013-02-11 08:12:53 -06:00
|
|
|
// Forslag
|
|
|
|
//if (!invalid && (cell.isInCoarseCell() || (!cell.isActiveInMatrixModel() && !cell.isActiveInFractureModel()) ) )
|
2013-08-26 06:56:42 -05:00
|
|
|
if (!invalid)
|
|
|
|
{
|
|
|
|
cell.setInvalid(cell.isLongPyramidCell());
|
|
|
|
}
|
2013-01-30 08:02:28 -06:00
|
|
|
|
2012-06-26 09:10:41 -05:00
|
|
|
#pragma omp atomic
|
|
|
|
computedCellCount++;
|
|
|
|
|
2012-09-11 02:22:36 -05:00
|
|
|
progInfo.setProgress((int)(computedCellCount/cellsPrProgressTick));
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
2012-06-26 09:10:41 -05:00
|
|
|
return true;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
//
|
|
|
|
// Class RigReaderInterfaceECL
|
|
|
|
//
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Constructor
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2012-06-26 09:10:41 -05:00
|
|
|
RifReaderEclipseOutput::RifReaderEclipseOutput()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-02-27 07:30:32 -06:00
|
|
|
m_fileName.clear();
|
2013-04-10 04:02:10 -05:00
|
|
|
m_filesWithSameBaseName.clear();
|
2013-02-27 07:30:32 -06:00
|
|
|
|
|
|
|
m_timeSteps.clear();
|
|
|
|
|
|
|
|
m_eclipseCase = NULL;
|
|
|
|
|
2013-02-27 07:13:37 -06:00
|
|
|
m_ecl_init_file = NULL;
|
|
|
|
m_dynamicResultsAccess = NULL;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Destructor
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2012-06-26 09:10:41 -05:00
|
|
|
RifReaderEclipseOutput::~RifReaderEclipseOutput()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-03-08 01:24:40 -06:00
|
|
|
close();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-02-27 07:13:37 -06:00
|
|
|
if (m_ecl_init_file)
|
2013-02-27 04:27:02 -06:00
|
|
|
{
|
2013-02-27 07:13:37 -06:00
|
|
|
ecl_file_close(m_ecl_init_file);
|
2013-02-27 04:27:02 -06:00
|
|
|
}
|
2013-02-27 07:13:37 -06:00
|
|
|
m_ecl_init_file = NULL;
|
2013-02-27 04:27:02 -06:00
|
|
|
|
2013-02-27 07:13:37 -06:00
|
|
|
if (m_dynamicResultsAccess.notNull())
|
|
|
|
{
|
|
|
|
m_dynamicResultsAccess->close();
|
|
|
|
}
|
2013-04-29 06:13:42 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Close interface (for now, no files are kept open after calling methods, so just clear members)
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RifReaderEclipseOutput::close()
|
|
|
|
{
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Read geometry from file given by name into given reservoir object
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-22 09:43:42 -05:00
|
|
|
bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid, RigCaseData* eclipseCase)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-02-13 06:24:39 -06:00
|
|
|
CVF_ASSERT(eclipseCase);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
if (!mainEclGrid)
|
|
|
|
{
|
|
|
|
// Some error
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-03-13 05:50:31 -05:00
|
|
|
RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS);
|
|
|
|
RigActiveCellInfo* fractureActiveCellInfo = eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS);
|
|
|
|
|
|
|
|
CVF_ASSERT(activeCellInfo && fractureActiveCellInfo);
|
2013-02-12 04:15:36 -06:00
|
|
|
|
2013-02-13 06:24:39 -06:00
|
|
|
RigMainGrid* mainGrid = eclipseCase->mainGrid();
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
cvf::Vec3st gridPointDim(0,0,0);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
cvf::Vec3st gridPointDim(0,0,0);
|
|
|
|
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);
|
|
|
|
mainGrid->addLocalGrid(localGrid);
|
|
|
|
|
|
|
|
localGrid->setIndexToStartOfCells(totalCellCount);
|
|
|
|
localGrid->setGridName(lgrName);
|
|
|
|
localGrid->setGridPointDimensions(gridPointDim);
|
|
|
|
|
|
|
|
totalCellCount += ecl_grid_get_global_size(localEclGrid);
|
|
|
|
}
|
2013-02-12 04:15:36 -06:00
|
|
|
|
|
|
|
activeCellInfo->setGlobalCellCount(totalCellCount);
|
2013-03-13 05:50:31 -05:00
|
|
|
fractureActiveCellInfo->setGlobalCellCount(totalCellCount);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
// Reserve room for the cells and nodes and fill them with data
|
|
|
|
|
|
|
|
mainGrid->cells().reserve(totalCellCount);
|
|
|
|
mainGrid->nodes().reserve(8*totalCellCount);
|
|
|
|
|
2012-09-11 02:22:36 -05:00
|
|
|
caf::ProgressInfo progInfo(3 + numLGRs, "");
|
2012-06-26 09:10:41 -05:00
|
|
|
progInfo.setProgressDescription("Main Grid");
|
2012-09-11 02:22:36 -05:00
|
|
|
progInfo.setNextProgressIncrement(3);
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2013-03-13 05:50:31 -05:00
|
|
|
transferGridCellData(mainGrid, activeCellInfo, fractureActiveCellInfo, mainGrid, mainEclGrid, 0, 0);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2012-09-11 02:22:36 -05:00
|
|
|
progInfo.setProgress(3);
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2013-01-30 02:30:48 -06:00
|
|
|
size_t globalMatrixActiveSize = ecl_grid_get_nactive(mainEclGrid);
|
|
|
|
size_t globalFractureActiveSize = ecl_grid_get_nactive_fracture(mainEclGrid);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-02-12 04:15:36 -06:00
|
|
|
activeCellInfo->setGridCount(1 + numLGRs);
|
2013-03-13 05:50:31 -05:00
|
|
|
fractureActiveCellInfo->setGridCount(1 + numLGRs);
|
2013-02-12 04:15:36 -06:00
|
|
|
|
2013-03-13 05:50:31 -05:00
|
|
|
activeCellInfo->setGridActiveCellCounts(0, globalMatrixActiveSize);
|
|
|
|
fractureActiveCellInfo->setGridActiveCellCounts(0, globalFractureActiveSize);
|
|
|
|
|
2013-05-21 04:10:59 -05:00
|
|
|
transferCoarseningInfo(mainEclGrid, mainGrid);
|
|
|
|
|
2013-02-01 08:33:21 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
for (lgrIdx = 0; lgrIdx < numLGRs; ++lgrIdx)
|
|
|
|
{
|
2012-06-26 09:10:41 -05:00
|
|
|
progInfo.setProgressDescription("LGR number " + QString::number(lgrIdx+1));
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
ecl_grid_type* localEclGrid = ecl_grid_iget_lgr(mainEclGrid, lgrIdx);
|
2013-02-01 08:33:21 -06:00
|
|
|
RigLocalGrid* localGrid = static_cast<RigLocalGrid*>(mainGrid->gridByIndex(lgrIdx+1));
|
|
|
|
|
2013-03-13 05:50:31 -05:00
|
|
|
transferGridCellData(mainGrid, activeCellInfo, fractureActiveCellInfo, localGrid, localEclGrid, globalMatrixActiveSize, globalFractureActiveSize);
|
2013-02-12 04:15:36 -06:00
|
|
|
|
|
|
|
int matrixActiveCellCount = ecl_grid_get_nactive(localEclGrid);
|
|
|
|
globalMatrixActiveSize += matrixActiveCellCount;
|
2013-02-01 08:33:21 -06:00
|
|
|
|
2013-02-12 04:15:36 -06:00
|
|
|
int fractureActiveCellCount = ecl_grid_get_nactive_fracture(localEclGrid);
|
|
|
|
globalFractureActiveSize += fractureActiveCellCount;
|
2013-02-01 08:33:21 -06:00
|
|
|
|
2013-03-13 05:50:31 -05:00
|
|
|
activeCellInfo->setGridActiveCellCounts(lgrIdx + 1, matrixActiveCellCount);
|
|
|
|
fractureActiveCellInfo->setGridActiveCellCounts(lgrIdx + 1, fractureActiveCellCount);
|
2013-05-21 04:10:59 -05:00
|
|
|
|
|
|
|
transferCoarseningInfo(localEclGrid, localGrid);
|
|
|
|
|
2012-09-11 02:22:36 -05:00
|
|
|
progInfo.setProgress(3 + lgrIdx);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
2013-02-12 04:15:36 -06:00
|
|
|
activeCellInfo->computeDerivedData();
|
2013-03-13 05:50:31 -05:00
|
|
|
fractureActiveCellInfo->computeDerivedData();
|
2013-02-12 04:15:36 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Open file and read geometry into given reservoir object
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-22 09:43:42 -05:00
|
|
|
bool RifReaderEclipseOutput::open(const QString& fileName, RigCaseData* eclipseCase)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-02-13 06:24:39 -06:00
|
|
|
CVF_ASSERT(eclipseCase);
|
2013-02-06 06:44:27 -06:00
|
|
|
caf::ProgressInfo progInfo(100, "");
|
2012-06-26 09:10:41 -05:00
|
|
|
|
|
|
|
progInfo.setProgressDescription("Reading Grid");
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
// Make sure everything's closed
|
|
|
|
close();
|
|
|
|
|
|
|
|
// Get set of files
|
|
|
|
QStringList fileSet;
|
2013-04-10 04:02:10 -05:00
|
|
|
if (!RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(fileName, &fileSet)) return false;
|
2013-02-06 06:44:27 -06:00
|
|
|
|
|
|
|
progInfo.incrementProgress();
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2013-02-06 06:44:27 -06:00
|
|
|
progInfo.setNextProgressIncrement(20);
|
2012-05-18 02:45:23 -05:00
|
|
|
// Keep the set of files of interest
|
2013-04-10 04:02:10 -05:00
|
|
|
m_filesWithSameBaseName = fileSet;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
// Read geometry
|
2012-06-26 09:10:41 -05:00
|
|
|
ecl_grid_type * mainEclGrid = ecl_grid_alloc( fileName.toAscii().data() );
|
|
|
|
|
2013-02-06 06:44:27 -06:00
|
|
|
progInfo.incrementProgress();
|
|
|
|
|
|
|
|
progInfo.setNextProgressIncrement(10);
|
2012-06-26 09:10:41 -05:00
|
|
|
progInfo.setProgressDescription("Transferring grid geometry");
|
|
|
|
|
2013-02-13 06:24:39 -06:00
|
|
|
if (!transferGeometry(mainEclGrid, eclipseCase)) return false;
|
2013-02-06 06:44:27 -06:00
|
|
|
progInfo.incrementProgress();
|
|
|
|
|
2013-08-26 06:56:42 -05:00
|
|
|
m_eclipseCase = eclipseCase;
|
2012-06-26 09:10:41 -05:00
|
|
|
|
|
|
|
progInfo.setProgressDescription("Reading Result index");
|
2013-02-06 06:44:27 -06:00
|
|
|
progInfo.setNextProgressIncrement(60);
|
2013-02-05 03:51:32 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
// Build results meta data
|
2013-04-22 06:24:49 -05:00
|
|
|
buildMetaData();
|
2013-02-06 06:44:27 -06:00
|
|
|
progInfo.incrementProgress();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-02-06 06:44:27 -06:00
|
|
|
progInfo.setNextProgressIncrement(8);
|
2012-06-26 09:10:41 -05:00
|
|
|
progInfo.setProgressDescription("Reading Well information");
|
2013-08-26 06:56:42 -05:00
|
|
|
readWellCells(mainEclGrid);
|
2013-02-05 03:51:32 -06:00
|
|
|
|
2013-08-26 06:56:42 -05:00
|
|
|
progInfo.setProgressDescription("Releasing reader memory");
|
|
|
|
ecl_grid_free( mainEclGrid );
|
|
|
|
progInfo.incrementProgress();
|
2013-02-05 03:51:32 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-02-27 04:27:02 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-22 09:43:42 -05:00
|
|
|
bool RifReaderEclipseOutput::openAndReadActiveCellData(const QString& fileName, const std::vector<QDateTime>& mainCaseTimeSteps, RigCaseData* eclipseCase)
|
2013-02-27 04:27:02 -06:00
|
|
|
{
|
|
|
|
CVF_ASSERT(eclipseCase);
|
2013-02-27 04:54:32 -06:00
|
|
|
|
|
|
|
// It is required to have a main grid before reading active cell data
|
|
|
|
if (!eclipseCase->mainGrid())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-02-27 04:27:02 -06:00
|
|
|
close();
|
|
|
|
|
|
|
|
// Get set of files
|
|
|
|
QStringList fileSet;
|
2013-04-10 04:02:10 -05:00
|
|
|
if (!RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(fileName, &fileSet)) return false;
|
2013-02-27 04:27:02 -06:00
|
|
|
|
|
|
|
// Keep the set of files of interest
|
2013-04-10 04:02:10 -05:00
|
|
|
m_filesWithSameBaseName = fileSet;
|
2013-02-27 07:13:37 -06:00
|
|
|
m_eclipseCase = eclipseCase;
|
2013-02-27 04:27:02 -06:00
|
|
|
|
|
|
|
|
2013-02-27 07:13:37 -06:00
|
|
|
if (!readActiveCellInfo())
|
2013-02-27 04:54:32 -06:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2013-02-27 04:27:02 -06:00
|
|
|
|
2013-04-10 04:02:10 -05:00
|
|
|
m_dynamicResultsAccess = createDynamicResultsAccess();
|
2013-04-22 06:24:49 -05:00
|
|
|
if (m_dynamicResultsAccess.notNull())
|
|
|
|
{
|
|
|
|
m_dynamicResultsAccess->setTimeSteps(mainCaseTimeSteps);
|
|
|
|
}
|
2013-03-05 06:10:26 -06:00
|
|
|
|
2013-02-27 04:27:02 -06:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
2013-03-07 06:13:34 -06:00
|
|
|
/// See also RigStatistics::computeActiveCellUnion()
|
2013-02-27 04:27:02 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-02-27 07:13:37 -06:00
|
|
|
bool RifReaderEclipseOutput::readActiveCellInfo()
|
2013-02-27 04:27:02 -06:00
|
|
|
{
|
2013-03-08 01:24:40 -06:00
|
|
|
CVF_ASSERT(m_eclipseCase);
|
2013-02-27 07:13:37 -06:00
|
|
|
CVF_ASSERT(m_eclipseCase->mainGrid());
|
2013-02-27 04:27:02 -06:00
|
|
|
|
2013-04-10 04:02:10 -05:00
|
|
|
QString egridFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_EGRID_FILE);
|
2013-02-27 04:27:02 -06:00
|
|
|
if (egridFileName.size() > 0)
|
|
|
|
{
|
2013-04-29 06:13:42 -05:00
|
|
|
ecl_file_type* ecl_file = ecl_file_open(egridFileName.toAscii().data(), ECL_FILE_CLOSE_STREAM);
|
2013-02-27 04:27:02 -06:00
|
|
|
if (!ecl_file) return false;
|
|
|
|
|
|
|
|
int actnumKeywordCount = ecl_file_get_num_named_kw(ecl_file, ACTNUM_KW);
|
|
|
|
if (actnumKeywordCount > 0)
|
|
|
|
{
|
|
|
|
std::vector<std::vector<int> > actnumValuesPerGrid;
|
|
|
|
actnumValuesPerGrid.resize(actnumKeywordCount);
|
|
|
|
|
|
|
|
size_t globalCellCount = 0;
|
2013-03-02 03:18:27 -06:00
|
|
|
for (size_t gridIdx = 0; gridIdx < static_cast<size_t>(actnumKeywordCount); gridIdx++)
|
2013-02-27 04:27:02 -06:00
|
|
|
{
|
|
|
|
RifEclipseOutputFileTools::keywordData(ecl_file, ACTNUM_KW, gridIdx, &actnumValuesPerGrid[gridIdx]);
|
|
|
|
|
|
|
|
globalCellCount += actnumValuesPerGrid[gridIdx].size();
|
|
|
|
}
|
|
|
|
|
2013-02-27 04:54:32 -06:00
|
|
|
// Check if number of cells is matching
|
2013-02-27 07:13:37 -06:00
|
|
|
if (m_eclipseCase->mainGrid()->cells().size() != globalCellCount)
|
2013-02-27 04:54:32 -06:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-03-13 05:50:31 -05:00
|
|
|
RigActiveCellInfo* activeCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS);
|
|
|
|
RigActiveCellInfo* fractureActiveCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS);
|
2013-02-27 04:27:02 -06:00
|
|
|
|
|
|
|
activeCellInfo->setGlobalCellCount(globalCellCount);
|
2013-03-13 05:50:31 -05:00
|
|
|
fractureActiveCellInfo->setGlobalCellCount(globalCellCount);
|
2013-02-27 04:27:02 -06:00
|
|
|
activeCellInfo->setGridCount(actnumKeywordCount);
|
2013-03-13 05:50:31 -05:00
|
|
|
fractureActiveCellInfo->setGridCount(actnumKeywordCount);
|
2013-02-27 04:27:02 -06:00
|
|
|
|
|
|
|
size_t cellIdx = 0;
|
2013-03-07 06:13:34 -06:00
|
|
|
size_t globalActiveMatrixIndex = 0;
|
|
|
|
size_t globalActiveFractureIndex = 0;
|
2013-03-02 03:18:27 -06:00
|
|
|
for (size_t gridIdx = 0; gridIdx < static_cast<size_t>(actnumKeywordCount); gridIdx++)
|
2013-02-27 04:27:02 -06:00
|
|
|
{
|
|
|
|
size_t activeMatrixIndex = 0;
|
|
|
|
size_t activeFractureIndex = 0;
|
|
|
|
|
|
|
|
std::vector<int>& actnumValues = actnumValuesPerGrid[gridIdx];
|
|
|
|
|
|
|
|
for (size_t i = 0; i < actnumValues.size(); i++)
|
|
|
|
{
|
|
|
|
if (actnumValues[i] == 1 || actnumValues[i] == 3)
|
|
|
|
{
|
2013-03-22 03:32:42 -05:00
|
|
|
activeCellInfo->setCellResultIndex(cellIdx, globalActiveMatrixIndex++);
|
2013-03-07 06:13:34 -06:00
|
|
|
activeMatrixIndex++;
|
2013-02-27 04:27:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if (actnumValues[i] == 2 || actnumValues[i] == 3)
|
|
|
|
{
|
2013-03-22 03:32:42 -05:00
|
|
|
fractureActiveCellInfo->setCellResultIndex(cellIdx, globalActiveFractureIndex++);
|
2013-03-07 06:13:34 -06:00
|
|
|
activeFractureIndex++;
|
2013-02-27 04:27:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
cellIdx++;
|
|
|
|
}
|
|
|
|
|
2013-03-13 05:50:31 -05:00
|
|
|
activeCellInfo->setGridActiveCellCounts(gridIdx, activeMatrixIndex);
|
|
|
|
fractureActiveCellInfo->setGridActiveCellCounts(gridIdx, activeFractureIndex);
|
2013-02-27 04:27:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
activeCellInfo->computeDerivedData();
|
2013-03-13 05:50:31 -05:00
|
|
|
fractureActiveCellInfo->computeDerivedData();
|
2013-02-27 04:27:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
ecl_file_close(ecl_file);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Build meta data - get states and results info
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-04-22 06:24:49 -05:00
|
|
|
void RifReaderEclipseOutput::buildMetaData()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-03-08 01:24:40 -06:00
|
|
|
CVF_ASSERT(m_eclipseCase);
|
2013-04-10 04:02:10 -05:00
|
|
|
CVF_ASSERT(m_filesWithSameBaseName.size() > 0);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-10 04:02:10 -05:00
|
|
|
caf::ProgressInfo progInfo(m_filesWithSameBaseName.size() + 3,"");
|
2013-02-06 06:44:27 -06:00
|
|
|
|
2013-04-10 04:02:10 -05:00
|
|
|
progInfo.setNextProgressIncrement(m_filesWithSameBaseName.size());
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2013-04-22 07:51:47 -05:00
|
|
|
RigCaseCellResultsData* matrixModelResults = m_eclipseCase->results(RifReaderInterface::MATRIX_RESULTS);
|
|
|
|
RigCaseCellResultsData* fractureModelResults = m_eclipseCase->results(RifReaderInterface::FRACTURE_RESULTS);
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
// Create access object for dynamic results
|
2013-04-10 04:02:10 -05:00
|
|
|
m_dynamicResultsAccess = createDynamicResultsAccess();
|
2013-04-22 07:51:47 -05:00
|
|
|
if (m_dynamicResultsAccess.notNull())
|
2013-01-30 07:13:50 -06:00
|
|
|
{
|
2013-04-22 07:51:47 -05:00
|
|
|
m_dynamicResultsAccess->open();
|
2013-03-05 06:10:26 -06:00
|
|
|
|
2013-04-22 07:51:47 -05:00
|
|
|
progInfo.incrementProgress();
|
2013-02-06 06:44:27 -06:00
|
|
|
|
2012-06-26 09:10:41 -05:00
|
|
|
|
|
|
|
// Get time steps
|
2012-05-18 02:45:23 -05:00
|
|
|
m_timeSteps = m_dynamicResultsAccess->timeSteps();
|
|
|
|
|
2013-02-05 03:51:32 -06:00
|
|
|
QStringList resultNames;
|
|
|
|
std::vector<size_t> resultNamesDataItemCounts;
|
|
|
|
m_dynamicResultsAccess->resultNames(&resultNames, &resultNamesDataItemCounts);
|
|
|
|
|
2013-02-01 07:39:32 -06:00
|
|
|
{
|
2013-03-13 05:50:31 -05:00
|
|
|
QStringList matrixResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts,
|
|
|
|
m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS),
|
|
|
|
m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS),
|
|
|
|
RifReaderInterface::MATRIX_RESULTS, m_dynamicResultsAccess->timeStepCount());
|
2013-02-01 07:39:32 -06:00
|
|
|
|
2013-02-05 03:51:32 -06:00
|
|
|
for (int i = 0; i < matrixResultNames.size(); ++i)
|
2013-02-01 07:39:32 -06:00
|
|
|
{
|
2013-03-21 09:31:47 -05:00
|
|
|
size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, matrixResultNames[i], false);
|
2013-02-01 07:39:32 -06:00
|
|
|
matrixModelResults->setTimeStepDates(resIndex, m_timeSteps);
|
|
|
|
}
|
|
|
|
}
|
2012-06-26 09:10:41 -05:00
|
|
|
|
|
|
|
{
|
2013-03-13 05:50:31 -05:00
|
|
|
QStringList fractureResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts,
|
|
|
|
m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS),
|
|
|
|
m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS),
|
|
|
|
RifReaderInterface::FRACTURE_RESULTS, m_dynamicResultsAccess->timeStepCount());
|
2013-02-01 07:39:32 -06:00
|
|
|
|
2013-02-05 03:51:32 -06:00
|
|
|
for (int i = 0; i < fractureResultNames.size(); ++i)
|
2013-02-01 07:39:32 -06:00
|
|
|
{
|
2013-03-21 09:31:47 -05:00
|
|
|
size_t resIndex = fractureModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, fractureResultNames[i], false);
|
2013-02-01 07:39:32 -06:00
|
|
|
fractureModelResults->setTimeStepDates(resIndex, m_timeSteps);
|
|
|
|
}
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
2013-02-06 06:44:27 -06:00
|
|
|
progInfo.incrementProgress();
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2013-03-05 06:10:26 -06:00
|
|
|
openInitFile();
|
2013-02-27 07:13:37 -06:00
|
|
|
|
|
|
|
progInfo.incrementProgress();
|
2013-02-05 03:51:32 -06:00
|
|
|
|
2013-03-05 06:10:26 -06:00
|
|
|
if (m_ecl_init_file)
|
2013-02-27 07:13:37 -06:00
|
|
|
{
|
2013-03-05 06:10:26 -06:00
|
|
|
QStringList resultNames;
|
|
|
|
std::vector<size_t> resultNamesDataItemCounts;
|
|
|
|
RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(m_ecl_init_file, &resultNames, &resultNamesDataItemCounts);
|
2012-08-31 12:12:47 -05:00
|
|
|
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2013-03-13 05:50:31 -05:00
|
|
|
QStringList matrixResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts,
|
|
|
|
m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS),
|
|
|
|
m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS),
|
|
|
|
RifReaderInterface::MATRIX_RESULTS, 1);
|
2013-02-01 07:39:32 -06:00
|
|
|
|
2013-03-18 05:40:39 -05:00
|
|
|
std::vector<QDateTime> staticDate;
|
2013-03-05 06:10:26 -06:00
|
|
|
if (m_timeSteps.size() > 0)
|
|
|
|
{
|
|
|
|
staticDate.push_back(m_timeSteps.front());
|
|
|
|
}
|
2013-02-01 07:39:32 -06:00
|
|
|
|
2013-03-05 06:10:26 -06:00
|
|
|
for (int i = 0; i < matrixResultNames.size(); ++i)
|
|
|
|
{
|
2013-03-21 09:31:47 -05:00
|
|
|
size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, matrixResultNames[i], false);
|
2013-03-05 06:10:26 -06:00
|
|
|
matrixModelResults->setTimeStepDates(resIndex, staticDate);
|
|
|
|
}
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-02-27 07:13:37 -06:00
|
|
|
{
|
2013-03-13 05:50:31 -05:00
|
|
|
QStringList fractureResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts,
|
|
|
|
m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS),
|
|
|
|
m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS),
|
|
|
|
RifReaderInterface::FRACTURE_RESULTS, 1);
|
2013-03-05 06:10:26 -06:00
|
|
|
|
2013-03-18 05:40:39 -05:00
|
|
|
std::vector<QDateTime> staticDate;
|
2013-03-05 06:10:26 -06:00
|
|
|
if (m_timeSteps.size() > 0)
|
|
|
|
{
|
|
|
|
staticDate.push_back(m_timeSteps.front());
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < fractureResultNames.size(); ++i)
|
|
|
|
{
|
2013-03-21 09:31:47 -05:00
|
|
|
size_t resIndex = fractureModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, fractureResultNames[i], false);
|
2013-03-05 06:10:26 -06:00
|
|
|
fractureModelResults->setTimeStepDates(resIndex, staticDate);
|
|
|
|
}
|
2013-02-27 07:13:37 -06:00
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Create results access object (.UNRST or .X0001 ... .XNNNN)
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-04-10 04:02:10 -05:00
|
|
|
RifEclipseRestartDataAccess* RifReaderEclipseOutput::createDynamicResultsAccess()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2012-06-26 09:10:41 -05:00
|
|
|
RifEclipseRestartDataAccess* resultsAccess = NULL;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
// Look for unified restart file
|
2013-04-10 04:02:10 -05:00
|
|
|
QString unrstFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_UNIFIED_RESTART_FILE);
|
2012-05-18 02:45:23 -05:00
|
|
|
if (unrstFileName.size() > 0)
|
|
|
|
{
|
2013-01-30 07:13:50 -06:00
|
|
|
resultsAccess = new RifEclipseUnifiedRestartFileAccess();
|
2013-04-10 04:02:10 -05:00
|
|
|
resultsAccess->setRestartFiles(QStringList(unrstFileName));
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Look for set of restart files (one file per time step)
|
2013-04-10 04:02:10 -05:00
|
|
|
QStringList restartFiles = RifEclipseOutputFileTools::filterFileNamesOfType(m_filesWithSameBaseName, ECL_RESTART_FILE);
|
2012-05-18 02:45:23 -05:00
|
|
|
if (restartFiles.size() > 0)
|
|
|
|
{
|
2013-01-30 07:13:50 -06:00
|
|
|
resultsAccess = new RifEclipseRestartFilesetAccess();
|
2013-04-10 04:02:10 -05:00
|
|
|
resultsAccess->setRestartFiles(restartFiles);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return resultsAccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Get all values of a given static result as doubles
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-01-30 07:13:50 -06:00
|
|
|
bool RifReaderEclipseOutput::staticResult(const QString& result, PorosityModelResultType matrixOrFracture, std::vector<double>* values)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
CVF_ASSERT(values);
|
2013-02-27 07:13:37 -06:00
|
|
|
|
2013-04-22 07:51:47 -05:00
|
|
|
openInitFile();
|
2013-02-27 07:13:37 -06:00
|
|
|
|
2013-04-22 07:51:47 -05:00
|
|
|
if(m_ecl_init_file)
|
|
|
|
{
|
|
|
|
std::vector<double> fileValues;
|
2013-02-05 03:51:32 -06:00
|
|
|
|
2013-04-22 07:51:47 -05:00
|
|
|
size_t numOccurrences = ecl_file_get_num_named_kw(m_ecl_init_file, result.toAscii().data());
|
|
|
|
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 02:45:23 -05:00
|
|
|
|
2013-04-22 07:51:47 -05:00
|
|
|
extractResultValuesBasedOnPorosityModel(matrixOrFracture, values, fileValues);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Get dynamic result at given step index. Will concatenate values for the main grid and all sub grids.
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-01-30 07:13:50 -06:00
|
|
|
bool RifReaderEclipseOutput::dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector<double>* values)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-03-05 06:10:26 -06:00
|
|
|
if (m_dynamicResultsAccess.isNull())
|
|
|
|
{
|
2013-04-10 04:02:10 -05:00
|
|
|
m_dynamicResultsAccess = createDynamicResultsAccess();
|
2013-03-05 06:10:26 -06:00
|
|
|
}
|
|
|
|
|
2013-04-22 06:24:49 -05:00
|
|
|
if (m_dynamicResultsAccess.notNull())
|
2013-03-05 06:10:26 -06:00
|
|
|
{
|
2013-04-22 06:24:49 -05:00
|
|
|
std::vector<double> fileValues;
|
|
|
|
if (!m_dynamicResultsAccess->results(result, stepIndex, m_eclipseCase->mainGrid()->gridCount(), &fileValues))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2013-02-05 03:51:32 -06:00
|
|
|
|
2013-04-22 06:24:49 -05:00
|
|
|
extractResultValuesBasedOnPorosityModel(matrixOrFracture, values, fileValues);
|
2013-02-05 03:51:32 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
2013-08-26 06:56:42 -05:00
|
|
|
|
|
|
|
|
|
|
|
// Helper structure to handle the metadata for connections in segments
|
|
|
|
struct SegmentData
|
|
|
|
{
|
|
|
|
SegmentData(const well_conn_collection_type* connections) :
|
|
|
|
m_branchId(-1),
|
|
|
|
m_segmentId(-1),
|
|
|
|
m_gridIndex(cvf::UNDEFINED_SIZE_T),
|
|
|
|
m_connections(connections)
|
|
|
|
{}
|
|
|
|
|
|
|
|
int m_branchId;
|
|
|
|
int m_segmentId;
|
|
|
|
size_t m_gridIndex;
|
|
|
|
const well_conn_collection_type* m_connections;
|
|
|
|
};
|
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
struct SegmentTreeNode
|
|
|
|
{
|
|
|
|
SegmentTreeNode() : outletSegment(NULL), mainChildSegment(NULL) {}
|
|
|
|
std::vector<RigWellResultPoint> connections;
|
|
|
|
|
|
|
|
SegmentTreeNode* outletSegment;
|
|
|
|
SegmentTreeNode* mainChildSegment;
|
|
|
|
std::vector<SegmentTreeNode*> additionalChildSegments;
|
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigWellResultPoint RifReaderEclipseOutput::createWellResultPoint(const RigGridBase* grid, const well_conn_type* ert_connection, int ertBranchId, int ertSegmentId)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(ert_connection);
|
|
|
|
CVF_ASSERT(grid);
|
|
|
|
|
|
|
|
RigWellResultPoint resultPoint;
|
|
|
|
int cellI = well_conn_get_i( ert_connection );
|
|
|
|
int cellJ = well_conn_get_j( ert_connection );
|
|
|
|
int cellK = well_conn_get_k( ert_connection );
|
|
|
|
bool isCellOpen = well_conn_open( ert_connection );
|
|
|
|
|
|
|
|
// 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());
|
|
|
|
}
|
|
|
|
|
|
|
|
// The K value might also be -1. It is not yet known why, or what it is supposed to mean,
|
|
|
|
// but for now we will interpret as 0.
|
|
|
|
// TODO: Ask Joakim Haave regarding this.
|
|
|
|
if (cellK < 0) cellK = 0;
|
|
|
|
|
|
|
|
resultPoint.m_gridIndex = grid->gridIndex();
|
|
|
|
resultPoint.m_gridCellIndex = grid->cellIndexFromIJK(cellI, cellJ, cellK);
|
|
|
|
|
|
|
|
resultPoint.m_isOpen = isCellOpen;
|
|
|
|
|
|
|
|
resultPoint.m_ertBranchId = ertBranchId;
|
|
|
|
resultPoint.m_ertSegmentId = ertSegmentId;
|
|
|
|
|
|
|
|
return resultPoint;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-26 06:56:42 -05:00
|
|
|
void getSegmentDataByBranchId(const std::list<SegmentData>& segments, std::vector<SegmentData>& branchSegments, int branchId)
|
|
|
|
{
|
|
|
|
std::list<SegmentData>::const_iterator it;
|
|
|
|
|
|
|
|
for (it = segments.begin(); it != segments.end(); it++)
|
|
|
|
{
|
|
|
|
if (it->m_branchId == branchId)
|
|
|
|
{
|
|
|
|
branchSegments.push_back(*it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-08-26 06:56:42 -05:00
|
|
|
void RifReaderEclipseOutput::readWellCells(const ecl_grid_type* mainEclGrid)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-03-08 01:24:40 -06:00
|
|
|
CVF_ASSERT(m_eclipseCase);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
if (m_dynamicResultsAccess.isNull()) return;
|
|
|
|
|
2013-08-26 06:56:42 -05:00
|
|
|
well_info_type* ert_well_info = well_info_alloc(mainEclGrid);
|
2012-05-18 02:45:23 -05:00
|
|
|
if (!ert_well_info) return;
|
|
|
|
|
|
|
|
m_dynamicResultsAccess->readWellData(ert_well_info);
|
|
|
|
|
2013-02-27 07:13:37 -06:00
|
|
|
RigMainGrid* mainGrid = m_eclipseCase->mainGrid();
|
2012-05-18 02:45:23 -05:00
|
|
|
std::vector<RigGridBase*> grids;
|
2013-02-27 07:13:37 -06:00
|
|
|
m_eclipseCase->allGrids(&grids);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-03-22 09:43:42 -05:00
|
|
|
cvf::Collection<RigSingleWellResultsData> wells;
|
2013-02-06 06:44:27 -06:00
|
|
|
caf::ProgressInfo progress(well_info_get_num_wells(ert_well_info), "");
|
2012-05-18 02:45:23 -05: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);
|
|
|
|
|
2013-03-22 09:43:42 -05:00
|
|
|
cvf::ref<RigSingleWellResultsData> wellResults = new RigSingleWellResultsData;
|
2012-05-18 02:45:23 -05:00
|
|
|
wellResults->m_wellName = wellName;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
wellResults->m_wellCellsTimeSteps.resize(timeStepCount);
|
|
|
|
|
|
|
|
int timeIdx;
|
|
|
|
for (timeIdx = 0; timeIdx < timeStepCount; timeIdx++)
|
|
|
|
{
|
|
|
|
well_state_type* ert_well_state = well_ts_iget_state(ert_well_time_series, timeIdx);
|
|
|
|
|
|
|
|
RigWellResultFrame& wellResFrame = wellResults->m_wellCellsTimeSteps[timeIdx];
|
|
|
|
|
|
|
|
// Build timestamp for well
|
2012-06-26 09:10:41 -05:00
|
|
|
// Also see RifEclipseOutputFileAccess::timeStepsText for accessing time_t structures
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
time_t stepTime = well_state_get_sim_time(ert_well_state);
|
|
|
|
wellResFrame.m_timestamp = QDateTime::fromTime_t(stepTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Production type
|
|
|
|
well_type_enum ert_well_type = well_state_get_type(ert_well_state);
|
|
|
|
if (ert_well_type == PRODUCER)
|
|
|
|
{
|
|
|
|
wellResFrame.m_productionType = RigWellResultFrame::PRODUCER;
|
|
|
|
}
|
|
|
|
else if (ert_well_type == WATER_INJECTOR)
|
|
|
|
{
|
|
|
|
wellResFrame.m_productionType = RigWellResultFrame::WATER_INJECTOR;
|
|
|
|
}
|
|
|
|
else if (ert_well_type == GAS_INJECTOR)
|
|
|
|
{
|
|
|
|
wellResFrame.m_productionType = RigWellResultFrame::GAS_INJECTOR;
|
|
|
|
}
|
|
|
|
else if (ert_well_type == OIL_INJECTOR)
|
|
|
|
{
|
|
|
|
wellResFrame.m_productionType = RigWellResultFrame::OIL_INJECTOR;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wellResFrame.m_productionType = RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE;
|
|
|
|
}
|
|
|
|
|
|
|
|
wellResFrame.m_isOpen = well_state_is_open( ert_well_state );
|
|
|
|
|
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
if (well_state_is_MSW(ert_well_state))
|
|
|
|
{
|
|
|
|
// Loop over all the grids in the model. If we have connections in one, we will discard
|
|
|
|
// the main grid connections as the well connections are duplicated in the main grid and LGR grids
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
bool hasWellConnectionsInLGR = false;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-08-26 06:56:42 -05:00
|
|
|
|
|
|
|
#if 0
|
2013-08-26 07:03:01 -05:00
|
|
|
// To be discussed with Statoil
|
|
|
|
for (size_t gridNr = 1; gridNr < grids.size(); ++gridNr)
|
2013-06-18 02:41:02 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
RigGridBase* lgrGrid = m_eclipseCase->grid(gridNr);
|
|
|
|
if (well_state_has_grid_connections(ert_well_state, lgrGrid->gridName().data()))
|
|
|
|
{
|
|
|
|
hasWellConnectionsInLGR = true;
|
|
|
|
break;
|
|
|
|
}
|
2013-06-18 02:41:02 -05:00
|
|
|
}
|
2013-08-26 06:56:42 -05:00
|
|
|
#endif
|
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
size_t gridNr = hasWellConnectionsInLGR ? 1 : 0;
|
|
|
|
for (; gridNr < grids.size(); ++gridNr)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-01-25 08:20:41 -06:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
// Wellhead. If several grids have a wellhead definition for this well, we use the last one. (Possibly the innermost LGR)
|
|
|
|
const well_conn_type* ert_wellhead = well_state_iget_wellhead(ert_well_state, static_cast<int>(gridNr));
|
|
|
|
if (ert_wellhead)
|
2013-02-08 07:51:42 -06:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
wellResFrame.m_wellHead = createWellResultPoint(grids[gridNr], ert_wellhead, -1, -1 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// CVF_ASSERT(0); // This is just a test assert to see if this condition exists in some file.
|
|
|
|
// All the grids does not necessarily have a well head definition. (I think, JJS)
|
2013-01-25 08:20:41 -06:00
|
|
|
}
|
2013-08-26 06:56:42 -05:00
|
|
|
|
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
std::string gridName;
|
|
|
|
if (gridNr == 0)
|
|
|
|
{
|
|
|
|
gridName = ECL_GRID_GLOBAL_GRID;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RigGridBase* rigGrid = m_eclipseCase->grid(gridNr);
|
|
|
|
gridName = rigGrid->gridName();
|
|
|
|
}
|
2013-08-26 06:56:42 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
std::list<SegmentData> segmentList;
|
|
|
|
std::vector<const well_segment_type*> outletBranchSegmentList; // Keep a list of branch outlet segments to avoid traversal twice
|
|
|
|
std::vector<int> ertBranchIDs;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
int branchCount = 0;
|
|
|
|
if (well_state_is_MSW(ert_well_state))
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
wellResults->setMultiSegmentWell(true);
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
well_branch_collection_type* branches = well_state_get_branches(ert_well_state);
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
branchCount = well_branch_collection_get_size(branches);
|
|
|
|
for (int branchIdx = 0; branchIdx < well_branch_collection_get_size(branches); branchIdx++)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
const well_segment_type* segment = well_branch_collection_iget_start_segment(branches, branchIdx);
|
|
|
|
int branchId = well_segment_get_branch_id(segment);
|
|
|
|
|
|
|
|
ertBranchIDs.push_back(branchId);
|
2013-06-18 02:41:02 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
while (segment && branchId == well_segment_get_branch_id(segment))
|
2013-08-26 06:56:42 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
SegmentData segmentData(NULL);
|
|
|
|
segmentData.m_branchId = branchId;
|
|
|
|
segmentData.m_segmentId = well_segment_get_id(segment);
|
|
|
|
segmentData.m_gridIndex = gridNr;
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
if (well_segment_has_grid_connections(segment, gridName.data()))
|
|
|
|
{
|
|
|
|
const well_conn_collection_type* connections = well_segment_get_connections(segment, gridName.data());
|
|
|
|
segmentData.m_connections = connections;
|
|
|
|
}
|
2013-06-18 02:41:02 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
// Insert in front, as the segments are accessed starting from grid cell closes to well head
|
|
|
|
segmentList.push_front(segmentData);
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
if (well_segment_get_outlet_id(segment) == -1)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
segment = well_segment_get_outlet(segment);
|
|
|
|
}
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
outletBranchSegmentList.push_back(segment);
|
|
|
|
}
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
branchCount = 1;
|
|
|
|
ertBranchIDs.push_back(0);
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
const well_conn_collection_type* connections = well_state_get_grid_connections(ert_well_state, gridName.data());
|
|
|
|
SegmentData segmentData(connections);
|
|
|
|
segmentData.m_gridIndex = gridNr;
|
|
|
|
segmentList.push_front(segmentData);
|
|
|
|
}
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
size_t currentGridBranchStartIndex = wellResFrame.m_wellResultBranches.size();
|
|
|
|
wellResFrame.m_wellResultBranches.resize(currentGridBranchStartIndex + branchCount);
|
2013-08-26 06:56:42 -05:00
|
|
|
|
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
// Import all well result cells for all connections
|
|
|
|
for (int branchIdx = 0; branchIdx < branchCount; branchIdx++)
|
2013-08-26 06:56:42 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
RigWellResultBranch& wellResultBranch = wellResFrame.m_wellResultBranches[currentGridBranchStartIndex + branchIdx];
|
|
|
|
wellResultBranch.m_branchIndex = branchIdx;
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
int ertBranchId = ertBranchIDs[branchIdx];
|
|
|
|
wellResultBranch.m_ertBranchId = ertBranchId;
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
std::vector<SegmentData> branchSegments;
|
|
|
|
getSegmentDataByBranchId(segmentList, branchSegments, ertBranchId);
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
for (size_t segmentIdx = 0; segmentIdx < branchSegments.size(); segmentIdx++)
|
|
|
|
{
|
|
|
|
SegmentData& connData = branchSegments[segmentIdx];
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
if (!connData.m_connections)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
size_t existingCellCount = wellResultBranch.m_branchResultPoints.size();
|
|
|
|
wellResultBranch.m_branchResultPoints.resize(existingCellCount + 1);
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
RigWellResultPoint& data = wellResultBranch.m_branchResultPoints[existingCellCount];
|
2013-08-26 06:56:42 -05:00
|
|
|
|
|
|
|
data.m_ertBranchId = connData.m_branchId;
|
|
|
|
data.m_ertSegmentId = connData.m_segmentId;
|
|
|
|
}
|
2013-08-26 07:03:01 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
int connectionCount = well_conn_collection_get_size(connData.m_connections);
|
|
|
|
|
|
|
|
size_t existingCellCount = wellResultBranch.m_branchResultPoints.size();
|
|
|
|
wellResultBranch.m_branchResultPoints.resize(existingCellCount + connectionCount);
|
|
|
|
|
|
|
|
for (int connIdx = 0; connIdx < connectionCount; connIdx++)
|
|
|
|
{
|
|
|
|
well_conn_type* ert_connection = well_conn_collection_iget(connData.m_connections, connIdx);
|
|
|
|
wellResultBranch.m_branchResultPoints[existingCellCount + connIdx] =
|
|
|
|
createWellResultPoint(grids[gridNr], ert_connection, connData.m_branchId, connData.m_segmentId);
|
|
|
|
}
|
|
|
|
}
|
2013-08-26 06:56:42 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
if (well_state_is_MSW(ert_well_state))
|
2013-08-26 06:56:42 -05:00
|
|
|
{
|
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
// Assign outlet well cells to leaf branch well heads
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
for (int branchIdx = 0; branchIdx < branchCount; branchIdx++)
|
2013-08-26 06:56:42 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
RigWellResultBranch& wellResultLeafBranch = wellResFrame.m_wellResultBranches[currentGridBranchStartIndex + branchIdx];
|
|
|
|
|
|
|
|
const well_segment_type* outletBranchSegment = outletBranchSegmentList[branchIdx];
|
|
|
|
CVF_ASSERT(outletBranchSegment);
|
|
|
|
|
|
|
|
int outletErtBranchId = well_segment_get_branch_id(outletBranchSegment);
|
|
|
|
|
|
|
|
size_t outletErtBranchIndex = cvf::UNDEFINED_SIZE_T;
|
|
|
|
for (size_t i = 0; i < ertBranchIDs.size(); i++)
|
2013-08-26 06:56:42 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
if (ertBranchIDs[i] == outletErtBranchId)
|
|
|
|
{
|
|
|
|
outletErtBranchIndex = i;
|
|
|
|
}
|
2013-08-26 06:56:42 -05:00
|
|
|
}
|
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
RigWellResultBranch& outletResultBranch = wellResFrame.m_wellResultBranches[currentGridBranchStartIndex + outletErtBranchIndex];
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
int outletErtSegmentId = well_segment_get_branch_id(outletBranchSegment);
|
|
|
|
size_t lastCellIndexForSegmentIdInOutletBranch = cvf::UNDEFINED_SIZE_T;
|
|
|
|
for (size_t outletCellIdx = 0; outletCellIdx < outletResultBranch.m_branchResultPoints.size(); outletCellIdx++)
|
2013-08-26 06:56:42 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
if (outletResultBranch.m_branchResultPoints[outletCellIdx].m_ertSegmentId == outletErtSegmentId)
|
|
|
|
{
|
|
|
|
lastCellIndexForSegmentIdInOutletBranch = outletCellIdx;
|
|
|
|
}
|
2013-08-26 06:56:42 -05:00
|
|
|
}
|
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
if (lastCellIndexForSegmentIdInOutletBranch == cvf::UNDEFINED_SIZE_T)
|
|
|
|
{
|
|
|
|
// Did not find the cell in the outlet branch based on branch id and segment id from outlet cell in leaf branch
|
|
|
|
CVF_ASSERT(0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RigWellResultPoint& outletCell = outletResultBranch.m_branchResultPoints[lastCellIndexForSegmentIdInOutletBranch];
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
wellResultLeafBranch.m_outletBranchIndex_OBSOLETE = currentGridBranchStartIndex + outletErtBranchIndex;
|
|
|
|
wellResultLeafBranch.m_outletBranchHeadCellIndex_OBSOLETE = lastCellIndexForSegmentIdInOutletBranch;
|
|
|
|
}
|
2013-08-26 06:56:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
// Update outlet well cells with no grid cell connections
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
for (int branchIdx = 0; branchIdx < branchCount; branchIdx++)
|
2013-08-26 06:56:42 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
RigWellResultBranch& wellResultLeafBranch = wellResFrame.m_wellResultBranches[currentGridBranchStartIndex + branchIdx];
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
const RigWellResultPoint* leafBranchHead = wellResFrame.findResultCellFromOutletSpecification(wellResultLeafBranch.m_outletBranchIndex_OBSOLETE, wellResultLeafBranch.m_outletBranchHeadCellIndex_OBSOLETE);
|
|
|
|
if (!leafBranchHead || leafBranchHead->isCell())
|
2013-08-26 06:56:42 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
continue;
|
2013-08-26 06:56:42 -05:00
|
|
|
}
|
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
RigWellResultBranch& outletResultBranch = wellResFrame.m_wellResultBranches[wellResultLeafBranch.m_outletBranchIndex_OBSOLETE];
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
size_t firstCellIndexWithGridConnectionInLeafBranch = cvf::UNDEFINED_SIZE_T;
|
|
|
|
for (size_t j = 0; j < wellResultLeafBranch.m_branchResultPoints.size(); j++)
|
2013-08-26 06:56:42 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
if (wellResultLeafBranch.m_branchResultPoints[j].isCell())
|
2013-08-26 06:56:42 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
firstCellIndexWithGridConnectionInLeafBranch = j;
|
|
|
|
break;
|
2013-08-26 06:56:42 -05:00
|
|
|
}
|
2013-08-26 07:03:01 -05:00
|
|
|
}
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
if (firstCellIndexWithGridConnectionInLeafBranch != cvf::UNDEFINED_SIZE_T)
|
|
|
|
{
|
|
|
|
const RigCell& firstCellWithGridConnectionInLeafBranch = m_eclipseCase->cellFromWellResultCell(wellResultLeafBranch.m_branchResultPoints[firstCellIndexWithGridConnectionInLeafBranch]);
|
|
|
|
cvf::Vec3d firstGridConnectionCenterInLeafBranch = firstCellWithGridConnectionInLeafBranch.center();
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
size_t cellIndexInOutletBranch = wellResultLeafBranch.m_outletBranchHeadCellIndex_OBSOLETE;
|
|
|
|
CVF_ASSERT(cellIndexInOutletBranch != cvf::UNDEFINED_SIZE_T);
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
RigWellResultPoint& currCell = outletResultBranch.m_branchResultPoints[cellIndexInOutletBranch];
|
|
|
|
|
|
|
|
while (cellIndexInOutletBranch != cvf::UNDEFINED_SIZE_T && !currCell.isCell())
|
2013-08-26 06:56:42 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
size_t branchConnectionCount = currCell.m_branchConnectionCount;
|
|
|
|
if (branchConnectionCount == 0)
|
|
|
|
{
|
|
|
|
currCell.m_bottomPosition = firstGridConnectionCenterInLeafBranch;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cvf::Vec3d currentWeightedCoord = currCell.m_bottomPosition * branchConnectionCount / static_cast<double>(branchConnectionCount + 1);
|
|
|
|
cvf::Vec3d additionalWeightedCoord = firstGridConnectionCenterInLeafBranch / static_cast<double>(branchConnectionCount + 1);
|
|
|
|
|
|
|
|
currCell.m_bottomPosition = currentWeightedCoord + additionalWeightedCoord;
|
|
|
|
}
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
currCell.m_branchConnectionCount++;
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
if (cellIndexInOutletBranch == 0)
|
2013-06-21 09:20:11 -05:00
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
cellIndexInOutletBranch = cvf::UNDEFINED_SIZE_T;
|
|
|
|
|
|
|
|
// Find the branch the outlet is connected to, and continue update of
|
|
|
|
// segments until a segment with a grid connection is found
|
|
|
|
const RigWellResultPoint* leafBranchHead = wellResFrame.findResultCellFromOutletSpecification(outletResultBranch.m_outletBranchIndex_OBSOLETE, outletResultBranch.m_outletBranchHeadCellIndex_OBSOLETE);
|
|
|
|
|
|
|
|
if (leafBranchHead &&
|
|
|
|
!leafBranchHead->isCell() &&
|
|
|
|
leafBranchHead->m_ertBranchId != outletResultBranch.m_ertBranchId)
|
|
|
|
{
|
|
|
|
outletResultBranch = wellResFrame.m_wellResultBranches[outletResultBranch.m_outletBranchIndex_OBSOLETE];
|
|
|
|
cellIndexInOutletBranch = outletResultBranch.m_outletBranchHeadCellIndex_OBSOLETE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cellIndexInOutletBranch--;
|
2013-06-21 09:20:11 -05:00
|
|
|
}
|
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
if(cellIndexInOutletBranch >= 0 && cellIndexInOutletBranch < outletResultBranch.m_branchResultPoints.size())
|
|
|
|
{
|
|
|
|
currCell = outletResultBranch.m_branchResultPoints[cellIndexInOutletBranch];
|
|
|
|
}
|
2013-06-21 09:20:11 -05:00
|
|
|
}
|
|
|
|
}
|
2013-06-13 15:12:02 -05:00
|
|
|
}
|
2013-06-21 09:20:11 -05:00
|
|
|
}
|
2013-06-13 15:12:02 -05:00
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
2013-08-26 07:03:01 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Loop over all the grids in the model. If we have connections in one, we will discard
|
|
|
|
// the main grid connections as the well connections are duplicated in the main grid and LGR grids
|
2013-08-26 07:09:25 -05:00
|
|
|
// Verified on 10 k case JJS. But smarter things could be done, like showing the "main grid well" if turning off the LGR's
|
2013-08-26 07:03:01 -05:00
|
|
|
|
|
|
|
bool hasWellConnectionsInLGR = false;
|
2013-08-26 07:09:25 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
for (size_t gridIdx = 1; gridIdx < grids.size(); ++gridIdx)
|
|
|
|
{
|
|
|
|
RigGridBase* lgrGrid = m_eclipseCase->grid(gridIdx);
|
|
|
|
if (well_state_has_grid_connections(ert_well_state, lgrGrid->gridName().data()))
|
|
|
|
{
|
|
|
|
hasWellConnectionsInLGR = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-08-26 07:09:25 -05:00
|
|
|
|
2013-08-26 07:03:01 -05:00
|
|
|
size_t gridNr = hasWellConnectionsInLGR ? 1 : 0;
|
|
|
|
for (; gridNr < grids.size(); ++gridNr)
|
|
|
|
{
|
|
|
|
|
|
|
|
// Wellhead. If several grids have a wellhead definition for this well, we use the last one. (Possibly the innermost LGR)
|
|
|
|
const well_conn_type* ert_wellhead = well_state_iget_wellhead(ert_well_state, static_cast<int>(gridNr));
|
|
|
|
if (ert_wellhead)
|
|
|
|
{
|
|
|
|
wellResFrame.m_wellHead = createWellResultPoint(grids[gridNr], ert_wellhead, -1, -1 );
|
|
|
|
std::cout << "Wellhead YES at timeIdx: " << timeIdx << " wellIdx: " << wellIdx << " Grid: " << gridNr << std::endl;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::cout << "Wellhead NO at timeIdx: " << timeIdx << " wellIdx: " << wellIdx << " Grid: " << gridNr << std::endl;
|
|
|
|
//CVF_ASSERT(0); // This is just a test assert to see if this condition exists in some file.
|
|
|
|
// All the grids does not necessarily have a well head definition. (I think, JJS)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string gridName;
|
|
|
|
if (gridNr == 0)
|
|
|
|
{
|
|
|
|
gridName = ECL_GRID_GLOBAL_GRID;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RigGridBase* rigGrid = m_eclipseCase->grid(gridNr);
|
|
|
|
gridName = rigGrid->gridName();
|
|
|
|
}
|
|
|
|
|
|
|
|
const well_conn_collection_type* connections = well_state_get_grid_connections(ert_well_state, gridName.data());
|
|
|
|
|
|
|
|
// Import all well result cells for all connections
|
|
|
|
if (connections)
|
|
|
|
{
|
|
|
|
int connectionCount = well_conn_collection_get_size(connections);
|
|
|
|
if (connectionCount)
|
|
|
|
{
|
|
|
|
wellResFrame.m_wellResultBranches.push_back(RigWellResultBranch());
|
|
|
|
RigWellResultBranch& wellResultBranch = wellResFrame.m_wellResultBranches.back();
|
|
|
|
|
|
|
|
wellResultBranch.m_branchIndex = 0;
|
|
|
|
wellResultBranch.m_ertBranchId = -1;
|
|
|
|
|
|
|
|
size_t existingCellCount = wellResultBranch.m_branchResultPoints.size();
|
|
|
|
wellResultBranch.m_branchResultPoints.resize(existingCellCount + connectionCount);
|
|
|
|
|
|
|
|
for (int connIdx = 0; connIdx < connectionCount; connIdx++)
|
|
|
|
{
|
|
|
|
well_conn_type* ert_connection = well_conn_collection_iget(connections, connIdx);
|
|
|
|
wellResultBranch.m_branchResultPoints[existingCellCount + connIdx] =
|
|
|
|
createWellResultPoint(grids[gridNr], ert_connection, -1, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
2013-08-26 06:56:42 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
wellResults->computeMappingFromResultTimeIndicesToWellTimeIndices(m_timeSteps);
|
|
|
|
|
|
|
|
wells.push_back(wellResults.p());
|
2013-02-06 06:44:27 -06:00
|
|
|
|
|
|
|
progress.incrementProgress();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
well_info_free(ert_well_info);
|
|
|
|
|
2013-02-27 07:13:37 -06:00
|
|
|
m_eclipseCase->setWellResults(wells);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
2013-01-25 08:20:41 -06:00
|
|
|
|
2013-02-05 03:51:32 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-13 05:50:31 -05:00
|
|
|
QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringList& keywords, const std::vector<size_t>& keywordDataItemCounts,
|
|
|
|
const RigActiveCellInfo* activeCellInfo, const RigActiveCellInfo* fractureActiveCellInfo,
|
|
|
|
PorosityModelResultType matrixOrFracture, size_t timeStepCount) const
|
2013-02-05 03:51:32 -06:00
|
|
|
{
|
2013-02-12 04:15:36 -06:00
|
|
|
CVF_ASSERT(activeCellInfo);
|
|
|
|
|
2013-03-02 03:18:27 -06:00
|
|
|
if (keywords.size() != static_cast<int>(keywordDataItemCounts.size()))
|
2013-02-05 03:51:32 -06:00
|
|
|
{
|
|
|
|
return QStringList();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (matrixOrFracture == RifReaderInterface::FRACTURE_RESULTS)
|
|
|
|
{
|
2013-03-22 03:32:42 -05:00
|
|
|
if (fractureActiveCellInfo->globalActiveCellCount() == 0)
|
2013-02-05 03:51:32 -06:00
|
|
|
{
|
|
|
|
return QStringList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList keywordsWithCorrectNumberOfDataItems;
|
|
|
|
|
|
|
|
for (int i = 0; i < keywords.size(); i++)
|
|
|
|
{
|
|
|
|
QString keyword = keywords[i];
|
|
|
|
size_t keywordDataCount = keywordDataItemCounts[i];
|
|
|
|
|
2013-03-22 03:32:42 -05:00
|
|
|
if (activeCellInfo->globalActiveCellCount() > 0)
|
2013-02-27 04:27:02 -06:00
|
|
|
{
|
2013-03-22 03:32:42 -05:00
|
|
|
size_t timeStepsMatrix = keywordDataItemCounts[i] / activeCellInfo->globalActiveCellCount();
|
|
|
|
size_t timeStepsMatrixRest = keywordDataItemCounts[i] % activeCellInfo->globalActiveCellCount();
|
2013-02-05 03:51:32 -06:00
|
|
|
|
2013-03-22 03:32:42 -05:00
|
|
|
size_t timeStepsMatrixAndFracture = keywordDataItemCounts[i] / (activeCellInfo->globalActiveCellCount() + fractureActiveCellInfo->globalActiveCellCount());
|
|
|
|
size_t timeStepsMatrixAndFractureRest = keywordDataItemCounts[i] % (activeCellInfo->globalActiveCellCount() + fractureActiveCellInfo->globalActiveCellCount());
|
2013-02-05 03:51:32 -06:00
|
|
|
|
2013-02-27 04:27:02 -06:00
|
|
|
if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS)
|
2013-02-05 03:51:32 -06:00
|
|
|
{
|
2013-02-27 04:27:02 -06:00
|
|
|
if (timeStepsMatrixRest == 0 || timeStepsMatrixAndFractureRest == 0)
|
|
|
|
{
|
|
|
|
if (timeStepCount == timeStepsMatrix || timeStepCount == timeStepsMatrixAndFracture)
|
|
|
|
{
|
|
|
|
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (timeStepsMatrixAndFractureRest == 0 && timeStepCount == timeStepsMatrixAndFracture)
|
2013-02-05 03:51:32 -06:00
|
|
|
{
|
|
|
|
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-02-27 04:27:02 -06:00
|
|
|
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
|
2013-02-05 03:51:32 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return keywordsWithCorrectNumberOfDataItems;
|
|
|
|
}
|
|
|
|
|
2013-02-27 04:27:02 -06:00
|
|
|
|
2013-02-05 03:51:32 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel(PorosityModelResultType matrixOrFracture, std::vector<double>* destinationResultValues, const std::vector<double>& sourceResultValues)
|
|
|
|
{
|
2013-03-13 05:50:31 -05:00
|
|
|
RigActiveCellInfo* fracActCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS);
|
2013-02-05 03:51:32 -06:00
|
|
|
|
|
|
|
|
2013-03-22 03:32:42 -05:00
|
|
|
if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS && fracActCellInfo->globalActiveCellCount() == 0)
|
2013-03-13 05:50:31 -05:00
|
|
|
{
|
|
|
|
destinationResultValues->insert(destinationResultValues->end(), sourceResultValues.begin(), sourceResultValues.end());
|
2013-02-05 03:51:32 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-13 05:50:31 -05:00
|
|
|
RigActiveCellInfo* actCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS);
|
|
|
|
|
2013-02-05 03:51:32 -06:00
|
|
|
size_t dataItemCount = 0;
|
|
|
|
size_t sourceStartPosition = 0;
|
|
|
|
|
2013-02-27 07:13:37 -06:00
|
|
|
for (size_t i = 0; i < m_eclipseCase->mainGrid()->gridCount(); i++)
|
2013-02-05 03:51:32 -06:00
|
|
|
{
|
2013-02-12 04:15:36 -06:00
|
|
|
size_t matrixActiveCellCount = 0;
|
|
|
|
size_t fractureActiveCellCount = 0;
|
2013-03-13 05:50:31 -05:00
|
|
|
|
|
|
|
actCellInfo->gridActiveCellCounts(i, matrixActiveCellCount);
|
|
|
|
fracActCellInfo->gridActiveCellCounts(i, fractureActiveCellCount);
|
2013-02-05 03:51:32 -06:00
|
|
|
|
2013-03-13 05:50:31 -05:00
|
|
|
if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS)
|
|
|
|
{
|
|
|
|
destinationResultValues->insert(destinationResultValues->end(),
|
|
|
|
sourceResultValues.begin() + sourceStartPosition,
|
|
|
|
sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
destinationResultValues->insert(destinationResultValues->end(),
|
|
|
|
sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount,
|
|
|
|
sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount + fractureActiveCellCount);
|
|
|
|
}
|
2013-02-05 03:51:32 -06:00
|
|
|
|
|
|
|
sourceStartPosition += (matrixActiveCellCount + fractureActiveCellCount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-27 07:13:37 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-04-22 07:51:47 -05:00
|
|
|
void RifReaderEclipseOutput::openInitFile()
|
2013-02-27 07:13:37 -06:00
|
|
|
{
|
|
|
|
if (m_ecl_init_file)
|
|
|
|
{
|
2013-04-22 07:51:47 -05:00
|
|
|
return;
|
2013-02-27 07:13:37 -06:00
|
|
|
}
|
|
|
|
|
2013-04-10 04:02:10 -05:00
|
|
|
QString initFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_INIT_FILE);
|
2013-02-27 07:13:37 -06:00
|
|
|
if (initFileName.size() > 0)
|
|
|
|
{
|
2013-04-29 06:13:42 -05:00
|
|
|
m_ecl_init_file = ecl_file_open(initFileName.toAscii().data(), ECL_FILE_CLOSE_STREAM);
|
2013-02-27 07:13:37 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-05 06:10:26 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-18 05:40:39 -05:00
|
|
|
std::vector<QDateTime> RifReaderEclipseOutput::timeSteps()
|
2013-03-05 06:10:26 -06:00
|
|
|
{
|
|
|
|
return m_timeSteps;
|
|
|
|
}
|
|
|
|
|
2013-05-21 04:10:59 -05: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 14:03:05 -05:00
|
|
|
grid->addCoarseningBox(i1, i2, j1, j2, k1, k2);
|
2013-05-21 04:10:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|