mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #5257 from OPM/feature-well-dist-clang
Well distribution plots
This commit is contained in:
commit
46c14af2fd
@ -67,6 +67,15 @@ void caf::AppEnum<RiaDefines::PlotAxis>::setUp()
|
||||
setDefault( RiaDefines::PLOT_AXIS_LEFT );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RiaDefines::PhaseType>::setUp()
|
||||
{
|
||||
addItem( RiaDefines::OIL_PHASE, "OIL_PHASE", "Oil" );
|
||||
addItem( RiaDefines::GAS_PHASE, "GAS_PHASE", "Gas" );
|
||||
addItem( RiaDefines::WATER_PHASE, "WATER_PHASE", "Water" );
|
||||
setDefault( RiaDefines::OIL_PHASE );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RiaDefines::WellPathComponentType>::setUp()
|
||||
{
|
||||
|
@ -41,7 +41,9 @@ class Rim3dView;
|
||||
class Ric3dPickEvent : public caf::PickEvent
|
||||
{
|
||||
public:
|
||||
Ric3dPickEvent( const std::vector<RiuPickItemInfo>& pickItemInfos, Rim3dView* view, Qt::KeyboardModifiers keyboardModifiers)
|
||||
Ric3dPickEvent( const std::vector<RiuPickItemInfo>& pickItemInfos,
|
||||
Rim3dView* view,
|
||||
Qt::KeyboardModifiers keyboardModifiers )
|
||||
: m_pickItemInfos( pickItemInfos )
|
||||
, m_view( view )
|
||||
, m_keyboardModifiers( keyboardModifiers )
|
||||
|
@ -13,6 +13,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellPltPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDataSourceForRftPlt.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPlotTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellRftEnsembleCurveSet.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellDistributionPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellDistributionPlotCollection.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -29,6 +31,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellPltPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDataSourceForRftPlt.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellPlotTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellRftEnsembleCurveSet.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellDistributionPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellDistributionPlotCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellDistributionPlot.h"
|
||||
#include "RimWellDistributionPlotCollection.h"
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
#include "cvfAssert.h"
|
||||
@ -42,6 +44,12 @@ RimFlowPlotCollection::RimFlowPlotCollection()
|
||||
CAF_PDM_InitFieldNoDefault( &m_defaultWellAllocPlot, "DefaultWellAllocationPlot", "", "", "", "" );
|
||||
m_defaultWellAllocPlot.uiCapability()->setUiHidden( true );
|
||||
|
||||
// CAF_PDM_InitFieldNoDefault( &m_dbgWellDistributionPlot, "DbgWellDistributionPlot", "", "", "", "" );
|
||||
// m_dbgWellDistributionPlot.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellDistributionPlotCollection, "WellDistributionPlotCollection", "", "", "", "" );
|
||||
m_wellDistributionPlotCollection.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_storedWellAllocPlots,
|
||||
"StoredWellAllocationPlots",
|
||||
"Stored Well Allocation Plots",
|
||||
@ -78,6 +86,8 @@ void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
|
||||
}
|
||||
|
||||
delete m_flowCharacteristicsPlot;
|
||||
// delete m_dbgWellDistributionPlot;
|
||||
delete m_wellDistributionPlotCollection;
|
||||
|
||||
m_storedWellAllocPlots.deleteAllChildObjects();
|
||||
m_storedFlowCharacteristicsPlots.deleteAllChildObjects();
|
||||
@ -88,7 +98,7 @@ void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::loadDataAndUpdate()
|
||||
{
|
||||
caf::ProgressInfo plotProgress( m_storedWellAllocPlots.size() + m_storedFlowCharacteristicsPlots.size() + 1, "" );
|
||||
caf::ProgressInfo plotProgress( m_storedWellAllocPlots.size() + m_storedFlowCharacteristicsPlots.size() + 3, "" );
|
||||
|
||||
if ( m_defaultWellAllocPlot ) m_defaultWellAllocPlot->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
@ -109,6 +119,16 @@ void RimFlowPlotCollection::loadDataAndUpdate()
|
||||
{
|
||||
m_flowCharacteristicsPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
// if ( m_dbgWellDistributionPlot )
|
||||
//{
|
||||
// m_dbgWellDistributionPlot->loadDataAndUpdate();
|
||||
//}
|
||||
|
||||
if ( m_wellDistributionPlotCollection )
|
||||
{
|
||||
m_wellDistributionPlotCollection->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -185,4 +205,15 @@ void RimFlowPlotCollection::ensureDefaultFlowPlotsAreCreated()
|
||||
{
|
||||
m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot;
|
||||
}
|
||||
|
||||
// if ( !m_dbgWellDistributionPlot() )
|
||||
//{
|
||||
// m_dbgWellDistributionPlot = new RimWellDistributionPlot;
|
||||
// m_dbgWellDistributionPlot->setAsPlotMdiWindow();
|
||||
//}
|
||||
|
||||
if ( !m_wellDistributionPlotCollection() )
|
||||
{
|
||||
m_wellDistributionPlotCollection = new RimWellDistributionPlotCollection;
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
class RimWellAllocationPlot;
|
||||
class RimFlowCharacteristicsPlot;
|
||||
class RimWellDistributionPlot;
|
||||
class RimWellDistributionPlotCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -48,8 +50,10 @@ public:
|
||||
void ensureDefaultFlowPlotsAreCreated();
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimFlowCharacteristicsPlot*> m_flowCharacteristicsPlot;
|
||||
caf::PdmChildField<RimWellAllocationPlot*> m_defaultWellAllocPlot;
|
||||
caf::PdmChildArrayField<RimWellAllocationPlot*> m_storedWellAllocPlots;
|
||||
caf::PdmChildArrayField<RimFlowCharacteristicsPlot*> m_storedFlowCharacteristicsPlots;
|
||||
caf::PdmChildField<RimFlowCharacteristicsPlot*> m_flowCharacteristicsPlot;
|
||||
caf::PdmChildField<RimWellAllocationPlot*> m_defaultWellAllocPlot;
|
||||
// caf::PdmChildField<RimWellDistributionPlot*> m_dbgWellDistributionPlot;
|
||||
caf::PdmChildField<RimWellDistributionPlotCollection*> m_wellDistributionPlotCollection;
|
||||
caf::PdmChildArrayField<RimWellAllocationPlot*> m_storedWellAllocPlots;
|
||||
caf::PdmChildArrayField<RimFlowCharacteristicsPlot*> m_storedFlowCharacteristicsPlots;
|
||||
};
|
||||
|
@ -0,0 +1,569 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// 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 "RimWellDistributionPlot.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigTofWellDistributionCalculator.h"
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "qwt_legend.h"
|
||||
#include "qwt_legend_label.h"
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_plot_curve.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QTextBrowser>
|
||||
#include <QWidget>
|
||||
|
||||
//#include "cvfBase.h"
|
||||
//#include "cvfTrace.h"
|
||||
//#include "cvfDebugTimer.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellDistributionPlot, "WellDistributionPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlot::RimWellDistributionPlot( RiaDefines::PhaseType phase )
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::RimWellDistributionPlot()");
|
||||
|
||||
CAF_PDM_InitObject( "Well Distribution Plot", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" );
|
||||
CAF_PDM_InitField( &m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "" );
|
||||
CAF_PDM_InitField( &m_wellName, "WellName", QString( "None" ), "Well", "", "", "" );
|
||||
CAF_PDM_InitField( &m_phase, "Phase", caf::AppEnum<RiaDefines::PhaseType>( phase ), "Phase", "", "", "" );
|
||||
CAF_PDM_InitField( &m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "" );
|
||||
CAF_PDM_InitField( &m_smallContributionsRelativeThreshold,
|
||||
"SmallContributionsRelativeThreshold",
|
||||
0.005,
|
||||
"Relative Threshold [0, 1]",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
m_showWindow = false;
|
||||
m_showPlotLegends = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlot::~RimWellDistributionPlot() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::setDataSourceParameters( RimEclipseResultCase* eclipseResultCase,
|
||||
int timeStepIndex,
|
||||
QString targetWellName )
|
||||
{
|
||||
m_case = eclipseResultCase;
|
||||
m_timeStepIndex = timeStepIndex;
|
||||
m_wellName = targetWellName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::setPlotOptions( bool groupSmallContributions, double smallContributionsRelativeThreshold )
|
||||
{
|
||||
m_groupSmallContributions = groupSmallContributions;
|
||||
m_smallContributionsRelativeThreshold = smallContributionsRelativeThreshold;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtPlotWidget* RimWellDistributionPlot::viewer()
|
||||
{
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::setAutoScaleXEnabled( bool /*enabled*/ )
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::setAutoScaleXEnabled()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::setAutoScaleYEnabled( bool /*enabled*/ )
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::setAutoScaleYEnabled()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::updateAxes()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::updateAxes()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::updateLegend()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::updateLegend()");
|
||||
|
||||
if ( !m_plotWidget )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// For now we always show the legend when in multiplot mode
|
||||
bool doShowLegend = true;
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
doShowLegend = m_showPlotLegends;
|
||||
}
|
||||
|
||||
if ( doShowLegend )
|
||||
{
|
||||
QwtLegend* legend = new QwtLegend( m_plotWidget );
|
||||
m_plotWidget->insertLegend( legend, QwtPlot::BottomLegend );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotWidget->insertLegend( nullptr );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::updateZoomInQwt()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::updateZoomInQwt()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::updateZoomFromQwt()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::updateZoomFromQwt()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellDistributionPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::asciiDataForPlotExport()");
|
||||
return QString();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::reattachAllCurves()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::reattachAllCurves()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::detachAllCurves()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::detachAllCurves()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RimWellDistributionPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* /*curve*/ ) const
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::findPdmObjectFromQwtCurve()");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::onAxisSelected( int /*axis*/, bool /*toggle*/ )
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::onAxisSelected()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellDistributionPlot::description() const
|
||||
{
|
||||
return uiName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellDistributionPlot::viewWidget()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::viewWidget()");
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimWellDistributionPlot::snapshotWindowContent()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::snapshotWindowContent()");
|
||||
|
||||
QImage image;
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
QPixmap pix = m_plotWidget->grab();
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::zoomAll()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::zoomAll()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::doRemoveFromCollection()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::doRemoveFromCollection()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellDistributionPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::createViewWidget()");
|
||||
|
||||
// It seems we risk being called multiple times
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
|
||||
|
||||
m_plotWidget->setAutoReplot( false );
|
||||
m_plotWidget->setDraggable( false );
|
||||
|
||||
updateLegend();
|
||||
onLoadDataAndUpdate();
|
||||
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::deleteViewWidget()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::deleteViewWidget()");
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->setParent( nullptr );
|
||||
delete m_plotWidget;
|
||||
m_plotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::onLoadDataAndUpdate()");
|
||||
// cvf::DebugTimer tim("RimWellDistributionPlot::onLoadDataAndUpdate()");
|
||||
|
||||
if ( isMdiWindow() )
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
}
|
||||
else
|
||||
{
|
||||
updateParentLayout();
|
||||
}
|
||||
|
||||
if ( !m_plotWidget )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
||||
|
||||
updateLegend();
|
||||
|
||||
if ( m_case )
|
||||
{
|
||||
// tim.reportLapTimeMS("about to start calc");
|
||||
RigTofWellDistributionCalculator calc( m_case, m_wellName, m_timeStepIndex, m_phase() );
|
||||
// tim.reportLapTimeMS("calc");
|
||||
|
||||
if ( m_groupSmallContributions )
|
||||
{
|
||||
calc.groupSmallContributions( m_smallContributionsRelativeThreshold );
|
||||
// tim.reportLapTimeMS("group");
|
||||
}
|
||||
|
||||
const RimFlowDiagSolution* flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
|
||||
// cvf::Trace::show("Populating plot for phase '%s'", m_phase == RiaDefines::OIL_PHASE ? "oil" : (m_phase ==
|
||||
// RiaDefines::GAS_PHASE ? "gas" : "water"));
|
||||
populatePlotWidgetWithCurveData( calc, *flowDiagSolution, m_plotWidget );
|
||||
}
|
||||
|
||||
QString phaseString = "N/A";
|
||||
if ( m_phase == RiaDefines::OIL_PHASE )
|
||||
phaseString = "Oil";
|
||||
else if ( m_phase == RiaDefines::GAS_PHASE )
|
||||
phaseString = "Gas";
|
||||
else if ( m_phase == RiaDefines::WATER_PHASE )
|
||||
phaseString = "Water";
|
||||
|
||||
const QString timeStepName = m_case ? m_case->timeStepName( m_timeStepIndex ) : "N/A";
|
||||
|
||||
const QString plotTitleStr =
|
||||
QString( "%1 Distribution: %2, %3" ).arg( phaseString ).arg( m_wellName ).arg( timeStepName );
|
||||
m_plotWidget->setTitle( plotTitleStr );
|
||||
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::xBottom, "TOF [years]" );
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::yLeft, "Reservoir Volume [m3]" );
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true );
|
||||
m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true );
|
||||
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellDistributionCalculator& calculator,
|
||||
const RimFlowDiagSolution& flowDiagSolution,
|
||||
RiuQwtPlotWidget* plotWidget )
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::populatePlotWidgetWithCurves()");
|
||||
|
||||
// Currently select this value so that the grid appears on top of the curves
|
||||
const double baseCurveZValue = 9.5;
|
||||
|
||||
plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve );
|
||||
plotWidget->setAxisScale( QwtPlot::xBottom, 0, 1 );
|
||||
plotWidget->setAxisScale( QwtPlot::yLeft, 0, 1 );
|
||||
plotWidget->setAxisAutoScale( QwtPlot::xBottom, true );
|
||||
plotWidget->setAxisAutoScale( QwtPlot::yLeft, true );
|
||||
|
||||
const std::vector<double>& tofValuesDays = calculator.sortedUniqueTofValues();
|
||||
if ( tofValuesDays.size() == 0 )
|
||||
{
|
||||
// cvf::Trace::show("No TOF values!");
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<double> tofValuesYears;
|
||||
for ( double tofDays : tofValuesDays )
|
||||
{
|
||||
const double tofYears = tofDays / 365.2425;
|
||||
tofValuesYears.push_back( tofYears );
|
||||
}
|
||||
|
||||
// cvf::Trace::show("numTofValues: %d (min, max: %f, %f)", static_cast<int>(tofValuesYears.size()),
|
||||
// tofValuesYears.front(), tofValuesYears.back());
|
||||
|
||||
const size_t numWells = calculator.contributingWellCount();
|
||||
// cvf::Trace::show("numContribWells: %d", static_cast<int>(numWells));
|
||||
|
||||
std::vector<double> yVals( tofValuesYears.size(), 0 );
|
||||
|
||||
for ( size_t i = 0; i < numWells; i++ )
|
||||
{
|
||||
const QString& wellName = calculator.contributingWellName( i );
|
||||
const std::vector<double>& volArr = calculator.accumulatedVolumeForContributingWell( i );
|
||||
|
||||
cvf::Color3f cvfClr = flowDiagSolution.tracerColor( wellName );
|
||||
QColor qtClr = RiaColorTools::toQColor( cvfClr );
|
||||
|
||||
for ( size_t j = 0; j < yVals.size(); j++ )
|
||||
{
|
||||
yVals[j] += volArr[j];
|
||||
}
|
||||
|
||||
// cvf::Trace::show("wellName min, max: %15s %12.3f, %12.3f maxAggrY: %12.3f",
|
||||
// wellName.toStdString().c_str(), volArr.front(), volArr.back(), yVals.back());
|
||||
|
||||
QwtPlotCurve* curve = new QwtPlotCurve;
|
||||
curve->setTitle( wellName );
|
||||
curve->setBrush( qtClr );
|
||||
curve->setZ( baseCurveZValue - i * 0.0001 );
|
||||
curve->setSamples( tofValuesYears.data(), yVals.data(), static_cast<int>( tofValuesYears.size() ) );
|
||||
curve->attach( plotWidget );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_case );
|
||||
uiOrdering.add( &m_timeStepIndex );
|
||||
uiOrdering.add( &m_wellName );
|
||||
uiOrdering.add( &m_phase );
|
||||
uiOrdering.add( &m_groupSmallContributions );
|
||||
uiOrdering.add( &m_smallContributionsRelativeThreshold );
|
||||
|
||||
m_smallContributionsRelativeThreshold.uiCapability()->setUiReadOnly( m_groupSmallContributions == false );
|
||||
|
||||
RimPlot::defineUiOrdering( uiConfigName, uiOrdering );
|
||||
// uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimWellDistributionPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
|
||||
|
||||
if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
RimProject* ownerProj = nullptr;
|
||||
firstAncestorOrThisOfType( ownerProj );
|
||||
if ( ownerProj )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> caseArr;
|
||||
ownerProj->descendantsIncludingThisOfType( caseArr );
|
||||
for ( RimEclipseResultCase* c : caseArr )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( fieldNeedingOptions == &m_timeStepIndex )
|
||||
{
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
const QStringList timeStepNames = m_case->timeStepStrings();
|
||||
for ( int i = 0; i < timeStepNames.size(); i++ )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( timeStepNames[i], i ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( options.size() == 0 )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", -1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
else if ( fieldNeedingOptions == &m_wellName )
|
||||
{
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
caf::QIconProvider simWellIcon( ":/Well.png" );
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
for ( const QString& name : sortedWellNameSet )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( name, name, true, simWellIcon ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( options.size() == 0 )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", QVariant() ) );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimPlot::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_case )
|
||||
{
|
||||
fixupDependentFieldsAfterCaseChange();
|
||||
}
|
||||
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::fixupDependentFieldsAfterCaseChange()
|
||||
{
|
||||
int newTimeStepIndex = -1;
|
||||
QString newWellName;
|
||||
|
||||
if ( m_case )
|
||||
{
|
||||
const int timeStepCount = m_case->timeStepStrings().size();
|
||||
if ( timeStepCount > 0 )
|
||||
{
|
||||
newTimeStepIndex = timeStepCount - 1;
|
||||
}
|
||||
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
if ( sortedWellNameSet.size() > 0 )
|
||||
{
|
||||
newWellName = *sortedWellNameSet.begin();
|
||||
}
|
||||
}
|
||||
|
||||
m_timeStepIndex = newTimeStepIndex;
|
||||
m_wellName = newWellName;
|
||||
}
|
103
ApplicationCode/ProjectDataModel/Flow/RimWellDistributionPlot.h
Normal file
103
ApplicationCode/ProjectDataModel/Flow/RimWellDistributionPlot.h
Normal file
@ -0,0 +1,103 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimPlot.h"
|
||||
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class RimEclipseResultCase;
|
||||
class RimFlowDiagSolution;
|
||||
class RigTofWellDistributionCalculator;
|
||||
class RiuQwtPlotWidget;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimWellDistributionPlot : public RimPlot
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
explicit RimWellDistributionPlot( RiaDefines::PhaseType phase = RiaDefines::OIL_PHASE );
|
||||
~RimWellDistributionPlot() override;
|
||||
|
||||
void setDataSourceParameters( RimEclipseResultCase* eclipseResultCase, int timeStepIndex, QString targetWellName );
|
||||
void setPlotOptions( bool groupSmallContributions, double smallContributionsRelativeThreshold );
|
||||
|
||||
// RimPlot implementations
|
||||
RiuQwtPlotWidget* viewer() override;
|
||||
void setAutoScaleXEnabled( bool enabled ) override;
|
||||
void setAutoScaleYEnabled( bool enabled ) override;
|
||||
void updateAxes() override;
|
||||
void updateLegend() override;
|
||||
void updateZoomInQwt() override;
|
||||
void updateZoomFromQwt() override;
|
||||
QString asciiDataForPlotExport() const override;
|
||||
void reattachAllCurves() override;
|
||||
void detachAllCurves() override;
|
||||
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
void onAxisSelected( int axis, bool toggle ) override;
|
||||
|
||||
// RimPlotWindow implementations
|
||||
QString description() const override;
|
||||
|
||||
// RimViewWindow implementations
|
||||
QWidget* viewWidget() override;
|
||||
QImage snapshotWindowContent() override;
|
||||
void zoomAll() override;
|
||||
|
||||
private:
|
||||
// RimPlot implementations
|
||||
void doRemoveFromCollection() override;
|
||||
|
||||
// RimViewWindow implementations
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
void fixupDependentFieldsAfterCaseChange();
|
||||
static void populatePlotWidgetWithCurveData( const RigTofWellDistributionCalculator& calculator,
|
||||
const RimFlowDiagSolution& flowDiagSolution,
|
||||
RiuQwtPlotWidget* plotWidget );
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||
caf::PdmField<int> m_timeStepIndex;
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::PhaseType>> m_phase;
|
||||
caf::PdmField<bool> m_groupSmallContributions;
|
||||
caf::PdmField<double> m_smallContributionsRelativeThreshold;
|
||||
|
||||
QPointer<RiuQwtPlotWidget> m_plotWidget;
|
||||
};
|
@ -0,0 +1,254 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// 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 "RimWellDistributionPlotCollection.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellDistributionPlot.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigTofWellDistributionCalculator.h"
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
#include "RiuQwtPlotTools.h"
|
||||
|
||||
#include "qwt_legend.h"
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_plot_curve.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QTextBrowser>
|
||||
#include <QWidget>
|
||||
|
||||
//#include "cvfBase.h"
|
||||
//#include "cvfTrace.h"
|
||||
//#include "cvfDebugTimer.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellDistributionPlotCollection, "WellDistributionPlotCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()
|
||||
: RimMultiPlotWindow( true )
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()");
|
||||
|
||||
CAF_PDM_InitObject( "Well Distribution Plots", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" );
|
||||
CAF_PDM_InitField( &m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "" );
|
||||
CAF_PDM_InitField( &m_wellName, "WellName", QString( "None" ), "Well", "", "", "" );
|
||||
CAF_PDM_InitField( &m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "" );
|
||||
CAF_PDM_InitField( &m_smallContributionsRelativeThreshold,
|
||||
"SmallContributionsRelativeThreshold",
|
||||
0.005,
|
||||
"Relative Threshold [0, 1]",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
m_plotWindowTitle = "Well Distribution Plots";
|
||||
m_columnCountEnum = RimMultiPlotWindow::COLUMNS_UNLIMITED;
|
||||
|
||||
m_showPlotLegends = false;
|
||||
m_showWindow = false;
|
||||
|
||||
setAcceptDrops( false );
|
||||
setAsPlotMdiWindow();
|
||||
|
||||
addPlot( new RimWellDistributionPlot( RiaDefines::OIL_PHASE ) );
|
||||
addPlot( new RimWellDistributionPlot( RiaDefines::GAS_PHASE ) );
|
||||
addPlot( new RimWellDistributionPlot( RiaDefines::WATER_PHASE ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlotCollection::~RimWellDistributionPlotCollection() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::onLoadDataAndUpdate()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlotCollection::onLoadDataAndUpdate()");
|
||||
|
||||
RimMultiPlotWindow::onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_case );
|
||||
uiOrdering.add( &m_timeStepIndex );
|
||||
uiOrdering.add( &m_wellName );
|
||||
uiOrdering.add( &m_groupSmallContributions );
|
||||
uiOrdering.add( &m_smallContributionsRelativeThreshold );
|
||||
|
||||
m_smallContributionsRelativeThreshold.uiCapability()->setUiReadOnly( m_groupSmallContributions == false );
|
||||
|
||||
// RimMultiPlotWindow::defineUiOrdering(uiConfigName, uiOrdering);
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimWellDistributionPlotCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimMultiPlotWindow::calculateValueOptions( fieldNeedingOptions,
|
||||
useOptionsOnly );
|
||||
|
||||
if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
RimProject* ownerProj = nullptr;
|
||||
firstAncestorOrThisOfType( ownerProj );
|
||||
if ( ownerProj )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> caseArr;
|
||||
ownerProj->descendantsIncludingThisOfType( caseArr );
|
||||
for ( RimEclipseResultCase* c : caseArr )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( fieldNeedingOptions == &m_timeStepIndex )
|
||||
{
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
const QStringList timeStepNames = m_case->timeStepStrings();
|
||||
for ( int i = 0; i < timeStepNames.size(); i++ )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( timeStepNames[i], i ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( options.size() == 0 )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", -1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
else if ( fieldNeedingOptions == &m_wellName )
|
||||
{
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
caf::QIconProvider simWellIcon( ":/Well.png" );
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
for ( const QString& name : sortedWellNameSet )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( name, name, true, simWellIcon ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( options.size() == 0 )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", QVariant() ) );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_case )
|
||||
{
|
||||
fixupDependentFieldsAfterCaseChange();
|
||||
}
|
||||
|
||||
bool shouldRecalculatePlotData = false;
|
||||
if ( changedField == &m_case || changedField == &m_timeStepIndex || changedField == &m_wellName ||
|
||||
changedField == &m_groupSmallContributions || changedField == &m_smallContributionsRelativeThreshold )
|
||||
{
|
||||
applyPlotParametersToContainedPlots();
|
||||
shouldRecalculatePlotData = true;
|
||||
}
|
||||
|
||||
RimMultiPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( shouldRecalculatePlotData )
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::applyPlotParametersToContainedPlots()
|
||||
{
|
||||
const size_t numPlots = plotCount();
|
||||
for ( size_t i = 0; i < numPlots; i++ )
|
||||
{
|
||||
// Dirty usage of dyn_cast, but type is lost when adding the plots to our base class
|
||||
RimWellDistributionPlot* aPlot = dynamic_cast<RimWellDistributionPlot*>( plotByIndex( i ) );
|
||||
if ( aPlot )
|
||||
{
|
||||
aPlot->setDataSourceParameters( m_case, m_timeStepIndex, m_wellName );
|
||||
aPlot->setPlotOptions( m_groupSmallContributions, m_smallContributionsRelativeThreshold );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::fixupDependentFieldsAfterCaseChange()
|
||||
{
|
||||
int newTimeStepIndex = -1;
|
||||
QString newWellName;
|
||||
|
||||
if ( m_case )
|
||||
{
|
||||
const int timeStepCount = m_case->timeStepStrings().size();
|
||||
if ( timeStepCount > 0 )
|
||||
{
|
||||
newTimeStepIndex = timeStepCount - 1;
|
||||
}
|
||||
|
||||
const std::set<QString> sortedWellNameSet = m_case->eclipseCaseData()->findSortedWellNames();
|
||||
if ( sortedWellNameSet.size() > 0 )
|
||||
{
|
||||
newWellName = *sortedWellNameSet.begin();
|
||||
}
|
||||
}
|
||||
|
||||
m_timeStepIndex = newTimeStepIndex;
|
||||
m_wellName = newWellName;
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimMultiPlotWindow.h"
|
||||
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <array>
|
||||
|
||||
class RimEclipseResultCase;
|
||||
class RimFlowDiagSolution;
|
||||
class RigTofWellDistributionCalculator;
|
||||
|
||||
class QTextBrowser;
|
||||
class QwtPlot;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimWellDistributionPlotCollection : public RimMultiPlotWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimWellDistributionPlotCollection();
|
||||
~RimWellDistributionPlotCollection() override;
|
||||
|
||||
private:
|
||||
// RimPlotWindow overrides
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fixupDependentFieldsAfterCaseChange();
|
||||
void applyPlotParametersToContainedPlots();
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||
caf::PdmField<int> m_timeStepIndex;
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<bool> m_groupSmallContributions;
|
||||
caf::PdmField<double> m_smallContributionsRelativeThreshold;
|
||||
};
|
@ -186,12 +186,12 @@ QList<caf::PdmOptionItemInfo>
|
||||
{
|
||||
if ( &m_resultPositionTypeUiField == fieldNeedingOptions )
|
||||
{
|
||||
std::vector<RigFemResultPosEnum> optionItems = { RIG_NODAL,
|
||||
RIG_ELEMENT_NODAL,
|
||||
RIG_INTEGRATION_POINT,
|
||||
RIG_ELEMENT_NODAL_FACE,
|
||||
RIG_FORMATION_NAMES,
|
||||
RIG_ELEMENT };
|
||||
std::vector<RigFemResultPosEnum> optionItems = {RIG_NODAL,
|
||||
RIG_ELEMENT_NODAL,
|
||||
RIG_INTEGRATION_POINT,
|
||||
RIG_ELEMENT_NODAL_FACE,
|
||||
RIG_FORMATION_NAMES,
|
||||
RIG_ELEMENT};
|
||||
if ( m_addWellPathDerivedResults )
|
||||
{
|
||||
optionItems.push_back( RIG_WELLPATH_DERIVED );
|
||||
@ -261,7 +261,7 @@ void RimGeoMechResultDefinition::setGeoMechCase( RimGeoMechCase* geomCase )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RimGeoMechResultDefinition::geoMechCase() const
|
||||
RimGeoMechCase* RimGeoMechResultDefinition::geoMechCase() const
|
||||
{
|
||||
return m_geomCase;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ CAF_PDM_SOURCE_INIT( RimMultiPlotWindow, "MultiPlot" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMultiPlotWindow::RimMultiPlotWindow()
|
||||
RimMultiPlotWindow::RimMultiPlotWindow( bool hidePlotsInTreeView )
|
||||
: m_acceptDrops( true )
|
||||
{
|
||||
CAF_PDM_InitObject( "Multi Plot", ":/WellLogPlot16x16.png", "", "" );
|
||||
@ -56,6 +56,7 @@ RimMultiPlotWindow::RimMultiPlotWindow()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plots, "Tracks", "", "", "", "" );
|
||||
m_plots.uiCapability()->setUiHidden( true );
|
||||
m_plots.uiCapability()->setUiTreeChildrenHidden( hidePlotsInTreeView );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_columnCountEnum, "NumberOfColumns", "Number of Columns", "", "", "" );
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
using ColumnCountEnum = caf::AppEnum<ColumnCount>;
|
||||
|
||||
public:
|
||||
RimMultiPlotWindow();
|
||||
RimMultiPlotWindow( bool hidePlotsInTreeView = false );
|
||||
~RimMultiPlotWindow() override;
|
||||
|
||||
RimMultiPlotWindow& operator=( RimMultiPlotWindow&& rhs );
|
||||
|
@ -54,6 +54,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RigWellPathIntersectionTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultInfo.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultAddress.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigTofAccumulatedPhaseFractionsCalculator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigTofWellDistributionCalculator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigTransmissibilityEquations.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigNumberOfFloodedPoreVolumesCalculator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigWeightedMeanCalc.h
|
||||
@ -123,6 +124,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RigCellGeometryTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigWellPathIntersectionTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigEclipseResultInfo.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigTofAccumulatedPhaseFractionsCalculator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigTofWellDistributionCalculator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigTransmissibilityEquations.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigNumberOfFloodedPoreVolumesCalculator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigWeightedMeanCalc.cpp
|
||||
|
@ -132,7 +132,7 @@ void RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFract
|
||||
double fractionPorvPhaseSumSoil = 0.0;
|
||||
double fractionPorvPhaseSumSgas = 0.0;
|
||||
|
||||
for ( auto element : tofAndIndexMap )
|
||||
for ( const auto& element : tofAndIndexMap )
|
||||
{
|
||||
double tofValue = element.first;
|
||||
for ( int index : element.second )
|
||||
@ -160,4 +160,4 @@ void RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFract
|
||||
accumulatedPhaseFractionSoil.push_back( fractionPorvPhaseSumSoil / fractionPorvSum );
|
||||
accumulatedPhaseFractionSgas.push_back( fractionPorvPhaseSumSgas / fractionPorvSum );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,319 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// 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 "RigTofWellDistributionCalculator.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPorosityModel.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFlowDiagResultAddress.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
#include "RigResultAccessor.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigTofWellDistributionCalculator::RigTofWellDistributionCalculator( RimEclipseResultCase* caseToApply,
|
||||
QString targetWellname,
|
||||
size_t timeStepIndex,
|
||||
RiaDefines::PhaseType phase )
|
||||
{
|
||||
CVF_ASSERT( caseToApply );
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = caseToApply->eclipseCaseData();
|
||||
CVF_ASSERT( eclipseCaseData );
|
||||
|
||||
RimFlowDiagSolution* flowDiagSolution = caseToApply->defaultFlowDiagSolution();
|
||||
CVF_ASSERT( flowDiagSolution );
|
||||
|
||||
RigFlowDiagResults* flowDiagResults = flowDiagSolution->flowDiagResults();
|
||||
CVF_ASSERT( flowDiagResults );
|
||||
|
||||
const std::vector<double>* porvResults = eclipseCaseData->resultValues( RiaDefines::MATRIX_MODEL,
|
||||
RiaDefines::STATIC_NATIVE,
|
||||
"PORV",
|
||||
0 );
|
||||
if ( !porvResults )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString phaseResultName;
|
||||
if ( phase == RiaDefines::WATER_PHASE )
|
||||
phaseResultName = "SWAT";
|
||||
else if ( phase == RiaDefines::OIL_PHASE )
|
||||
phaseResultName = "SOIL";
|
||||
else if ( phase == RiaDefines::GAS_PHASE )
|
||||
phaseResultName = "SGAS";
|
||||
const std::vector<double>* phaseResults = eclipseCaseData->resultValues( RiaDefines::MATRIX_MODEL,
|
||||
RiaDefines::DYNAMIC_NATIVE,
|
||||
phaseResultName,
|
||||
timeStepIndex );
|
||||
if ( !phaseResults )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const RigFlowDiagResultAddress resultAddrTof( "TOF",
|
||||
RigFlowDiagResultAddress::PhaseSelection::PHASE_ALL,
|
||||
targetWellname.toStdString() );
|
||||
const RigFlowDiagResultAddress resultAddrFraction( "Fraction",
|
||||
RigFlowDiagResultAddress::PhaseSelection::PHASE_ALL,
|
||||
targetWellname.toStdString() );
|
||||
|
||||
const std::vector<double>* tofData = flowDiagResults->resultValues( resultAddrTof, timeStepIndex );
|
||||
const std::vector<double>* targetWellFractionData = flowDiagResults->resultValues( resultAddrFraction, timeStepIndex );
|
||||
if ( !tofData || !targetWellFractionData )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const std::map<double, std::vector<size_t>> tofToCellIndicesMap = buildSortedTofToCellIndicesMap( *tofData );
|
||||
|
||||
const std::vector<QString> candidateContributingWellNames = findCandidateContributingWellNames( *flowDiagSolution,
|
||||
targetWellname,
|
||||
timeStepIndex );
|
||||
|
||||
const size_t numContribWells = candidateContributingWellNames.size();
|
||||
for ( size_t iContribWell = 0; iContribWell < numContribWells; iContribWell++ )
|
||||
{
|
||||
const QString contribWellName = candidateContributingWellNames[iContribWell];
|
||||
|
||||
const RigFlowDiagResultAddress resultAddrContribWellFraction( "Fraction",
|
||||
RigFlowDiagResultAddress::PhaseSelection::PHASE_ALL,
|
||||
contribWellName.toStdString() );
|
||||
const std::vector<double>* contribWellFractionData = flowDiagResults->resultValues( resultAddrContribWellFraction,
|
||||
timeStepIndex );
|
||||
if ( !contribWellFractionData )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
double accumulatedVolForSpecifiedPhase = 0;
|
||||
|
||||
ContribWellEntry contribWellEntry;
|
||||
contribWellEntry.name = contribWellName;
|
||||
|
||||
for ( const auto& mapElement : tofToCellIndicesMap )
|
||||
{
|
||||
const double tofValue = mapElement.first;
|
||||
const std::vector<size_t>& cellIndicesArr = mapElement.second;
|
||||
|
||||
for ( size_t cellIndex : cellIndicesArr )
|
||||
{
|
||||
const double porv = porvResults->at( cellIndex );
|
||||
const double targetWellFractionVal = targetWellFractionData->at( cellIndex );
|
||||
const double contribWellFractionVal = contribWellFractionData->at( cellIndex );
|
||||
if ( contribWellFractionVal == HUGE_VAL )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const double volAllPhasesThisCell = porv * targetWellFractionVal * contribWellFractionVal;
|
||||
accumulatedVolForSpecifiedPhase += phaseResults->at( cellIndex ) * volAllPhasesThisCell;
|
||||
}
|
||||
|
||||
contribWellEntry.accumulatedVolAlongTof.push_back( accumulatedVolForSpecifiedPhase );
|
||||
}
|
||||
|
||||
if ( accumulatedVolForSpecifiedPhase > 0 )
|
||||
{
|
||||
m_contributingWells.push_back( contribWellEntry );
|
||||
}
|
||||
}
|
||||
|
||||
for ( const auto& mapElement : tofToCellIndicesMap )
|
||||
{
|
||||
const double tofValue = mapElement.first;
|
||||
m_tofInIncreasingOrder.push_back( tofValue );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigTofWellDistributionCalculator::groupSmallContributions( double smallContribThreshold )
|
||||
{
|
||||
if ( m_tofInIncreasingOrder.size() == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double totalVolAtLastTof = 0;
|
||||
for ( const ContribWellEntry& entry : m_contributingWells )
|
||||
{
|
||||
totalVolAtLastTof += entry.accumulatedVolAlongTof.back();
|
||||
}
|
||||
|
||||
std::vector<ContribWellEntry> sourceEntryArr = std::move( m_contributingWells );
|
||||
|
||||
ContribWellEntry groupingEntry;
|
||||
groupingEntry.name = "Other";
|
||||
groupingEntry.accumulatedVolAlongTof.resize( m_tofInIncreasingOrder.size(), 0 );
|
||||
bool anySmallContribsDetected = false;
|
||||
|
||||
for ( const ContribWellEntry& sourceEntry : sourceEntryArr )
|
||||
{
|
||||
const double volAtLastTof = sourceEntry.accumulatedVolAlongTof.back();
|
||||
if ( volAtLastTof >= totalVolAtLastTof * smallContribThreshold )
|
||||
{
|
||||
m_contributingWells.push_back( sourceEntry );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( size_t i = 0; i < groupingEntry.accumulatedVolAlongTof.size(); i++ )
|
||||
{
|
||||
groupingEntry.accumulatedVolAlongTof[i] += sourceEntry.accumulatedVolAlongTof[i];
|
||||
}
|
||||
anySmallContribsDetected = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( anySmallContribsDetected )
|
||||
{
|
||||
m_contributingWells.push_back( groupingEntry );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<double, std::vector<size_t>>
|
||||
RigTofWellDistributionCalculator::buildSortedTofToCellIndicesMap( const std::vector<double>& tofData )
|
||||
{
|
||||
std::map<double, std::vector<size_t>> tofToCellIndicesMap;
|
||||
|
||||
for ( size_t i = 0; i < tofData.size(); i++ )
|
||||
{
|
||||
const double tofValue = tofData[i];
|
||||
if ( tofValue == HUGE_VAL )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Also filter out special TOF values greater than 73000 days (~200 years)
|
||||
if ( tofValue > 73000.0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::vector<size_t> vectorOfIndexes{i};
|
||||
auto iteratorBoolFromInsertToMap = tofToCellIndicesMap.insert( std::make_pair( tofValue, vectorOfIndexes ) );
|
||||
if ( !iteratorBoolFromInsertToMap.second )
|
||||
{
|
||||
// Map element for this tofValue already exist => we must add the cell index ourselves
|
||||
iteratorBoolFromInsertToMap.first->second.push_back( i );
|
||||
}
|
||||
}
|
||||
|
||||
return tofToCellIndicesMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Determine name of the the wells that are candidates for contributing in our calculation
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString>
|
||||
RigTofWellDistributionCalculator::findCandidateContributingWellNames( const RimFlowDiagSolution& flowDiagSolution,
|
||||
QString targetWellname,
|
||||
size_t timeStepIndex )
|
||||
{
|
||||
std::vector<QString> candidateWellNames;
|
||||
|
||||
const RimFlowDiagSolution::TracerStatusType targetWellStatus =
|
||||
flowDiagSolution.tracerStatusInTimeStep( targetWellname, timeStepIndex );
|
||||
if ( targetWellStatus != RimFlowDiagSolution::INJECTOR && targetWellStatus != RimFlowDiagSolution::PRODUCER )
|
||||
{
|
||||
RiaLogging::warning( "Status of target well is neither INJECTOR nor PRODUCER" );
|
||||
return candidateWellNames;
|
||||
}
|
||||
|
||||
const RimFlowDiagSolution::TracerStatusType oppositeStatus = ( targetWellStatus == RimFlowDiagSolution::INJECTOR )
|
||||
? RimFlowDiagSolution::PRODUCER
|
||||
: RimFlowDiagSolution::INJECTOR;
|
||||
|
||||
const std::vector<QString> allWellNames = flowDiagSolution.tracerNames();
|
||||
for ( const QString& name : allWellNames )
|
||||
{
|
||||
const RimFlowDiagSolution::TracerStatusType status = flowDiagSolution.tracerStatusInTimeStep( name,
|
||||
timeStepIndex );
|
||||
if ( status == oppositeStatus )
|
||||
{
|
||||
candidateWellNames.push_back( name );
|
||||
}
|
||||
else if ( status == targetWellStatus )
|
||||
{
|
||||
if ( RimFlowDiagSolution::hasCrossFlowEnding( name ) )
|
||||
{
|
||||
candidateWellNames.push_back( name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return candidateWellNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>& RigTofWellDistributionCalculator::sortedUniqueTofValues() const
|
||||
{
|
||||
return m_tofInIncreasingOrder;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigTofWellDistributionCalculator::contributingWellCount() const
|
||||
{
|
||||
return m_contributingWells.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString& RigTofWellDistributionCalculator::contributingWellName( size_t contribWellIndex ) const
|
||||
{
|
||||
return m_contributingWells[contribWellIndex].name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>&
|
||||
RigTofWellDistributionCalculator::accumulatedVolumeForContributingWell( size_t contributingWellIndex ) const
|
||||
{
|
||||
CVF_ASSERT( contributingWellIndex < m_contributingWells.size() );
|
||||
const ContribWellEntry& entry = m_contributingWells[contributingWellIndex];
|
||||
return entry.accumulatedVolAlongTof;
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimEclipseResultCase;
|
||||
class RimFlowDiagSolution;
|
||||
class QString;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RigTofWellDistributionCalculator
|
||||
{
|
||||
public:
|
||||
RigTofWellDistributionCalculator( RimEclipseResultCase* caseToApply,
|
||||
QString targetWellname,
|
||||
size_t timeStepIndex,
|
||||
RiaDefines::PhaseType phase );
|
||||
|
||||
void groupSmallContributions( double smallContribThreshold );
|
||||
|
||||
const std::vector<double>& sortedUniqueTofValues() const;
|
||||
|
||||
size_t contributingWellCount() const;
|
||||
const QString& contributingWellName( size_t contribWellIndex ) const;
|
||||
const std::vector<double>& accumulatedVolumeForContributingWell( size_t contributingWellIndex ) const;
|
||||
|
||||
private:
|
||||
static std::map<double, std::vector<size_t>> buildSortedTofToCellIndicesMap( const std::vector<double>& tofData );
|
||||
static std::vector<QString> findCandidateContributingWellNames( const RimFlowDiagSolution& flowDiagSolution,
|
||||
QString targetWellname,
|
||||
size_t timeStepIndex );
|
||||
|
||||
struct ContribWellEntry
|
||||
{
|
||||
QString name;
|
||||
std::vector<double> accumulatedVolAlongTof; // This array has same size as m_tofInIncreasingOrder
|
||||
};
|
||||
|
||||
private:
|
||||
std::vector<double> m_tofInIncreasingOrder;
|
||||
std::vector<ContribWellEntry> m_contributingWells;
|
||||
};
|
@ -55,8 +55,6 @@ RiuRelativePermeabilityPlotUpdater::RiuRelativePermeabilityPlotUpdater( RiuRelat
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -254,8 +252,8 @@ QString RiuRelativePermeabilityPlotUpdater::constructCellReferenceText( const Ri
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuEclipseSelectionItem*
|
||||
RiuRelativePermeabilityPlotUpdater::extractEclipseSelectionItem( const RiuSelectionItem* selectionItem,
|
||||
Rim3dView*& newFollowAnimView )
|
||||
RiuRelativePermeabilityPlotUpdater::extractEclipseSelectionItem( const RiuSelectionItem* selectionItem,
|
||||
Rim3dView*& newFollowAnimView )
|
||||
{
|
||||
newFollowAnimView = nullptr;
|
||||
RiuEclipseSelectionItem* eclipseSelectionItem = nullptr;
|
||||
@ -288,7 +286,6 @@ RiuRelativePermeabilityPlotUpdater::extractEclipseSelectionItem( const RiuSelect
|
||||
return eclipseSelectionItem;
|
||||
}
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user