Skip to content

Commit

Permalink
Support well path geometry for summary RFT data
Browse files Browse the repository at this point in the history
* Compare well path names when matching sim well names
* 10501 Make it possible to use well path geo when plotting summary RFT data
  • Loading branch information
magnesj authored Aug 15, 2023
1 parent a243311 commit ef2de3e
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ bool RicImportGridModelFromSummaryCaseFeature::findAndActivateFirstView( const R
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RicImportGridModelFromSummaryCaseFeature::gridModelFromSummaryCase( const RimFileSummaryCase* summaryCase )
RimEclipseCase* RicImportGridModelFromSummaryCaseFeature::gridModelFromSummaryCase( const RimSummaryCase* summaryCase )
{
if ( summaryCase )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

class RimEclipseCase;
class RimFileSummaryCase;
class RimSummaryCase;

//==================================================================================================
///
Expand All @@ -31,12 +32,12 @@ class RicImportGridModelFromSummaryCaseFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT;

public:
static bool openOrImportGridModelFromSummaryCase( const RimFileSummaryCase* summaryCase );
static bool openOrImportGridModelFromSummaryCase( const RimFileSummaryCase* summaryCase );
static RimEclipseCase* gridModelFromSummaryCase( const RimSummaryCase* summaryCase );

protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;

static bool findAndActivateFirstView( const RimFileSummaryCase* summaryCase );
static RimEclipseCase* gridModelFromSummaryCase( const RimFileSummaryCase* summaryCase );
static bool findAndActivateFirstView( const RimFileSummaryCase* summaryCase );
};
3 changes: 2 additions & 1 deletion ApplicationLibCode/FileInterface/RifDataSourceForRftPlt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,12 @@ RifDataSourceForRftPlt::RifDataSourceForRftPlt( RimSummaryCaseCollection* ensemb
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifDataSourceForRftPlt::RifDataSourceForRftPlt( RimSummaryCase* summaryCase, RimSummaryCaseCollection* ensemble )
RifDataSourceForRftPlt::RifDataSourceForRftPlt( RimSummaryCase* summaryCase, RimSummaryCaseCollection* ensemble, RimEclipseCase* eclipseCase )
{
m_sourceType = SourceType::SUMMARY_RFT;
m_summaryCase = summaryCase;
m_ensemble = ensemble;
m_eclCase = eclipseCase;
}

//--------------------------------------------------------------------------------------------------
Expand Down
4 changes: 1 addition & 3 deletions ApplicationLibCode/FileInterface/RifDataSourceForRftPlt.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class RifDataSourceForRftPlt
RifDataSourceForRftPlt();
RifDataSourceForRftPlt( SourceType sourceType, RimEclipseCase* eclCase );
RifDataSourceForRftPlt( RimSummaryCaseCollection* ensemble );
RifDataSourceForRftPlt( RimSummaryCase* summaryCase, RimSummaryCaseCollection* ensemble );
RifDataSourceForRftPlt( RimSummaryCase* summaryCase, RimSummaryCaseCollection* ensemble, RimEclipseCase* eclipseCase );
RifDataSourceForRftPlt( RimWellLogFile* wellLogFile );
RifDataSourceForRftPlt( RimObservedFmuRftData* observedFmuRftData );
RifDataSourceForRftPlt( RimPressureDepthData* pressureDepthData );
Expand All @@ -78,8 +78,6 @@ class RifDataSourceForRftPlt

std::vector<RiaDefines::EclipseUnitSystem> availableUnitSystems() const;

friend QTextStream& operator>>( QTextStream& str, RifDataSourceForRftPlt& addr );

auto operator<=>( const RifDataSourceForRftPlt& rhs ) const -> std::strong_ordering;

// When operator<=>() is overloaded, no operator==() nor operator!=() are defined by default by the compiler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ RifDataSourceForRftPlt RimDataSourceForRftPlt::address() const
case RifDataSourceForRftPlt::SourceType::GRID_MODEL_CELL_DATA:
return RifDataSourceForRftPlt( RifDataSourceForRftPlt::SourceType::GRID_MODEL_CELL_DATA, m_eclCase );
case RifDataSourceForRftPlt::SourceType::SUMMARY_RFT:
return RifDataSourceForRftPlt( m_summaryCase, m_ensemble );
return RifDataSourceForRftPlt( m_summaryCase, m_ensemble, m_eclCase );
case RifDataSourceForRftPlt::SourceType::ENSEMBLE_RFT:
return RifDataSourceForRftPlt( m_ensemble );
case RifDataSourceForRftPlt::SourceType::OBSERVED_FMU_RFT:
Expand Down
21 changes: 11 additions & 10 deletions ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,17 +618,20 @@ RiaRftPltCurveDefinition RimWellPlotTools::curveDefFromCurve( const RimWellLogCu
const QString& wellName = rftAddress.wellName();
const QDateTime& timeStep = rftAddress.timeStep();

if ( rftCase != nullptr )
if ( rftSummaryCase != nullptr )
{
// Presens of rftSummaryCase must be tested before rftCase because a rftSummaryCase can have a rftCase
// The rftCase is used to extract TVD/MD from the grid model

RimSummaryCaseCollection* parentEnsemble = rftSummaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
return RiaRftPltCurveDefinition( RifDataSourceForRftPlt( rftSummaryCase, parentEnsemble, rftCase ), wellName, timeStep );
}
else if ( rftCase != nullptr )
{
return RiaRftPltCurveDefinition( RifDataSourceForRftPlt( RifDataSourceForRftPlt::SourceType::RFT_SIM_WELL_DATA, rftCase ),
wellName,
timeStep );
}
else if ( rftSummaryCase != nullptr )
{
RimSummaryCaseCollection* parentEnsemble = rftSummaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
return RiaRftPltCurveDefinition( RifDataSourceForRftPlt( rftSummaryCase, parentEnsemble ), wellName, timeStep );
}
else if ( rftEnsemble != nullptr )
{
return RiaRftPltCurveDefinition( RifDataSourceForRftPlt( rftEnsemble ), wellName, timeStep );
Expand Down Expand Up @@ -805,7 +808,7 @@ std::set<RiaRftPltCurveDefinition>
{
if ( summaryCase && summaryCase->rftReader() )
{
RifDataSourceForRftPlt summaryAddr( summaryCase, addr.ensemble() );
RifDataSourceForRftPlt summaryAddr( summaryCase, addr.ensemble(), addr.eclCase() );

std::set<QDateTime> timeSteps = summaryCase->rftReader()->availableTimeSteps( wellPathNameOrSimWellName );
for ( const QDateTime& time : timeSteps )
Expand Down Expand Up @@ -835,14 +838,12 @@ std::set<RiaRftPltCurveDefinition>
auto summaryCase = addr.summaryCase();
if ( summaryCase && summaryCase->rftReader() )
{
RifDataSourceForRftPlt summaryAddr( summaryCase, addr.ensemble() );

std::set<QDateTime> timeSteps = summaryCase->rftReader()->availableTimeSteps( wellPathNameOrSimWellName );
for ( const QDateTime& time : timeSteps )
{
if ( selectedTimeStepSet.count( time ) )
{
curveDefs.insert( RiaRftPltCurveDefinition( summaryAddr, wellPathNameOrSimWellName, time ) );
curveDefs.insert( RiaRftPltCurveDefinition( addr, wellPathNameOrSimWellName, time ) );
}
}
}
Expand Down
11 changes: 9 additions & 2 deletions ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "RiaSimWellBranchTools.h"
#include "RiaSummaryTools.h"

#include "RicImportGridModelFromSummaryCaseFeature.h"

#include "RifReaderEclipseRft.h"

#include "RigCaseCellResultsData.h"
Expand Down Expand Up @@ -540,6 +542,10 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
RifEclipseRftAddress::RftWellLogChannelType::PRESSURE );
curve->setRftAddress( address );

// A summary case address can optionally contain an Eclipse case used to compute the TVD/MD for a well path
// https://github.com/OPM/ResInsight/issues/10501
curve->setEclipseResultCase( dynamic_cast<RimEclipseResultCase*>( curveDefToAdd.address().eclCase() ) );

double zValue = 1.0;
if ( !curveDefToAdd.address().ensemble() )
{
Expand Down Expand Up @@ -842,8 +848,9 @@ QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptionsForSources()
{
if ( summaryCase->rftReader() && summaryCase->rftReader()->wellNames().contains( m_wellPathNameOrSimWellName ) )
{
auto parentEnsemble = summaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
auto addr = RifDataSourceForRftPlt( summaryCase, parentEnsemble );
auto eclipeGridModel = RicImportGridModelFromSummaryCaseFeature::gridModelFromSummaryCase( summaryCase );
auto parentEnsemble = summaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
auto addr = RifDataSourceForRftPlt( summaryCase, parentEnsemble, eclipeGridModel );

auto item = caf::PdmOptionItemInfo( summaryCase->displayCaseName(), QVariant::fromValue( addr ) );
item.setLevel( 1 );
Expand Down
8 changes: 8 additions & 0 deletions ApplicationLibCode/ProjectDataModel/RimProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,14 @@ RimWellPath* RimProject::wellPathFromSimWellName( const QString& simWellName, in
return path;
}
}

for ( RimWellPath* const path : allWellPaths() )
{
if ( QString::compare( path->name(), simWellName ) == 0 )
{
return path;
}
}
return nullptr;
}

Expand Down

0 comments on commit ef2de3e

Please sign in to comment.