mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Rename ApplicationCode to ApplicationLibCode
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFlowDiagSolution.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFlowPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellAllocationPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTotalWellAllocationPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTofAccumulatedPhaseFractionsPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellFlowRateCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellAllocationPlotLegend.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFlowCharacteristicsPlot.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellRftPlot.h
|
||||
${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
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFlowDiagSolution.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFlowPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellAllocationPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTotalWellAllocationPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTofAccumulatedPhaseFractionsPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellFlowRateCurve.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellAllocationPlotLegend.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFlowCharacteristicsPlot.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimWellRftPlot.cpp
|
||||
${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
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "ProjectDataModel\\Flow" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimDataSourceForRftPlt.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimObservedFmuRftData.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimWellLogFile.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cvfAssert.h"
|
||||
#include <QString>
|
||||
#include <QTextStream>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void caf::AppEnum<RifDataSourceForRftPlt::SourceType>::setUp()
|
||||
{
|
||||
addItem( RifDataSourceForRftPlt::SourceType::RFT, "RFT", "RFT Cases" );
|
||||
addItem( RifDataSourceForRftPlt::SourceType::GRID, "GRID", "Grid Cases" );
|
||||
addItem( RifDataSourceForRftPlt::SourceType::OBSERVED, "OBSERVED", "Observed Data" );
|
||||
addItem( RifDataSourceForRftPlt::SourceType::ENSEMBLE_RFT, "ENSEMBLE", "Ensembles with RFT Data" );
|
||||
addItem( RifDataSourceForRftPlt::SourceType::OBSERVED_FMU_RFT, "OBSERVED_FMU", "Observed FMU Data" );
|
||||
setDefault( RifDataSourceForRftPlt::SourceType::NONE );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CAF_PDM_SOURCE_INIT( RimDataSourceForRftPlt, "RftAddress" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDataSourceForRftPlt::RimDataSourceForRftPlt()
|
||||
{
|
||||
InitPdmObject();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDataSourceForRftPlt::RimDataSourceForRftPlt( const RifDataSourceForRftPlt& addr )
|
||||
{
|
||||
InitPdmObject();
|
||||
setAddress( addr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDataSourceForRftPlt::setAddress( const RifDataSourceForRftPlt& address )
|
||||
{
|
||||
m_sourceType = address.sourceType();
|
||||
m_eclCase = address.eclCase();
|
||||
m_wellLogFile = address.wellLogFile();
|
||||
m_ensemble = address.ensemble();
|
||||
m_observedFmuRftData = address.observedFmuRftData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifDataSourceForRftPlt RimDataSourceForRftPlt::address() const
|
||||
{
|
||||
switch ( m_sourceType() )
|
||||
{
|
||||
case RifDataSourceForRftPlt::OBSERVED:
|
||||
return RifDataSourceForRftPlt( m_sourceType(), m_wellLogFile );
|
||||
case RifDataSourceForRftPlt::RFT:
|
||||
case RifDataSourceForRftPlt::GRID:
|
||||
return RifDataSourceForRftPlt( m_sourceType(), m_eclCase );
|
||||
case RifDataSourceForRftPlt::ENSEMBLE_RFT:
|
||||
return RifDataSourceForRftPlt( m_sourceType(), m_ensemble );
|
||||
case RifDataSourceForRftPlt::OBSERVED_FMU_RFT:
|
||||
return RifDataSourceForRftPlt( m_sourceType(), m_observedFmuRftData );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return RifDataSourceForRftPlt();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDataSourceForRftPlt::InitPdmObject()
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault( &m_sourceType, "SourceType", "Source Type", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_eclCase, "EclipseCase", "Eclipse Case", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellLogFile, "WellLogFile", "Well Log File", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_observedFmuRftData, "ObservedFmuRftData", "Observed FMU Data", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDataSourceForRftPlt& RimDataSourceForRftPlt::operator=( const RimDataSourceForRftPlt& other )
|
||||
{
|
||||
m_sourceType = other.m_sourceType();
|
||||
m_eclCase = other.m_eclCase();
|
||||
m_wellLogFile = other.m_wellLogFile();
|
||||
m_ensemble = other.m_ensemble();
|
||||
m_observedFmuRftData = other.m_observedFmuRftData();
|
||||
return *this;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimViewWindow.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "RifDataSourceForRftPltQMetaType.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include <QDate>
|
||||
#include <QMetaType>
|
||||
#include <QPointer>
|
||||
|
||||
class RimObservedFmuRftData;
|
||||
class RimSummaryCaseCollection;
|
||||
class RimWellLogFile;
|
||||
class RimEclipseCase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimDataSourceForRftPlt : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimDataSourceForRftPlt();
|
||||
RimDataSourceForRftPlt( const RifDataSourceForRftPlt& addr );
|
||||
|
||||
void setAddress( const RifDataSourceForRftPlt& address );
|
||||
RifDataSourceForRftPlt address() const;
|
||||
|
||||
RimDataSourceForRftPlt& operator=( const RimDataSourceForRftPlt& other );
|
||||
|
||||
private:
|
||||
void InitPdmObject();
|
||||
|
||||
caf::PdmField<caf::AppEnum<RifDataSourceForRftPlt::SourceType>> m_sourceType;
|
||||
caf::PdmPtrField<RimEclipseCase*> m_eclCase;
|
||||
caf::PdmPtrField<RimWellLogFile*> m_wellLogFile;
|
||||
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble;
|
||||
caf::PdmPtrField<RimObservedFmuRftData*> m_observedFmuRftData;
|
||||
};
|
||||
@@ -0,0 +1,892 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimFlowCharacteristicsPlot.h"
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RifCsvDataTableFormatter.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFaultInViewCollection.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RicEclipsePropertyFilterFeatureImpl.h"
|
||||
#include "RicSelectOrCreateViewFeatureImpl.h"
|
||||
|
||||
#include "RiuFlowCharacteristicsPlot.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void AppEnum<RimFlowCharacteristicsPlot::TimeSelectionType>::setUp()
|
||||
{
|
||||
addItem( RimFlowCharacteristicsPlot::ALL_AVAILABLE, "ALL_AVAILABLE", "All With Calculated Flow Diagnostics" );
|
||||
addItem( RimFlowCharacteristicsPlot::SELECTED, "SELECTED", "Selected" );
|
||||
setDefault( RimFlowCharacteristicsPlot::SELECTED );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimFlowCharacteristicsPlot, "FlowCharacteristicsPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Flow Characteristics", ":/FlowCharPlot16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_case, "FlowCase", "Case", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_flowDiagSolution, "FlowDiagSolution", "Flow Diag Solution", "", "", "" );
|
||||
m_flowDiagSolution.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_timeStepSelectionType, "TimeSelectionType", "Time Steps", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "SelectedTimeSteps", "", "", "", "" );
|
||||
m_selectedTimeSteps.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedTimeStepsUi, "SelectedTimeStepsUi", "", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_applyTimeSteps, "ApplyTimeSteps", "", "", "", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &m_applyTimeSteps );
|
||||
|
||||
CAF_PDM_InitField( &m_maxPvFraction,
|
||||
"CellPVThreshold",
|
||||
0.1,
|
||||
"Aquifer Cell Threshold",
|
||||
"",
|
||||
"Exclude Aquifer Effects by adding a Cell Pore Volume Threshold as Fraction of Total Pore "
|
||||
"Volume.",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Legend", "", "", "" );
|
||||
|
||||
// Region group
|
||||
CAF_PDM_InitFieldNoDefault( &m_cellFilter, "CellFilter", "Cell Filter", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_cellFilterView, "CellFilterView", "View", "", "", "" );
|
||||
CAF_PDM_InitField( &m_tracerFilter, "TracerFilter", QString(), "Tracer Filter", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_selectedTracerNames, "SelectedTracerNames", " ", "", "", "" );
|
||||
m_selectedTracerNames.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
||||
CAF_PDM_InitFieldNoDefault( &m_showRegion, "ShowRegion", "", "", "", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &m_showRegion );
|
||||
|
||||
CAF_PDM_InitField( &m_minCommunication, "MinCommunication", 0.0, "Min Communication", "", "", "" );
|
||||
CAF_PDM_InitField( &m_maxTof, "MaxTof", 146000, "Max Time of Flight [days]", "", "", "" );
|
||||
|
||||
this->m_showWindow = false;
|
||||
setAsPlotMdiWindow();
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowCharacteristicsPlot::~RimFlowCharacteristicsPlot()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
|
||||
if ( m_flowCharPlotWidget )
|
||||
{
|
||||
m_flowCharPlotWidget->hide();
|
||||
m_flowCharPlotWidget->setParent( nullptr );
|
||||
delete m_flowCharPlotWidget;
|
||||
m_flowCharPlotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// TODO: implement properly
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimFlowCharacteristicsPlot::id() const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::setFromFlowSolution( RimFlowDiagSolution* flowSolution )
|
||||
{
|
||||
if ( !flowSolution )
|
||||
{
|
||||
m_case = nullptr;
|
||||
m_cellFilterView = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
RimEclipseResultCase* eclCase;
|
||||
flowSolution->firstAncestorOrThisOfType( eclCase );
|
||||
m_case = eclCase;
|
||||
if ( !eclCase->reservoirViews.empty() )
|
||||
{
|
||||
m_cellFilterView = eclCase->reservoirViews()[0];
|
||||
}
|
||||
}
|
||||
|
||||
m_flowDiagSolution = flowSolution;
|
||||
m_showWindow = true;
|
||||
m_timeStepToFlowResultMap.clear();
|
||||
m_currentlyPlottedTimeSteps.clear();
|
||||
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::deleteViewWidget()
|
||||
{
|
||||
if ( m_flowCharPlotWidget )
|
||||
{
|
||||
m_flowCharPlotWidget->hide();
|
||||
m_flowCharPlotWidget->setParent( nullptr );
|
||||
delete m_flowCharPlotWidget;
|
||||
m_flowCharPlotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::updateCurrentTimeStep()
|
||||
{
|
||||
if ( m_timeStepSelectionType() != ALL_AVAILABLE ) return;
|
||||
if ( !m_flowDiagSolution() ) return;
|
||||
|
||||
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
|
||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps( RigFlowDiagResultAddress::PHASE_ALL );
|
||||
|
||||
if ( m_currentlyPlottedTimeSteps == calculatedTimesteps ) return;
|
||||
|
||||
this->onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::setTimeSteps( const std::vector<int>& timeSteps )
|
||||
{
|
||||
m_selectedTimeSteps = timeSteps;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::setInjectorsAndProducers( const std::vector<QString>& injectors,
|
||||
const std::vector<QString>& producers )
|
||||
{
|
||||
std::vector<QString> allTracers;
|
||||
|
||||
allTracers = producers;
|
||||
allTracers.insert( allTracers.end(), injectors.begin(), injectors.end() );
|
||||
|
||||
if ( producers.empty() && !injectors.empty() )
|
||||
{
|
||||
m_cellFilter = RigFlowDiagResults::CELLS_FLOODED;
|
||||
}
|
||||
else if ( !producers.empty() && injectors.empty() )
|
||||
{
|
||||
m_cellFilter = RigFlowDiagResults::CELLS_DRAINED;
|
||||
}
|
||||
else if ( !producers.empty() && !injectors.empty() )
|
||||
{
|
||||
m_cellFilter = RigFlowDiagResults::CELLS_COMMUNICATION;
|
||||
}
|
||||
|
||||
m_selectedTracerNames = allTracers;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::setMinimumCommunication( double minimumCommunication )
|
||||
{
|
||||
m_minCommunication = minimumCommunication;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::setAquiferCellThreshold( double aquiferCellThreshold )
|
||||
{
|
||||
m_maxPvFraction = aquiferCellThreshold;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimFlowCharacteristicsPlot::fontSize() const
|
||||
{
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::updateFonts()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimFlowCharacteristicsPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType( proj );
|
||||
if ( proj )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> cases;
|
||||
proj->descendantsIncludingThisOfType( cases );
|
||||
for ( RimEclipseResultCase* c : cases )
|
||||
{
|
||||
if ( c->defaultFlowDiagSolution() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_cellFilterView )
|
||||
{
|
||||
if ( m_case )
|
||||
{
|
||||
for ( RimEclipseView* view : m_case()->reservoirViews() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( view->name(), view, false, view->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_flowDiagSolution )
|
||||
{
|
||||
if ( m_case )
|
||||
{
|
||||
std::vector<RimFlowDiagSolution*> flowSols = m_case->flowDiagSolutions();
|
||||
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
for ( RimFlowDiagSolution* flowSol : flowSols )
|
||||
{
|
||||
options.push_back(
|
||||
caf::PdmOptionItemInfo( flowSol->userDescription(), flowSol, false, flowSol->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_selectedTimeStepsUi )
|
||||
{
|
||||
if ( m_flowDiagSolution && m_case )
|
||||
{
|
||||
QStringList timeStepDates = m_case->timeStepStrings();
|
||||
std::vector<int> calculatedTimeSteps =
|
||||
m_flowDiagSolution()->flowDiagResults()->calculatedTimeSteps( RigFlowDiagResultAddress::PHASE_ALL );
|
||||
for ( int tsIdx = 0; tsIdx < timeStepDates.size(); ++tsIdx )
|
||||
{
|
||||
auto it = std::find( calculatedTimeSteps.begin(), calculatedTimeSteps.end(), tsIdx );
|
||||
QString itemText = timeStepDates[tsIdx];
|
||||
if ( it != calculatedTimeSteps.end() )
|
||||
{
|
||||
itemText = itemText + " *";
|
||||
}
|
||||
options.push_back( caf::PdmOptionItemInfo( itemText, tsIdx ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_selectedTracerNames )
|
||||
{
|
||||
if ( m_flowDiagSolution )
|
||||
{
|
||||
std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames();
|
||||
std::vector<std::pair<QString, QString>> sortedTracerNames;
|
||||
for ( QString tracerName : tracerNames )
|
||||
{
|
||||
if ( !caf::Utils::isStringMatch( m_tracerFilter, tracerName ) ) continue;
|
||||
|
||||
RimFlowDiagSolution::TracerStatusType tracerStatus = m_flowDiagSolution->tracerStatusOverall( tracerName );
|
||||
if ( tracerStatus == RimFlowDiagSolution::CLOSED ) continue;
|
||||
|
||||
if ( m_cellFilter() == RigFlowDiagResults::CELLS_FLOODED )
|
||||
{
|
||||
if ( tracerStatus == RimFlowDiagSolution::INJECTOR || tracerStatus == RimFlowDiagSolution::VARYING )
|
||||
{
|
||||
sortedTracerNames.push_back( std::make_pair( tracerName, tracerName ) );
|
||||
}
|
||||
}
|
||||
else if ( m_cellFilter() == RigFlowDiagResults::CELLS_DRAINED )
|
||||
{
|
||||
if ( tracerStatus == RimFlowDiagSolution::PRODUCER || tracerStatus == RimFlowDiagSolution::VARYING )
|
||||
{
|
||||
sortedTracerNames.push_back( std::make_pair( tracerName, tracerName ) );
|
||||
}
|
||||
}
|
||||
else if ( m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION )
|
||||
{
|
||||
QString prefix;
|
||||
switch ( tracerStatus )
|
||||
{
|
||||
case RimFlowDiagSolution::INJECTOR:
|
||||
prefix = "I : ";
|
||||
break;
|
||||
case RimFlowDiagSolution::PRODUCER:
|
||||
prefix = "P : ";
|
||||
break;
|
||||
case RimFlowDiagSolution::VARYING:
|
||||
prefix = "I/P: ";
|
||||
break;
|
||||
case RimFlowDiagSolution::UNDEFINED:
|
||||
prefix = "U : ";
|
||||
break;
|
||||
}
|
||||
sortedTracerNames.push_back( std::make_pair( prefix + tracerName, tracerName ) );
|
||||
}
|
||||
}
|
||||
|
||||
std::sort( sortedTracerNames.begin(),
|
||||
sortedTracerNames.end(),
|
||||
[]( const std::pair<QString, QString>& a, const std::pair<QString, QString>& b ) -> bool {
|
||||
return a.first < b.first;
|
||||
} );
|
||||
|
||||
for ( auto& tracer : sortedTracerNames )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( tracer.first, tracer.second ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
{
|
||||
// Ensure a case is selected if one is available
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType( proj );
|
||||
if ( proj )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> cases;
|
||||
proj->descendantsIncludingThisOfType( cases );
|
||||
RimEclipseResultCase* defaultCase = nullptr;
|
||||
for ( RimEclipseResultCase* c : cases )
|
||||
{
|
||||
if ( c->defaultFlowDiagSolution() )
|
||||
{
|
||||
if ( !defaultCase ) defaultCase = c; // Select first
|
||||
}
|
||||
}
|
||||
if ( !m_case() && defaultCase )
|
||||
{
|
||||
m_case = defaultCase;
|
||||
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
if ( !m_case()->reservoirViews.empty() )
|
||||
{
|
||||
m_cellFilterView = m_case()->reservoirViews()[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uiOrdering.add( &m_case );
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* timeStepsGroup = uiOrdering.addNewGroup( "Time Steps" );
|
||||
|
||||
timeStepsGroup->add( &m_timeStepSelectionType );
|
||||
|
||||
if ( m_timeStepSelectionType == SELECTED )
|
||||
{
|
||||
timeStepsGroup->add( &m_selectedTimeStepsUi );
|
||||
timeStepsGroup->add( &m_applyTimeSteps );
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* regionGroup = uiOrdering.addNewGroup( "Region" );
|
||||
regionGroup->add( &m_cellFilter );
|
||||
if ( m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION ||
|
||||
m_cellFilter() == RigFlowDiagResults::CELLS_DRAINED || m_cellFilter() == RigFlowDiagResults::CELLS_FLOODED )
|
||||
{
|
||||
regionGroup->add( &m_tracerFilter );
|
||||
regionGroup->add( &m_selectedTracerNames );
|
||||
regionGroup->add( &m_showRegion );
|
||||
}
|
||||
else if ( m_cellFilter() == RigFlowDiagResults::CELLS_VISIBLE )
|
||||
{
|
||||
regionGroup->add( &m_cellFilterView );
|
||||
}
|
||||
|
||||
if ( m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION )
|
||||
{
|
||||
regionGroup->add( &m_minCommunication );
|
||||
}
|
||||
else if ( m_cellFilter() == RigFlowDiagResults::CELLS_DRAINED || m_cellFilter() == RigFlowDiagResults::CELLS_FLOODED )
|
||||
{
|
||||
regionGroup->add( &m_maxTof );
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* optionsGroup = uiOrdering.addNewGroup( "Options" );
|
||||
optionsGroup->add( &m_flowDiagSolution );
|
||||
|
||||
optionsGroup->add( &m_showLegend );
|
||||
optionsGroup->add( &m_maxPvFraction );
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_applyTimeSteps )
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
{
|
||||
attrib->m_buttonText = "Apply";
|
||||
}
|
||||
}
|
||||
else if ( field == &m_showRegion )
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
{
|
||||
attrib->m_buttonText = "Show Region";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimFlowCharacteristicsPlot::viewWidget()
|
||||
{
|
||||
return m_flowCharPlotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::zoomAll()
|
||||
{
|
||||
if ( m_flowCharPlotWidget ) m_flowCharPlotWidget->zoomAll();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( &m_case == changedField )
|
||||
{
|
||||
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
m_currentlyPlottedTimeSteps.clear();
|
||||
if ( !m_case()->reservoirViews.empty() )
|
||||
{
|
||||
m_cellFilterView = m_case()->reservoirViews()[0];
|
||||
}
|
||||
}
|
||||
else if ( &m_applyTimeSteps == changedField )
|
||||
{
|
||||
if ( m_flowDiagSolution )
|
||||
{
|
||||
// Compute any missing time steps from selected
|
||||
for ( int tsIdx : m_selectedTimeStepsUi() )
|
||||
{
|
||||
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux( tsIdx );
|
||||
}
|
||||
m_selectedTimeSteps = m_selectedTimeStepsUi;
|
||||
}
|
||||
m_applyTimeSteps = false;
|
||||
}
|
||||
else if ( &m_showRegion == changedField )
|
||||
{
|
||||
if ( m_case )
|
||||
{
|
||||
if ( m_cellFilter() != RigFlowDiagResults::CELLS_ACTIVE )
|
||||
{
|
||||
RimEclipseView* view =
|
||||
RicSelectOrCreateViewFeatureImpl::showViewSelection( m_case,
|
||||
"FlowCharacteristicsLastUsedView",
|
||||
"RegionView",
|
||||
"Show Region in View" );
|
||||
|
||||
if ( view != nullptr )
|
||||
{
|
||||
view->faultCollection()->showFaultCollection = false;
|
||||
view->cellResult()->setResultType( RiaDefines::ResultCatType::FLOW_DIAGNOSTICS );
|
||||
view->cellResult()->setFlowDiagTracerSelectionType( RimEclipseResultDefinition::FLOW_TR_BY_SELECTION );
|
||||
view->cellResult()->setSelectedTracers( m_selectedTracerNames );
|
||||
|
||||
if ( m_cellFilter() == RigFlowDiagResults::CELLS_COMMUNICATION )
|
||||
{
|
||||
view->cellResult()->setResultVariable( RIG_FLD_COMMUNICATION_RESNAME );
|
||||
}
|
||||
else
|
||||
{
|
||||
view->cellResult()->setResultVariable( RIG_FLD_TOF_RESNAME );
|
||||
}
|
||||
|
||||
int timeStep = 0;
|
||||
if ( m_timeStepSelectionType() == ALL_AVAILABLE )
|
||||
{
|
||||
if ( m_flowDiagSolution )
|
||||
{
|
||||
std::vector<int> timeSteps = m_flowDiagSolution()->flowDiagResults()->calculatedTimeSteps(
|
||||
RigFlowDiagResultAddress::PHASE_ALL );
|
||||
if ( !timeSteps.empty() )
|
||||
{
|
||||
timeStep = timeSteps[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !m_selectedTimeStepsUi().empty() )
|
||||
{
|
||||
timeStep = m_selectedTimeStepsUi()[0];
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure selected time step has computed results
|
||||
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux( timeStep );
|
||||
|
||||
view->setCurrentTimeStep( timeStep );
|
||||
|
||||
for ( RimEclipsePropertyFilter* f : view->eclipsePropertyFilterCollection()->propertyFilters() )
|
||||
{
|
||||
f->isActive = false;
|
||||
}
|
||||
RicEclipsePropertyFilterFeatureImpl::addPropertyFilter( view->eclipsePropertyFilterCollection() );
|
||||
|
||||
view->loadDataAndUpdate();
|
||||
m_case->updateConnectedEditors();
|
||||
|
||||
RicSelectOrCreateViewFeatureImpl::focusView( view );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( changedField == &m_cellFilter )
|
||||
{
|
||||
m_selectedTracerNames = std::vector<QString>();
|
||||
}
|
||||
|
||||
// All fields update plot
|
||||
|
||||
this->onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimFlowCharacteristicsPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if ( m_flowCharPlotWidget )
|
||||
{
|
||||
QPixmap pix = m_flowCharPlotWidget->grab();
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
|
||||
if ( m_flowDiagSolution && m_flowCharPlotWidget )
|
||||
{
|
||||
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
|
||||
if ( !flowResult ) return;
|
||||
|
||||
{
|
||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps( RigFlowDiagResultAddress::PHASE_ALL );
|
||||
|
||||
if ( m_timeStepSelectionType == SELECTED )
|
||||
{
|
||||
for ( int tsIdx : m_selectedTimeSteps() )
|
||||
{
|
||||
m_flowDiagSolution()->flowDiagResults()->maxAbsPairFlux( tsIdx );
|
||||
}
|
||||
calculatedTimesteps = m_selectedTimeSteps();
|
||||
}
|
||||
|
||||
m_currentlyPlottedTimeSteps = calculatedTimesteps;
|
||||
}
|
||||
|
||||
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
|
||||
QStringList timeStepStrings = m_case->timeStepStrings();
|
||||
std::vector<double> lorenzVals( timeStepDates.size(), HUGE_VAL );
|
||||
|
||||
m_flowCharPlotWidget->removeAllCurves();
|
||||
|
||||
std::vector<QString> selectedTracerNames = m_selectedTracerNames();
|
||||
if ( m_cellFilter() == RigFlowDiagResults::CELLS_ACTIVE )
|
||||
{
|
||||
if ( m_flowDiagSolution )
|
||||
{
|
||||
selectedTracerNames = m_flowDiagSolution->tracerNames();
|
||||
}
|
||||
}
|
||||
|
||||
std::map<int, RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame> timeStepToFlowResultMap;
|
||||
|
||||
for ( int timeStepIdx : m_currentlyPlottedTimeSteps )
|
||||
{
|
||||
if ( m_cellFilter() == RigFlowDiagResults::CELLS_VISIBLE )
|
||||
{
|
||||
cvf::UByteArray visibleCells;
|
||||
m_case()->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
|
||||
if ( m_cellFilterView )
|
||||
{
|
||||
m_cellFilterView()->calculateCurrentTotalCellVisibility( &visibleCells, timeStepIdx );
|
||||
}
|
||||
|
||||
RigActiveCellInfo* activeCellInfo =
|
||||
m_case()->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
std::vector<char> visibleActiveCells( activeCellInfo->reservoirActiveCellCount(), 0 );
|
||||
|
||||
for ( size_t i = 0; i < visibleCells.size(); ++i )
|
||||
{
|
||||
size_t cellIndex = activeCellInfo->cellResultIndex( i );
|
||||
if ( cellIndex != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
visibleActiveCells[cellIndex] = visibleCells[i];
|
||||
}
|
||||
}
|
||||
|
||||
auto flowCharResults =
|
||||
flowResult->flowCharacteristicsResults( timeStepIdx, visibleActiveCells, m_maxPvFraction() );
|
||||
timeStepToFlowResultMap[timeStepIdx] = flowCharResults;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto flowCharResults = flowResult->flowCharacteristicsResults( timeStepIdx,
|
||||
m_cellFilter(),
|
||||
selectedTracerNames,
|
||||
m_maxPvFraction(),
|
||||
m_minCommunication(),
|
||||
m_maxTof() );
|
||||
timeStepToFlowResultMap[timeStepIdx] = flowCharResults;
|
||||
}
|
||||
lorenzVals[timeStepIdx] = timeStepToFlowResultMap[timeStepIdx].m_lorenzCoefficient;
|
||||
}
|
||||
|
||||
m_timeStepToFlowResultMap = timeStepToFlowResultMap;
|
||||
|
||||
m_flowCharPlotWidget->setLorenzCurve( timeStepStrings, timeStepDates, lorenzVals );
|
||||
|
||||
for ( int timeStepIdx : m_currentlyPlottedTimeSteps )
|
||||
{
|
||||
const auto& flowCharResults = timeStepToFlowResultMap[timeStepIdx];
|
||||
|
||||
m_flowCharPlotWidget->addFlowCapStorageCapCurve( timeStepDates[timeStepIdx],
|
||||
flowCharResults.m_storageCapFlowCapCurve.first,
|
||||
flowCharResults.m_storageCapFlowCapCurve.second );
|
||||
m_flowCharPlotWidget->addSweepEfficiencyCurve( timeStepDates[timeStepIdx],
|
||||
flowCharResults.m_dimensionlessTimeSweepEfficiencyCurve.first,
|
||||
flowCharResults.m_dimensionlessTimeSweepEfficiencyCurve.second );
|
||||
}
|
||||
|
||||
m_flowCharPlotWidget->showLegend( m_showLegend() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// TODO: implement properly
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::assignIdIfNecessary()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowCharacteristicsPlot::viewGeometryUpdated()
|
||||
{
|
||||
if ( m_cellFilter() == RigFlowDiagResults::CELLS_VISIBLE )
|
||||
{
|
||||
// Only need to reload data if cell filtering is based on visible cells in view.
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double interpolate( const std::vector<double>& xData, const std::vector<double>& yData, double x, bool extrapolate )
|
||||
{
|
||||
size_t itemCount = xData.size();
|
||||
|
||||
size_t index = 0;
|
||||
if ( x >= xData[itemCount - 2] )
|
||||
{
|
||||
index = itemCount - 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( x > xData[index + 1] )
|
||||
index++;
|
||||
}
|
||||
double xLeft = xData[index];
|
||||
double yLeft = yData[index];
|
||||
double xRight = xData[index + 1];
|
||||
double yRight = yData[index + 1];
|
||||
|
||||
if ( !extrapolate )
|
||||
{
|
||||
if ( x < xLeft ) yRight = yLeft;
|
||||
if ( x > xRight ) yLeft = yRight;
|
||||
}
|
||||
|
||||
double dydx = ( yRight - yLeft ) / ( xRight - xLeft );
|
||||
|
||||
return yLeft + dydx * ( x - xLeft );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFlowCharacteristicsPlot::curveDataAsText() const
|
||||
{
|
||||
QString fieldSeparator = RiaPreferences::current()->csvTextExportFieldSeparator;
|
||||
QString tableText;
|
||||
|
||||
QTextStream stream( &tableText );
|
||||
RifCsvDataTableFormatter formatter( stream, fieldSeparator );
|
||||
|
||||
std::vector<RifTextDataTableColumn> header = {
|
||||
RifTextDataTableColumn( "Date" ),
|
||||
RifTextDataTableColumn( "StorageCapacity" ),
|
||||
RifTextDataTableColumn( "FlowCapacity" ),
|
||||
RifTextDataTableColumn( "SweepEfficiency" ),
|
||||
RifTextDataTableColumn( "DimensionlessTime" ),
|
||||
RifTextDataTableColumn( "LorentzCoefficient" ),
|
||||
};
|
||||
|
||||
formatter.header( header );
|
||||
|
||||
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
|
||||
|
||||
std::vector<double> storageCapacitySamplingValues = { 0.08, 0.1, 0.2, 0.3, 0.4 };
|
||||
size_t sampleCount = storageCapacitySamplingValues.size();
|
||||
|
||||
for ( const auto& timeIndex : m_currentlyPlottedTimeSteps )
|
||||
{
|
||||
QString dateString = timeStepDates[timeIndex].toString( "yyyy-MM-dd" );
|
||||
|
||||
auto a = m_timeStepToFlowResultMap.find( timeIndex );
|
||||
if ( a != m_timeStepToFlowResultMap.end() )
|
||||
{
|
||||
auto storageCapacityValues = a->second.m_storageCapFlowCapCurve.first;
|
||||
auto flowCapacityValues = a->second.m_storageCapFlowCapCurve.second;
|
||||
|
||||
bool extrapolate = false;
|
||||
std::vector<double> flowCapacitySamplingValues;
|
||||
for ( const auto storageCapacity : storageCapacitySamplingValues )
|
||||
{
|
||||
{
|
||||
double flowCapacity =
|
||||
interpolate( storageCapacityValues, flowCapacityValues, storageCapacity, extrapolate );
|
||||
flowCapacitySamplingValues.push_back( flowCapacity );
|
||||
}
|
||||
}
|
||||
|
||||
auto dimensionLessTimeValues = a->second.m_dimensionlessTimeSweepEfficiencyCurve.first;
|
||||
auto sweepEffValues = a->second.m_dimensionlessTimeSweepEfficiencyCurve.second;
|
||||
|
||||
std::vector<double> dimensionLessTimeSamplingValues;
|
||||
std::vector<double> sweepEffSamplingValues;
|
||||
double range = dimensionLessTimeValues.back() - dimensionLessTimeValues[0];
|
||||
double step = range / sampleCount;
|
||||
for ( size_t i = 0; i < sampleCount; i++ )
|
||||
{
|
||||
double dimensionLessTimeValue = i * step;
|
||||
dimensionLessTimeSamplingValues.push_back( dimensionLessTimeValue );
|
||||
double sweepEffValue =
|
||||
interpolate( dimensionLessTimeValues, sweepEffValues, dimensionLessTimeValue, extrapolate );
|
||||
sweepEffSamplingValues.push_back( sweepEffValue );
|
||||
}
|
||||
|
||||
auto lorentz = a->second.m_lorenzCoefficient;
|
||||
|
||||
for ( size_t i = 0; i < sampleCount; i++ )
|
||||
{
|
||||
formatter.add( dateString );
|
||||
formatter.add( storageCapacitySamplingValues[i] );
|
||||
formatter.add( flowCapacitySamplingValues[i] );
|
||||
formatter.add( sweepEffSamplingValues[i] );
|
||||
formatter.add( dimensionLessTimeSamplingValues[i] );
|
||||
formatter.add( lorentz );
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
formatter.tableCompleted();
|
||||
|
||||
return tableText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimFlowCharacteristicsPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
m_flowCharPlotWidget = new RiuFlowCharacteristicsPlot( this, mainWindowParent );
|
||||
return m_flowCharPlotWidget;
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimViewWindow.h"
|
||||
|
||||
#include "RigFlowDiagResults.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class RimFlowDiagSolution;
|
||||
class RimEclipseResultCase;
|
||||
class RimEclipseView;
|
||||
|
||||
class RiuFlowCharacteristicsPlot;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmOptionItemInfo;
|
||||
}
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class Color3f;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimFlowCharacteristicsPlot : public RimViewWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimFlowCharacteristicsPlot();
|
||||
~RimFlowCharacteristicsPlot() override;
|
||||
|
||||
int id() const final;
|
||||
|
||||
void setFromFlowSolution( RimFlowDiagSolution* flowSolution );
|
||||
void updateCurrentTimeStep();
|
||||
|
||||
// RimViewWindow overrides
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
void zoomAll() override;
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void deleteViewWidget() override;
|
||||
void viewGeometryUpdated();
|
||||
|
||||
QString curveDataAsText() const;
|
||||
|
||||
enum TimeSelectionType
|
||||
{
|
||||
ALL_AVAILABLE,
|
||||
SELECTED,
|
||||
};
|
||||
|
||||
void setTimeSteps( const std::vector<int>& timeSteps );
|
||||
void setInjectorsAndProducers( const std::vector<QString>& injectors, const std::vector<QString>& producers );
|
||||
void setMinimumCommunication( double minimumCommunication );
|
||||
void setAquiferCellThreshold( double aquiferCellThreshold );
|
||||
|
||||
int fontSize() const override;
|
||||
void updateFonts() override;
|
||||
|
||||
protected:
|
||||
// RimViewWindow overrides
|
||||
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
// Overridden PDM methods
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
void assignIdIfNecessary() final;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
|
||||
caf::PdmField<caf::AppEnum<TimeSelectionType>> m_timeStepSelectionType;
|
||||
caf::PdmField<std::vector<int>> m_selectedTimeSteps;
|
||||
caf::PdmField<std::vector<int>> m_selectedTimeStepsUi;
|
||||
caf::PdmField<bool> m_applyTimeSteps;
|
||||
caf::PdmField<bool> m_showLegend;
|
||||
caf::PdmField<double> m_maxPvFraction;
|
||||
|
||||
caf::PdmField<RigFlowDiagResults::CellFilterEnum> m_cellFilter;
|
||||
caf::PdmPtrField<RimEclipseView*> m_cellFilterView;
|
||||
caf::PdmField<QString> m_tracerFilter;
|
||||
caf::PdmField<std::vector<QString>> m_selectedTracerNames;
|
||||
caf::PdmField<bool> m_showRegion;
|
||||
|
||||
caf::PdmField<double> m_minCommunication;
|
||||
caf::PdmField<int> m_maxTof;
|
||||
|
||||
std::vector<int> m_currentlyPlottedTimeSteps;
|
||||
std::map<int, RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame> m_timeStepToFlowResultMap;
|
||||
|
||||
QPointer<RiuFlowCharacteristicsPlot> m_flowCharPlotWidget;
|
||||
};
|
||||
354
ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp
Normal file
354
ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp
Normal file
@@ -0,0 +1,354 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil 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 "RimFlowDiagSolution.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigSimWellData.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimFlowDiagSolution, "FlowDiagSolution" );
|
||||
|
||||
#define CROSS_FLOW_ENDING "-XF"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFlowDiagSolution::hasCrossFlowEnding( const QString& tracerName )
|
||||
{
|
||||
return tracerName.endsWith( CROSS_FLOW_ENDING );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFlowDiagSolution::removeCrossFlowEnding( const QString& tracerName )
|
||||
{
|
||||
if ( tracerName.endsWith( CROSS_FLOW_ENDING ) )
|
||||
{
|
||||
return tracerName.left( tracerName.size() - 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return tracerName;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFlowDiagSolution::addCrossFlowEnding( const QString& wellName )
|
||||
{
|
||||
return wellName + CROSS_FLOW_ENDING;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowDiagSolution::RimFlowDiagSolution( void )
|
||||
{
|
||||
CAF_PDM_InitObject( "Flow Diagnostics Solution", "", "", "" );
|
||||
CAF_PDM_InitField( &m_userDescription, "UserDescription", QString( "All Wells" ), "Description", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowDiagSolution::~RimFlowDiagSolution( void )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFlowDiagSolution::userDescription() const
|
||||
{
|
||||
return m_userDescription();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
|
||||
{
|
||||
if ( m_flowDiagResults.isNull() )
|
||||
{
|
||||
size_t timeStepCount;
|
||||
{
|
||||
RimEclipseResultCase* eclCase;
|
||||
this->firstAncestorOrThisOfType( eclCase );
|
||||
|
||||
if ( !eclCase || !eclCase->eclipseCaseData() )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
timeStepCount =
|
||||
eclCase->eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->maxTimeStepCount();
|
||||
}
|
||||
|
||||
m_flowDiagResults = new RigFlowDiagResults( this, timeStepCount );
|
||||
}
|
||||
|
||||
return m_flowDiagResults.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RimFlowDiagSolution::tracerNames() const
|
||||
{
|
||||
RimEclipseResultCase* eclCase;
|
||||
this->firstAncestorOrThisOfType( eclCase );
|
||||
|
||||
std::vector<QString> tracerNameSet;
|
||||
|
||||
if ( eclCase && eclCase->eclipseCaseData() )
|
||||
{
|
||||
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
|
||||
|
||||
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
|
||||
{
|
||||
tracerNameSet.push_back( simWellData[wIdx]->m_wellName );
|
||||
tracerNameSet.push_back( addCrossFlowEnding( simWellData[wIdx]->m_wellName ) );
|
||||
}
|
||||
}
|
||||
|
||||
return tracerNameSet;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<std::string, std::vector<int>> RimFlowDiagSolution::allInjectorTracerActiveCellIndices( size_t timeStepIndex ) const
|
||||
{
|
||||
return allTracerActiveCellIndices( timeStepIndex, true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<std::string, std::vector<int>> RimFlowDiagSolution::allProducerTracerActiveCellIndices( size_t timeStepIndex ) const
|
||||
{
|
||||
return allTracerActiveCellIndices( timeStepIndex, false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<std::string, std::vector<int>> RimFlowDiagSolution::allTracerActiveCellIndices( size_t timeStepIndex,
|
||||
bool useInjectors ) const
|
||||
{
|
||||
RimEclipseResultCase* eclCase;
|
||||
this->firstAncestorOrThisOfType( eclCase );
|
||||
|
||||
std::map<std::string, std::vector<int>> tracersWithCells;
|
||||
|
||||
if ( eclCase && eclCase->eclipseCaseData() )
|
||||
{
|
||||
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
|
||||
RigMainGrid* mainGrid = eclCase->eclipseCaseData()->mainGrid();
|
||||
RigActiveCellInfo* activeCellInfo = eclCase->eclipseCaseData()->activeCellInfo(
|
||||
RiaDefines::PorosityModelType::MATRIX_MODEL ); // Todo: Must come from the results
|
||||
// definition
|
||||
|
||||
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
|
||||
{
|
||||
if ( !simWellData[wIdx]->hasWellResult( timeStepIndex ) ) continue;
|
||||
const RigWellResultFrame& wellResFrame = simWellData[wIdx]->wellResultFrame( timeStepIndex );
|
||||
|
||||
bool isInjectorWell = ( wellResFrame.m_productionType != RigWellResultFrame::PRODUCER &&
|
||||
wellResFrame.m_productionType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE );
|
||||
|
||||
std::string wellName = simWellData[wIdx]->m_wellName.toStdString();
|
||||
std::string wellNameXf = addCrossFlowEnding( simWellData[wIdx]->m_wellName ).toStdString();
|
||||
|
||||
std::vector<int>& tracerCells = tracersWithCells[wellName];
|
||||
std::vector<int>& tracerCellsCrossFlow = tracersWithCells[wellNameXf];
|
||||
|
||||
for ( const RigWellResultBranch& wBr : wellResFrame.m_wellResultBranches )
|
||||
{
|
||||
for ( const RigWellResultPoint& wrp : wBr.m_branchResultPoints )
|
||||
{
|
||||
if ( wrp.isValid() && wrp.m_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 );
|
||||
|
||||
int cellActiveIndex = static_cast<int>( activeCellInfo->cellResultIndex( reservoirCellIndex ) );
|
||||
|
||||
if ( useInjectors == isInjectorWell )
|
||||
{
|
||||
tracerCells.push_back( cellActiveIndex );
|
||||
}
|
||||
else
|
||||
{
|
||||
tracerCellsCrossFlow.push_back( cellActiveIndex );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( tracerCells.empty() ) tracersWithCells.erase( wellName );
|
||||
if ( tracerCellsCrossFlow.empty() ) tracersWithCells.erase( wellNameXf );
|
||||
}
|
||||
}
|
||||
|
||||
return tracersWithCells;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall( const QString& tracerName ) const
|
||||
{
|
||||
RimEclipseResultCase* eclCase;
|
||||
this->firstAncestorOrThisOfTypeAsserted( eclCase );
|
||||
|
||||
TracerStatusType tracerStatus = UNDEFINED;
|
||||
if ( eclCase && eclCase->eclipseCaseData() )
|
||||
{
|
||||
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
|
||||
|
||||
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
|
||||
{
|
||||
QString wellName = removeCrossFlowEnding( tracerName );
|
||||
|
||||
if ( simWellData[wIdx]->m_wellName != wellName ) continue;
|
||||
|
||||
tracerStatus = CLOSED;
|
||||
for ( const RigWellResultFrame& wellResFrame : simWellData[wIdx]->m_wellCellsTimeSteps )
|
||||
{
|
||||
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR ||
|
||||
wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR ||
|
||||
wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
|
||||
{
|
||||
if ( tracerStatus == PRODUCER )
|
||||
tracerStatus = VARYING;
|
||||
else
|
||||
tracerStatus = INJECTOR;
|
||||
}
|
||||
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
|
||||
{
|
||||
if ( tracerStatus == INJECTOR )
|
||||
tracerStatus = VARYING;
|
||||
else
|
||||
tracerStatus = PRODUCER;
|
||||
}
|
||||
if ( tracerStatus == VARYING ) break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ( hasCrossFlowEnding( tracerName ) )
|
||||
{
|
||||
if ( tracerStatus == PRODUCER )
|
||||
tracerStatus = INJECTOR;
|
||||
else if ( tracerStatus == INJECTOR )
|
||||
tracerStatus = PRODUCER;
|
||||
}
|
||||
}
|
||||
|
||||
return tracerStatus;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeStep( const QString& tracerName,
|
||||
size_t timeStepIndex ) const
|
||||
{
|
||||
RimEclipseResultCase* eclCase;
|
||||
this->firstAncestorOrThisOfTypeAsserted( eclCase );
|
||||
|
||||
if ( eclCase && eclCase->eclipseCaseData() )
|
||||
{
|
||||
const cvf::Collection<RigSimWellData>& simWellData = eclCase->eclipseCaseData()->wellResults();
|
||||
|
||||
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
|
||||
{
|
||||
QString wellName = removeCrossFlowEnding( tracerName );
|
||||
|
||||
if ( simWellData[wIdx]->m_wellName != wellName ) continue;
|
||||
if ( !simWellData[wIdx]->hasWellResult( timeStepIndex ) ) return CLOSED;
|
||||
|
||||
const RigWellResultFrame& wellResFrame = simWellData[wIdx]->wellResultFrame( timeStepIndex );
|
||||
|
||||
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR ||
|
||||
wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR ||
|
||||
wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
|
||||
{
|
||||
if ( hasCrossFlowEnding( tracerName ) ) return PRODUCER;
|
||||
|
||||
return INJECTOR;
|
||||
}
|
||||
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER ||
|
||||
wellResFrame.m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
|
||||
{
|
||||
if ( hasCrossFlowEnding( tracerName ) ) return INJECTOR;
|
||||
|
||||
return PRODUCER;
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return UNDEFINED;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RimFlowDiagSolution::tracerColor( const QString& tracerName ) const
|
||||
{
|
||||
QString wellName = removeCrossFlowEnding( tracerName );
|
||||
|
||||
if ( wellName == RIG_FLOW_TOTAL_NAME ) return cvf::Color3f::LIGHT_GRAY;
|
||||
if ( wellName == RIG_RESERVOIR_TRACER_NAME ) return cvf::Color3f::LIGHT_GRAY;
|
||||
if ( wellName == RIG_TINY_TRACER_GROUP_NAME ) return cvf::Color3f::DARK_GRAY;
|
||||
|
||||
RimEclipseResultCase* eclCase;
|
||||
this->firstAncestorOrThisOfType( eclCase );
|
||||
|
||||
if ( eclCase )
|
||||
{
|
||||
return eclCase->defaultWellColor( wellName );
|
||||
}
|
||||
|
||||
return cvf::Color3f::LIGHT_GRAY;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimFlowDiagSolution::userDescriptionField()
|
||||
{
|
||||
return &m_userDescription;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil 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 "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
class RigFlowDiagResults;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimFlowDiagSolution : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimFlowDiagSolution();
|
||||
~RimFlowDiagSolution() override;
|
||||
|
||||
QString userDescription() const;
|
||||
RigFlowDiagResults* flowDiagResults();
|
||||
std::vector<QString> tracerNames() const;
|
||||
|
||||
std::map<std::string, std::vector<int>> allInjectorTracerActiveCellIndices( size_t timeStepIndex ) const;
|
||||
std::map<std::string, std::vector<int>> allProducerTracerActiveCellIndices( size_t timeStepIndex ) const;
|
||||
|
||||
enum TracerStatusType
|
||||
{
|
||||
CLOSED, ///< Tracer has no active cells, and does not contribute
|
||||
PRODUCER, ///< Tracer with producing cells
|
||||
INJECTOR, ///< Tracer with injecting cells
|
||||
VARYING, ///< Tracer is producing and injecting at different time steps. Only used as a timestep-overall type
|
||||
UNDEFINED ///< Used as "Any" or "not set"
|
||||
};
|
||||
|
||||
TracerStatusType tracerStatusOverall( const QString& tracerName ) const;
|
||||
TracerStatusType tracerStatusInTimeStep( const QString& tracerName, size_t timeStepIndex ) const;
|
||||
cvf::Color3f tracerColor( const QString& tracerName ) const;
|
||||
|
||||
static bool hasCrossFlowEnding( const QString& tracerName );
|
||||
static QString removeCrossFlowEnding( const QString& tracerName );
|
||||
static QString addCrossFlowEnding( const QString& wellName );
|
||||
|
||||
private:
|
||||
std::map<std::string, std::vector<int>> allTracerActiveCellIndices( size_t timeStepIndex, bool useInjectors ) const;
|
||||
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
caf::PdmField<QString> m_userDescription;
|
||||
|
||||
cvf::ref<RigFlowDiagResults> m_flowDiagResults;
|
||||
};
|
||||
@@ -0,0 +1,213 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimFlowPlotCollection.h"
|
||||
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellDistributionPlotCollection.h"
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
#include "cvfAssert.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimFlowPlotCollection, "FlowPlotCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowPlotCollection::RimFlowPlotCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Flow Diagnostics Plots", ":/WellAllocPlots16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_flowCharacteristicsPlot, "FlowCharacteristicsPlot", "", "", "", "" );
|
||||
m_flowCharacteristicsPlot.uiCapability()->setUiHidden( true );
|
||||
|
||||
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", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_storedFlowCharacteristicsPlots,
|
||||
"StoredFlowCharacteristicsPlots",
|
||||
"Stored Flow Characteristics Plots",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowPlotCollection::~RimFlowPlotCollection()
|
||||
{
|
||||
delete m_defaultWellAllocPlot();
|
||||
|
||||
m_storedWellAllocPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
|
||||
{
|
||||
if ( m_defaultWellAllocPlot )
|
||||
{
|
||||
m_defaultWellAllocPlot->removeFromMdiAreaAndDeleteViewWidget();
|
||||
delete m_defaultWellAllocPlot();
|
||||
}
|
||||
|
||||
delete m_flowCharacteristicsPlot;
|
||||
// delete m_dbgWellDistributionPlot;
|
||||
delete m_wellDistributionPlotCollection;
|
||||
|
||||
m_storedWellAllocPlots.deleteAllChildObjects();
|
||||
m_storedFlowCharacteristicsPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::loadDataAndUpdate()
|
||||
{
|
||||
caf::ProgressInfo plotProgress( m_storedWellAllocPlots.size() + m_storedFlowCharacteristicsPlots.size() + 3, "" );
|
||||
|
||||
if ( m_defaultWellAllocPlot ) m_defaultWellAllocPlot->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
|
||||
for ( RimWellAllocationPlot* p : m_storedWellAllocPlots )
|
||||
{
|
||||
p->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
}
|
||||
|
||||
for ( RimFlowCharacteristicsPlot* p : m_storedFlowCharacteristicsPlots )
|
||||
{
|
||||
p->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
}
|
||||
|
||||
if ( m_flowCharacteristicsPlot )
|
||||
{
|
||||
m_flowCharacteristicsPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
// if ( m_dbgWellDistributionPlot )
|
||||
//{
|
||||
// m_dbgWellDistributionPlot->loadDataAndUpdate();
|
||||
//}
|
||||
|
||||
if ( m_wellDistributionPlotCollection )
|
||||
{
|
||||
m_wellDistributionPlotCollection->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimFlowPlotCollection::plotCount() const
|
||||
{
|
||||
size_t plotCount = 0;
|
||||
if ( m_defaultWellAllocPlot ) plotCount = 1;
|
||||
plotCount += m_storedWellAllocPlots.size();
|
||||
plotCount += m_storedFlowCharacteristicsPlots.size();
|
||||
return plotCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::addWellAllocPlotToStoredPlots( RimWellAllocationPlot* plot )
|
||||
{
|
||||
m_storedWellAllocPlots.push_back( plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::addFlowCharacteristicsPlotToStoredPlots( RimFlowCharacteristicsPlot* plot )
|
||||
{
|
||||
m_storedFlowCharacteristicsPlots.push_back( plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot* RimFlowPlotCollection::defaultWellAllocPlot()
|
||||
{
|
||||
if ( !m_defaultWellAllocPlot() )
|
||||
{
|
||||
m_defaultWellAllocPlot = new RimWellAllocationPlot;
|
||||
m_defaultWellAllocPlot->setDescription( "Default Flow Diagnostics Plot" );
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
|
||||
return m_defaultWellAllocPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowCharacteristicsPlot* RimFlowPlotCollection::defaultFlowCharacteristicsPlot()
|
||||
{
|
||||
if ( !m_flowCharacteristicsPlot() )
|
||||
{
|
||||
m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot;
|
||||
}
|
||||
|
||||
this->updateConnectedEditors();
|
||||
|
||||
return m_flowCharacteristicsPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlotCollection* RimFlowPlotCollection::wellDistributionPlotCollection() const
|
||||
{
|
||||
return m_wellDistributionPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFlowPlotCollection::ensureDefaultFlowPlotsAreCreated()
|
||||
{
|
||||
if ( !m_defaultWellAllocPlot() )
|
||||
{
|
||||
m_defaultWellAllocPlot = new RimWellAllocationPlot;
|
||||
m_defaultWellAllocPlot->setDescription( "Default Flow Diagnostics Plot" );
|
||||
}
|
||||
|
||||
if ( !m_flowCharacteristicsPlot() )
|
||||
{
|
||||
m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot;
|
||||
}
|
||||
|
||||
if ( !m_wellDistributionPlotCollection() )
|
||||
{
|
||||
m_wellDistributionPlotCollection = new RimWellDistributionPlotCollection;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimWellAllocationPlot;
|
||||
class RimFlowCharacteristicsPlot;
|
||||
class RimWellDistributionPlot;
|
||||
class RimWellDistributionPlotCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimFlowPlotCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimFlowPlotCollection();
|
||||
~RimFlowPlotCollection() override;
|
||||
|
||||
void closeDefaultPlotWindowAndDeletePlots();
|
||||
void loadDataAndUpdate();
|
||||
size_t plotCount() const;
|
||||
|
||||
void addWellAllocPlotToStoredPlots( RimWellAllocationPlot* plot );
|
||||
void addFlowCharacteristicsPlotToStoredPlots( RimFlowCharacteristicsPlot* plot );
|
||||
RimWellAllocationPlot* defaultWellAllocPlot();
|
||||
RimFlowCharacteristicsPlot* defaultFlowCharacteristicsPlot();
|
||||
RimWellDistributionPlotCollection* wellDistributionPlotCollection() const;
|
||||
void ensureDefaultFlowPlotsAreCreated();
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimFlowCharacteristicsPlot*> m_flowCharacteristicsPlot;
|
||||
caf::PdmChildField<RimWellAllocationPlot*> m_defaultWellAllocPlot;
|
||||
caf::PdmChildField<RimWellDistributionPlotCollection*> m_wellDistributionPlotCollection;
|
||||
caf::PdmChildArrayField<RimWellAllocationPlot*> m_storedWellAllocPlots;
|
||||
caf::PdmChildArrayField<RimFlowCharacteristicsPlot*> m_storedFlowCharacteristicsPlots;
|
||||
};
|
||||
@@ -0,0 +1,253 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimTofAccumulatedPhaseFractionsPlot.h"
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
|
||||
#include "RigSimWellData.h"
|
||||
#include "RigTofAccumulatedPhaseFractionsCalculator.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuTofAccumulatedPhaseFractionsPlot.h"
|
||||
#include "RiuWellAllocationPlot.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimTofAccumulatedPhaseFractionsPlot, "TofAccumulatedPhaseFractionsPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTofAccumulatedPhaseFractionsPlot::RimTofAccumulatedPhaseFractionsPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Cumulative Saturation by Time of Flight", ":/TOFAccSatPlot16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Cumulative Saturation by Time of Flight" ), "Name", "", "", "" );
|
||||
m_userName.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" );
|
||||
m_showPlotTitle.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_maxTof, "MaxTof", 50, "Max Time of Flight [year]", "", "", "" );
|
||||
m_showWindow = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTofAccumulatedPhaseFractionsPlot::~RimTofAccumulatedPhaseFractionsPlot()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
|
||||
if ( m_tofAccumulatedPhaseFractionsPlotWidget )
|
||||
{
|
||||
m_tofAccumulatedPhaseFractionsPlotWidget->hide();
|
||||
m_tofAccumulatedPhaseFractionsPlotWidget->setParent( nullptr );
|
||||
delete m_tofAccumulatedPhaseFractionsPlotWidget;
|
||||
m_tofAccumulatedPhaseFractionsPlotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// TODO: implement properly
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimTofAccumulatedPhaseFractionsPlot::id() const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTofAccumulatedPhaseFractionsPlot::deleteViewWidget()
|
||||
{
|
||||
if ( m_tofAccumulatedPhaseFractionsPlotWidget )
|
||||
{
|
||||
m_tofAccumulatedPhaseFractionsPlotWidget->hide();
|
||||
m_tofAccumulatedPhaseFractionsPlotWidget->setParent( nullptr );
|
||||
delete m_tofAccumulatedPhaseFractionsPlotWidget;
|
||||
m_tofAccumulatedPhaseFractionsPlotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTofAccumulatedPhaseFractionsPlot::reloadFromWell()
|
||||
{
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseResultCase* RimTofAccumulatedPhaseFractionsPlot::resultCase()
|
||||
{
|
||||
RimWellAllocationPlot* allocationPlot;
|
||||
firstAncestorOrThisOfTypeAsserted( allocationPlot );
|
||||
|
||||
return allocationPlot->rimCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimTofAccumulatedPhaseFractionsPlot::tracerName()
|
||||
{
|
||||
RimWellAllocationPlot* allocationPlot;
|
||||
firstAncestorOrThisOfTypeAsserted( allocationPlot );
|
||||
|
||||
return allocationPlot->wellName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimTofAccumulatedPhaseFractionsPlot::timeStep()
|
||||
{
|
||||
RimWellAllocationPlot* allocationPlot;
|
||||
firstAncestorOrThisOfTypeAsserted( allocationPlot );
|
||||
|
||||
return static_cast<size_t>( allocationPlot->timeStep() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimTofAccumulatedPhaseFractionsPlot::fontSize() const
|
||||
{
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTofAccumulatedPhaseFractionsPlot::updateFonts()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimTofAccumulatedPhaseFractionsPlot::viewWidget()
|
||||
{
|
||||
return m_tofAccumulatedPhaseFractionsPlotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTofAccumulatedPhaseFractionsPlot::zoomAll()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTofAccumulatedPhaseFractionsPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_userName || changedField == &m_showPlotTitle )
|
||||
{
|
||||
updateMdiWindowTitle();
|
||||
}
|
||||
else if ( changedField == &m_maxTof )
|
||||
{
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimTofAccumulatedPhaseFractionsPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
// TODO
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTofAccumulatedPhaseFractionsPlot::setDescription( const QString& description )
|
||||
{
|
||||
m_userName = description;
|
||||
this->updateMdiWindowTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimTofAccumulatedPhaseFractionsPlot::description() const
|
||||
{
|
||||
return m_userName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// TODO: Implement properly
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTofAccumulatedPhaseFractionsPlot::assignIdIfNecessary()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTofAccumulatedPhaseFractionsPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
|
||||
if ( m_tofAccumulatedPhaseFractionsPlotWidget && m_showWindow() )
|
||||
{
|
||||
RigTofAccumulatedPhaseFractionsCalculator calc( resultCase(), tracerName(), timeStep() );
|
||||
|
||||
const std::vector<double>& xValues = calc.sortedUniqueTOFValues();
|
||||
const std::vector<double>& watValues = calc.accumulatedPhaseFractionsSwat();
|
||||
const std::vector<double>& oilValues = calc.accumulatedPhaseFractionsSoil();
|
||||
const std::vector<double>& gasValues = calc.accumulatedPhaseFractionsSgas();
|
||||
|
||||
m_tofAccumulatedPhaseFractionsPlotWidget->setSamples( xValues, watValues, oilValues, gasValues, m_maxTof() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimTofAccumulatedPhaseFractionsPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
if ( !m_tofAccumulatedPhaseFractionsPlotWidget )
|
||||
{
|
||||
m_tofAccumulatedPhaseFractionsPlotWidget = new RiuTofAccumulatedPhaseFractionsPlot( this, mainWindowParent );
|
||||
}
|
||||
return m_tofAccumulatedPhaseFractionsPlotWidget;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimViewWindow.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimEclipseResultCase;
|
||||
class RimWellLogPlot;
|
||||
class RiuTofAccumulatedPhaseFractionsPlot;
|
||||
class RiuWellAllocationPlot;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmOptionItemInfo;
|
||||
}
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class Color3f;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimTofAccumulatedPhaseFractionsPlot : public RimViewWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimTofAccumulatedPhaseFractionsPlot();
|
||||
~RimTofAccumulatedPhaseFractionsPlot() override;
|
||||
|
||||
int id() const final;
|
||||
|
||||
void setDescription( const QString& description );
|
||||
QString description() const;
|
||||
|
||||
// RimViewWindow overrides
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
void zoomAll() override;
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void deleteViewWidget() override;
|
||||
|
||||
void reloadFromWell();
|
||||
|
||||
RimEclipseResultCase* resultCase();
|
||||
QString tracerName();
|
||||
size_t timeStep();
|
||||
|
||||
int fontSize() const override;
|
||||
void updateFonts() override;
|
||||
|
||||
protected:
|
||||
// RimViewWindow overrides
|
||||
void assignIdIfNecessary() final;
|
||||
void onLoadDataAndUpdate() override;
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
// Overridden PDM methods
|
||||
caf::PdmFieldHandle* userDescriptionField() override { return &m_userName; }
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showPlotTitle;
|
||||
caf::PdmField<QString> m_userName;
|
||||
caf::PdmField<int> m_maxTof;
|
||||
|
||||
QPointer<RiuTofAccumulatedPhaseFractionsPlot> m_tofAccumulatedPhaseFractionsPlotWidget;
|
||||
};
|
||||
@@ -0,0 +1,236 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimTotalWellAllocationPlot.h"
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
|
||||
#include "RigSimWellData.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiuNightchartsWidget.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuWellAllocationPlot.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimTotalWellAllocationPlot, "TotalWellAllocationPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTotalWellAllocationPlot::RimTotalWellAllocationPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Total Allocation", ":/WellAllocPie16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Total Allocation" ), "Name", "", "", "" );
|
||||
m_userName.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTotalWellAllocationPlot::~RimTotalWellAllocationPlot()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
|
||||
if ( m_wellTotalAllocationPlotWidget )
|
||||
{
|
||||
m_wellTotalAllocationPlotWidget->hide();
|
||||
m_wellTotalAllocationPlotWidget->setParent( nullptr );
|
||||
delete m_wellTotalAllocationPlotWidget;
|
||||
m_wellTotalAllocationPlotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// TODO: implement properly
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimTotalWellAllocationPlot::id() const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::deleteViewWidget()
|
||||
{
|
||||
if ( m_wellTotalAllocationPlotWidget )
|
||||
{
|
||||
m_wellTotalAllocationPlotWidget->hide();
|
||||
m_wellTotalAllocationPlotWidget->setParent( nullptr );
|
||||
delete m_wellTotalAllocationPlotWidget;
|
||||
m_wellTotalAllocationPlotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimTotalWellAllocationPlot::fontSize() const
|
||||
{
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::updateFonts()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimTotalWellAllocationPlot::viewWidget()
|
||||
{
|
||||
return m_wellTotalAllocationPlotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::zoomAll()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_userName || changedField == &m_showPlotTitle )
|
||||
{
|
||||
updateMdiWindowTitle();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// TODO: Implement properly
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::assignIdIfNecessary()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimTotalWellAllocationPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
// TODO
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::setDescription( const QString& description )
|
||||
{
|
||||
m_userName = description;
|
||||
this->updateMdiWindowTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimTotalWellAllocationPlot::description() const
|
||||
{
|
||||
return m_userName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimTotalWellAllocationPlot::totalAllocationAsText() const
|
||||
{
|
||||
QString txt;
|
||||
|
||||
for ( auto a : m_sliceInfo )
|
||||
{
|
||||
txt += a.first;
|
||||
txt += "\t";
|
||||
txt += QString::number( a.second );
|
||||
txt += "\n";
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::addSlice( const QString& name, const cvf::Color3f& color, float value )
|
||||
{
|
||||
if ( m_wellTotalAllocationPlotWidget )
|
||||
{
|
||||
QColor sliceColor( color.rByte(), color.gByte(), color.bByte() );
|
||||
|
||||
m_wellTotalAllocationPlotWidget->addItem( name, sliceColor, value );
|
||||
m_wellTotalAllocationPlotWidget->update();
|
||||
}
|
||||
|
||||
m_sliceInfo.push_back( std::make_pair( name, value ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::clearSlices()
|
||||
{
|
||||
if ( m_wellTotalAllocationPlotWidget )
|
||||
{
|
||||
m_wellTotalAllocationPlotWidget->clear();
|
||||
m_wellTotalAllocationPlotWidget->update();
|
||||
}
|
||||
|
||||
m_sliceInfo.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimTotalWellAllocationPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimTotalWellAllocationPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
m_wellTotalAllocationPlotWidget = new RiuNightchartsWidget( mainWindowParent );
|
||||
m_wellTotalAllocationPlotWidget->showLegend( false );
|
||||
return m_wellTotalAllocationPlotWidget;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimViewWindow.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimWellLogPlot;
|
||||
class RiuNightchartsWidget;
|
||||
class RiuWellAllocationPlot;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmOptionItemInfo;
|
||||
}
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class Color3f;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimTotalWellAllocationPlot : public RimViewWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimTotalWellAllocationPlot();
|
||||
~RimTotalWellAllocationPlot() override;
|
||||
|
||||
int id() const final;
|
||||
|
||||
void setDescription( const QString& description );
|
||||
QString description() const;
|
||||
QString totalAllocationAsText() const;
|
||||
|
||||
void addSlice( const QString& name, const cvf::Color3f& color, float value );
|
||||
void clearSlices();
|
||||
// RimViewWindow overrides
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
void zoomAll() override;
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void deleteViewWidget() override;
|
||||
|
||||
int fontSize() const override;
|
||||
void updateFonts() override;
|
||||
|
||||
protected:
|
||||
// RimViewWindow overrides
|
||||
|
||||
void onLoadDataAndUpdate() override;
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
// Overridden PDM methods
|
||||
caf::PdmFieldHandle* userDescriptionField() override { return &m_userName; }
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
private:
|
||||
void assignIdIfNecessary() final;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showPlotTitle;
|
||||
caf::PdmField<QString> m_userName;
|
||||
|
||||
QPointer<RiuNightchartsWidget> m_wellTotalAllocationPlotWidget;
|
||||
|
||||
std::vector<std::pair<QString, float>> m_sliceInfo;
|
||||
};
|
||||
@@ -0,0 +1,993 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimWellAllocationPlot.h"
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RigAccWellFlowCalculator.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFlowDiagResultAddress.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
#include "RigSimWellData.h"
|
||||
#include "RigSimulationWellCenterLineCalculator.h"
|
||||
#include "RigSimulationWellCoordsAndMD.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimTofAccumulatedPhaseFractionsPlot.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimTotalWellAllocationPlot.h"
|
||||
#include "RimWellAllocationPlotLegend.h"
|
||||
#include "RimWellFlowRateCurve.h"
|
||||
#include "RimWellLogCurveCommonDataSource.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RimWellLogFile.h"
|
||||
#include "RimWellPlotTools.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
#include "RiuWellAllocationPlot.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellAllocationPlot, "WellAllocationPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void AppEnum<RimWellAllocationPlot::FlowType>::setUp()
|
||||
{
|
||||
addItem( RimWellAllocationPlot::ACCUMULATED, "ACCUMULATED", "Accumulated" );
|
||||
addItem( RimWellAllocationPlot::INFLOW, "INFLOW", "Inflow Rates" );
|
||||
setDefault( RimWellAllocationPlot::ACCUMULATED );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot::RimWellAllocationPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Well Allocation Plot", ":/WellAllocPlot16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Flow Diagnostics Plot" ), "Name", "", "", "" );
|
||||
m_userName.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_branchDetection,
|
||||
"BranchDetection",
|
||||
true,
|
||||
"Branch Detection",
|
||||
"",
|
||||
"Compute branches based on how simulation well cells are organized",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case", "", "", "" );
|
||||
m_case.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_timeStep, "PlotTimeStep", 0, "Time Step", "", "", "" );
|
||||
CAF_PDM_InitField( &m_wellName, "WellName", QString( "None" ), "Well", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_flowDiagSolution, "FlowDiagSolution", "Plot Type", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_flowType, "FlowType", "Flow Type", "", "", "" );
|
||||
CAF_PDM_InitField( &m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "" );
|
||||
CAF_PDM_InitField( &m_smallContributionsThreshold, "SmallContributionsThreshold", 0.005, "Threshold", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_accumulatedWellFlowPlot, "AccumulatedWellFlowPlot", "Accumulated Well Flow", "", "", "" );
|
||||
m_accumulatedWellFlowPlot.uiCapability()->setUiHidden( true );
|
||||
m_accumulatedWellFlowPlot = new RimWellLogPlot;
|
||||
m_accumulatedWellFlowPlot->setDepthUnit( RiaDefines::DepthUnitType::UNIT_NONE );
|
||||
m_accumulatedWellFlowPlot->setDepthType( RiaDefines::DepthTypeEnum::CONNECTION_NUMBER );
|
||||
m_accumulatedWellFlowPlot->setLegendsVisible( false );
|
||||
m_accumulatedWellFlowPlot->uiCapability()->setUiIconFromResourceString( ":/WellFlowPlot16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", "" );
|
||||
m_totalWellAllocationPlot.uiCapability()->setUiHidden( true );
|
||||
m_totalWellAllocationPlot = new RimTotalWellAllocationPlot;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellAllocationPlotLegend, "WellAllocLegend", "Legend", "", "", "" );
|
||||
m_wellAllocationPlotLegend.uiCapability()->setUiHidden( true );
|
||||
m_wellAllocationPlotLegend = new RimWellAllocationPlotLegend;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_tofAccumulatedPhaseFractionsPlot,
|
||||
"TofAccumulatedPhaseFractionsPlot",
|
||||
"TOF Accumulated Phase Fractions",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
m_tofAccumulatedPhaseFractionsPlot.uiCapability()->setUiHidden( true );
|
||||
m_tofAccumulatedPhaseFractionsPlot = new RimTofAccumulatedPhaseFractionsPlot;
|
||||
|
||||
this->setAsPlotMdiWindow();
|
||||
|
||||
m_accumulatedWellFlowPlot->setAvailableDepthUnits( {} );
|
||||
m_accumulatedWellFlowPlot->setAvailableDepthTypes( { RiaDefines::DepthTypeEnum::CONNECTION_NUMBER,
|
||||
RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH,
|
||||
RiaDefines::DepthTypeEnum::PSEUDO_LENGTH } );
|
||||
|
||||
m_accumulatedWellFlowPlot->setCommonDataSourceEnabled( false );
|
||||
|
||||
m_showWindow = false;
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot::~RimWellAllocationPlot()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
|
||||
delete m_accumulatedWellFlowPlot();
|
||||
delete m_totalWellAllocationPlot();
|
||||
delete m_tofAccumulatedPhaseFractionsPlot();
|
||||
|
||||
if ( m_wellAllocationPlotWidget )
|
||||
{
|
||||
m_wellAllocationPlotWidget->hide();
|
||||
m_wellAllocationPlotWidget->setParent( nullptr );
|
||||
delete m_wellAllocationPlotWidget;
|
||||
m_wellAllocationPlotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// TODO: implement properly
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimWellAllocationPlot::id() const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::setFromSimulationWell( RimSimWellInView* simWell )
|
||||
{
|
||||
m_showWindow = true;
|
||||
|
||||
RimEclipseView* eclView;
|
||||
simWell->firstAncestorOrThisOfType( eclView );
|
||||
RimEclipseResultCase* eclCase;
|
||||
simWell->firstAncestorOrThisOfType( eclCase );
|
||||
|
||||
m_case = eclCase;
|
||||
m_wellName = simWell->simWellData()->m_wellName;
|
||||
m_timeStep = eclView->currentTimeStep();
|
||||
|
||||
// Use the active flow diag solutions, or the first one as default
|
||||
m_flowDiagSolution = eclView->cellResult()->flowDiagSolution();
|
||||
if ( !m_flowDiagSolution )
|
||||
{
|
||||
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
}
|
||||
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::deleteViewWidget()
|
||||
{
|
||||
if ( m_wellAllocationPlotWidget )
|
||||
{
|
||||
m_wellAllocationPlotWidget->hide();
|
||||
m_wellAllocationPlotWidget->setParent( nullptr );
|
||||
delete m_wellAllocationPlotWidget;
|
||||
m_wellAllocationPlotWidget = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateFromWell()
|
||||
{
|
||||
// Delete existing tracks
|
||||
{
|
||||
std::vector<RimWellLogTrack*> tracks;
|
||||
accumulatedWellFlowPlot()->descendantsIncludingThisOfType( tracks );
|
||||
|
||||
for ( RimWellLogTrack* t : tracks )
|
||||
{
|
||||
accumulatedWellFlowPlot()->removePlot( t );
|
||||
delete t;
|
||||
}
|
||||
}
|
||||
|
||||
CVF_ASSERT( accumulatedWellFlowPlot()->plotCount() == 0 );
|
||||
|
||||
QString description;
|
||||
if ( m_flowType() == ACCUMULATED ) description = "Accumulated Flow";
|
||||
if ( m_flowType() == INFLOW ) description = "Inflow Rates";
|
||||
|
||||
RimWellLogPlotNameConfig* nameConfig = accumulatedWellFlowPlot()->nameConfig();
|
||||
nameConfig->setCustomName( description );
|
||||
nameConfig->setAutoNameTags( false, true, false, false, false );
|
||||
nameConfig->setFieldVisibility( true, true, true, false, false );
|
||||
accumulatedWellFlowPlot()->updateAutoName();
|
||||
|
||||
if ( !m_case ) return;
|
||||
|
||||
const RigSimWellData* simWellData = m_case->eclipseCaseData()->findSimWellData( m_wellName );
|
||||
|
||||
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 );
|
||||
|
||||
std::map<QString, const std::vector<double>*> tracerFractionCellValues = findRelevantTracerCellFractions( simWellData );
|
||||
|
||||
std::unique_ptr<RigAccWellFlowCalculator> wfCalculator;
|
||||
|
||||
double smallContributionThreshold = 0.0;
|
||||
if ( m_groupSmallContributions() ) smallContributionThreshold = m_smallContributionsThreshold;
|
||||
|
||||
if ( tracerFractionCellValues.size() )
|
||||
{
|
||||
bool isProducer =
|
||||
( simWellData->wellProductionType( m_timeStep ) == RigWellResultFrame::PRODUCER ||
|
||||
simWellData->wellProductionType( m_timeStep ) == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE );
|
||||
RigEclCellIndexCalculator cellIdxCalc( m_case->eclipseCaseData()->mainGrid(),
|
||||
m_case->eclipseCaseData()->activeCellInfo(
|
||||
RiaDefines::PorosityModelType::MATRIX_MODEL ) );
|
||||
wfCalculator.reset( new RigAccWellFlowCalculator( pipeBranchesCLCoords,
|
||||
pipeBranchesCellIds,
|
||||
tracerFractionCellValues,
|
||||
cellIdxCalc,
|
||||
smallContributionThreshold,
|
||||
isProducer ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( pipeBranchesCLCoords.size() > 0 )
|
||||
{
|
||||
wfCalculator.reset(
|
||||
new RigAccWellFlowCalculator( pipeBranchesCLCoords, pipeBranchesCellIds, smallContributionThreshold ) );
|
||||
}
|
||||
}
|
||||
|
||||
auto depthType = accumulatedWellFlowPlot()->depthType();
|
||||
|
||||
if ( depthType == RiaDefines::DepthTypeEnum::MEASURED_DEPTH ) return;
|
||||
|
||||
// Create tracks and curves from the calculated data
|
||||
|
||||
size_t branchCount = pipeBranchesCLCoords.size();
|
||||
for ( size_t brIdx = 0; brIdx < branchCount; ++brIdx )
|
||||
{
|
||||
// Skip Tiny dummy branches
|
||||
if ( pipeBranchesCellIds[brIdx].size() <= 3 ) continue;
|
||||
|
||||
RimWellLogTrack* plotTrack = new RimWellLogTrack();
|
||||
|
||||
plotTrack->setDescription( QString( "Branch %1" ).arg( brIdx + 1 ) );
|
||||
plotTrack->setFormationsForCaseWithSimWellOnly( true );
|
||||
plotTrack->setFormationBranchIndex( (int)brIdx );
|
||||
|
||||
accumulatedWellFlowPlot()->addPlot( plotTrack );
|
||||
|
||||
const std::vector<double>& depthValues = depthType == RiaDefines::DepthTypeEnum::CONNECTION_NUMBER
|
||||
? wfCalculator->connectionNumbersFromTop( brIdx )
|
||||
: depthType == RiaDefines::DepthTypeEnum::PSEUDO_LENGTH
|
||||
? wfCalculator->pseudoLengthFromTop( brIdx )
|
||||
: depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH
|
||||
? wfCalculator->trueVerticalDepth( brIdx )
|
||||
: std::vector<double>();
|
||||
|
||||
{
|
||||
std::vector<QString> tracerNames = wfCalculator->tracerNames();
|
||||
for ( const QString& tracerName : tracerNames )
|
||||
{
|
||||
std::vector<double> curveDepthValues = depthValues;
|
||||
std::vector<double> accFlow;
|
||||
if ( depthType == RiaDefines::DepthTypeEnum::CONNECTION_NUMBER )
|
||||
{
|
||||
accFlow = ( m_flowType == ACCUMULATED
|
||||
? wfCalculator->accumulatedTracerFlowPrConnection( tracerName, brIdx )
|
||||
: wfCalculator->tracerFlowPrConnection( tracerName, brIdx ) );
|
||||
|
||||
// Insert the first depth position again, to add a <maxdepth, 0.0> value pair
|
||||
curveDepthValues.insert( curveDepthValues.begin(), curveDepthValues[0] );
|
||||
accFlow.insert( accFlow.begin(), 0.0 );
|
||||
|
||||
if ( m_flowType == ACCUMULATED && brIdx == 0 && !accFlow.empty() ) // Add fictitious point to -1 for
|
||||
// first branch
|
||||
{
|
||||
accFlow.push_back( accFlow.back() );
|
||||
curveDepthValues.push_back( -1.0 );
|
||||
}
|
||||
|
||||
// Shift the "bars" to make connection number tick at the midpoint of the constant value
|
||||
// when showing in flow rate
|
||||
if ( m_flowType == INFLOW )
|
||||
{
|
||||
for ( double& connNum : curveDepthValues )
|
||||
{
|
||||
connNum += 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( depthType == RiaDefines::DepthTypeEnum::PSEUDO_LENGTH ||
|
||||
depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH )
|
||||
{
|
||||
accFlow = ( m_flowType == ACCUMULATED
|
||||
? wfCalculator->accumulatedTracerFlowPrPseudoLength( tracerName, brIdx )
|
||||
: wfCalculator->tracerFlowPrPseudoLength( tracerName, brIdx ) );
|
||||
|
||||
// Insert the first depth position again, to add a <maxdepth, 0.0> value pair
|
||||
curveDepthValues.insert( curveDepthValues.begin(), curveDepthValues[0] );
|
||||
accFlow.insert( accFlow.begin(), 0.0 );
|
||||
|
||||
if ( brIdx == 0 && branchCount > 1 )
|
||||
{
|
||||
// Add a dummy negative depth value to make the contribution
|
||||
// from other branches connected to well head visible
|
||||
|
||||
auto minmax_it = std::minmax_element( curveDepthValues.begin(), curveDepthValues.end() );
|
||||
double availableMinDepth = *( minmax_it.first );
|
||||
double availableMaxDepth = *( minmax_it.second );
|
||||
|
||||
double depthSpan = 0.1 * cvf::Math::abs( availableMinDepth - availableMaxDepth );
|
||||
|
||||
// Round off value to floored decade
|
||||
double logDecValue = log10( depthSpan );
|
||||
logDecValue = cvf::Math::floor( logDecValue );
|
||||
depthSpan = pow( 10.0, logDecValue );
|
||||
|
||||
double dummyNegativeDepthValue = curveDepthValues.back() - depthSpan;
|
||||
|
||||
curveDepthValues.push_back( dummyNegativeDepthValue );
|
||||
accFlow.push_back( accFlow.back() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !accFlow.empty() )
|
||||
{
|
||||
addStackedCurve( tracerName, depthType, curveDepthValues, accFlow, plotTrack );
|
||||
// TODO: THIs is the data to be plotted...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateWellFlowPlotXAxisTitle( plotTrack );
|
||||
}
|
||||
|
||||
QString wellStatusText =
|
||||
QString( "(%1)" ).arg( RimWellAllocationPlot::wellStatusTextForTimeStep( m_wellName, m_case, m_timeStep ) );
|
||||
|
||||
QString flowTypeText = m_flowDiagSolution() ? "Well Allocation" : "Well Flow";
|
||||
setDescription( flowTypeText + ": " + m_wellName + " " + wellStatusText + ", " +
|
||||
m_case->timeStepStrings()[m_timeStep] + " (" + m_case->caseUserDescription() + ")" );
|
||||
|
||||
/// Pie chart
|
||||
|
||||
m_totalWellAllocationPlot->clearSlices();
|
||||
if ( m_wellAllocationPlotWidget ) m_wellAllocationPlotWidget->clearLegend();
|
||||
|
||||
if ( wfCalculator )
|
||||
{
|
||||
std::vector<std::pair<QString, double>> totalTracerFractions = wfCalculator->totalTracerFractions();
|
||||
|
||||
for ( const auto& tracerVal : totalTracerFractions )
|
||||
{
|
||||
cvf::Color3f color;
|
||||
if ( m_flowDiagSolution )
|
||||
color = m_flowDiagSolution->tracerColor( tracerVal.first );
|
||||
else
|
||||
color = getTracerColor( tracerVal.first );
|
||||
|
||||
double tracerPercent = 100 * tracerVal.second;
|
||||
|
||||
m_totalWellAllocationPlot->addSlice( tracerVal.first, color, tracerPercent );
|
||||
if ( m_wellAllocationPlotWidget )
|
||||
m_wellAllocationPlotWidget->addLegendItem( tracerVal.first, color, tracerPercent );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_wellAllocationPlotWidget )
|
||||
m_wellAllocationPlotWidget->showLegend( m_wellAllocationPlotLegend->isShowingLegend() );
|
||||
m_totalWellAllocationPlot->updateConnectedEditors();
|
||||
|
||||
accumulatedWellFlowPlot()->updateConnectedEditors();
|
||||
m_tofAccumulatedPhaseFractionsPlot->reloadFromWell();
|
||||
m_tofAccumulatedPhaseFractionsPlot->updateConnectedEditors();
|
||||
|
||||
if ( m_wellAllocationPlotWidget ) m_wellAllocationPlotWidget->updateGeometry();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QString, const std::vector<double>*>
|
||||
RimWellAllocationPlot::findRelevantTracerCellFractions( const RigSimWellData* simWellData )
|
||||
{
|
||||
std::map<QString, const std::vector<double>*> tracerCellFractionValues;
|
||||
|
||||
if ( m_flowDiagSolution && simWellData->hasWellResult( m_timeStep ) )
|
||||
{
|
||||
RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::UNDEFINED;
|
||||
|
||||
const RigWellResultFrame::WellProductionType prodType = simWellData->wellProductionType( m_timeStep );
|
||||
if ( prodType == RigWellResultFrame::PRODUCER || prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
|
||||
{
|
||||
requestedTracerType = RimFlowDiagSolution::INJECTOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
requestedTracerType = RimFlowDiagSolution::PRODUCER;
|
||||
}
|
||||
|
||||
std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames();
|
||||
for ( const QString& tracerName : tracerNames )
|
||||
{
|
||||
if ( m_flowDiagSolution->tracerStatusInTimeStep( tracerName, m_timeStep ) == requestedTracerType )
|
||||
{
|
||||
RigFlowDiagResultAddress resAddr( RIG_FLD_CELL_FRACTION_RESNAME,
|
||||
RigFlowDiagResultAddress::PHASE_ALL,
|
||||
tracerName.toStdString() );
|
||||
const std::vector<double>* tracerCellFractions =
|
||||
m_flowDiagSolution->flowDiagResults()->resultValues( resAddr, m_timeStep );
|
||||
if ( tracerCellFractions ) tracerCellFractionValues[tracerName] = tracerCellFractions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tracerCellFractionValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle( RimWellLogTrack* plotTrack )
|
||||
{
|
||||
RiaEclipseUnitTools::UnitSystem unitSet = m_case->eclipseCaseData()->unitsType();
|
||||
RimWellLogFile::WellFlowCondition condition = m_flowDiagSolution ? RimWellLogFile::WELL_FLOW_COND_RESERVOIR
|
||||
: RimWellLogFile::WELL_FLOW_COND_STANDARD;
|
||||
|
||||
QString axisTitle = RimWellPlotTools::flowPlotAxisTitle( condition, unitSet );
|
||||
plotTrack->setXAxisTitle( axisTitle );
|
||||
|
||||
#if 0
|
||||
if (m_flowDiagSolution)
|
||||
{
|
||||
QString unitText;
|
||||
switch ( unitSet )
|
||||
{
|
||||
case RiaEclipseUnitTools::UNITS_METRIC:
|
||||
unitText = "[m<sup>3</sup>/day]";
|
||||
break;
|
||||
case RiaEclipseUnitTools::UNITS_FIELD:
|
||||
unitText = "[Brl/day]";
|
||||
break;
|
||||
case RiaEclipseUnitTools::UNITS_LAB:
|
||||
unitText = "[cm<sup>3</sup>/hr]";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
plotTrack->setXAxisTitle("Reservoir Flow Rate " + unitText);
|
||||
}
|
||||
else
|
||||
{
|
||||
QString unitText;
|
||||
switch ( unitSet )
|
||||
{
|
||||
case RiaEclipseUnitTools::UNITS_METRIC:
|
||||
unitText = "[Liquid Sm<sup>3</sup>/day], [Gas kSm<sup>3</sup>/day]";
|
||||
break;
|
||||
case RiaEclipseUnitTools::UNITS_FIELD:
|
||||
unitText = "[Liquid BBL/day], [Gas BOE/day]";
|
||||
break;
|
||||
case RiaEclipseUnitTools::UNITS_LAB:
|
||||
unitText = "[cm<sup>3</sup>/hr]";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
plotTrack->setXAxisTitle("Surface Flow Rate " + unitText);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::addStackedCurve( const QString& tracerName,
|
||||
RiaDefines::DepthTypeEnum depthType,
|
||||
const std::vector<double>& depthValues,
|
||||
const std::vector<double>& accFlow,
|
||||
RimWellLogTrack* plotTrack )
|
||||
{
|
||||
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
|
||||
curve->setFlowValuesPrDepthValue( tracerName, depthType, depthValues, accFlow );
|
||||
|
||||
if ( m_flowDiagSolution )
|
||||
{
|
||||
curve->setColor( m_flowDiagSolution->tracerColor( tracerName ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
curve->setColor( getTracerColor( tracerName ) );
|
||||
}
|
||||
|
||||
plotTrack->addCurve( curve );
|
||||
|
||||
curve->loadDataAndUpdate( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateWidgetTitleWindowTitle()
|
||||
{
|
||||
updateMdiWindowTitle();
|
||||
|
||||
if ( m_wellAllocationPlotWidget )
|
||||
{
|
||||
if ( m_showPlotTitle )
|
||||
{
|
||||
m_wellAllocationPlotWidget->showTitle( m_userName );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_wellAllocationPlotWidget->hideTitle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellAllocationPlot::wellStatusTextForTimeStep( const QString& wellName,
|
||||
const RimEclipseResultCase* eclipseResultCase,
|
||||
size_t timeStep )
|
||||
{
|
||||
QString statusText = "Undefined";
|
||||
|
||||
if ( eclipseResultCase )
|
||||
{
|
||||
const RigSimWellData* simWellData = eclipseResultCase->eclipseCaseData()->findSimWellData( wellName );
|
||||
|
||||
if ( simWellData )
|
||||
{
|
||||
if ( simWellData->hasWellResult( timeStep ) )
|
||||
{
|
||||
const RigWellResultFrame& wellResultFrame = simWellData->wellResultFrame( timeStep );
|
||||
|
||||
RigWellResultFrame::WellProductionType prodType = wellResultFrame.m_productionType;
|
||||
|
||||
switch ( prodType )
|
||||
{
|
||||
case RigWellResultFrame::PRODUCER:
|
||||
statusText = "Producer";
|
||||
break;
|
||||
case RigWellResultFrame::OIL_INJECTOR:
|
||||
statusText = "Oil Injector";
|
||||
break;
|
||||
case RigWellResultFrame::GAS_INJECTOR:
|
||||
statusText = "Gas Injector";
|
||||
break;
|
||||
case RigWellResultFrame::WATER_INJECTOR:
|
||||
statusText = "Water Injector";
|
||||
break;
|
||||
case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return statusText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// TODO: Implement properly
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::assignIdIfNecessary()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellAllocationPlot::viewWidget()
|
||||
{
|
||||
return m_wellAllocationPlotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::zoomAll()
|
||||
{
|
||||
m_accumulatedWellFlowPlot()->zoomAll();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlot* RimWellAllocationPlot::accumulatedWellFlowPlot()
|
||||
{
|
||||
return m_accumulatedWellFlowPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTotalWellAllocationPlot* RimWellAllocationPlot::totalWellFlowPlot()
|
||||
{
|
||||
return m_totalWellAllocationPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimTofAccumulatedPhaseFractionsPlot* RimWellAllocationPlot::tofAccumulatedPhaseFractionsPlot()
|
||||
{
|
||||
return m_tofAccumulatedPhaseFractionsPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RimWellAllocationPlot::plotLegend()
|
||||
{
|
||||
return m_wellAllocationPlotLegend;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseResultCase* RimWellAllocationPlot::rimCase()
|
||||
{
|
||||
return m_case();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimWellAllocationPlot::timeStep()
|
||||
{
|
||||
return m_timeStep();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot::FlowType RimWellAllocationPlot::flowType()
|
||||
{
|
||||
return m_flowType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimWellAllocationPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_wellName )
|
||||
{
|
||||
std::set<QString> sortedWellNames = this->findSortedWellNames();
|
||||
|
||||
caf::IconProvider simWellIcon( ":/Well.svg" );
|
||||
for ( const QString& wname : sortedWellNames )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) );
|
||||
}
|
||||
|
||||
if ( options.size() == 0 )
|
||||
{
|
||||
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_timeStep )
|
||||
{
|
||||
RimTools::timeStepsForCase( m_case, &options );
|
||||
|
||||
if ( options.size() == 0 )
|
||||
{
|
||||
options.push_front( caf::PdmOptionItemInfo( "None", -1 ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_case )
|
||||
{
|
||||
RimProject* proj = nullptr;
|
||||
this->firstAncestorOrThisOfType( proj );
|
||||
if ( proj )
|
||||
{
|
||||
std::vector<RimEclipseResultCase*> cases;
|
||||
proj->descendantsIncludingThisOfType( cases );
|
||||
|
||||
for ( RimEclipseResultCase* c : cases )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_flowDiagSolution )
|
||||
{
|
||||
if ( m_case )
|
||||
{
|
||||
// std::vector<RimFlowDiagSolution*> flowSols = m_case->flowDiagSolutions();
|
||||
// options.push_back(caf::PdmOptionItemInfo("None", nullptr));
|
||||
// for (RimFlowDiagSolution* flowSol : flowSols)
|
||||
//{
|
||||
// options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false,
|
||||
// flowSol->uiIcon()));
|
||||
//}
|
||||
|
||||
RimFlowDiagSolution* defaultFlowSolution = m_case->defaultFlowDiagSolution();
|
||||
options.push_back( caf::PdmOptionItemInfo( "Well Flow", nullptr ) );
|
||||
if ( defaultFlowSolution )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "Allocation", defaultFlowSolution ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellAllocationPlot::wellName() const
|
||||
{
|
||||
return m_wellName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::removeFromMdiAreaAndDeleteViewWidget()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
deleteViewWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::showPlotLegend( bool doShow )
|
||||
{
|
||||
if ( m_wellAllocationPlotWidget ) m_wellAllocationPlotWidget->showLegend( doShow );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimWellAllocationPlot::fontSize() const
|
||||
{
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateFonts()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_userName || changedField == &m_showPlotTitle )
|
||||
{
|
||||
updateWidgetTitleWindowTitle();
|
||||
}
|
||||
else if ( changedField == &m_case )
|
||||
{
|
||||
if ( m_flowDiagSolution && m_case )
|
||||
{
|
||||
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_flowDiagSolution = nullptr;
|
||||
}
|
||||
|
||||
if ( !m_case )
|
||||
m_timeStep = 0;
|
||||
else if ( m_timeStep >= static_cast<int>( m_case->timeStepDates().size() ) )
|
||||
{
|
||||
m_timeStep = std::max( 0, ( (int)m_case->timeStepDates().size() ) - 1 );
|
||||
}
|
||||
|
||||
std::set<QString> sortedWellNames = findSortedWellNames();
|
||||
if ( !sortedWellNames.size() )
|
||||
m_wellName = "";
|
||||
else if ( sortedWellNames.count( m_wellName() ) == 0 )
|
||||
{
|
||||
m_wellName = *sortedWellNames.begin();
|
||||
}
|
||||
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
else if ( changedField == &m_wellName || changedField == &m_timeStep || changedField == &m_flowDiagSolution ||
|
||||
changedField == &m_groupSmallContributions || changedField == &m_smallContributionsThreshold ||
|
||||
changedField == &m_flowType || changedField == &m_branchDetection )
|
||||
{
|
||||
onLoadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QString> RimWellAllocationPlot::findSortedWellNames()
|
||||
{
|
||||
std::set<QString> sortedWellNames;
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
const cvf::Collection<RigSimWellData>& simWellData = m_case->eclipseCaseData()->wellResults();
|
||||
|
||||
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
|
||||
{
|
||||
sortedWellNames.insert( simWellData[wIdx]->m_wellName );
|
||||
}
|
||||
}
|
||||
|
||||
return sortedWellNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimWellAllocationPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if ( m_wellAllocationPlotWidget )
|
||||
{
|
||||
QPixmap pix = m_wellAllocationPlotWidget->grab();
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_userName );
|
||||
uiOrdering.add( &m_showPlotTitle );
|
||||
|
||||
caf::PdmUiGroup& dataGroup = *uiOrdering.addNewGroup( "Plot Data" );
|
||||
dataGroup.add( &m_case );
|
||||
dataGroup.add( &m_timeStep );
|
||||
dataGroup.add( &m_wellName );
|
||||
dataGroup.add( &m_branchDetection );
|
||||
|
||||
caf::PdmUiGroup& optionGroup = *uiOrdering.addNewGroup( "Options" );
|
||||
optionGroup.add( &m_flowDiagSolution );
|
||||
optionGroup.add( &m_flowType );
|
||||
optionGroup.add( &m_groupSmallContributions );
|
||||
optionGroup.add( &m_smallContributionsThreshold );
|
||||
m_smallContributionsThreshold.uiCapability()->setUiReadOnly( !m_groupSmallContributions() );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::setDescription( const QString& description )
|
||||
{
|
||||
m_userName = description;
|
||||
|
||||
updateWidgetTitleWindowTitle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellAllocationPlot::description() const
|
||||
{
|
||||
return m_userName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellAllocationPlot::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
m_wellAllocationPlotWidget = new RiuWellAllocationPlot( this, mainWindowParent );
|
||||
return m_wellAllocationPlotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RimWellAllocationPlot::getTracerColor( const QString& tracerName )
|
||||
{
|
||||
if ( tracerName == RIG_FLOW_OIL_NAME ) return cvf::Color3f::DARK_GREEN;
|
||||
if ( tracerName == RIG_FLOW_GAS_NAME ) return cvf::Color3f::DARK_RED;
|
||||
if ( tracerName == RIG_FLOW_WATER_NAME ) return cvf::Color3f::BLUE;
|
||||
return cvf::Color3f::DARK_GRAY;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateFormationNamesData() const
|
||||
{
|
||||
for ( size_t i = 0; i < m_accumulatedWellFlowPlot->plotCount(); ++i )
|
||||
{
|
||||
RimWellLogTrack* track = dynamic_cast<RimWellLogTrack*>( m_accumulatedWellFlowPlot->plotByIndex( i ) );
|
||||
CAF_ASSERT( track );
|
||||
if ( track )
|
||||
{
|
||||
track->setAndUpdateSimWellFormationNamesData( m_case, m_wellName );
|
||||
}
|
||||
}
|
||||
}
|
||||
158
ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.h
Normal file
158
ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.h
Normal file
@@ -0,0 +1,158 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimViewWindow.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class RigSimWellData;
|
||||
class RimEclipseResultCase;
|
||||
class RimFlowDiagSolution;
|
||||
class RimSimWellInView;
|
||||
class RimTofAccumulatedPhaseFractionsPlot;
|
||||
class RimTotalWellAllocationPlot;
|
||||
class RimWellAllocationPlotLegend;
|
||||
class RimWellLogPlot;
|
||||
class RimWellLogTrack;
|
||||
class RiuWellAllocationPlot;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class Color3f;
|
||||
}
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmOptionItemInfo;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellAllocationPlot : public RimViewWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum FlowType
|
||||
{
|
||||
ACCUMULATED,
|
||||
INFLOW
|
||||
};
|
||||
|
||||
public:
|
||||
RimWellAllocationPlot();
|
||||
~RimWellAllocationPlot() override;
|
||||
|
||||
int id() const final;
|
||||
void setFromSimulationWell( RimSimWellInView* simWell );
|
||||
|
||||
void setDescription( const QString& description );
|
||||
QString description() const;
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
void zoomAll() override;
|
||||
|
||||
RimWellLogPlot* accumulatedWellFlowPlot();
|
||||
RimTotalWellAllocationPlot* totalWellFlowPlot();
|
||||
RimTofAccumulatedPhaseFractionsPlot* tofAccumulatedPhaseFractionsPlot();
|
||||
caf::PdmObject* plotLegend();
|
||||
RimEclipseResultCase* rimCase();
|
||||
int timeStep();
|
||||
FlowType flowType();
|
||||
|
||||
QString wellName() const;
|
||||
|
||||
void removeFromMdiAreaAndDeleteViewWidget();
|
||||
|
||||
void showPlotLegend( bool doShow );
|
||||
|
||||
int fontSize() const override;
|
||||
void updateFonts() override;
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
caf::PdmFieldHandle* userDescriptionField() override { return &m_userName; }
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
std::set<QString> findSortedWellNames();
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
void updateFromWell();
|
||||
|
||||
std::map<QString, const std::vector<double>*> findRelevantTracerCellFractions( const RigSimWellData* simWellData );
|
||||
|
||||
void updateWellFlowPlotXAxisTitle( RimWellLogTrack* plotTrack );
|
||||
|
||||
void addStackedCurve( const QString& tracerName,
|
||||
RiaDefines::DepthTypeEnum depthType,
|
||||
const std::vector<double>& depthValues,
|
||||
const std::vector<double>& accFlow,
|
||||
RimWellLogTrack* plotTrack );
|
||||
|
||||
void updateWidgetTitleWindowTitle();
|
||||
static QString wellStatusTextForTimeStep( const QString& wellName,
|
||||
const RimEclipseResultCase* eclipseResultCase,
|
||||
size_t timeStep );
|
||||
|
||||
// RimViewWindow overrides
|
||||
void assignIdIfNecessary() final;
|
||||
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void deleteViewWidget() override;
|
||||
|
||||
cvf::Color3f getTracerColor( const QString& tracerName );
|
||||
|
||||
void updateFormationNamesData() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showPlotTitle;
|
||||
caf::PdmField<QString> m_userName;
|
||||
|
||||
caf::PdmField<bool> m_branchDetection;
|
||||
|
||||
caf::PdmPtrField<RimEclipseResultCase*> m_case;
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<int> m_timeStep;
|
||||
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
|
||||
caf::PdmField<bool> m_groupSmallContributions;
|
||||
caf::PdmField<double> m_smallContributionsThreshold;
|
||||
caf::PdmField<caf::AppEnum<FlowType>> m_flowType;
|
||||
|
||||
QPointer<RiuWellAllocationPlot> m_wellAllocationPlotWidget;
|
||||
|
||||
caf::PdmChildField<RimWellLogPlot*> m_accumulatedWellFlowPlot;
|
||||
caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot;
|
||||
caf::PdmChildField<RimWellAllocationPlotLegend*> m_wellAllocationPlotLegend;
|
||||
caf::PdmChildField<RimTofAccumulatedPhaseFractionsPlot*> m_tofAccumulatedPhaseFractionsPlot;
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimWellAllocationPlotLegend.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellAllocationPlotLegend, "WellAllocationPlotLegend" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlotLegend::RimWellAllocationPlotLegend()
|
||||
{
|
||||
CAF_PDM_InitObject( "Legend", ":/WellAllocLegend16x16.png", "", "" );
|
||||
CAF_PDM_InitField( &m_showLegend, "ShowPlotLegend", true, "Show Plot Legend", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlotLegend::~RimWellAllocationPlotLegend()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimWellAllocationPlotLegend::objectToggleField()
|
||||
{
|
||||
return &m_showLegend;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlotLegend::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_showLegend )
|
||||
{
|
||||
RimWellAllocationPlot* walp;
|
||||
firstAncestorOrThisOfType( walp );
|
||||
|
||||
if ( walp ) walp->showPlotLegend( m_showLegend() );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
class RimWellAllocationPlotLegend : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimWellAllocationPlotLegend();
|
||||
~RimWellAllocationPlotLegend() override;
|
||||
|
||||
bool isShowingLegend() { return m_showLegend(); }
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showLegend;
|
||||
};
|
||||
@@ -0,0 +1,573 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimTools.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( "Cumulative Phase 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]",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitField( &m_maximumTof, "MaximumTOF", 20.0, "Maximum Time of Flight [0, 200]", "", "", "" );
|
||||
|
||||
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,
|
||||
double maximumTof )
|
||||
{
|
||||
m_groupSmallContributions = groupSmallContributions;
|
||||
m_smallContributionsRelativeThreshold = smallContributionsRelativeThreshold;
|
||||
m_maximumTof = maximumTof;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::PhaseType RimWellDistributionPlot::phase() const
|
||||
{
|
||||
return m_phase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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;
|
||||
}
|
||||
|
||||
// Hide the legend when in multiplot mode, as the legend is handeled by the multi plot grid layout
|
||||
bool doShowLegend = false;
|
||||
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()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtPlotWidget* RimWellDistributionPlot::doCreatePlotViewWidget( 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 );
|
||||
|
||||
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 && m_case->ensureReservoirCaseIsOpen() )
|
||||
{
|
||||
// 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, m_maximumTof );
|
||||
}
|
||||
|
||||
QString phaseString = "N/A";
|
||||
if ( m_phase == RiaDefines::PhaseType::OIL_PHASE )
|
||||
phaseString = "Oil";
|
||||
else if ( m_phase == RiaDefines::PhaseType::GAS_PHASE )
|
||||
phaseString = "Gas";
|
||||
else if ( m_phase == RiaDefines::PhaseType::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,
|
||||
double maximumTof )
|
||||
{
|
||||
// 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;
|
||||
|
||||
if ( tofYears > maximumTof ) continue;
|
||||
|
||||
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 )
|
||||
{
|
||||
RimTools::timeStepsForCase( m_case, &options );
|
||||
|
||||
if ( options.size() == 0 )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", -1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
else if ( fieldNeedingOptions == &m_wellName )
|
||||
{
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
caf::IconProvider simWellIcon( ":/Well.svg" );
|
||||
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;
|
||||
}
|
||||
@@ -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::PhaseType::OIL_PHASE );
|
||||
~RimWellDistributionPlot() override;
|
||||
|
||||
void setDataSourceParameters( RimEclipseResultCase* eclipseResultCase, int timeStepIndex, QString targetWellName );
|
||||
void setPlotOptions( bool groupSmallContributions, double smallContributionsRelativeThreshold, double maximumTof );
|
||||
|
||||
RiaDefines::PhaseType phase() const;
|
||||
|
||||
// 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:
|
||||
// RimViewWindow implementations
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent ) override;
|
||||
|
||||
void fixupDependentFieldsAfterCaseChange();
|
||||
static void populatePlotWidgetWithCurveData( const RigTofWellDistributionCalculator& calculator,
|
||||
const RimFlowDiagSolution& flowDiagSolution,
|
||||
RiuQwtPlotWidget* plotWidget,
|
||||
double maximumTof );
|
||||
|
||||
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;
|
||||
caf::PdmField<double> m_maximumTof;
|
||||
|
||||
QPointer<RiuQwtPlotWidget> m_plotWidget;
|
||||
};
|
||||
@@ -0,0 +1,448 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimPlot.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellDistributionPlot.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigTofWellDistributionCalculator.h"
|
||||
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
#include "RiuMultiPlotPage.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()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()");
|
||||
|
||||
CAF_PDM_InitObject( "Cumulative Phase Distribution Plot", ":/CumulativePhaseDist16x16.png", "", "" );
|
||||
|
||||
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]",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitField( &m_maximumTof, "MaximumTOF", 20.0, "Maximum Time of Flight [0, 200]", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plots, "Plots", "", "", "", "" );
|
||||
m_plots.uiCapability()->setUiHidden( true );
|
||||
m_plots.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_showOil, "ShowOil", true, "Show Oil", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showGas, "ShowGas", true, "Show Gas", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showWater, "ShowWater", true, "Show Water", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_plotWindowTitle,
|
||||
"PlotDescription",
|
||||
QString( "Cumulative Phase Distribution Plots" ),
|
||||
"Name",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
m_showWindow = false;
|
||||
|
||||
setAsPlotMdiWindow();
|
||||
|
||||
addPlot( new RimWellDistributionPlot( RiaDefines::PhaseType::OIL_PHASE ) );
|
||||
addPlot( new RimWellDistributionPlot( RiaDefines::PhaseType::GAS_PHASE ) );
|
||||
addPlot( new RimWellDistributionPlot( RiaDefines::PhaseType::WATER_PHASE ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellDistributionPlotCollection::~RimWellDistributionPlotCollection()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
m_plots.deleteAllChildObjects();
|
||||
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::setData( RimEclipseResultCase* eclipseCase, QString wellName, int timeStepIndex )
|
||||
{
|
||||
m_case = eclipseCase;
|
||||
m_wellName = wellName;
|
||||
m_timeStepIndex = timeStepIndex;
|
||||
|
||||
applyPlotParametersToContainedPlots();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellDistributionPlotCollection::viewWidget()
|
||||
{
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellDistributionPlotCollection::description() const
|
||||
{
|
||||
return m_plotWindowTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimWellDistributionPlotCollection::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
QPixmap pix( m_viewer->size() );
|
||||
m_viewer->renderTo( &pix );
|
||||
image = pix.toImage();
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::zoomAll()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimWellDistributionPlotCollection::userDescriptionField()
|
||||
{
|
||||
return &m_plotWindowTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::onLoadDataAndUpdate()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlotCollection::onLoadDataAndUpdate()");
|
||||
updateMdiWindowVisibility();
|
||||
updatePlots();
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellDistributionPlotCollection::createViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
m_viewer = new RiuMultiPlotPage( this, mainWindowParent );
|
||||
m_viewer->setPlotTitle( m_plotWindowTitle );
|
||||
recreatePlotWidgets();
|
||||
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::deleteViewWidget()
|
||||
{
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::doRenderWindowContent( QPaintDevice* paintDevice )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->renderTo( paintDevice );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::addPlot( RimPlot* plot )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
size_t index = m_plots.size();
|
||||
m_plots.insert( index, plot );
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
plot->createPlotWidget();
|
||||
m_viewer->insertPlot( plot->viewer(), index );
|
||||
}
|
||||
plot->setShowWindow( true );
|
||||
plot->setLegendsVisible( false );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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 );
|
||||
uiOrdering.add( &m_maximumTof );
|
||||
|
||||
uiOrdering.add( &m_showOil );
|
||||
uiOrdering.add( &m_showGas );
|
||||
uiOrdering.add( &m_showWater );
|
||||
|
||||
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 = RimPlotWindow::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 )
|
||||
{
|
||||
RimTools::timeStepsForCase( m_case, &options );
|
||||
|
||||
if ( options.size() == 0 )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", -1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
else if ( fieldNeedingOptions == &m_wellName )
|
||||
{
|
||||
if ( m_case && m_case->eclipseCaseData() )
|
||||
{
|
||||
caf::IconProvider simWellIcon( ":/Well.svg" );
|
||||
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 ||
|
||||
changedField == &m_maximumTof || changedField == &m_showOil || changedField == &m_showGas ||
|
||||
changedField == &m_showWater || changedField == &m_showWindow )
|
||||
{
|
||||
applyPlotParametersToContainedPlots();
|
||||
shouldRecalculatePlotData = true;
|
||||
}
|
||||
|
||||
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( shouldRecalculatePlotData )
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
updateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::applyPlotParametersToContainedPlots()
|
||||
{
|
||||
const size_t numPlots = m_plots.size();
|
||||
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*>( m_plots[i] );
|
||||
if ( aPlot )
|
||||
{
|
||||
if ( aPlot->phase() == RiaDefines::PhaseType::OIL_PHASE )
|
||||
{
|
||||
aPlot->setShowWindow( m_showOil );
|
||||
}
|
||||
else if ( aPlot->phase() == RiaDefines::PhaseType::GAS_PHASE )
|
||||
{
|
||||
aPlot->setShowWindow( m_showGas );
|
||||
}
|
||||
else if ( aPlot->phase() == RiaDefines::PhaseType::WATER_PHASE )
|
||||
{
|
||||
aPlot->setShowWindow( m_showWater );
|
||||
}
|
||||
|
||||
aPlot->setDataSourceParameters( m_case, m_timeStepIndex, m_wellName );
|
||||
aPlot->setPlotOptions( m_groupSmallContributions, m_smallContributionsRelativeThreshold, m_maximumTof );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::updatePlots()
|
||||
{
|
||||
if ( m_showWindow )
|
||||
{
|
||||
for ( RimPlot* plot : m_plots() )
|
||||
{
|
||||
plot->loadDataAndUpdate();
|
||||
plot->updateZoomInQwt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::cleanupBeforeClose()
|
||||
{
|
||||
auto plotVector = m_plots.childObjects();
|
||||
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
|
||||
{
|
||||
plotVector[tIdx]->detachAllCurves();
|
||||
}
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->setParent( nullptr );
|
||||
delete m_viewer;
|
||||
m_viewer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlotCollection::recreatePlotWidgets()
|
||||
{
|
||||
CVF_ASSERT( m_viewer );
|
||||
|
||||
for ( auto plot : m_plots() )
|
||||
{
|
||||
plot->createPlotWidget();
|
||||
m_viewer->addPlot( plot->viewer() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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,100 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimPlotWindow.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <array>
|
||||
|
||||
class RimEclipseResultCase;
|
||||
class RimFlowDiagSolution;
|
||||
class RimPlot;
|
||||
class RigTofWellDistributionCalculator;
|
||||
class RiuMultiPlotPage;
|
||||
|
||||
class QTextBrowser;
|
||||
class QwtPlot;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RimWellDistributionPlotCollection : public RimPlotWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimWellDistributionPlotCollection();
|
||||
~RimWellDistributionPlotCollection() override;
|
||||
|
||||
void setData( RimEclipseResultCase* eclipseCase, QString wellName, int timeStepIndex );
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
QString description() const override;
|
||||
QImage snapshotWindowContent() override;
|
||||
void zoomAll() override;
|
||||
|
||||
caf::PdmFieldHandle* userDescriptionField() 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;
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
|
||||
void deleteViewWidget() override;
|
||||
|
||||
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
|
||||
|
||||
private:
|
||||
void addPlot( RimPlot* plot );
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fixupDependentFieldsAfterCaseChange();
|
||||
void applyPlotParametersToContainedPlots();
|
||||
void updatePlots();
|
||||
void cleanupBeforeClose();
|
||||
void recreatePlotWidgets();
|
||||
|
||||
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;
|
||||
caf::PdmField<double> m_maximumTof;
|
||||
|
||||
caf::PdmField<QString> m_plotWindowTitle;
|
||||
caf::PdmChildArrayField<RimPlot*> m_plots;
|
||||
|
||||
caf::PdmField<bool> m_showOil;
|
||||
caf::PdmField<bool> m_showGas;
|
||||
caf::PdmField<bool> m_showWater;
|
||||
|
||||
QPointer<RiuMultiPlotPage> m_viewer;
|
||||
};
|
||||
@@ -0,0 +1,302 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimWellFlowRateCurve.h"
|
||||
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "RigWellLogCurveData.h"
|
||||
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
|
||||
#include "cvfMath.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellFlowRateCurve, "WellFlowRateCurve" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellFlowRateCurve::RimWellFlowRateCurve()
|
||||
{
|
||||
CAF_PDM_InitObject( "Flow Rate Curve", "", "", "" );
|
||||
m_groupId = 0;
|
||||
m_doFillCurve = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellFlowRateCurve::~RimWellFlowRateCurve()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseResultCase* RimWellFlowRateCurve::rimCase()
|
||||
{
|
||||
RimWellAllocationPlot* wap = wellAllocationPlot();
|
||||
if ( wap )
|
||||
{
|
||||
return wap->rimCase();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimWellFlowRateCurve::timeStep()
|
||||
{
|
||||
RimWellAllocationPlot* wap = wellAllocationPlot();
|
||||
|
||||
if ( wap )
|
||||
{
|
||||
return wap->timeStep();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellFlowRateCurve::wellName() const
|
||||
{
|
||||
QString name;
|
||||
|
||||
RimWellAllocationPlot* wap = wellAllocationPlot();
|
||||
|
||||
if ( wap )
|
||||
{
|
||||
name = wap->wellName();
|
||||
}
|
||||
else
|
||||
{
|
||||
name = "Undefined";
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellFlowRateCurve::wellLogChannelUiName() const
|
||||
{
|
||||
return "AccumulatedFlowRate";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellFlowRateCurve::wellLogChannelUnits() const
|
||||
{
|
||||
return RiaWellLogUnitTools<double>::noUnitString();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::setGroupId( int groupId )
|
||||
{
|
||||
m_groupId = groupId;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimWellFlowRateCurve::groupId() const
|
||||
{
|
||||
return m_groupId;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::setDoFillCurve( bool doFill )
|
||||
{
|
||||
m_doFillCurve = doFill;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellFlowRateCurve::createCurveAutoName()
|
||||
{
|
||||
return m_curveAutoName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
|
||||
|
||||
m_qwtPlotCurve->setTitle( createCurveAutoName() );
|
||||
|
||||
if ( updateParentPlot )
|
||||
{
|
||||
RimWellLogTrack* track = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( track );
|
||||
track->updateStackedCurveData();
|
||||
|
||||
updateZoomInParentPlot();
|
||||
}
|
||||
|
||||
if ( m_parentQwtPlot ) m_parentQwtPlot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::updateCurveAppearance()
|
||||
{
|
||||
RimWellLogCurve::updateCurveAppearance();
|
||||
|
||||
bool isLastCurveInGroup = false;
|
||||
{
|
||||
RimWellLogTrack* wellLogTrack;
|
||||
firstAncestorOrThisOfTypeAsserted( wellLogTrack );
|
||||
std::map<int, std::vector<RimWellLogCurve*>> stackedCurveGroups = wellLogTrack->visibleStackedCurves();
|
||||
const std::vector<RimWellLogCurve*>& curveGroup = stackedCurveGroups[this->m_groupId];
|
||||
|
||||
if ( !curveGroup.empty() )
|
||||
{
|
||||
isLastCurveInGroup = ( curveGroup.back() == this );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isUsingConnectionNumberDepthType() )
|
||||
{
|
||||
m_qwtPlotCurve->setStyle( QwtPlotCurve::Steps );
|
||||
}
|
||||
|
||||
if ( m_doFillCurve || isLastCurveInGroup ) // Fill the last curve in group with a transparent color to "tie" the
|
||||
// group together
|
||||
{
|
||||
QColor curveQColor =
|
||||
QColor( m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte() );
|
||||
QColor fillColor = curveQColor;
|
||||
QColor lineColor = curveQColor.darker();
|
||||
|
||||
if ( !m_doFillCurve && isLastCurveInGroup )
|
||||
{
|
||||
fillColor = QColor( 24, 16, 10, 50 );
|
||||
lineColor = curveQColor;
|
||||
}
|
||||
|
||||
QLinearGradient gradient;
|
||||
gradient.setCoordinateMode( QGradient::StretchToDeviceMode );
|
||||
gradient.setColorAt( 0, fillColor.darker( 110 ) );
|
||||
gradient.setColorAt( 0.15, fillColor );
|
||||
gradient.setColorAt( 0.25, fillColor );
|
||||
gradient.setColorAt( 0.4, fillColor.darker( 110 ) );
|
||||
gradient.setColorAt( 0.6, fillColor );
|
||||
gradient.setColorAt( 0.8, fillColor.darker( 110 ) );
|
||||
gradient.setColorAt( 1, fillColor );
|
||||
m_qwtPlotCurve->setBrush( gradient );
|
||||
|
||||
QPen curvePen = m_qwtPlotCurve->pen();
|
||||
curvePen.setColor( lineColor );
|
||||
m_qwtPlotCurve->setPen( curvePen );
|
||||
m_qwtPlotCurve->setOrientation( Qt::Horizontal );
|
||||
m_qwtPlotCurve->setBaseline( 0.0 );
|
||||
m_qwtPlotCurve->setCurveAttribute( QwtPlotCurve::Inverted, true );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_curveName );
|
||||
m_curveName.uiCapability()->setUiReadOnly( true );
|
||||
uiOrdering.add( &m_curveColor );
|
||||
m_curveColor.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_showCurve )
|
||||
{
|
||||
loadDataAndUpdate( true );
|
||||
}
|
||||
|
||||
RimWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellFlowRateCurve::isUsingConnectionNumberDepthType() const
|
||||
{
|
||||
RimWellLogPlot* wellLogPlot;
|
||||
firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( wellLogPlot && wellLogPlot->depthType() == RiaDefines::DepthTypeEnum::CONNECTION_NUMBER )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const
|
||||
{
|
||||
RimWellAllocationPlot* wap = nullptr;
|
||||
this->firstAncestorOrThisOfType( wap );
|
||||
|
||||
return wap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::setFlowValuesPrDepthValue( const QString& curveName,
|
||||
RiaDefines::DepthTypeEnum depthType,
|
||||
const std::vector<double>& depthValues,
|
||||
const std::vector<double>& flowRates )
|
||||
{
|
||||
this->setValuesAndDepths( flowRates, depthValues, depthType, 0.0, RiaDefines::DepthUnitType::UNIT_NONE, false );
|
||||
|
||||
m_curveAutoName = curveName;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimWellLogCurve.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimEclipseResultCase;
|
||||
class RimWellAllocationPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellFlowRateCurve : public RimWellLogCurve
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimWellFlowRateCurve();
|
||||
~RimWellFlowRateCurve() override;
|
||||
|
||||
void setFlowValuesPrDepthValue( const QString& curveName,
|
||||
RiaDefines::DepthTypeEnum depthType,
|
||||
const std::vector<double>& depthValues,
|
||||
const std::vector<double>& flowRates );
|
||||
|
||||
RimEclipseResultCase* rimCase();
|
||||
int timeStep();
|
||||
QString wellName() const override;
|
||||
QString wellLogChannelUiName() const override;
|
||||
QString wellLogChannelUnits() const override;
|
||||
|
||||
void setGroupId( int groupId );
|
||||
int groupId() const;
|
||||
|
||||
void setDoFillCurve( bool doFill );
|
||||
|
||||
protected:
|
||||
QString createCurveAutoName() override;
|
||||
void onLoadDataAndUpdate( bool updateParentPlot ) override;
|
||||
void updateCurveAppearance() override;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
private:
|
||||
bool isUsingConnectionNumberDepthType() const;
|
||||
RimWellAllocationPlot* wellAllocationPlot() const;
|
||||
|
||||
QString m_curveAutoName;
|
||||
|
||||
int m_groupId;
|
||||
bool m_doFillCurve;
|
||||
};
|
||||
1241
ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp
Normal file
1241
ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp
Normal file
File diff suppressed because it is too large
Load Diff
156
ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.h
Normal file
156
ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.h
Normal file
@@ -0,0 +1,156 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RiaEclipseUnitTools.h"
|
||||
#include "RiaRftPltCurveDefinition.h"
|
||||
|
||||
#include "RifDataSourceForRftPltQMetaType.h"
|
||||
#include "RifEclipseRftAddress.h"
|
||||
|
||||
#include "RimWellLogFile.h"
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
class RimEclipseCase;
|
||||
class RimEclipseResultCase;
|
||||
class RimObservedFmuRftData;
|
||||
class RimSummaryCaseCollection;
|
||||
class RimWellLogCurve;
|
||||
class RimWellLogFileChannel;
|
||||
class RimWellLogPlot;
|
||||
class RimWellPath;
|
||||
class RiuWellRftPlot;
|
||||
class RigEclipseCaseData;
|
||||
class RigEclipseResultAddress;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
enum FlowType
|
||||
{
|
||||
FLOW_TYPE_PHASE_SPLIT,
|
||||
FLOW_TYPE_TOTAL
|
||||
};
|
||||
enum FlowPhase
|
||||
{
|
||||
FLOW_PHASE_NONE,
|
||||
FLOW_PHASE_OIL,
|
||||
FLOW_PHASE_GAS,
|
||||
FLOW_PHASE_WATER,
|
||||
FLOW_PHASE_TOTAL
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellPlotTools
|
||||
{
|
||||
public:
|
||||
// PLT Only
|
||||
static bool isOilFlowChannel( const QString& channelName );
|
||||
static bool isGasFlowChannel( const QString& channelName );
|
||||
static bool isWaterFlowChannel( const QString& channelName );
|
||||
static bool isTotalFlowChannel( const QString& channelName );
|
||||
static FlowPhase flowPhaseFromChannelName( const QString& channelName );
|
||||
|
||||
static std::vector<RimWellLogFile*> wellLogFilesContainingFlow( const QString& wellName );
|
||||
static RimWellPath* wellPathByWellPathNameOrSimWellName( const QString& wellPathNameOrSimwellName );
|
||||
|
||||
// RFT Only
|
||||
private:
|
||||
static std::pair<RigEclipseResultAddress, QString> pressureResultDataInfo( const RigEclipseCaseData* eclipseCaseData );
|
||||
|
||||
public:
|
||||
static void addTimeStepsToMap( std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& destMap,
|
||||
const std::map<QDateTime, std::set<RifDataSourceForRftPlt>>& timeStepsToAdd );
|
||||
static std::vector<RimWellLogFile*> wellLogFilesContainingPressure( const QString& wellPathNameOrSimWellName );
|
||||
static RimWellLogFileChannel* getPressureChannelFromWellFile( const RimWellLogFile* wellLogFile );
|
||||
static RimWellPath* wellPathFromWellLogFile( const RimWellLogFile* wellLogFile );
|
||||
static std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timeStepsMapFromGridCase( RimEclipseCase* gridCase );
|
||||
static RiaRftPltCurveDefinition curveDefFromCurve( const RimWellLogCurve* curve );
|
||||
|
||||
// others
|
||||
static bool hasFlowData( const RimWellLogFile* wellLogFile );
|
||||
static bool hasAssociatedWellPath( const QString& wellName );
|
||||
|
||||
// Both
|
||||
static std::vector<RimEclipseResultCase*> gridCasesForWell( const QString& simWellName );
|
||||
static std::vector<RimEclipseResultCase*> rftCasesForWell( const QString& simWellName );
|
||||
static std::vector<RimSummaryCaseCollection*> rftEnsemblesForWell( const QString& simWellName );
|
||||
static std::vector<RimSummaryCaseCollection*> rftEnsembles();
|
||||
static std::vector<RimObservedFmuRftData*> observedFmuRftDataForWell( const QString& simWellName );
|
||||
static std::vector<RimObservedFmuRftData*> observedFmuRftData();
|
||||
static QString simWellName( const QString& wellPathNameOrSimWellName );
|
||||
|
||||
static std::map<QDateTime, std::set<RifDataSourceForRftPlt>> calculateRelevantTimeStepsFromCases(
|
||||
const QString& wellPathNameOrSimWellName,
|
||||
const std::vector<RifDataSourceForRftPlt>& selSources,
|
||||
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& interestingRFTResults );
|
||||
|
||||
static void
|
||||
calculateValueOptionsForTimeSteps( const QString& wellPathNameOrSimWellName,
|
||||
const std::vector<RifDataSourceForRftPlt>& selSources,
|
||||
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& interestingRFTResults,
|
||||
QList<caf::PdmOptionItemInfo>& options );
|
||||
|
||||
static std::set<RiaRftPltCurveDefinition>
|
||||
curveDefsFromTimesteps( const QString& wellPathNameOrSimWellName,
|
||||
const std::vector<QDateTime>& selectedTimeStepVector,
|
||||
bool firstReportTimeStepIsValid,
|
||||
const std::vector<RifDataSourceForRftPlt>& selectedSourcesExpanded,
|
||||
const std::set<RifEclipseRftAddress::RftWellLogChannelType>& interestingRFTResults );
|
||||
|
||||
static QString flowPlotAxisTitle( RimWellLogFile::WellFlowCondition condition,
|
||||
RiaEclipseUnitTools::UnitSystem unitSystem );
|
||||
|
||||
static QString flowUnitText( RimWellLogFile::WellFlowCondition condition, RiaEclipseUnitTools::UnitSystem unitSystem );
|
||||
|
||||
static QString curveUnitText( RimWellLogFile::WellFlowCondition condition,
|
||||
RiaEclipseUnitTools::UnitSystem unitSystem,
|
||||
FlowPhase flowPhase );
|
||||
|
||||
static bool hasFlowData( const RimWellPath* wellPath );
|
||||
|
||||
private:
|
||||
friend class StaticFieldsInitializer;
|
||||
static const std::set<QString> PRESSURE_DATA_NAMES;
|
||||
|
||||
static const std::set<QString> OIL_CHANNEL_NAMES;
|
||||
static const std::set<QString> GAS_CHANNEL_NAMES;
|
||||
static const std::set<QString> WATER_CHANNEL_NAMES;
|
||||
static const std::set<QString> TOTAL_CHANNEL_NAMES;
|
||||
|
||||
static std::set<QString> FLOW_DATA_NAMES;
|
||||
|
||||
static bool hasPressureData( const RimWellLogFile* wellLogFile );
|
||||
static bool isPressureChannel( RimWellLogFileChannel* channel );
|
||||
static bool hasPressureData( RimEclipseResultCase* gridCase );
|
||||
static bool hasPressureData( RimWellPath* wellPath );
|
||||
static bool hasFlowData( RimEclipseResultCase* gridCase );
|
||||
static bool isFlowChannel( RimWellLogFileChannel* channel );
|
||||
static bool tryMatchChannelName( const std::set<QString>& channelNames, const QString& channelNameToMatch );
|
||||
static std::set<QDateTime> findMatchingOrAdjacentTimeSteps( const std::set<QDateTime>& baseTimeLine,
|
||||
const std::set<QDateTime>& availableTimeSteps );
|
||||
static std::set<QDateTime>
|
||||
availableSimWellTimesteps( RimEclipseCase* eclCase, const QString& simWellName, bool addFirstReportTimeStep );
|
||||
};
|
||||
1129
ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp
Normal file
1129
ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp
Normal file
File diff suppressed because it is too large
Load Diff
132
ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.h
Normal file
132
ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.h
Normal file
@@ -0,0 +1,132 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RifDataSourceForRftPltQMetaType.h"
|
||||
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellPlotTools.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cvfCollection.h"
|
||||
|
||||
#include <QDate>
|
||||
#include <QMetaType>
|
||||
#include <QPointer>
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
class RimEclipseCase;
|
||||
class RimEclipseResultCase;
|
||||
class RimWellLogCurve;
|
||||
class RimWellLogFileChannel;
|
||||
class RimWellPath;
|
||||
class RiuWellPltPlot;
|
||||
class RimWellLogTrack;
|
||||
class RiaRftPltCurveDefinition;
|
||||
class RimDataSourceForRftPlt;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class Color3f;
|
||||
}
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmOptionItemInfo;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellPltPlot : public RimWellLogPlot
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
static const char PLOT_NAME_QFORMAT_STRING[];
|
||||
|
||||
public:
|
||||
RimWellPltPlot();
|
||||
~RimWellPltPlot() override;
|
||||
|
||||
void setCurrentWellName( const QString& currWellName );
|
||||
|
||||
static const char* plotNameFormatString();
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
void calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options );
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
void initAfterRead() override;
|
||||
void setupBeforeSave() override;
|
||||
void initAfterLoad();
|
||||
|
||||
private:
|
||||
void syncSourcesIoFieldFromGuiField();
|
||||
void syncCurvesFromUiSelection();
|
||||
|
||||
std::set<RiaRftPltCurveDefinition> selectedCurveDefs() const;
|
||||
void addStackedCurve( const QString& tracerName,
|
||||
const std::vector<double>& depthValues,
|
||||
const std::vector<double>& accFlow,
|
||||
RimWellLogTrack* plotTrack,
|
||||
cvf::Color3f color,
|
||||
int curveGroupId,
|
||||
bool doFillCurve );
|
||||
|
||||
std::vector<RifDataSourceForRftPlt> selectedSourcesExpanded() const;
|
||||
|
||||
// RimViewWindow overrides
|
||||
|
||||
void setPlotXAxisTitles( RimWellLogTrack* plotTrack );
|
||||
|
||||
void updateFormationsOnPlot() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_wellPathName;
|
||||
|
||||
caf::PdmField<std::vector<RifDataSourceForRftPlt>> m_selectedSources;
|
||||
caf::PdmChildArrayField<RimDataSourceForRftPlt*> m_selectedSourcesForIo;
|
||||
|
||||
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
|
||||
|
||||
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
|
||||
|
||||
caf::PdmField<bool> m_useStandardConditionCurves;
|
||||
caf::PdmField<bool> m_useReservoirConditionCurves;
|
||||
caf::PdmField<std::vector<caf::AppEnum<FlowPhase>>> m_phases;
|
||||
|
||||
bool m_doInitAfterLoad;
|
||||
bool m_isOnLoad;
|
||||
};
|
||||
@@ -0,0 +1,259 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimWellRftEnsembleCurveSet.h"
|
||||
#include "RimEnsembleCurveSetColorManager.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimWellRftPlot.h"
|
||||
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiObjectHandle.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellRftEnsembleCurveSet, "WellRftEnsembleCurveSet" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellRftEnsembleCurveSet::RimWellRftEnsembleCurveSet()
|
||||
{
|
||||
CAF_PDM_InitObject( "Ensemble Curve Set", ":/EnsembleCurveSet16x16.png", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble", "", "", "" );
|
||||
m_ensemble.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_ensemble.uiCapability()->setAutoAddingOptionFromValue( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleName, "NameAndUnit", "NameAndUnit", "", "", "" );
|
||||
m_ensembleName.registerGetMethod( this, &RimWellRftEnsembleCurveSet::ensembleName );
|
||||
m_ensembleName.uiCapability()->setUiHidden( true );
|
||||
m_ensembleName.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitField( &m_ensembleColorMode, "ColorMode", ColorModeEnum( ColorMode::SINGLE_COLOR ), "Coloring Mode", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter", "", "", "" );
|
||||
m_ensembleParameter.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ensembleLegendConfig, "LegendConfig", "", "", "", "" );
|
||||
m_ensembleLegendConfig = new RimRegularLegendConfig();
|
||||
m_ensembleLegendConfig->setColorLegend(
|
||||
RimRegularLegendConfig::mapToColorLegend( RimEnsembleCurveSetColorManager::DEFAULT_ENSEMBLE_COLOR_RANGE ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellRftEnsembleCurveSet::~RimWellRftEnsembleCurveSet()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCaseCollection* RimWellRftEnsembleCurveSet::ensemble() const
|
||||
{
|
||||
return m_ensemble;
|
||||
}
|
||||
|
||||
void RimWellRftEnsembleCurveSet::setEnsemble( RimSummaryCaseCollection* ensemble )
|
||||
{
|
||||
m_ensemble = ensemble;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleCurveSetColorManager::ColorMode RimWellRftEnsembleCurveSet::colorMode() const
|
||||
{
|
||||
return m_ensembleColorMode();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::setColorMode( ColorMode mode )
|
||||
{
|
||||
m_ensembleColorMode = mode;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::initializeLegend()
|
||||
{
|
||||
auto ensembleParam = m_ensemble->ensembleParameter( m_ensembleParameter );
|
||||
m_ensembleLegendConfig->setTitle( m_ensemble->name() + "\n" + m_ensembleParameter );
|
||||
RimEnsembleCurveSetColorManager::initializeLegendConfig( m_ensembleLegendConfig, ensembleParam );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RimWellRftEnsembleCurveSet::caseColor( const RimSummaryCase* summaryCase ) const
|
||||
{
|
||||
auto ensembleParam = m_ensemble->ensembleParameter( m_ensembleParameter );
|
||||
return RimEnsembleCurveSetColorManager::caseColor( m_ensembleLegendConfig, summaryCase, ensembleParam );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellRftEnsembleCurveSet::currentEnsembleParameter() const
|
||||
{
|
||||
return m_ensembleParameter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::setEnsembleParameter( const QString& parameterName )
|
||||
{
|
||||
m_ensembleParameter = parameterName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RimWellRftEnsembleCurveSet::allEnsembleParameters() const
|
||||
{
|
||||
std::set<QString> paramSet;
|
||||
RimSummaryCaseCollection* group = m_ensemble;
|
||||
if ( group )
|
||||
{
|
||||
for ( RimSummaryCase* rimCase : group->allSummaryCases() )
|
||||
{
|
||||
if ( rimCase->caseRealizationParameters() != nullptr )
|
||||
{
|
||||
auto ps = rimCase->caseRealizationParameters()->parameters();
|
||||
for ( auto p : ps )
|
||||
paramSet.insert( p.first );
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::vector<QString>( paramSet.begin(), paramSet.end() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimRegularLegendConfig* RimWellRftEnsembleCurveSet::legendConfig()
|
||||
{
|
||||
return m_ensembleLegendConfig;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
EnsembleParameter::Type RimWellRftEnsembleCurveSet::currentEnsembleParameterType() const
|
||||
{
|
||||
if ( m_ensembleColorMode() == ColorMode::BY_ENSEMBLE_PARAM )
|
||||
{
|
||||
RimSummaryCaseCollection* group = m_ensemble();
|
||||
QString parameterName = m_ensembleParameter();
|
||||
|
||||
if ( group && !parameterName.isEmpty() )
|
||||
{
|
||||
auto eParam = group->ensembleParameter( parameterName );
|
||||
return eParam.type;
|
||||
}
|
||||
}
|
||||
return EnsembleParameter::TYPE_NONE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_ensembleColorMode || changedField == &m_ensembleParameter )
|
||||
{
|
||||
RimWellRftPlot* rftPlot = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( rftPlot );
|
||||
rftPlot->syncCurvesFromUiSelection();
|
||||
rftPlot->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimWellRftEnsembleCurveSet::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
if ( fieldNeedingOptions == &m_ensembleParameter )
|
||||
{
|
||||
for ( const QString& param : allEnsembleParameters() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( param, param ) );
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* colorsGroup = uiOrdering.addNewGroup( "Ensemble Curve Colors" );
|
||||
colorsGroup->add( &m_ensembleColorMode );
|
||||
|
||||
if ( m_ensembleColorMode == ColorMode::BY_ENSEMBLE_PARAM )
|
||||
{
|
||||
colorsGroup->add( &m_ensembleParameter );
|
||||
}
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellRftEnsembleCurveSet::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
|
||||
QString uiConfigName /*= "" */ )
|
||||
{
|
||||
if ( m_ensembleColorMode == ColorMode::BY_ENSEMBLE_PARAM && !m_ensembleParameter().isEmpty() )
|
||||
{
|
||||
uiTreeOrdering.add( m_ensembleLegendConfig() );
|
||||
}
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimWellRftEnsembleCurveSet::userDescriptionField()
|
||||
{
|
||||
return &m_ensembleName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellRftEnsembleCurveSet::ensembleName() const
|
||||
{
|
||||
if ( m_ensemble ) return m_ensemble->name();
|
||||
|
||||
return "";
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimEnsembleCurveSetColorManager.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cvfColor3.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class RiuCvfOverlayItemWidget;
|
||||
|
||||
class RimWellRftEnsembleCurveSet : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
typedef RimEnsembleCurveSetColorManager::ColorMode ColorMode;
|
||||
typedef RimEnsembleCurveSetColorManager::ColorModeEnum ColorModeEnum;
|
||||
|
||||
public:
|
||||
RimWellRftEnsembleCurveSet();
|
||||
~RimWellRftEnsembleCurveSet() override;
|
||||
|
||||
RimSummaryCaseCollection* ensemble() const;
|
||||
void setEnsemble( RimSummaryCaseCollection* ensemble );
|
||||
ColorMode colorMode() const;
|
||||
void setColorMode( ColorMode mode );
|
||||
void initializeLegend();
|
||||
cvf::Color3f caseColor( const RimSummaryCase* summaryCase ) const;
|
||||
QString currentEnsembleParameter() const;
|
||||
|
||||
void setEnsembleParameter( const QString& parameterName );
|
||||
std::vector<QString> allEnsembleParameters() const;
|
||||
RimRegularLegendConfig* legendConfig();
|
||||
EnsembleParameter::Type currentEnsembleParameterType() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
QString ensembleName() const;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimSummaryCaseCollection*> m_ensemble;
|
||||
caf::PdmProxyValueField<QString> m_ensembleName;
|
||||
caf::PdmField<ColorModeEnum> m_ensembleColorMode;
|
||||
caf::PdmField<QString> m_ensembleParameter;
|
||||
caf::PdmChildField<RimRegularLegendConfig*> m_ensembleLegendConfig;
|
||||
};
|
||||
1411
ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp
Normal file
1411
ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp
Normal file
File diff suppressed because it is too large
Load Diff
165
ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h
Normal file
165
ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h
Normal file
@@ -0,0 +1,165 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil 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 "RimEnsembleCurveSetColorManager.h"
|
||||
#include "RimViewWindow.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellRftEnsembleCurveSet.h"
|
||||
|
||||
#include "RifDataSourceForRftPltQMetaType.h"
|
||||
#include "RiuQwtSymbol.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cvfCollection.h"
|
||||
|
||||
#include <QDate>
|
||||
#include <QMetaType>
|
||||
#include <QPointer>
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
class RimEclipseCase;
|
||||
class RimEclipseResultCase;
|
||||
class RimRegularLegendConfig;
|
||||
class RimWellLogCurve;
|
||||
class RimWellLogFileChannel;
|
||||
class RimWellPath;
|
||||
class RimWellPathCollection;
|
||||
class RiuWellRftPlot;
|
||||
class RigEclipseCaseData;
|
||||
class RiaRftPltCurveDefinition;
|
||||
class RifDataSourceForRftPlt;
|
||||
class RifEclipseRftAddress;
|
||||
class RiuDraggableOverlayFrame;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class Color3f;
|
||||
}
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmOptionItemInfo;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellRftPlot : public RimWellLogPlot
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
static const std::set<QString> PRESSURE_DATA_NAMES;
|
||||
static const char PLOT_NAME_QFORMAT_STRING[];
|
||||
|
||||
public:
|
||||
RimWellRftPlot();
|
||||
~RimWellRftPlot() override;
|
||||
|
||||
const QString& simWellOrWellPathName() const;
|
||||
void setSimWellOrWellPathName( const QString& currWellName );
|
||||
|
||||
int branchIndex() const;
|
||||
|
||||
void applyInitialSelections();
|
||||
|
||||
static const char* plotNameFormatString();
|
||||
|
||||
void deleteCurvesAssosicatedWithObservedData( const RimObservedFmuRftData* observedFmuRftData );
|
||||
|
||||
bool showErrorBarsForObservedData() const;
|
||||
void onLegendDefinitionChanged();
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
std::map<QString, QStringList> findWellSources();
|
||||
void updateEditorsFromPreviousSelection();
|
||||
void updateEditorsFromCurves();
|
||||
void syncCurvesFromUiSelection();
|
||||
void assignWellPathToExtractionCurves();
|
||||
|
||||
RimObservedFmuRftData* findObservedFmuData( const QString& wellPathName, const QDateTime& timeStep ) const;
|
||||
|
||||
std::set<RiaRftPltCurveDefinition> selectedCurveDefs() const;
|
||||
std::set<RiaRftPltCurveDefinition> curveDefsFromCurves() const;
|
||||
|
||||
void updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition>& allCurveDefs,
|
||||
const std::set<RiaRftPltCurveDefinition>& curveDefsToAdd,
|
||||
const std::set<RimWellLogCurve*>& curvesToDelete );
|
||||
|
||||
std::vector<RifDataSourceForRftPlt> selectedSourcesExpanded() const;
|
||||
|
||||
// RimViewWindow overrides
|
||||
|
||||
void applyCurveAppearance( RimWellLogCurve* curve );
|
||||
void applyCurveColor( RimWellLogCurve* curve );
|
||||
|
||||
void updateFormationsOnPlot() const;
|
||||
QString associatedSimWellName() const;
|
||||
|
||||
static RiuQwtSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseRftAddress& address );
|
||||
static RiuQwtSymbol::LabelPosition statisticsLabelPosFromAddress( const RifEclipseRftAddress& address );
|
||||
|
||||
cvf::Color3f findCurveColor( RimWellLogCurve* curve );
|
||||
void defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveDefinition>& allCurveDefs );
|
||||
|
||||
std::vector<RimSummaryCaseCollection*> selectedEnsembles() const;
|
||||
void createEnsembleCurveSets();
|
||||
RimWellRftEnsembleCurveSet* findEnsembleCurveSet( RimSummaryCaseCollection* ensemble ) const;
|
||||
|
||||
private:
|
||||
friend class RimWellRftEnsembleCurveSet;
|
||||
|
||||
caf::PdmField<QString> m_wellPathNameOrSimWellName;
|
||||
caf::PdmField<int> m_branchIndex;
|
||||
caf::PdmField<bool> m_branchDetection;
|
||||
caf::PdmField<bool> m_showStatisticsCurves;
|
||||
caf::PdmField<bool> m_showEnsembleCurves;
|
||||
caf::PdmField<bool> m_showErrorInObservedData;
|
||||
|
||||
caf::PdmField<std::vector<RifDataSourceForRftPlt>> m_selectedSources;
|
||||
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
|
||||
|
||||
caf::PdmPtrField<RimWellPathCollection*> m_wellPathCollection;
|
||||
|
||||
caf::PdmChildArrayField<RimWellRftEnsembleCurveSet*> m_ensembleCurveSets;
|
||||
std::map<RimWellRftEnsembleCurveSet*, QPointer<RiuDraggableOverlayFrame>> m_ensembleLegendFrames;
|
||||
|
||||
std::map<RifDataSourceForRftPlt, cvf::Color3f> m_dataSourceColors;
|
||||
std::map<QDateTime, RiuQwtSymbol::PointSymbolEnum> m_timeStepSymbols;
|
||||
bool m_isOnLoad;
|
||||
|
||||
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
|
||||
};
|
||||
Reference in New Issue
Block a user