mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-20 11:48:35 -06:00
Merge pull request #5328 from OPM/fix-cumulative-phase-distr
UI changes for cumulative phase distribution
This commit is contained in:
commit
899d1a6f78
@ -10,6 +10,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicShowContributingWellsFeatureImpl.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicPlotProductionRateFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSelectViewUI.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowTotalAllocationDataFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowCumulativePhasePlotFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -23,6 +24,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicShowContributingWellsFeatureImpl.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicPlotProductionRateFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSelectViewUI.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowTotalAllocationDataFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowCumulativePhasePlotFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 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 "RicShowCumulativePhasePlotFeature.h"
|
||||
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellDistributionPlotCollection.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicShowCumulativePhasePlotFeature, "RicShowCumulativePhasePlotFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowCumulativePhasePlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimWellAllocationPlot* plot = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellAllocationPlot>();
|
||||
|
||||
return plot != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowCumulativePhasePlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimWellAllocationPlot* plot = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellAllocationPlot>();
|
||||
|
||||
if ( !plot ) return;
|
||||
|
||||
RimFlowPlotCollection* flowPlotColl = nullptr;
|
||||
plot->firstAncestorOrThisOfType( flowPlotColl );
|
||||
|
||||
if ( !flowPlotColl ) return;
|
||||
|
||||
RimWellDistributionPlotCollection* wdp = flowPlotColl->wellDistributionPlotCollection();
|
||||
wdp->setData( plot->rimCase(), plot->wellName(), plot->timeStep() );
|
||||
wdp->setShowWindow( true );
|
||||
wdp->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowCumulativePhasePlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
// actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
|
||||
actionToSetup->setText( "Show Cumulative Phase Distribution Plot" );
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020 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 "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicShowCumulativePhasePlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -190,6 +190,14 @@ RimFlowCharacteristicsPlot* RimFlowPlotCollection::defaultFlowCharacteristicsPlo
|
||||
return m_flowCharacteristicsPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlotCollection* RimFlowPlotCollection::wellDistributionPlotCollection() const
|
||||
{
|
||||
return m_wellDistributionPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -43,11 +43,12 @@ public:
|
||||
void loadDataAndUpdate();
|
||||
size_t plotCount() const;
|
||||
|
||||
void addWellAllocPlotToStoredPlots( RimWellAllocationPlot* plot );
|
||||
void addFlowCharacteristicsPlotToStoredPlots( RimFlowCharacteristicsPlot* plot );
|
||||
RimWellAllocationPlot* defaultWellAllocPlot();
|
||||
RimFlowCharacteristicsPlot* defaultFlowCharacteristicsPlot();
|
||||
void ensureDefaultFlowPlotsAreCreated();
|
||||
void addWellAllocPlotToStoredPlots( RimWellAllocationPlot* plot );
|
||||
void addFlowCharacteristicsPlotToStoredPlots( RimFlowCharacteristicsPlot* plot );
|
||||
RimWellAllocationPlot* defaultWellAllocPlot();
|
||||
RimFlowCharacteristicsPlot* defaultFlowCharacteristicsPlot();
|
||||
RimWellDistributionPlotCollection* wellDistributionPlotCollection() const;
|
||||
void ensureDefaultFlowPlotsAreCreated();
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimFlowCharacteristicsPlot*> m_flowCharacteristicsPlot;
|
||||
|
@ -912,6 +912,15 @@ QString RimWellAllocationPlot::description() const
|
||||
void RimWellAllocationPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
|
||||
if ( !m_case ) return;
|
||||
|
||||
// If no 3D view is open, we have to make sure the case is opened
|
||||
if ( !m_case->ensureReservoirCaseIsOpen() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateFromWell();
|
||||
m_accumulatedWellFlowPlot->loadDataAndUpdate();
|
||||
updateFormationNamesData();
|
||||
|
@ -58,7 +58,7 @@ RimWellDistributionPlot::RimWellDistributionPlot( RiaDefines::PhaseType phase )
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::RimWellDistributionPlot()");
|
||||
|
||||
CAF_PDM_InitObject( "Well Distribution Plot", "", "", "" );
|
||||
CAF_PDM_InitObject( "Cumulative Phase Distribution Plot", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" );
|
||||
CAF_PDM_InitField( &m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "" );
|
||||
@ -73,6 +73,8 @@ RimWellDistributionPlot::RimWellDistributionPlot( RiaDefines::PhaseType phase )
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitField( &m_maximumTof, "MaximumTOF", 20.0, "Maximum Time of Flight [0, 200]", "", "", "" );
|
||||
|
||||
m_showWindow = false;
|
||||
m_showPlotLegends = true;
|
||||
}
|
||||
@ -97,10 +99,13 @@ void RimWellDistributionPlot::setDataSourceParameters( RimEclipseResultCase* ecl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::setPlotOptions( bool groupSmallContributions, double smallContributionsRelativeThreshold )
|
||||
void RimWellDistributionPlot::setPlotOptions( bool groupSmallContributions,
|
||||
double smallContributionsRelativeThreshold,
|
||||
double maximumTof )
|
||||
{
|
||||
m_groupSmallContributions = groupSmallContributions;
|
||||
m_smallContributionsRelativeThreshold = smallContributionsRelativeThreshold;
|
||||
m_maximumTof = maximumTof;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -339,7 +344,7 @@ void RimWellDistributionPlot::onLoadDataAndUpdate()
|
||||
|
||||
updateLegend();
|
||||
|
||||
if ( m_case )
|
||||
if ( m_case && m_case->ensureReservoirCaseIsOpen() )
|
||||
{
|
||||
// tim.reportLapTimeMS("about to start calc");
|
||||
RigTofWellDistributionCalculator calc( m_case, m_wellName, m_timeStepIndex, m_phase() );
|
||||
@ -355,7 +360,7 @@ void RimWellDistributionPlot::onLoadDataAndUpdate()
|
||||
|
||||
// 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 );
|
||||
populatePlotWidgetWithCurveData( calc, *flowDiagSolution, m_plotWidget, m_maximumTof );
|
||||
}
|
||||
|
||||
QString phaseString = "N/A";
|
||||
@ -385,7 +390,8 @@ void RimWellDistributionPlot::onLoadDataAndUpdate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellDistributionCalculator& calculator,
|
||||
const RimFlowDiagSolution& flowDiagSolution,
|
||||
RiuQwtPlotWidget* plotWidget )
|
||||
RiuQwtPlotWidget* plotWidget,
|
||||
double maximumTof )
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::populatePlotWidgetWithCurves()");
|
||||
|
||||
@ -409,6 +415,9 @@ void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellD
|
||||
for ( double tofDays : tofValuesDays )
|
||||
{
|
||||
const double tofYears = tofDays / 365.2425;
|
||||
|
||||
if ( tofYears > maximumTof ) continue;
|
||||
|
||||
tofValuesYears.push_back( tofYears );
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
~RimWellDistributionPlot() override;
|
||||
|
||||
void setDataSourceParameters( RimEclipseResultCase* eclipseResultCase, int timeStepIndex, QString targetWellName );
|
||||
void setPlotOptions( bool groupSmallContributions, double smallContributionsRelativeThreshold );
|
||||
void setPlotOptions( bool groupSmallContributions, double smallContributionsRelativeThreshold, double maximumTof );
|
||||
|
||||
// RimPlot implementations
|
||||
RiuQwtPlotWidget* viewer() override;
|
||||
@ -81,7 +81,8 @@ private:
|
||||
void fixupDependentFieldsAfterCaseChange();
|
||||
static void populatePlotWidgetWithCurveData( const RigTofWellDistributionCalculator& calculator,
|
||||
const RimFlowDiagSolution& flowDiagSolution,
|
||||
RiuQwtPlotWidget* plotWidget );
|
||||
RiuQwtPlotWidget* plotWidget,
|
||||
double maximumTof );
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
@ -98,6 +99,7 @@ private:
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::PhaseType>> m_phase;
|
||||
caf::PdmField<bool> m_groupSmallContributions;
|
||||
caf::PdmField<double> m_smallContributionsRelativeThreshold;
|
||||
caf::PdmField<double> m_maximumTof;
|
||||
|
||||
QPointer<RiuQwtPlotWidget> m_plotWidget;
|
||||
};
|
||||
|
@ -57,7 +57,7 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()");
|
||||
|
||||
CAF_PDM_InitObject( "Well Distribution Plots", "", "", "" );
|
||||
CAF_PDM_InitObject( "Cumulative Phase Distribution Plot", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" );
|
||||
CAF_PDM_InitField( &m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "" );
|
||||
@ -71,7 +71,8 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()
|
||||
"",
|
||||
"" );
|
||||
|
||||
m_plotWindowTitle = "Well Distribution Plots";
|
||||
CAF_PDM_InitField( &m_maximumTof, "MaximumTOF", 20.0, "Maximum Time of Flight [0, 200]", "", "", "" );
|
||||
m_plotWindowTitle = "Cumulative Phase Distribution Plots";
|
||||
m_columnCount = RimMultiPlotWindow::COLUMNS_UNLIMITED;
|
||||
|
||||
m_showPlotLegends = false;
|
||||
@ -90,6 +91,18 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlotCollection::~RimWellDistributionPlotCollection() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::setData( RimEclipseResultCase* eclipseCase, QString wellName, int timeStepIndex )
|
||||
{
|
||||
m_case = eclipseCase;
|
||||
m_wellName = wellName;
|
||||
m_timeStepIndex = timeStepIndex;
|
||||
|
||||
applyPlotParametersToContainedPlots();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -110,6 +123,7 @@ void RimWellDistributionPlotCollection::defineUiOrdering( QString uiConfigName,
|
||||
uiOrdering.add( &m_wellName );
|
||||
uiOrdering.add( &m_groupSmallContributions );
|
||||
uiOrdering.add( &m_smallContributionsRelativeThreshold );
|
||||
uiOrdering.add( &m_maximumTof );
|
||||
|
||||
m_smallContributionsRelativeThreshold.uiCapability()->setUiReadOnly( m_groupSmallContributions == false );
|
||||
|
||||
@ -194,7 +208,8 @@ void RimWellDistributionPlotCollection::fieldChangedByUi( const caf::PdmFieldHan
|
||||
|
||||
bool shouldRecalculatePlotData = false;
|
||||
if ( changedField == &m_case || changedField == &m_timeStepIndex || changedField == &m_wellName ||
|
||||
changedField == &m_groupSmallContributions || changedField == &m_smallContributionsRelativeThreshold )
|
||||
changedField == &m_groupSmallContributions || changedField == &m_smallContributionsRelativeThreshold ||
|
||||
changedField == &m_maximumTof )
|
||||
{
|
||||
applyPlotParametersToContainedPlots();
|
||||
shouldRecalculatePlotData = true;
|
||||
@ -221,7 +236,7 @@ void RimWellDistributionPlotCollection::applyPlotParametersToContainedPlots()
|
||||
if ( aPlot )
|
||||
{
|
||||
aPlot->setDataSourceParameters( m_case, m_timeStepIndex, m_wellName );
|
||||
aPlot->setPlotOptions( m_groupSmallContributions, m_smallContributionsRelativeThreshold );
|
||||
aPlot->setPlotOptions( m_groupSmallContributions, m_smallContributionsRelativeThreshold, m_maximumTof );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,8 @@ public:
|
||||
RimWellDistributionPlotCollection();
|
||||
~RimWellDistributionPlotCollection() override;
|
||||
|
||||
void setData( RimEclipseResultCase* eclipseCase, QString wellName, int timeStepIndex );
|
||||
|
||||
private:
|
||||
// RimPlotWindow overrides
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
@ -68,4 +70,5 @@ private:
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<bool> m_groupSmallContributions;
|
||||
caf::PdmField<double> m_smallContributionsRelativeThreshold;
|
||||
caf::PdmField<double> m_maximumTof;
|
||||
};
|
||||
|
@ -42,6 +42,7 @@ RigTofAccumulatedPhaseFractionsCalculator::RigTofAccumulatedPhaseFractionsCalcul
|
||||
size_t timestep )
|
||||
{
|
||||
RigEclipseCaseData* eclipseCaseData = caseToApply->eclipseCaseData();
|
||||
if ( !eclipseCaseData ) return;
|
||||
|
||||
const std::vector<double>* swatResults = eclipseCaseData->resultValues( RiaDefines::MATRIX_MODEL,
|
||||
RiaDefines::DYNAMIC_NATIVE,
|
||||
|
@ -185,6 +185,7 @@ void RiuWellAllocationPlot::contextMenuEvent( QContextMenuEvent* event )
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
menuBuilder << "RicShowContributingWellsFromPlotFeature";
|
||||
menuBuilder << "RicShowCumulativePhasePlotFeature";
|
||||
|
||||
menuBuilder.appendToMenu( &menu );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user