mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#11706 Use connection depths when plotting connection data
The plotting of curve values for connections to a segment fails in some cases. The current implementation finds the segment a connection is attached to, and use the depth (both MD and TVD) information from this segment. This method is not working in all cases. Use the reported location of connections attached to segments based on CONLENST and CONLENEN. When measured depth is requested, use these values. There might be gaps in the reported segment sequence. Use CONDEPTH when TVD depth is requested. Use CONBRNO to find the branch number, and then use lookup table branchIdsAndOneBasedBranchIndices to find the branch index. Use the branch index to filter the results for requested branch. The number of values in CON* result values is different to result values for SEG* results.
This commit is contained in:
@@ -136,57 +136,54 @@ QList<caf::PdmOptionItemInfo>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimRftTools::segmentBranchIndexOptions( RifReaderRftInterface* readerRft,
|
||||
QList<caf::PdmOptionItemInfo> RimRftTools::segmentBranchIndexOptions( RifReaderOpmRft* readerRft,
|
||||
const QString& wellName,
|
||||
const QDateTime& timeStep,
|
||||
RiaDefines::RftBranchType branchType )
|
||||
{
|
||||
auto opmReader = dynamic_cast<RifReaderOpmRft*>( readerRft );
|
||||
if ( opmReader )
|
||||
if ( !readerRft ) return {};
|
||||
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
options.push_front( caf::PdmOptionItemInfo( RiaDefines::allBranches(), -1 ) );
|
||||
|
||||
auto branchIdIndex = readerRft->branchIdsAndOneBasedIndices( wellName, timeStep, branchType );
|
||||
|
||||
std::set<int> indices;
|
||||
for ( auto b : branchIdIndex )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
options.push_front( caf::PdmOptionItemInfo( RiaDefines::allBranches(), -1 ) );
|
||||
|
||||
auto branchIdIndex = opmReader->branchIdsAndOneBasedIndices( wellName, timeStep, branchType );
|
||||
|
||||
std::set<int> indices;
|
||||
for ( auto b : branchIdIndex )
|
||||
{
|
||||
indices.insert( b.second );
|
||||
}
|
||||
|
||||
for ( auto i : indices )
|
||||
{
|
||||
std::vector<int> branchIds;
|
||||
for ( auto b : branchIdIndex )
|
||||
{
|
||||
if ( b.second == i ) branchIds.push_back( b.first );
|
||||
}
|
||||
|
||||
auto minMax = std::minmax_element( branchIds.begin(), branchIds.end() );
|
||||
|
||||
auto txt = QString( "%1 (Branch Id %2-%3)" ).arg( i ).arg( *minMax.first ).arg( *minMax.second );
|
||||
options.push_back( caf::PdmOptionItemInfo( txt, i ) );
|
||||
}
|
||||
|
||||
return options;
|
||||
indices.insert( b.second );
|
||||
}
|
||||
|
||||
return {};
|
||||
for ( auto i : indices )
|
||||
{
|
||||
std::vector<int> branchIds;
|
||||
for ( auto b : branchIdIndex )
|
||||
{
|
||||
if ( b.second == i ) branchIds.push_back( b.first );
|
||||
}
|
||||
|
||||
auto minMax = std::minmax_element( branchIds.begin(), branchIds.end() );
|
||||
|
||||
auto txt = QString( "%1 (Branch Id %2-%3)" ).arg( i ).arg( *minMax.first ).arg( *minMax.second );
|
||||
options.push_back( caf::PdmOptionItemInfo( txt, i ) );
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimRftTools::segmentStartMdValues( RifReaderRftInterface* readerRft,
|
||||
std::vector<double> RimRftTools::segmentStartMdValues( RifReaderOpmRft* readerRft,
|
||||
const QString& wellName,
|
||||
const QDateTime& dateTime,
|
||||
int segmentBranchIndex,
|
||||
RiaDefines::RftBranchType segmentBranchType )
|
||||
{
|
||||
std::vector<double> values;
|
||||
if ( !readerRft ) return {};
|
||||
|
||||
auto resultNameSeglenst = RifEclipseRftAddress::createBranchSegmentAddress( wellName,
|
||||
std::vector<double> values;
|
||||
auto resultNameSeglenst = RifEclipseRftAddress::createBranchSegmentAddress( wellName,
|
||||
dateTime,
|
||||
RiaDefines::segmentStartDepthResultName(),
|
||||
segmentBranchIndex,
|
||||
@@ -206,20 +203,43 @@ std::vector<double> RimRftTools::segmentStartMdValues( RifReaderRftInterface*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimRftTools::segmentEndMdValues( RifReaderRftInterface* readerRft,
|
||||
std::vector<double> RimRftTools::segmentEndMdValues( RifReaderOpmRft* readerRft,
|
||||
const QString& wellName,
|
||||
const QDateTime& dateTime,
|
||||
int segmentBranchIndex,
|
||||
RiaDefines::RftBranchType segmentBranchType )
|
||||
{
|
||||
std::vector<double> values;
|
||||
if ( !readerRft ) return {};
|
||||
|
||||
auto resultNameSeglenst = RifEclipseRftAddress::createBranchSegmentAddress( wellName,
|
||||
dateTime,
|
||||
RiaDefines::segmentEndDepthResultName(),
|
||||
segmentBranchIndex,
|
||||
segmentBranchType );
|
||||
readerRft->values( resultNameSeglenst, &values );
|
||||
std::vector<double> values;
|
||||
auto resultAddress = RifEclipseRftAddress::createBranchSegmentAddress( wellName,
|
||||
dateTime,
|
||||
RiaDefines::segmentEndDepthResultName(),
|
||||
segmentBranchIndex,
|
||||
segmentBranchType );
|
||||
readerRft->values( resultAddress, &values );
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimRftTools::segmentConnectionMdValues( RifReaderOpmRft* readerRft,
|
||||
const QString& wellName,
|
||||
const QDateTime& dateTime,
|
||||
int segmentBranchIndex,
|
||||
RiaDefines::RftBranchType segmentBranchType )
|
||||
{
|
||||
if ( !readerRft ) return {};
|
||||
|
||||
std::vector<double> values;
|
||||
auto resultAddress = RifEclipseRftAddress::createBranchSegmentAddress( wellName,
|
||||
dateTime,
|
||||
RiaDefines::segmentConnectionMeasuredDepthResultName(),
|
||||
segmentBranchIndex,
|
||||
segmentBranchType );
|
||||
readerRft->values( resultAddress, &values );
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace caf
|
||||
class PdmOptionItemInfo;
|
||||
}
|
||||
class RifReaderRftInterface;
|
||||
class RifReaderOpmRft;
|
||||
|
||||
class RimRftTools
|
||||
{
|
||||
@@ -41,20 +42,27 @@ public:
|
||||
|
||||
static QList<caf::PdmOptionItemInfo>
|
||||
segmentResultNameOptions( RifReaderRftInterface* readerRft, const QString& wellName, const QDateTime& timeStep );
|
||||
static QList<caf::PdmOptionItemInfo> segmentBranchIndexOptions( RifReaderRftInterface* readerRft,
|
||||
|
||||
static QList<caf::PdmOptionItemInfo> segmentBranchIndexOptions( RifReaderOpmRft* readerRft,
|
||||
const QString& wellName,
|
||||
const QDateTime& timeStep,
|
||||
RiaDefines::RftBranchType branchType );
|
||||
|
||||
static std::vector<double> segmentStartMdValues( RifReaderRftInterface* readerRft,
|
||||
static std::vector<double> segmentStartMdValues( RifReaderOpmRft* readerRft,
|
||||
const QString& wellName,
|
||||
const QDateTime& dateTime,
|
||||
int segmentBranchIndex,
|
||||
RiaDefines::RftBranchType segmentBranchType );
|
||||
|
||||
static std::vector<double> segmentEndMdValues( RifReaderRftInterface* readerRft,
|
||||
static std::vector<double> segmentEndMdValues( RifReaderOpmRft* readerRft,
|
||||
const QString& wellName,
|
||||
const QDateTime& dateTime,
|
||||
int segmentBranchIndex,
|
||||
RiaDefines::RftBranchType segmentBranchType );
|
||||
|
||||
static std::vector<double> segmentConnectionMdValues( RifReaderOpmRft* readerRft,
|
||||
const QString& wellName,
|
||||
const QDateTime& dateTime,
|
||||
int segmentBranchIndex,
|
||||
RiaDefines::RftBranchType segmentBranchType );
|
||||
};
|
||||
|
||||
@@ -267,7 +267,10 @@ QList<caf::PdmOptionItemInfo> RimRftTopologyCurve::calculateValueOptions( const
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_segmentBranchIndex )
|
||||
{
|
||||
options = RimRftTools::segmentBranchIndexOptions( reader, m_wellName(), m_timeStep(), RiaDefines::RftBranchType::RFT_UNKNOWN );
|
||||
options = RimRftTools::segmentBranchIndexOptions( dynamic_cast<RifReaderOpmRft*>( reader ),
|
||||
m_wellName(),
|
||||
m_timeStep(),
|
||||
RiaDefines::RftBranchType::RFT_UNKNOWN );
|
||||
}
|
||||
|
||||
return options;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "RiaSimWellBranchTools.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RifReaderOpmRft.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimDataSourceSteppingTools.h"
|
||||
#include "RimEclipseCase.h"
|
||||
@@ -1005,7 +1007,10 @@ QList<caf::PdmOptionItemInfo> RimWellLogCurveCommonDataSource::calculateValueOpt
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_rftSegmentBranchIndex )
|
||||
{
|
||||
options = RimRftTools::segmentBranchIndexOptions( rftReader(), m_rftWellName(), m_rftTimeStep(), m_rftSegmentBranchType() );
|
||||
options = RimRftTools::segmentBranchIndexOptions( dynamic_cast<RifReaderOpmRft*>( rftReader() ),
|
||||
m_rftWellName(),
|
||||
m_rftTimeStep(),
|
||||
m_rftSegmentBranchType() );
|
||||
}
|
||||
|
||||
return options;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "RifEclipseRftAddress.h"
|
||||
#include "RifReaderEclipseRft.h"
|
||||
#include "RifReaderOpmRft.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEclipseWellLogExtractor.h"
|
||||
@@ -572,7 +573,7 @@ std::map<QString, QString> RimWellLogRftCurve::createCurveNameKeyValueMap() cons
|
||||
|
||||
variableValueMap[RiaDefines::namingVariableWellBranch()] = branchText;
|
||||
|
||||
if ( isSegmentResult( m_segmentResultName() ) )
|
||||
if ( RiaDefines::isSegmentResult( m_segmentResultName() ) )
|
||||
{
|
||||
variableValueMap[RiaDefines::namingVariableResultType()] = m_segmentBranchType().uiText();
|
||||
}
|
||||
@@ -911,7 +912,8 @@ QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions( const c
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_segmentBranchIndex )
|
||||
{
|
||||
options = RimRftTools::segmentBranchIndexOptions( reader, m_wellName(), m_timeStep(), m_segmentBranchType() );
|
||||
options =
|
||||
RimRftTools::segmentBranchIndexOptions( dynamic_cast<RifReaderOpmRft*>( reader ), m_wellName(), m_timeStep(), m_segmentBranchType() );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_scaleFactor )
|
||||
{
|
||||
@@ -1128,11 +1130,23 @@ std::vector<double> RimWellLogRftCurve::tvDepthValues()
|
||||
|
||||
if ( m_rftDataType() == RftDataType::RFT_SEGMENT_DATA )
|
||||
{
|
||||
depthAddress = RifEclipseRftAddress::createBranchSegmentAddress( m_wellName(),
|
||||
m_timeStep,
|
||||
RiaDefines::segmentTvdDepthResultName(),
|
||||
segmentBranchIndex(),
|
||||
m_segmentBranchType() );
|
||||
if ( RiaDefines::isSegmentConnectionResult( m_segmentResultName ) )
|
||||
|
||||
{
|
||||
depthAddress = RifEclipseRftAddress::createBranchSegmentAddress( m_wellName(),
|
||||
m_timeStep,
|
||||
RiaDefines::segmentConnectionTvdDepthResultName(),
|
||||
segmentBranchIndex(),
|
||||
m_segmentBranchType() );
|
||||
}
|
||||
else
|
||||
{
|
||||
depthAddress = RifEclipseRftAddress::createBranchSegmentAddress( m_wellName(),
|
||||
m_timeStep,
|
||||
RiaDefines::segmentTvdDepthResultName(),
|
||||
segmentBranchIndex(),
|
||||
m_segmentBranchType() );
|
||||
}
|
||||
}
|
||||
|
||||
reader->values( depthAddress, &values );
|
||||
@@ -1147,14 +1161,19 @@ std::vector<double> RimWellLogRftCurve::measuredDepthValues( QString& prefixText
|
||||
{
|
||||
if ( m_rftDataType() == RftDataType::RFT_SEGMENT_DATA )
|
||||
{
|
||||
RifReaderRftInterface* reader = rftReader();
|
||||
if ( reader )
|
||||
if ( auto opmRftReader = dynamic_cast<RifReaderOpmRft*>( rftReader() ) )
|
||||
{
|
||||
prefixText = "SEGMENT/";
|
||||
|
||||
if ( RiaDefines::isSegmentConnectionResult( m_segmentResultName() ) )
|
||||
{
|
||||
return RimRftTools::segmentConnectionMdValues( opmRftReader, m_wellName(), m_timeStep, segmentBranchIndex(), m_segmentBranchType() );
|
||||
}
|
||||
|
||||
// Always use segment end MD values for segment data, as the curve is plotted as step left
|
||||
return RimRftTools::segmentEndMdValues( reader, m_wellName(), m_timeStep, segmentBranchIndex(), m_segmentBranchType() );
|
||||
return RimRftTools::segmentEndMdValues( opmRftReader, m_wellName(), m_timeStep, segmentBranchIndex(), m_segmentBranchType() );
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -1238,11 +1257,3 @@ int RimWellLogRftCurve::segmentBranchIndex() const
|
||||
{
|
||||
return m_segmentBranchIndex();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogRftCurve::isSegmentResult( const QString& resultName )
|
||||
{
|
||||
return resultName.startsWith( "SEG" );
|
||||
}
|
||||
|
||||
@@ -131,8 +131,6 @@ private:
|
||||
|
||||
int segmentBranchIndex() const;
|
||||
|
||||
static bool isSegmentResult( const QString& resultName );
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
|
||||
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
|
||||
|
||||
Reference in New Issue
Block a user