mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improved simulation well visualization
* Move members to private in RigWellResultPoint * Create simulation well path geometry using well topology * Add separate MSW well pipe centerline computations * Review comments --------- Co-authored-by: magnesj <magnesj@users.noreply.github.com>
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#include "RigCell.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigSimWellData.h"
|
||||
#include "RigSimulationWellCenterLineCalculator.h"
|
||||
#include "RigWellPath.h"
|
||||
#include "RigWellResultPoint.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
@@ -30,7 +32,6 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimSimWellInView.h"
|
||||
|
||||
#include "RigWellPath.h"
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimSimWellFracture, "SimWellFracture" );
|
||||
@@ -344,14 +345,10 @@ void RimSimWellFracture::computeSimWellBranchCenterLines()
|
||||
this->firstAncestorOrThisOfType( rimWell );
|
||||
CVF_ASSERT( rimWell );
|
||||
|
||||
std::vector<std::vector<cvf::Vec3d>> pipeBranchesCLCoords;
|
||||
std::vector<std::vector<RigWellResultPoint>> pipeBranchesCellIds;
|
||||
|
||||
rimWell->calculateWellPipeStaticCenterLine( pipeBranchesCLCoords, pipeBranchesCellIds );
|
||||
|
||||
for ( const auto& branch : pipeBranchesCLCoords )
|
||||
const auto simWellBranches = RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline( rimWell );
|
||||
for ( const auto& [coords, wellCells] : simWellBranches )
|
||||
{
|
||||
RigSimulationWellCoordsAndMD wellPathWithMD( branch );
|
||||
RigSimulationWellCoordsAndMD wellPathWithMD( coords );
|
||||
|
||||
m_branchCenterLines.push_back( wellPathWithMD );
|
||||
}
|
||||
|
||||
@@ -191,11 +191,11 @@ std::map<std::string, std::vector<int>> RimFlowDiagSolution::allTracerActiveCell
|
||||
{
|
||||
for ( const RigWellResultPoint& wrp : wBr.m_branchResultPoints )
|
||||
{
|
||||
if ( wrp.isValid() && wrp.m_isOpen &&
|
||||
if ( wrp.isValid() && wrp.isOpen() &&
|
||||
( ( useInjectors && wrp.flowRate() < 0.0 ) || ( !useInjectors && wrp.flowRate() > 0.0 ) ) )
|
||||
{
|
||||
RigGridBase* grid = mainGrid->gridByIndex( wrp.m_gridIndex );
|
||||
size_t reservoirCellIndex = grid->reservoirCellIndex( wrp.m_gridCellIndex );
|
||||
RigGridBase* grid = mainGrid->gridByIndex( wrp.gridIndex() );
|
||||
size_t reservoirCellIndex = grid->reservoirCellIndex( wrp.cellIndex() );
|
||||
|
||||
int cellActiveIndex = static_cast<int>( activeCellInfo->cellResultIndex( reservoirCellIndex ) );
|
||||
|
||||
|
||||
@@ -454,18 +454,16 @@ RimWellAllocationOverTimeCollection RimWellAllocationOverTimePlot::createWellAll
|
||||
continue;
|
||||
}
|
||||
|
||||
std::vector<std::vector<cvf::Vec3d>> pipeBranchesCLCoords;
|
||||
std::vector<std::vector<RigWellResultPoint>> pipeBranchesCellIds;
|
||||
std::map<QString, const std::vector<double>*> tracerFractionCellValues =
|
||||
RimWellAllocationTools::findOrCreateRelevantTracerCellFractions( simWellData, m_flowDiagSolution, i );
|
||||
|
||||
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame( m_case->eclipseCaseData(),
|
||||
simWellData,
|
||||
i,
|
||||
branchDetection,
|
||||
true,
|
||||
pipeBranchesCLCoords,
|
||||
pipeBranchesCellIds );
|
||||
auto simWellBranches = RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineForTimeStep( m_case->eclipseCaseData(),
|
||||
simWellData,
|
||||
i,
|
||||
branchDetection,
|
||||
true );
|
||||
|
||||
const auto& [pipeBranchesCLCoords, pipeBranchesCellIds] = RigSimulationWellCenterLineCalculator::extractBranchData( simWellBranches );
|
||||
|
||||
if ( tracerFractionCellValues.size() )
|
||||
{
|
||||
|
||||
@@ -246,16 +246,12 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
if ( !simWellData ) return;
|
||||
|
||||
// Set up the Accumulated Well Flow Calculator
|
||||
std::vector<std::vector<cvf::Vec3d>> pipeBranchesCLCoords;
|
||||
std::vector<std::vector<RigWellResultPoint>> pipeBranchesCellIds;
|
||||
|
||||
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame( m_case->eclipseCaseData(),
|
||||
simWellData,
|
||||
m_timeStep,
|
||||
m_branchDetection,
|
||||
true,
|
||||
pipeBranchesCLCoords,
|
||||
pipeBranchesCellIds );
|
||||
const auto simWellBranches = RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineForTimeStep( m_case->eclipseCaseData(),
|
||||
simWellData,
|
||||
m_timeStep,
|
||||
m_branchDetection,
|
||||
true );
|
||||
const auto& [pipeBranchesCLCoords, pipeBranchesCellIds] = RigSimulationWellCenterLineCalculator::extractBranchData( simWellBranches );
|
||||
|
||||
std::map<QString, const std::vector<double>*> tracerFractionCellValues =
|
||||
RimWellAllocationTools::findOrCreateRelevantTracerCellFractions( simWellData, m_flowDiagSolution, m_timeStep );
|
||||
|
||||
@@ -353,15 +353,14 @@ public:
|
||||
m_pipeBranchMeasuredDepths.push_back( intersections[wpExIdx].endMD );
|
||||
|
||||
RigWellResultPoint resPoint;
|
||||
resPoint.m_isOpen = true;
|
||||
resPoint.m_gridIndex = 0; // Always main grid
|
||||
resPoint.m_gridCellIndex = globCellIdx; // Shortcut, since we only have
|
||||
// main grid results from RFT
|
||||
resPoint.setIsOpen( true );
|
||||
resPoint.setGridIndex( 0 ); // Always main grid
|
||||
resPoint.setGridCellIndex( globCellIdx ); // Shortcut, since we only have
|
||||
// main grid results from RFT
|
||||
|
||||
resPoint.m_gasRate = RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents( eclCase->eclipseCaseData()->unitsType(),
|
||||
gasRates[it->second] );
|
||||
resPoint.m_oilRate = oilRates[it->second];
|
||||
resPoint.m_waterRate = watRates[it->second];
|
||||
const double adjustedGasRate =
|
||||
RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents( eclCase->eclipseCaseData()->unitsType(), gasRates[it->second] );
|
||||
resPoint.setFlowData( -1.0, oilRates[it->second], adjustedGasRate, watRates[it->second] );
|
||||
|
||||
m_pipeBranchWellResultPoints.push_back( resPoint );
|
||||
|
||||
@@ -415,8 +414,8 @@ public:
|
||||
const std::vector<RigWellResultPoint>& branchResPoints = resFrame->m_wellResultBranches[brIdx].m_branchResultPoints;
|
||||
for ( size_t wrpIdx = 0; wrpIdx < branchResPoints.size(); wrpIdx++ )
|
||||
{
|
||||
const RigGridBase* grid = mainGrid->gridByIndex( branchResPoints[wrpIdx].m_gridIndex );
|
||||
size_t globalCellIndex = grid->reservoirCellIndex( branchResPoints[wrpIdx].m_gridCellIndex );
|
||||
const RigGridBase* grid = mainGrid->gridByIndex( branchResPoints[wrpIdx].gridIndex() );
|
||||
size_t globalCellIndex = grid->reservoirCellIndex( branchResPoints[wrpIdx].cellIndex() );
|
||||
|
||||
globCellIdxToIdxInSimWellBranch[globalCellIndex] = std::make_pair( brIdx, wrpIdx );
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ const RigVirtualPerforationTransmissibilities* RimEclipseCase::computeAndGetVirt
|
||||
if ( r.isCell() )
|
||||
{
|
||||
RigCompletionData compData( wellRes->m_wellName,
|
||||
RigCompletionDataGridCell( r.m_gridCellIndex, rigEclipseCase->mainGrid() ),
|
||||
RigCompletionDataGridCell( r.cellIndex(), rigEclipseCase->mainGrid() ),
|
||||
0 );
|
||||
compData.setTransmissibility( r.connectionFactor() );
|
||||
|
||||
|
||||
@@ -1685,14 +1685,14 @@ void RimEclipseView::calculateVisibleWellCellsIncFence( cvf::UByteArray* visible
|
||||
const std::vector<RigWellResultPoint>& wsResCells = wellResSegments[wsIdx].m_branchResultPoints;
|
||||
for ( size_t cIdx = 0; cIdx < wsResCells.size(); ++cIdx )
|
||||
{
|
||||
if ( wsResCells[cIdx].m_gridIndex == grid->gridIndex() )
|
||||
if ( wsResCells[cIdx].gridIndex() == grid->gridIndex() )
|
||||
{
|
||||
if ( !wsResCells[cIdx].isCell() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
size_t gridCellIndex = wsResCells[cIdx].m_gridCellIndex;
|
||||
size_t gridCellIndex = wsResCells[cIdx].cellIndex();
|
||||
( *visibleCells )[gridCellIndex] = true;
|
||||
|
||||
// Calculate well fence cells
|
||||
|
||||
@@ -192,15 +192,6 @@ std::vector<const RigWellPath*> RimSimWellInView::wellPipeBranches() const
|
||||
return std::vector<const RigWellPath*>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellInView::calculateWellPipeStaticCenterLine( std::vector<std::vector<cvf::Vec3d>>& pipeBranchesCLCoords,
|
||||
std::vector<std::vector<RigWellResultPoint>>& pipeBranchesCellIds )
|
||||
{
|
||||
RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline( this, pipeBranchesCLCoords, pipeBranchesCellIds );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// frameIndex = -1 will use the static well frame
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -340,8 +331,8 @@ bool RimSimWellInView::intersectsWellCellsFilteredCells( const RigWellResultFram
|
||||
|
||||
// First check the wellhead:
|
||||
|
||||
size_t gridIndex = wrsf->m_wellHead.m_gridIndex;
|
||||
size_t gridCellIndex = wrsf->m_wellHead.m_gridCellIndex;
|
||||
size_t gridIndex = wrsf->m_wellHead.gridIndex();
|
||||
size_t gridCellIndex = wrsf->m_wellHead.cellIndex();
|
||||
|
||||
if ( gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
@@ -362,8 +353,8 @@ bool RimSimWellInView::intersectsWellCellsFilteredCells( const RigWellResultFram
|
||||
{
|
||||
if ( wellResultPoint.isCell() )
|
||||
{
|
||||
gridIndex = wellResultPoint.m_gridIndex;
|
||||
gridCellIndex = wellResultPoint.m_gridCellIndex;
|
||||
gridIndex = wellResultPoint.gridIndex();
|
||||
gridCellIndex = wellResultPoint.cellIndex();
|
||||
|
||||
const cvf::UByteArray* cellVisibility = rvMan->cellVisibility( visGridPart, gridIndex, frameIndex );
|
||||
if ( gridCellIndex < cellVisibility->size() && ( *cellVisibility )[gridCellIndex] )
|
||||
@@ -770,24 +761,21 @@ void RimSimWellInView::scaleDisk( double minValue, double maxValue )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RimSimWellInView::boundingBoxInDomainCoords() const
|
||||
{
|
||||
std::vector<std::vector<cvf::Vec3d>> pipeBranchesCLCoords;
|
||||
std::vector<std::vector<RigWellResultPoint>> pipeBranchesCellIds;
|
||||
|
||||
auto noConst = const_cast<RimSimWellInView*>( this );
|
||||
RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline( noConst, pipeBranchesCLCoords, pipeBranchesCellIds );
|
||||
auto noConst = const_cast<RimSimWellInView*>( this );
|
||||
auto simWellBranches = RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline( noConst );
|
||||
|
||||
cvf::BoundingBox bb;
|
||||
for ( auto branch : pipeBranchesCLCoords )
|
||||
for ( const auto& [coords, wellCells] : simWellBranches )
|
||||
{
|
||||
if ( !branch.empty() )
|
||||
if ( !coords.empty() )
|
||||
{
|
||||
// Estimate the bounding box based on first, middle and last coordinate of branches
|
||||
bb.add( branch.front() );
|
||||
bb.add( coords.front() );
|
||||
|
||||
size_t mid = branch.size() / 2;
|
||||
bb.add( branch[mid] );
|
||||
size_t mid = coords.size() / 2;
|
||||
bb.add( coords[mid] );
|
||||
|
||||
bb.add( branch.back() );
|
||||
bb.add( coords.back() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,9 +76,6 @@ public:
|
||||
|
||||
std::vector<const RigWellPath*> wellPipeBranches() const;
|
||||
|
||||
void calculateWellPipeStaticCenterLine( std::vector<std::vector<cvf::Vec3d>>& pipeBranchesCLCoords,
|
||||
std::vector<std::vector<RigWellResultPoint>>& pipeBranchesCellIds );
|
||||
|
||||
void wellHeadTopBottomPosition( int frameIndex, cvf::Vec3d* top, cvf::Vec3d* bottom );
|
||||
double pipeRadius();
|
||||
int pipeCrossSectionVertexCount();
|
||||
|
||||
@@ -409,9 +409,9 @@ void RimStreamlineInViewCollection::findStartCells( int
|
||||
{
|
||||
for ( const auto& point : branch.m_branchResultPoints )
|
||||
{
|
||||
if ( point.isValid() && point.m_isOpen )
|
||||
if ( point.isValid() && point.isOpen() )
|
||||
{
|
||||
RigCell cell = grids[point.m_gridIndex]->cell( point.m_gridCellIndex );
|
||||
RigCell cell = grids[point.gridIndex()]->cell( point.cellIndex() );
|
||||
if ( frame->m_productionType == RiaDefines::WellProductionType::PRODUCER )
|
||||
{
|
||||
outProducerCells.push_back( std::pair<QString, RigCell>( swdata->m_wellName, cell ) );
|
||||
|
||||
Reference in New Issue
Block a user