Improve RFT reader performance

* #9963 Rft reader: Search for DATA file when required
WSEGLINK is used to establish the branch topology for MSW wells. Search and read WSEGLINK data when segment data is requested by the user. This can be a time consuming operation.
Avoid doing this search for standard RFT plots.

* Make sure that single summary curves are displayed correctly
* Make sure single summary curves are visible in the plot
This commit is contained in:
Magne Sjaastad 2023-03-14 13:14:40 +01:00 committed by GitHub
parent 064c0adb8c
commit 09c04cbcd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 105 additions and 54 deletions

View File

@ -30,6 +30,7 @@
#include "RifReaderOpmRft.h"
#include "RimFileSummaryCase.h"
#include "RimRftCase.h"
#include "RimRftTopologyCurve.h"
#include "RimSummaryCase.h"
@ -58,10 +59,12 @@ bool RicNewMultiPhaseRftSegmentPlotFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
{
RimSummaryCase* summaryCase = RicNewRftSegmentWellLogPlotFeature::getSelectedOrFirstRftCase();
if ( !summaryCase ) return;
auto fileSummaryCase = dynamic_cast<RimFileSummaryCase*>( RicNewRftSegmentWellLogPlotFeature::getSelectedOrFirstRftCase() );
if ( !fileSummaryCase ) return;
auto rftReader = summaryCase->rftReader();
fileSummaryCase->searchForWseglinkAndRecreateRftReader();
auto rftReader = fileSummaryCase->rftReader();
if ( !rftReader )
{
RiaLogging::error( "Could not open RFT file or no RFT file present. " );
@ -82,7 +85,7 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
for ( auto branchType : allBranchTypes )
{
QString trackName = "Reservoir Rates - " + caf::AppEnum<RiaDefines::RftBranchType>::uiText( branchType );
appendTrackAndCurveForBranchType( plot, trackName, { "CONGRAT", "CONORAT", "CONWRAT" }, wellName, branchType, summaryCase );
appendTrackAndCurveForBranchType( plot, trackName, { "CONGRAT", "CONORAT", "CONWRAT" }, wellName, branchType, fileSummaryCase );
}
for ( auto branchType : allBranchTypes )
@ -90,12 +93,12 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
QString trackName = caf::AppEnum<RiaDefines::RftBranchType>::uiText( branchType );
trackName += " Rates";
appendTrackAndCurveForBranchType( plot, trackName, { "SEGGRAT", "SEGORAT", "SEGWRAT" }, wellName, branchType, summaryCase );
appendTrackAndCurveForBranchType( plot, trackName, { "SEGGRAT", "SEGORAT", "SEGWRAT" }, wellName, branchType, fileSummaryCase );
}
RicNewRftSegmentWellLogPlotFeature::appendPressureTrack( plot, wellName, summaryCase );
RicNewRftSegmentWellLogPlotFeature::appendConnectionFactorTrack( plot, wellName, summaryCase );
RicNewRftSegmentWellLogPlotFeature::appendTopologyTrack( plot, wellName, summaryCase );
RicNewRftSegmentWellLogPlotFeature::appendPressureTrack( plot, wellName, fileSummaryCase );
RicNewRftSegmentWellLogPlotFeature::appendConnectionFactorTrack( plot, wellName, fileSummaryCase );
RicNewRftSegmentWellLogPlotFeature::appendTopologyTrack( plot, wellName, fileSummaryCase );
plot->loadDataAndUpdate();
plot->updateTrackVisibility();

View File

@ -31,6 +31,7 @@
#include "RifReaderOpmRft.h"
#include "RimFileSummaryCase.h"
#include "RimRftCase.h"
#include "RimRftTopologyCurve.h"
#include "RimSummaryCase.h"
@ -59,10 +60,12 @@ bool RicNewRftSegmentWellLogPlotFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked )
{
RimSummaryCase* summaryCase = RicNewRftSegmentWellLogPlotFeature::getSelectedOrFirstRftCase();
if ( !summaryCase ) return;
auto fileSummaryCase = dynamic_cast<RimFileSummaryCase*>( RicNewRftSegmentWellLogPlotFeature::getSelectedOrFirstRftCase() );
if ( !fileSummaryCase ) return;
auto rftReader = summaryCase->rftReader();
fileSummaryCase->searchForWseglinkAndRecreateRftReader();
auto rftReader = fileSummaryCase->rftReader();
if ( !rftReader )
{
RiaLogging::error( "Could not open RFT file or no RFT file present. " );
@ -87,7 +90,7 @@ void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked )
plot->addPlot( plotTrack );
plotTrack->setDescription( trackName );
auto curve = createAndAddCurve( plotTrack, "CONGRAT", wellName, branchType, summaryCase );
auto curve = createAndAddCurve( plotTrack, "CONGRAT", wellName, branchType, fileSummaryCase );
curve->setScaleFactor( 1e-3 );
curve->setFillStyle( Qt::SolidPattern );
}
@ -97,14 +100,14 @@ void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked )
QString resultName = "SEGGRAT";
QString trackName = caf::AppEnum<RiaDefines::RftBranchType>::uiText( branchType );
trackName += " Rates";
auto curve = appendTrackAndCurveForBranchType( plot, trackName, resultName, wellName, branchType, summaryCase );
auto curve = appendTrackAndCurveForBranchType( plot, trackName, resultName, wellName, branchType, fileSummaryCase );
curve->setScaleFactor( 1e-3 );
curve->setFillStyle( Qt::SolidPattern );
}
appendPressureTrack( plot, wellName, summaryCase );
appendConnectionFactorTrack( plot, wellName, summaryCase );
appendTopologyTrack( plot, wellName, summaryCase );
appendPressureTrack( plot, wellName, fileSummaryCase );
appendConnectionFactorTrack( plot, wellName, fileSummaryCase );
appendTopologyTrack( plot, wellName, fileSummaryCase );
plot->loadDataAndUpdate();
plot->updateTrackVisibility();

