mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -3,17 +3,17 @@
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "RigReservoirBuilderMock.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigCell.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigSimWellData.h"
|
||||
|
||||
@@ -32,61 +32,64 @@
|
||||
#include <ctime>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigReservoirBuilderMock::RigReservoirBuilderMock()
|
||||
{
|
||||
m_resultCount = 0;
|
||||
m_timeStepCount = 0;
|
||||
m_resultCount = 0;
|
||||
m_timeStepCount = 0;
|
||||
m_gridPointDimensions = cvf::Vec3st::ZERO;
|
||||
m_enableWellData = true;
|
||||
m_enableWellData = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirBuilderMock::setGridPointDimensions(const cvf::Vec3st& gridPointDimensions)
|
||||
void RigReservoirBuilderMock::setGridPointDimensions( const cvf::Vec3st& gridPointDimensions )
|
||||
{
|
||||
m_gridPointDimensions = gridPointDimensions;
|
||||
m_gridPointDimensions = gridPointDimensions;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirBuilderMock::setResultInfo(size_t resultCount, size_t timeStepCount)
|
||||
void RigReservoirBuilderMock::setResultInfo( size_t resultCount, size_t timeStepCount )
|
||||
{
|
||||
m_resultCount = resultCount;
|
||||
m_resultCount = resultCount;
|
||||
m_timeStepCount = timeStepCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirBuilderMock::appendNodes(const cvf::Vec3d& min, const cvf::Vec3d& max, const cvf::Vec3st& cubeDimension, std::vector<cvf::Vec3d>& nodes)
|
||||
void RigReservoirBuilderMock::appendNodes( const cvf::Vec3d& min,
|
||||
const cvf::Vec3d& max,
|
||||
const cvf::Vec3st& cubeDimension,
|
||||
std::vector<cvf::Vec3d>& nodes )
|
||||
{
|
||||
double dx = (max.x() - min.x()) / static_cast<double>(cubeDimension.x());
|
||||
double dy = (max.y() - min.y()) / static_cast<double>(cubeDimension.y());
|
||||
double dz = (max.z() - min.z()) / static_cast<double>(cubeDimension.z());
|
||||
double dx = ( max.x() - min.x() ) / static_cast<double>( cubeDimension.x() );
|
||||
double dy = ( max.y() - min.y() ) / static_cast<double>( cubeDimension.y() );
|
||||
double dz = ( max.z() - min.z() ) / static_cast<double>( cubeDimension.z() );
|
||||
|
||||
double zPos = min.z();
|
||||
|
||||
size_t k;
|
||||
for (k = 0; k < cubeDimension.z(); k++)
|
||||
for ( k = 0; k < cubeDimension.z(); k++ )
|
||||
{
|
||||
double yPos = min.y();
|
||||
|
||||
size_t j;
|
||||
for (j = 0; j < cubeDimension.y(); j++)
|
||||
for ( j = 0; j < cubeDimension.y(); j++ )
|
||||
{
|
||||
double xPos = min.x();
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < cubeDimension.x(); i++)
|
||||
for ( i = 0; i < cubeDimension.x(); i++ )
|
||||
{
|
||||
cvf::Vec3d cornerA(xPos, yPos, zPos);
|
||||
cvf::Vec3d cornerB(xPos + dx, yPos + dy, zPos + dz);
|
||||
cvf::Vec3d cornerA( xPos, yPos, zPos );
|
||||
cvf::Vec3d cornerB( xPos + dx, yPos + dy, zPos + dz );
|
||||
|
||||
appendCubeNodes(cornerA, cornerB, nodes);
|
||||
appendCubeNodes( cornerA, cornerB, nodes );
|
||||
|
||||
xPos += dx;
|
||||
}
|
||||
@@ -98,11 +101,10 @@ void RigReservoirBuilderMock::appendNodes(const cvf::Vec3d& min, const cvf::Vec3
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirBuilderMock::appendCubeNodes(const cvf::Vec3d& min, const cvf::Vec3d& max, std::vector<cvf::Vec3d>& nodes)
|
||||
void RigReservoirBuilderMock::appendCubeNodes( const cvf::Vec3d& min, const cvf::Vec3d& max, std::vector<cvf::Vec3d>& nodes )
|
||||
{
|
||||
//
|
||||
// 7---------6 Faces:
|
||||
@@ -112,45 +114,48 @@ void RigReservoirBuilderMock::appendCubeNodes(const cvf::Vec3d& min, const cvf::
|
||||
// | 3------|--2 *---i 3 right 1, 2, 6, 5
|
||||
// | / | / 4 back 3, 7, 6, 2
|
||||
// |/ |/ 5 left 0, 4, 7, 3
|
||||
// 0---------1
|
||||
// 0---------1
|
||||
|
||||
cvf::Vec3d v0(min.x(), min.y(), min.z());
|
||||
cvf::Vec3d v1(max.x(), min.y(), min.z());
|
||||
cvf::Vec3d v2(max.x(), max.y(), min.z());
|
||||
cvf::Vec3d v3(min.x(), max.y(), min.z());
|
||||
|
||||
cvf::Vec3d v4(min.x(), min.y(), max.z());
|
||||
cvf::Vec3d v5(max.x(), min.y(), max.z());
|
||||
cvf::Vec3d v6(max.x(), max.y(), max.z());
|
||||
cvf::Vec3d v7(min.x(), max.y(), max.z());
|
||||
cvf::Vec3d v0( min.x(), min.y(), min.z() );
|
||||
cvf::Vec3d v1( max.x(), min.y(), min.z() );
|
||||
cvf::Vec3d v2( max.x(), max.y(), min.z() );
|
||||
cvf::Vec3d v3( min.x(), max.y(), min.z() );
|
||||
|
||||
nodes.push_back(v0);
|
||||
nodes.push_back(v1);
|
||||
nodes.push_back(v2);
|
||||
nodes.push_back(v3);
|
||||
nodes.push_back(v4);
|
||||
nodes.push_back(v5);
|
||||
nodes.push_back(v6);
|
||||
nodes.push_back(v7);
|
||||
cvf::Vec3d v4( min.x(), min.y(), max.z() );
|
||||
cvf::Vec3d v5( max.x(), min.y(), max.z() );
|
||||
cvf::Vec3d v6( max.x(), max.y(), max.z() );
|
||||
cvf::Vec3d v7( min.x(), max.y(), max.z() );
|
||||
|
||||
nodes.push_back( v0 );
|
||||
nodes.push_back( v1 );
|
||||
nodes.push_back( v2 );
|
||||
nodes.push_back( v3 );
|
||||
nodes.push_back( v4 );
|
||||
nodes.push_back( v5 );
|
||||
nodes.push_back( v6 );
|
||||
nodes.push_back( v7 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirBuilderMock::appendCells(size_t nodeStartIndex, size_t cellCount, RigGridBase* hostGrid, std::vector<RigCell>& cells)
|
||||
void RigReservoirBuilderMock::appendCells( size_t nodeStartIndex,
|
||||
size_t cellCount,
|
||||
RigGridBase* hostGrid,
|
||||
std::vector<RigCell>& cells )
|
||||
{
|
||||
long long i;
|
||||
|
||||
size_t cellIndexStart = cells.size();
|
||||
cells.resize(cells.size() + cellCount);
|
||||
cells.resize( cells.size() + cellCount );
|
||||
|
||||
#pragma omp parallel for
|
||||
for (i = 0; i < static_cast<long long>(cellCount); i++)
|
||||
for ( i = 0; i < static_cast<long long>( cellCount ); i++ )
|
||||
{
|
||||
RigCell& riCell = cells[cellIndexStart + i];
|
||||
|
||||
riCell.setHostGrid(hostGrid);
|
||||
riCell.setGridLocalCellIndex(i);
|
||||
riCell.setHostGrid( hostGrid );
|
||||
riCell.setGridLocalCellIndex( i );
|
||||
|
||||
riCell.cornerIndices()[0] = nodeStartIndex + i * 8 + 0;
|
||||
riCell.cornerIndices()[1] = nodeStartIndex + i * 8 + 1;
|
||||
@@ -161,27 +166,27 @@ void RigReservoirBuilderMock::appendCells(size_t nodeStartIndex, size_t cellCoun
|
||||
riCell.cornerIndices()[6] = nodeStartIndex + i * 8 + 6;
|
||||
riCell.cornerIndices()[7] = nodeStartIndex + i * 8 + 7;
|
||||
|
||||
riCell.setParentCellIndex(0);
|
||||
riCell.setParentCellIndex( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirBuilderMock::populateReservoir(RigEclipseCaseData* eclipseCase)
|
||||
void RigReservoirBuilderMock::populateReservoir( RigEclipseCaseData* eclipseCase )
|
||||
{
|
||||
std::vector<cvf::Vec3d>& mainGridNodes = eclipseCase->mainGrid()->nodes();
|
||||
appendNodes(m_minWorldCoordinate, m_maxWorldCoordinate, cellDimension(), mainGridNodes);
|
||||
appendNodes( m_minWorldCoordinate, m_maxWorldCoordinate, cellDimension(), mainGridNodes );
|
||||
size_t mainGridNodeCount = mainGridNodes.size();
|
||||
size_t mainGridCellCount = mainGridNodeCount / 8;
|
||||
|
||||
// Must create cells in main grid here, as this information is used when creating LGRs
|
||||
appendCells(0, mainGridCellCount, eclipseCase->mainGrid(), eclipseCase->mainGrid()->globalCellArray());
|
||||
appendCells( 0, mainGridCellCount, eclipseCase->mainGrid(), eclipseCase->mainGrid()->globalCellArray() );
|
||||
|
||||
size_t totalCellCount = mainGridCellCount;
|
||||
|
||||
size_t lgrIdx;
|
||||
for (lgrIdx = 0; lgrIdx < m_localGridRefinements.size(); lgrIdx++)
|
||||
for ( lgrIdx = 0; lgrIdx < m_localGridRefinements.size(); lgrIdx++ )
|
||||
{
|
||||
LocalGridRefinement& lgr = m_localGridRefinements[lgrIdx];
|
||||
|
||||
@@ -189,173 +194,185 @@ void RigReservoirBuilderMock::populateReservoir(RigEclipseCaseData* eclipseCase)
|
||||
std::vector<size_t> mainGridIndicesWithSubGrid;
|
||||
{
|
||||
size_t i;
|
||||
for (i = lgr.m_mainGridMinCellPosition.x(); i <= lgr.m_mainGridMaxCellPosition.x(); i++)
|
||||
for ( i = lgr.m_mainGridMinCellPosition.x(); i <= lgr.m_mainGridMaxCellPosition.x(); i++ )
|
||||
{
|
||||
size_t j;
|
||||
for (j = lgr.m_mainGridMinCellPosition.y(); j <= lgr.m_mainGridMaxCellPosition.y(); j++)
|
||||
for ( j = lgr.m_mainGridMinCellPosition.y(); j <= lgr.m_mainGridMaxCellPosition.y(); j++ )
|
||||
{
|
||||
size_t k;
|
||||
for (k = lgr.m_mainGridMinCellPosition.z(); k <= lgr.m_mainGridMaxCellPosition.z(); k++)
|
||||
for ( k = lgr.m_mainGridMinCellPosition.z(); k <= lgr.m_mainGridMaxCellPosition.z(); k++ )
|
||||
{
|
||||
mainGridIndicesWithSubGrid.push_back(cellIndexFromIJK(i, j, k));
|
||||
mainGridIndicesWithSubGrid.push_back( cellIndexFromIJK( i, j, k ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create local grid and set local grid dimensions
|
||||
RigLocalGrid* localGrid = new RigLocalGrid(eclipseCase->mainGrid());
|
||||
localGrid->setGridId(1);
|
||||
localGrid->setGridName("LGR_1");
|
||||
eclipseCase->mainGrid()->addLocalGrid(localGrid);
|
||||
localGrid->setParentGrid(eclipseCase->mainGrid());
|
||||
|
||||
localGrid->setIndexToStartOfCells(mainGridNodes.size() / 8);
|
||||
cvf::Vec3st gridPointDimensions(
|
||||
lgr.m_singleCellRefinementFactors.x() * (lgr.m_mainGridMaxCellPosition.x() - lgr.m_mainGridMinCellPosition.x() + 1) + 1,
|
||||
lgr.m_singleCellRefinementFactors.y() * (lgr.m_mainGridMaxCellPosition.y() - lgr.m_mainGridMinCellPosition.y() + 1) + 1,
|
||||
lgr.m_singleCellRefinementFactors.z() * (lgr.m_mainGridMaxCellPosition.z() - lgr.m_mainGridMinCellPosition.z() + 1) + 1);
|
||||
localGrid->setGridPointDimensions(gridPointDimensions);
|
||||
RigLocalGrid* localGrid = new RigLocalGrid( eclipseCase->mainGrid() );
|
||||
localGrid->setGridId( 1 );
|
||||
localGrid->setGridName( "LGR_1" );
|
||||
eclipseCase->mainGrid()->addLocalGrid( localGrid );
|
||||
localGrid->setParentGrid( eclipseCase->mainGrid() );
|
||||
|
||||
localGrid->setIndexToStartOfCells( mainGridNodes.size() / 8 );
|
||||
cvf::Vec3st
|
||||
gridPointDimensions( lgr.m_singleCellRefinementFactors.x() *
|
||||
( lgr.m_mainGridMaxCellPosition.x() - lgr.m_mainGridMinCellPosition.x() + 1 ) +
|
||||
1,
|
||||
lgr.m_singleCellRefinementFactors.y() *
|
||||
( lgr.m_mainGridMaxCellPosition.y() - lgr.m_mainGridMinCellPosition.y() + 1 ) +
|
||||
1,
|
||||
lgr.m_singleCellRefinementFactors.z() *
|
||||
( lgr.m_mainGridMaxCellPosition.z() - lgr.m_mainGridMinCellPosition.z() + 1 ) +
|
||||
1 );
|
||||
localGrid->setGridPointDimensions( gridPointDimensions );
|
||||
|
||||
cvf::BoundingBox bb;
|
||||
size_t cellIdx;
|
||||
for (cellIdx = 0; cellIdx < mainGridIndicesWithSubGrid.size(); cellIdx++)
|
||||
size_t cellIdx;
|
||||
for ( cellIdx = 0; cellIdx < mainGridIndicesWithSubGrid.size(); cellIdx++ )
|
||||
{
|
||||
RigCell& cell = eclipseCase->mainGrid()->globalCellArray()[mainGridIndicesWithSubGrid[cellIdx]];
|
||||
|
||||
|
||||
std::array<size_t, 8>& indices = cell.cornerIndices();
|
||||
int nodeIdx;
|
||||
for (nodeIdx = 0; nodeIdx < 8; nodeIdx++)
|
||||
int nodeIdx;
|
||||
for ( nodeIdx = 0; nodeIdx < 8; nodeIdx++ )
|
||||
{
|
||||
bb.add(eclipseCase->mainGrid()->nodes()[indices[nodeIdx]]);
|
||||
bb.add( eclipseCase->mainGrid()->nodes()[indices[nodeIdx]] );
|
||||
}
|
||||
// Deactivate cell in main grid
|
||||
cell.setSubGrid(localGrid);
|
||||
cell.setSubGrid( localGrid );
|
||||
}
|
||||
|
||||
cvf::Vec3st lgrCellDimensions = gridPointDimensions - cvf::Vec3st(1, 1, 1);
|
||||
appendNodes(bb.min(), bb.max(), lgrCellDimensions, mainGridNodes);
|
||||
cvf::Vec3st lgrCellDimensions = gridPointDimensions - cvf::Vec3st( 1, 1, 1 );
|
||||
appendNodes( bb.min(), bb.max(), lgrCellDimensions, mainGridNodes );
|
||||
|
||||
size_t subGridCellCount = (mainGridNodes.size() / 8) - totalCellCount;
|
||||
appendCells(totalCellCount*8, subGridCellCount, localGrid, eclipseCase->mainGrid()->globalCellArray());
|
||||
size_t subGridCellCount = ( mainGridNodes.size() / 8 ) - totalCellCount;
|
||||
appendCells( totalCellCount * 8, subGridCellCount, localGrid, eclipseCase->mainGrid()->globalCellArray() );
|
||||
totalCellCount += subGridCellCount;
|
||||
}
|
||||
|
||||
eclipseCase->mainGrid()->setGridPointDimensions(m_gridPointDimensions);
|
||||
eclipseCase->mainGrid()->setGridPointDimensions( m_gridPointDimensions );
|
||||
|
||||
if (m_enableWellData)
|
||||
if ( m_enableWellData )
|
||||
{
|
||||
addWellData(eclipseCase, eclipseCase->mainGrid());
|
||||
addWellData( eclipseCase, eclipseCase->mainGrid() );
|
||||
}
|
||||
|
||||
addFaults(eclipseCase);
|
||||
addFaults( eclipseCase );
|
||||
|
||||
// Set all cells active
|
||||
RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL);
|
||||
activeCellInfo->setReservoirCellCount(eclipseCase->mainGrid()->globalCellArray().size());
|
||||
for (size_t i = 0; i < eclipseCase->mainGrid()->globalCellArray().size(); i++)
|
||||
RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo( RiaDefines::MATRIX_MODEL );
|
||||
activeCellInfo->setReservoirCellCount( eclipseCase->mainGrid()->globalCellArray().size() );
|
||||
for ( size_t i = 0; i < eclipseCase->mainGrid()->globalCellArray().size(); i++ )
|
||||
{
|
||||
activeCellInfo->setCellResultIndex(i, i);
|
||||
activeCellInfo->setCellResultIndex( i, i );
|
||||
}
|
||||
|
||||
activeCellInfo->setGridCount(1);
|
||||
activeCellInfo->setGridActiveCellCounts(0, eclipseCase->mainGrid()->globalCellArray().size());
|
||||
activeCellInfo->setGridCount( 1 );
|
||||
activeCellInfo->setGridActiveCellCounts( 0, eclipseCase->mainGrid()->globalCellArray().size() );
|
||||
activeCellInfo->computeDerivedData();
|
||||
|
||||
// Add grid coarsening for main grid
|
||||
if (cellDimension().x() > 4 &&
|
||||
cellDimension().y() > 5 &&
|
||||
cellDimension().z() > 6)
|
||||
if ( cellDimension().x() > 4 && cellDimension().y() > 5 && cellDimension().z() > 6 )
|
||||
{
|
||||
eclipseCase->mainGrid()->addCoarseningBox(1, 2, 1, 3, 1, 4);
|
||||
eclipseCase->mainGrid()->addCoarseningBox(3, 4, 4, 5, 5, 6);
|
||||
eclipseCase->mainGrid()->addCoarseningBox( 1, 2, 1, 3, 1, 4 );
|
||||
eclipseCase->mainGrid()->addCoarseningBox( 3, 4, 4, 5, 5, 6 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirBuilderMock::addLocalGridRefinement(const cvf::Vec3st& mainGridStart, const cvf::Vec3st& mainGridEnd, const cvf::Vec3st& refinementFactors)
|
||||
void RigReservoirBuilderMock::addLocalGridRefinement( const cvf::Vec3st& mainGridStart,
|
||||
const cvf::Vec3st& mainGridEnd,
|
||||
const cvf::Vec3st& refinementFactors )
|
||||
{
|
||||
m_localGridRefinements.push_back(LocalGridRefinement(mainGridStart, mainGridEnd, refinementFactors));
|
||||
m_localGridRefinements.push_back( LocalGridRefinement( mainGridStart, mainGridEnd, refinementFactors ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirBuilderMock::setWorldCoordinates(cvf::Vec3d minWorldCoordinate, cvf::Vec3d maxWorldCoordinate)
|
||||
void RigReservoirBuilderMock::setWorldCoordinates( cvf::Vec3d minWorldCoordinate, cvf::Vec3d maxWorldCoordinate )
|
||||
{
|
||||
m_minWorldCoordinate = minWorldCoordinate;
|
||||
m_maxWorldCoordinate = maxWorldCoordinate;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigReservoirBuilderMock::inputProperty(RigEclipseCaseData* eclipseCase, const QString& propertyName, std::vector<double>* values)
|
||||
bool RigReservoirBuilderMock::inputProperty( RigEclipseCaseData* eclipseCase,
|
||||
const QString& propertyName,
|
||||
std::vector<double>* values )
|
||||
{
|
||||
size_t k;
|
||||
|
||||
/* initialize random seed: */
|
||||
srand ( time(nullptr) );
|
||||
srand( time( nullptr ) );
|
||||
|
||||
/* generate secret number: */
|
||||
int iSecret = rand() % 20 + 1;
|
||||
|
||||
for (k = 0; k < eclipseCase->mainGrid()->globalCellArray().size(); k++)
|
||||
for ( k = 0; k < eclipseCase->mainGrid()->globalCellArray().size(); k++ )
|
||||
{
|
||||
values->push_back(k * iSecret);
|
||||
values->push_back( k * iSecret );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigReservoirBuilderMock::staticResult(RigEclipseCaseData* eclipseCase, const QString& result, std::vector<double>* values)
|
||||
bool RigReservoirBuilderMock::staticResult( RigEclipseCaseData* eclipseCase,
|
||||
const QString& result,
|
||||
std::vector<double>* values )
|
||||
{
|
||||
values->resize(eclipseCase->mainGrid()->globalCellArray().size());
|
||||
values->resize( eclipseCase->mainGrid()->globalCellArray().size() );
|
||||
|
||||
#pragma omp parallel for
|
||||
for (long long k = 0; k < static_cast<long long>(eclipseCase->mainGrid()->globalCellArray().size()); k++)
|
||||
for ( long long k = 0; k < static_cast<long long>( eclipseCase->mainGrid()->globalCellArray().size() ); k++ )
|
||||
{
|
||||
values->at(k) = (k * 2) % eclipseCase->mainGrid()->globalCellArray().size();
|
||||
values->at( k ) = ( k * 2 ) % eclipseCase->mainGrid()->globalCellArray().size();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigReservoirBuilderMock::dynamicResult(RigEclipseCaseData* eclipseCase, const QString& result, size_t stepIndex, std::vector<double>* values)
|
||||
bool RigReservoirBuilderMock::dynamicResult( RigEclipseCaseData* eclipseCase,
|
||||
const QString& result,
|
||||
size_t stepIndex,
|
||||
std::vector<double>* values )
|
||||
{
|
||||
int resultIndex = 1;
|
||||
|
||||
QRegExp rx("[0-9]{1,2}"); // Find number 0-99
|
||||
int digitPos = rx.indexIn(result);
|
||||
if (digitPos > -1)
|
||||
QRegExp rx( "[0-9]{1,2}" ); // Find number 0-99
|
||||
int digitPos = rx.indexIn( result );
|
||||
if ( digitPos > -1 )
|
||||
{
|
||||
resultIndex = rx.cap(0).toInt() + 1;
|
||||
resultIndex = rx.cap( 0 ).toInt() + 1;
|
||||
}
|
||||
|
||||
double scaleValue = 1.0 + resultIndex * 0.1;
|
||||
double scaleValue = 1.0 + resultIndex * 0.1;
|
||||
double offsetValue = 100 * resultIndex;
|
||||
|
||||
values->resize(eclipseCase->mainGrid()->globalCellArray().size());
|
||||
values->resize( eclipseCase->mainGrid()->globalCellArray().size() );
|
||||
|
||||
#pragma omp parallel for
|
||||
for (long long k = 0; k < static_cast<long long>(eclipseCase->mainGrid()->globalCellArray().size()); k++)
|
||||
for ( long long k = 0; k < static_cast<long long>( eclipseCase->mainGrid()->globalCellArray().size() ); k++ )
|
||||
{
|
||||
double val = offsetValue + scaleValue * ( (stepIndex * 1000 + k) % eclipseCase->mainGrid()->globalCellArray().size() );
|
||||
values->at(k) = val;
|
||||
double val = offsetValue +
|
||||
scaleValue * ( ( stepIndex * 1000 + k ) % eclipseCase->mainGrid()->globalCellArray().size() );
|
||||
values->at( k ) = val;
|
||||
}
|
||||
|
||||
// Set result size to zero for some timesteps
|
||||
if ((stepIndex + 1) % 3 == 0)
|
||||
if ( ( stepIndex + 1 ) % 3 == 0 )
|
||||
{
|
||||
values->clear();
|
||||
}
|
||||
@@ -364,60 +381,59 @@ bool RigReservoirBuilderMock::dynamicResult(RigEclipseCaseData* eclipseCase, con
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirBuilderMock::addWellData(RigEclipseCaseData* eclipseCase, RigGridBase* grid)
|
||||
void RigReservoirBuilderMock::addWellData( RigEclipseCaseData* eclipseCase, RigGridBase* grid )
|
||||
{
|
||||
CVF_ASSERT(eclipseCase);
|
||||
CVF_ASSERT(grid);
|
||||
CVF_ASSERT( eclipseCase );
|
||||
CVF_ASSERT( grid );
|
||||
|
||||
cvf::Vec3st dim = grid->gridPointDimensions();
|
||||
|
||||
cvf::Collection<RigSimWellData> wells;
|
||||
|
||||
int wellIdx;
|
||||
for (wellIdx = 0; wellIdx < 1; wellIdx++)
|
||||
for ( wellIdx = 0; wellIdx < 1; wellIdx++ )
|
||||
{
|
||||
cvf::ref<RigSimWellData> wellCellsTimeHistory = new RigSimWellData;
|
||||
wellCellsTimeHistory->m_wellName = QString("Well %1").arg(wellIdx);
|
||||
wellCellsTimeHistory->m_wellName = QString( "Well %1" ).arg( wellIdx );
|
||||
|
||||
wellCellsTimeHistory->m_wellCellsTimeSteps.resize(m_timeStepCount);
|
||||
wellCellsTimeHistory->m_wellCellsTimeSteps.resize( m_timeStepCount );
|
||||
|
||||
size_t timeIdx;
|
||||
for (timeIdx = 0; timeIdx < m_timeStepCount; timeIdx++)
|
||||
for ( timeIdx = 0; timeIdx < m_timeStepCount; timeIdx++ )
|
||||
{
|
||||
RigWellResultFrame& wellCells = wellCellsTimeHistory->m_wellCellsTimeSteps[timeIdx];
|
||||
|
||||
wellCells.m_productionType = RigWellResultFrame::PRODUCER;
|
||||
wellCells.m_isOpen = true;
|
||||
wellCells.m_isOpen = true;
|
||||
|
||||
wellCells.m_wellHead.m_gridIndex = 0;
|
||||
wellCells.m_wellHead.m_gridCellIndex = grid->cellIndexFromIJK(1, 0, 0);
|
||||
wellCells.m_wellHead.m_gridIndex = 0;
|
||||
wellCells.m_wellHead.m_gridCellIndex = grid->cellIndexFromIJK( 1, 0, 0 );
|
||||
|
||||
// Connections
|
||||
// int connectionCount = CVF_MIN(dim.x(), CVF_MIN(dim.y(), dim.z())) - 2;
|
||||
// int connectionCount = CVF_MIN(dim.x(), CVF_MIN(dim.y(), dim.z())) - 2;
|
||||
size_t connectionCount = dim.z() - 2;
|
||||
if (connectionCount > 0)
|
||||
if ( connectionCount > 0 )
|
||||
{
|
||||
// Only main grid supported by now. Must be taken care of when LGRs are supported
|
||||
wellCells.m_wellResultBranches.resize(1);
|
||||
wellCells.m_wellResultBranches.resize( 1 );
|
||||
RigWellResultBranch& wellSegment = wellCells.m_wellResultBranches[0];
|
||||
|
||||
size_t connIdx;
|
||||
for (connIdx = 0; connIdx < connectionCount; connIdx++)
|
||||
for ( connIdx = 0; connIdx < connectionCount; connIdx++ )
|
||||
{
|
||||
if (connIdx == (size_t)(connectionCount/4)) continue;
|
||||
if ( connIdx == ( size_t )( connectionCount / 4 ) ) continue;
|
||||
|
||||
RigWellResultPoint data;
|
||||
data.m_gridIndex = 0;
|
||||
|
||||
if (connIdx < dim.y()-2)
|
||||
data.m_gridCellIndex = grid->cellIndexFromIJK(1 , 1 + connIdx , 1 + connIdx);
|
||||
if ( connIdx < dim.y() - 2 )
|
||||
data.m_gridCellIndex = grid->cellIndexFromIJK( 1, 1 + connIdx, 1 + connIdx );
|
||||
else
|
||||
data.m_gridCellIndex = grid->cellIndexFromIJK(1 , dim.y()-2 , 1 + connIdx);
|
||||
|
||||
data.m_gridCellIndex = grid->cellIndexFromIJK( 1, dim.y() - 2, 1 + connIdx );
|
||||
|
||||
if (connIdx < connectionCount / 2)
|
||||
if ( connIdx < connectionCount / 2 )
|
||||
{
|
||||
data.m_isOpen = true;
|
||||
}
|
||||
@@ -426,37 +442,39 @@ void RigReservoirBuilderMock::addWellData(RigEclipseCaseData* eclipseCase, RigGr
|
||||
data.m_isOpen = false;
|
||||
}
|
||||
|
||||
if (wellSegment.m_branchResultPoints.size() == 0 || wellSegment.m_branchResultPoints.back().m_gridCellIndex != data.m_gridCellIndex)
|
||||
if ( wellSegment.m_branchResultPoints.size() == 0 ||
|
||||
wellSegment.m_branchResultPoints.back().m_gridCellIndex != data.m_gridCellIndex )
|
||||
{
|
||||
wellSegment.m_branchResultPoints.push_back(data);
|
||||
wellSegment.m_branchResultPoints.push_back( data );
|
||||
|
||||
if (connIdx == connectionCount / 2 )
|
||||
if ( connIdx == connectionCount / 2 )
|
||||
{
|
||||
RigWellResultPoint deadEndData = data;
|
||||
deadEndData.m_gridCellIndex = data.m_gridCellIndex + 1;
|
||||
deadEndData.m_isOpen = true;
|
||||
deadEndData.m_gridCellIndex = data.m_gridCellIndex + 1;
|
||||
deadEndData.m_isOpen = true;
|
||||
|
||||
RigWellResultPoint deadEndData1 = data;
|
||||
deadEndData1.m_gridCellIndex = data.m_gridCellIndex + 2;
|
||||
deadEndData1.m_isOpen = false;
|
||||
deadEndData1.m_gridCellIndex = data.m_gridCellIndex + 2;
|
||||
deadEndData1.m_isOpen = false;
|
||||
|
||||
wellSegment.m_branchResultPoints.push_back(deadEndData);
|
||||
wellSegment.m_branchResultPoints.push_back(deadEndData1);
|
||||
wellSegment.m_branchResultPoints.push_back( deadEndData );
|
||||
wellSegment.m_branchResultPoints.push_back( deadEndData1 );
|
||||
|
||||
wellSegment.m_branchResultPoints.push_back(deadEndData);
|
||||
wellSegment.m_branchResultPoints.push_back( deadEndData );
|
||||
|
||||
data.m_isOpen = true;
|
||||
wellSegment.m_branchResultPoints.push_back(data);
|
||||
wellSegment.m_branchResultPoints.push_back( data );
|
||||
}
|
||||
}
|
||||
|
||||
if (connIdx < dim.y()-2)
|
||||
if ( connIdx < dim.y() - 2 )
|
||||
{
|
||||
data.m_gridCellIndex = grid->cellIndexFromIJK(1 , 1 + connIdx , 2 + connIdx);
|
||||
data.m_gridCellIndex = grid->cellIndexFromIJK( 1, 1 + connIdx, 2 + connIdx );
|
||||
|
||||
if (wellSegment.m_branchResultPoints.size() == 0 || wellSegment.m_branchResultPoints.back().m_gridCellIndex != data.m_gridCellIndex)
|
||||
if ( wellSegment.m_branchResultPoints.size() == 0 ||
|
||||
wellSegment.m_branchResultPoints.back().m_gridCellIndex != data.m_gridCellIndex )
|
||||
{
|
||||
wellSegment.m_branchResultPoints.push_back(data);
|
||||
wellSegment.m_branchResultPoints.push_back( data );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -466,56 +484,56 @@ void RigReservoirBuilderMock::addWellData(RigEclipseCaseData* eclipseCase, RigGr
|
||||
// Create a mapping from result timestep indices to well timestep indices.
|
||||
// Use one-to-one mapping for easy use
|
||||
std::vector<size_t> map;
|
||||
for (timeIdx = 0; timeIdx < m_timeStepCount; timeIdx++)
|
||||
for ( timeIdx = 0; timeIdx < m_timeStepCount; timeIdx++ )
|
||||
{
|
||||
map.push_back(timeIdx);
|
||||
map.push_back( timeIdx );
|
||||
}
|
||||
wellCellsTimeHistory->m_resultTimeStepIndexToWellTimeStepIndex = map;
|
||||
|
||||
wells.push_back(wellCellsTimeHistory.p());
|
||||
wells.push_back( wellCellsTimeHistory.p() );
|
||||
}
|
||||
|
||||
eclipseCase->setSimWellData(wells);
|
||||
eclipseCase->setSimWellData( wells );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirBuilderMock::addFaults(RigEclipseCaseData* eclipseCase)
|
||||
void RigReservoirBuilderMock::addFaults( RigEclipseCaseData* eclipseCase )
|
||||
{
|
||||
if (!eclipseCase) return;
|
||||
if ( !eclipseCase ) return;
|
||||
|
||||
RigMainGrid* grid = eclipseCase->mainGrid();
|
||||
if (!grid) return;
|
||||
if ( !grid ) return;
|
||||
|
||||
cvf::Collection<RigFault> faults;
|
||||
|
||||
{
|
||||
cvf::ref<RigFault> fault = new RigFault;
|
||||
fault->setName("Fault A");
|
||||
|
||||
fault->setName( "Fault A" );
|
||||
|
||||
cvf::Vec3st min = cvf::Vec3st::ZERO;
|
||||
cvf::Vec3st max(0, 0, cellDimension().z() - 2);
|
||||
|
||||
if (cellDimension().x() > 5)
|
||||
cvf::Vec3st max( 0, 0, cellDimension().z() - 2 );
|
||||
|
||||
if ( cellDimension().x() > 5 )
|
||||
{
|
||||
min.x() = cellDimension().x() / 2;
|
||||
max.x() = min.x() + 2;
|
||||
}
|
||||
|
||||
if (cellDimension().y() > 5)
|
||||
|
||||
if ( cellDimension().y() > 5 )
|
||||
{
|
||||
min.y() = cellDimension().y() / 2;
|
||||
max.y() = cellDimension().y() / 2;
|
||||
}
|
||||
|
||||
cvf::CellRange cellRange(min, max);
|
||||
cvf::CellRange cellRange( min, max );
|
||||
|
||||
fault->addCellRangeForFace(cvf::StructGridInterface::POS_I, cellRange);
|
||||
faults.push_back(fault.p());
|
||||
fault->addCellRangeForFace( cvf::StructGridInterface::POS_I, cellRange );
|
||||
faults.push_back( fault.p() );
|
||||
}
|
||||
|
||||
grid->setFaults(faults);
|
||||
grid->setFaults( faults );
|
||||
|
||||
// NNCs
|
||||
std::vector<RigConnection>& nncConnections = grid->nncData()->connections();
|
||||
@@ -523,12 +541,12 @@ void RigReservoirBuilderMock::addFaults(RigEclipseCaseData* eclipseCase)
|
||||
size_t i1 = 2;
|
||||
size_t j1 = 2;
|
||||
size_t k1 = 3;
|
||||
|
||||
|
||||
size_t i2 = 2;
|
||||
size_t j2 = 3;
|
||||
size_t k2 = 4;
|
||||
|
||||
addNnc(grid, i1, j1, k1, i2, j2, k2, nncConnections);
|
||||
addNnc( grid, i1, j1, k1, i2, j2, k2, nncConnections );
|
||||
}
|
||||
|
||||
{
|
||||
@@ -540,37 +558,43 @@ void RigReservoirBuilderMock::addFaults(RigEclipseCaseData* eclipseCase)
|
||||
size_t j2 = 1;
|
||||
size_t k2 = 4;
|
||||
|
||||
addNnc(grid, i1, j1, k1, i2, j2, k2, nncConnections);
|
||||
addNnc( grid, i1, j1, k1, i2, j2, k2, nncConnections );
|
||||
}
|
||||
|
||||
std::vector<double>& tranVals = grid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameCombTrans());
|
||||
for (size_t cIdx = 0; cIdx < tranVals.size(); ++cIdx)
|
||||
std::vector<double>& tranVals = grid->nncData()->makeStaticConnectionScalarResult(
|
||||
RigNNCData::propertyNameCombTrans() );
|
||||
for ( size_t cIdx = 0; cIdx < tranVals.size(); ++cIdx )
|
||||
{
|
||||
tranVals[cIdx] = 0.2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirBuilderMock::enableWellData(bool enableWellData)
|
||||
void RigReservoirBuilderMock::enableWellData( bool enableWellData )
|
||||
{
|
||||
m_enableWellData = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirBuilderMock::addNnc(RigMainGrid* grid, size_t i1, size_t j1, size_t k1, size_t i2, size_t j2, size_t k2, std::vector<RigConnection> &nncConnections)
|
||||
void RigReservoirBuilderMock::addNnc( RigMainGrid* grid,
|
||||
size_t i1,
|
||||
size_t j1,
|
||||
size_t k1,
|
||||
size_t i2,
|
||||
size_t j2,
|
||||
size_t k2,
|
||||
std::vector<RigConnection>& nncConnections )
|
||||
{
|
||||
size_t c1GlobalIndex = grid->cellIndexFromIJK(i1, j1, k1);
|
||||
size_t c2GlobalIndex = grid->cellIndexFromIJK(i2, j2, k2);
|
||||
size_t c1GlobalIndex = grid->cellIndexFromIJK( i1, j1, k1 );
|
||||
size_t c2GlobalIndex = grid->cellIndexFromIJK( i2, j2, k2 );
|
||||
|
||||
RigConnection conn;
|
||||
conn.m_c1GlobIdx = c1GlobalIndex;
|
||||
conn.m_c2GlobIdx = c2GlobalIndex;
|
||||
|
||||
nncConnections.push_back(conn);
|
||||
nncConnections.push_back( conn );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user