View File

@ -376,7 +376,7 @@ void RimWellRftPlot::updateEditorsFromCurves()
{
selectedSources.insert( RifDataSourceForRftPlt( curveDef.address().wellLogFile() ) );
}
else if ( curveDef.address().sourceType() == RifDataSourceForRftPlt::SourceType::SUMMARY_RFT )
else if ( ( curveDef.address().sourceType() == RifDataSourceForRftPlt::SourceType::SUMMARY_RFT ) && curveDef.address().ensemble() )
{
selectedSources.insert( RifDataSourceForRftPlt( curveDef.address().ensemble() ) );
}
@ -545,12 +545,22 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
curveDefToAdd.timeStep(),
RifEclipseRftAddress::RftWellLogChannelType::PRESSURE );
curve->setRftAddress( address );
curve->setZOrder( 1 );
double zValue = 1.0;
if ( !curveDefToAdd.address().ensemble() )
{
zValue = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_NON_OBSERVED );
}
curve->setZOrder( zValue );
applyCurveAppearance( curve );
bool isFirstSummaryCurveInEnsemble = ensemblesWithSummaryCurves.count( curveDefToAdd.address().ensemble() ) == 0u;
curve->setShowInLegend( isFirstSummaryCurveInEnsemble );
ensemblesWithSummaryCurves.insert( curveDefToAdd.address().ensemble() );
if ( curveDefToAdd.address().ensemble() )
{
bool isFirstSummaryCurveInEnsemble = ensemblesWithSummaryCurves.count( curveDefToAdd.address().ensemble() ) == 0u;
curve->setShowInLegend( isFirstSummaryCurveInEnsemble );
ensemblesWithSummaryCurves.insert( curveDefToAdd.address().ensemble() );
}
}
else if ( m_showStatisticsCurves && curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::SourceType::ENSEMBLE_RFT )
{

View File

@ -68,6 +68,8 @@ RimFileSummaryCase::RimFileSummaryCase()
CAF_PDM_InitFieldNoDefault( &m_rftCase, "RftCase", "RFT Data" );
m_rftCase = new RimRftCase;
m_hasParsedForWeseglink = false;
}
//--------------------------------------------------------------------------------------------------
@ -147,36 +149,10 @@ void RimFileSummaryCase::createRftReaderInterface()
}
}
if ( m_rftCase->dataDeckFilePath().isEmpty() )
{
// Search for *.DATA file in same folder as summary file. If not found, search for a schedule file.
QString validDataDeckFileName;
QString dataDeckFileName = folder + "/" + fileInfo.completeBaseName() + ".DATA";
QFileInfo fi( dataDeckFileName );
if ( fi.exists() )
{
validDataDeckFileName = dataDeckFileName;
}
else
{
QString scheduleFileName = folder + "/" + fileInfo.completeBaseName() + ".SCH";
QFileInfo fi( scheduleFileName );
if ( fi.exists() )
{
validDataDeckFileName = scheduleFileName;
}
}
if ( !validDataDeckFileName.isEmpty() )
{
m_rftCase->setDataDeckFileName( dataDeckFileName );
}
}
m_summaryEclipseRftReader = RimFileSummaryCase::findRftDataAndCreateReader( rftFileName, m_rftCase->dataDeckFilePath() );
// Usually, the data deck file path is empty at this point. If the user has specified the path manually, we use that.
// The intention is to use searchForWseglinkAndRecreateRftReader() to search for the data deck file path. Here we avoid searching for
// the data deck file by default, as this is a time consuming operation.
m_summaryEclipseRftReader = RimFileSummaryCase::createOpmRftReader( rftFileName, m_rftCase->dataDeckFilePath() );
}
//--------------------------------------------------------------------------------------------------
@ -230,7 +206,7 @@ RifSummaryReaderInterface* RimFileSummaryCase::findRelatedFilesAndCreateReader(
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifReaderOpmRft* RimFileSummaryCase::findRftDataAndCreateReader( const QString& rftFileName, const QString& dataDeckFileName )
RifReaderOpmRft* RimFileSummaryCase::createOpmRftReader( const QString& rftFileName, const QString& dataDeckFileName )
{
QFileInfo fi( rftFileName );
@ -419,6 +395,52 @@ QString RimFileSummaryCase::createAdditionalSummaryFileName()
return filePath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFileSummaryCase::searchForWseglinkAndRecreateRftReader()
{
if ( m_hasParsedForWeseglink ) return;
if ( m_rftCase->dataDeckFilePath().isEmpty() )
{
QFileInfo fileInfo( summaryHeaderFilename() );
QString folder = fileInfo.absolutePath();
// Search for *.DATA file in same folder as summary file. If not found, search for a schedule file.
QString validDataDeckFileName;
QString dataDeckFileName = folder + "/" + fileInfo.completeBaseName() + ".DATA";
QFileInfo fi( dataDeckFileName );
if ( fi.exists() )
{
validDataDeckFileName = dataDeckFileName;
}
else
{
QString scheduleFileName = folder + "/" + fileInfo.completeBaseName() + ".SCH";
QFileInfo fi( scheduleFileName );
if ( fi.exists() )
{
validDataDeckFileName = scheduleFileName;
}
}
if ( !validDataDeckFileName.isEmpty() )
{
m_rftCase->setDataDeckFileName( dataDeckFileName );
// Create a new reader including the file path to the data deck file
// NB! This can be a time consuming operation
m_summaryEclipseRftReader = RimFileSummaryCase::createOpmRftReader( m_rftCase->rftFilePath(), m_rftCase->dataDeckFilePath() );
}
}
m_hasParsedForWeseglink = true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -53,6 +53,7 @@ public:
void createRftReaderInterface() override;
RifSummaryReaderInterface* summaryReader() override;
RifReaderRftInterface* rftReader() override;
void searchForWseglinkAndRecreateRftReader();
void setIncludeRestartFiles( bool includeRestartFiles );
@ -72,7 +73,7 @@ private:
QString additionalSummaryDataFilePath() const;
static QString createAdditionalSummaryFileName();
static RifReaderOpmRft* findRftDataAndCreateReader( const QString& rftFileName, const QString& dataDeckFileName );
static RifReaderOpmRft* createOpmRftReader( const QString& rftFileName, const QString& dataDeckFileName );
private:
cvf::ref<RifSummaryReaderInterface> m_fileSummaryReader;
@ -85,4 +86,6 @@ private:
cvf::ref<RifOpmCommonEclipseSummary> m_additionalSummaryFileReader;
caf::PdmChildField<RimRftCase*> m_rftCase;
bool m_hasParsedForWeseglink;
};

View File

@ -43,6 +43,7 @@
#include "RimDepthTrackPlot.h"
#include "RimEclipseResultCase.h"
#include "RimFileSummaryCase.h"
#include "RimMainPlotCollection.h"
#include "RimObservedFmuRftData.h"
#include "RimPressureDepthData.h"
@ -999,6 +1000,15 @@ void RimWellLogRftCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
loadData = true;
}
if ( changedField == &m_rftDataType )
{
if ( m_rftDataType() == RftDataType::RFT_SEGMENT_DATA )
{
auto fileSummaryCase = dynamic_cast<RimFileSummaryCase*>( m_summaryCase() );
if ( fileSummaryCase ) fileSummaryCase->searchForWseglinkAndRecreateRftReader();
}
}
if ( loadData ) this->loadDataAndUpdate( true );
}

View File

@ -5,7 +5,7 @@ set(RESINSIGHT_PATCH_VERSION 0)
# Opional text with no restrictions
#set(RESINSIGHT_VERSION_TEXT "-dev")
set(RESINSIGHT_VERSION_TEXT "-RC_02")
set(RESINSIGHT_VERSION_TEXT "-RC_03")
# Optional text
# Must be unique and increasing within one combination of major/minor/patch version