RFT Curves: Add more segment curves

- add CONGRAT
- add pressure track
- add CONFAC
- fix some plot layout issues
- Fix bug for first segment MD location
- Add default scale factor 1e-3 for gas curves
- Avoid inf values in some curves, seen in PRESSURE and CONFAC
- Use assignment in statements instead of std::get
This commit is contained in:
Magne Sjaastad 2022-10-27 11:17:41 +02:00
parent f6bde92d81
commit 4c3e1c3fe8
19 changed files with 455 additions and 188 deletions

View File

@ -497,11 +497,11 @@ RimWellLogCurve* RicWellLogTools::addSummaryRftCurve( RimWellLogTrack* plotTrack
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogCurve* RicWellLogTools::addSummaryRftSegmentCurve( RimWellLogTrack* plotTrack,
const QString& resultName,
const QString& wellName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* rimCase )
RimWellLogRftCurve* RicWellLogTools::addSummaryRftSegmentCurve( RimWellLogTrack* plotTrack,
const QString& resultName,
const QString& wellName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* rimCase )
{
auto curve = new RimWellLogRftCurve();
@ -519,7 +519,6 @@ RimWellLogCurve* RicWellLogTools::addSummaryRftSegmentCurve( RimWellLogTrack*
curve->enableColorFromResultName( true );
curve->assignColorFromResultName( resultName );
curve->setLineThickness( 4 );
curve->setFillStyle( Qt::SolidPattern );
curve->setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_STEP_LEFT );

View File

@ -77,12 +77,12 @@ public:
const QString& measurementName,
bool showPlotWindow = true );
static RimWellLogCurve* addSummaryRftCurve( RimWellLogTrack* plotTrack, RimSummaryCase* rimCase );
static RimWellLogCurve* addSummaryRftSegmentCurve( RimWellLogTrack* plotTrack,
const QString& resultName,
const QString& wellName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* rimCase );
static RimWellLogCurve* addSummaryRftCurve( RimWellLogTrack* plotTrack, RimSummaryCase* rimCase );
static RimWellLogRftCurve* addSummaryRftSegmentCurve( RimWellLogTrack* plotTrack,
const QString& resultName,
const QString& wellName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* rimCase );
private:
template <typename ExtractionCurveType>

View File

@ -24,6 +24,7 @@
#include "RicWellLogTools.h"
#include "RiaApplication.h"
#include "RiaPlotWindowRedrawScheduler.h"
#include "RiaRftDefines.h"
#include "RifReaderOpmRft.h"
@ -32,6 +33,7 @@
#include "RimRftTopologyCurve.h"
#include "RimSummaryCase.h"
#include "RimWellLogPlot.h"
#include "RimWellLogRftCurve.h"
#include "RimWellLogTrack.h"
#include "RiuPlotMainWindowTools.h"
@ -70,6 +72,8 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
plot->setPlotTitleVisible( true );
plot->setLegendItemsClickable( false );
plot->enableDepthMarkerLine( true );
plot->setLegendPosition( RimPlotWindow::LegendPosition::INSIDE_UPPER_LEFT );
plot->setLegendFontSize( caf::FontTools::RelativeSize::XSmall );
QString wellName = "Unknown";
@ -80,21 +84,36 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
if ( !wellNames.empty() ) wellName = *wellNames.begin();
}
std::vector<QString> resultNames = { "SEGGRAT", "SEGORAT", "SEGWRAT" };
appendTrackAndCurveForBranchType( plot,
"Connection Rates",
{ "CONGRAT", "CONORAT", "CONWRAT" },
wellName,
RiaDefines::RftBranchType::RFT_ANNULUS,
summaryCase );
std::vector<RiaDefines::RftBranchType> branchTypes{ RiaDefines::RftBranchType::RFT_ANNULUS,
RiaDefines::RftBranchType::RFT_DEVICE,
RiaDefines::RftBranchType::RFT_TUBING };
for ( auto branchType : branchTypes )
{
appendTrackAndCurveForBranchType( plot, resultNames, wellName, branchType, summaryCase );
for ( auto branchType : { RiaDefines::RftBranchType::RFT_ANNULUS,
RiaDefines::RftBranchType::RFT_DEVICE,
RiaDefines::RftBranchType::RFT_TUBING } )
{
appendTrackAndCurveForBranchType( plot,
"Segment Rates",
{ "SEGGRAT", "SEGORAT", "SEGWRAT" },
wellName,
branchType,
summaryCase );
}
}
RicNewRftSegmentWellLogPlotFeature::appendPressureTrack( plot, wellName, summaryCase );
RicNewRftSegmentWellLogPlotFeature::appendConnectionFactorTrack( plot, wellName, summaryCase );
RicNewRftSegmentWellLogPlotFeature::appendTopologyTrack( plot, wellName, summaryCase );
plot->loadDataAndUpdate();
RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots();
plot->updateLayout();
RiuPlotMainWindowTools::onObjectAppended( plot );
}
@ -102,14 +121,15 @@ void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
///
//--------------------------------------------------------------------------------------------------
void RicNewMultiPhaseRftSegmentPlotFeature::appendTrackAndCurveForBranchType( RimWellLogPlot* plot,
const QString& trackName,
const std::vector<QString>& resultNames,
const QString& wellName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* summaryCase )
{
RimWellLogTrack* plotTrack = new RimWellLogTrack();
auto plotTrack = new RimWellLogTrack();
plot->addPlot( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( plot->plotCount() ) );
plotTrack->setDescription( trackName );
plot->loadDataAndUpdate();
@ -121,11 +141,16 @@ void RicNewMultiPhaseRftSegmentPlotFeature::appendTrackAndCurveForBranchType( Ri
QString templateText = RiaDefines::namingVariableResultName() + ", " + RiaDefines::namingVariableResultType();
curve->setCurveNameTemplateText( templateText );
if ( resultName == "SEGGRAT" || resultName == "CONGRAT" )
{
curve->setScaleFactor( 1e-3 );
}
curve->setFillStyle( Qt::SolidPattern );
curve->setIsStacked( true );
curve->loadDataAndUpdate( true );
curve->updateAllRequiredEditors();
RiuPlotMainWindowTools::setExpanded( curve );
}
}

View File

@ -39,6 +39,7 @@ private:
void setupActionLook( QAction* actionToSetup ) override;
void appendTrackAndCurveForBranchType( RimWellLogPlot* plot,
const QString& trackName,
const std::vector<QString>& resultNames,
const QString& wellName,
RiaDefines::RftBranchType branchType,

View File

@ -23,6 +23,8 @@
#include "RicWellLogTools.h"
#include "RiaApplication.h"
#include "RiaColorTools.h"
#include "RiaPlotWindowRedrawScheduler.h"
#include "RiaRftDefines.h"
#include "RifReaderOpmRft.h"
@ -30,6 +32,7 @@
#include "RimRftCase.h"
#include "RimRftTopologyCurve.h"
#include "RimSummaryCase.h"
#include "RimWellLogRftCurve.h"
#include "RimWellLogTrack.h"
#include "RiuPlotMainWindow.h"
@ -69,6 +72,8 @@ void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked )
plot->setPlotTitleVisible( true );
plot->setLegendItemsClickable( false );
plot->enableDepthMarkerLine( true );
plot->setLegendPosition( RimPlotWindow::LegendPosition::INSIDE_UPPER_LEFT );
plot->setLegendFontSize( caf::FontTools::RelativeSize::XSmall );
QString wellName = "Unknown";
@ -79,48 +84,80 @@ void RicNewRftSegmentWellLogPlotFeature::onActionTriggered( bool isChecked )
if ( !wellNames.empty() ) wellName = *wellNames.begin();
}
QString resultName = "SEGGRAT";
std::vector<RiaDefines::RftBranchType> branchTypes{ RiaDefines::RftBranchType::RFT_ANNULUS,
RiaDefines::RftBranchType::RFT_DEVICE,
RiaDefines::RftBranchType::RFT_TUBING };
for ( auto branchType : branchTypes )
{
appendTrackAndCurveForBranchType( plot, resultName, wellName, branchType, summaryCase );
RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addPlot( plotTrack );
plotTrack->setDescription( "Connection Rates" );
auto curve =
createAndAddCurve( plotTrack, "CONGRAT", wellName, RiaDefines::RftBranchType::RFT_ANNULUS, summaryCase );
curve->setScaleFactor( 1e-3 );
curve->setFillStyle( Qt::SolidPattern );
}
for ( auto branchType : { RiaDefines::RftBranchType::RFT_ANNULUS,
RiaDefines::RftBranchType::RFT_DEVICE,
RiaDefines::RftBranchType::RFT_TUBING } )
{
QString resultName = "SEGGRAT";
QString trackName = "Segment Rates";
auto curve = appendTrackAndCurveForBranchType( plot, trackName, resultName, wellName, branchType, summaryCase );
curve->setScaleFactor( 1e-3 );
curve->setFillStyle( Qt::SolidPattern );
}
appendPressureTrack( plot, wellName, summaryCase );
appendConnectionFactorTrack( plot, wellName, summaryCase );
appendTopologyTrack( plot, wellName, summaryCase );
plot->loadDataAndUpdate();
RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots();
plot->updateLayout();
RiuPlotMainWindowTools::onObjectAppended( plot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftSegmentWellLogPlotFeature::appendTrackAndCurveForBranchType( RimWellLogPlot* plot,
RimWellLogRftCurve* RicNewRftSegmentWellLogPlotFeature::appendTrackAndCurveForBranchType( RimWellLogPlot* plot,
const QString& trackName,
const QString& resultName,
const QString& wellName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* summaryCase )
{
RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addPlot( plotTrack );
plotTrack->setDescription( trackName );
plot->loadDataAndUpdate();
auto curve = createAndAddCurve( plotTrack, resultName, wellName, branchType, summaryCase );
curve->loadDataAndUpdate( true );
curve->updateAllRequiredEditors();
return curve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogRftCurve* RicNewRftSegmentWellLogPlotFeature::createAndAddCurve( RimWellLogTrack* track,
const QString& resultName,
const QString& wellName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* summaryCase )
{
RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addPlot( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( plot->plotCount() ) );
plot->loadDataAndUpdate();
auto curve = RicWellLogTools::addSummaryRftSegmentCurve( plotTrack, resultName, wellName, branchType, summaryCase );
auto curve = RicWellLogTools::addSummaryRftSegmentCurve( track, resultName, wellName, branchType, summaryCase );
curve->setNamingMethod( RiaDefines::ObjectNamingMethod::TEMPLATE );
QString templateText = RiaDefines::namingVariableResultName() + ", " + RiaDefines::namingVariableResultType();
curve->setCurveNameTemplateText( templateText );
curve->loadDataAndUpdate( true );
curve->updateAllRequiredEditors();
RiuPlotMainWindowTools::setExpanded( curve );
return curve;
}
//--------------------------------------------------------------------------------------------------
@ -205,6 +242,59 @@ void RicNewRftSegmentWellLogPlotFeature::appendTopologyTrack( RimWellLogPlot* pl
track->updateAllRequiredEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftSegmentWellLogPlotFeature::appendPressureTrack( RimWellLogPlot* plot,
const QString& wellName,
RimSummaryCase* summaryCase )
{
auto track = new RimWellLogTrack();
track->setDescription( "Pressure" );
plot->addPlot( track );
QString resultName = "SEGPRES";
for ( auto branchType : { RiaDefines::RftBranchType::RFT_TUBING,
RiaDefines::RftBranchType::RFT_DEVICE,
RiaDefines::RftBranchType::RFT_ANNULUS } )
{
auto curve = createAndAddCurve( track, resultName, wellName, branchType, summaryCase );
auto color = RimRftTopologyCurve::colorForRftBranchType( branchType );
curve->setColor( color );
curve->setLineThickness( 3 );
}
auto curve = createAndAddCurve( track, "PRESSURE", wellName, RiaDefines::RftBranchType::RFT_ANNULUS, summaryCase );
curve->setLineThickness( 3 );
track->updateAllRequiredEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewRftSegmentWellLogPlotFeature::appendConnectionFactorTrack( RimWellLogPlot* plot,
const QString& wellName,
RimSummaryCase* summaryCase )
{
QString trackName = "Connection Factors";
QString resultName = "CONFAC";
auto curve = appendTrackAndCurveForBranchType( plot,
trackName,
resultName,
wellName,
RiaDefines::RftBranchType::RFT_ANNULUS,
summaryCase );
auto curveColor = cvf::Color3f( cvf::Color3f::ColorIdent::ORANGE );
curve->setColor( curveColor );
auto fillColor = RiaColorTools::makeLighter( curveColor, 0.3f );
curve->setFillColor( fillColor );
curve->setFillStyle( Qt::SolidPattern );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -25,6 +25,8 @@
class RimWellLogPlot;
class RimSummaryCase;
class RimPlotCurve;
class RimWellLogTrack;
class RimWellLogRftCurve;
//==================================================================================================
///
@ -35,6 +37,8 @@ class RicNewRftSegmentWellLogPlotFeature : public caf::CmdFeature
public:
static void appendTopologyTrack( RimWellLogPlot* plot, const QString& wellName, RimSummaryCase* summaryCase );
static void appendPressureTrack( RimWellLogPlot* plot, const QString& wellName, RimSummaryCase* summaryCase );
static void appendConnectionFactorTrack( RimWellLogPlot* plot, const QString& wellName, RimSummaryCase* summaryCase );
private:
bool isCommandEnabled() override;
@ -42,11 +46,18 @@ private:
void setupActionLook( QAction* actionToSetup ) override;
void appendTrackAndCurveForBranchType( RimWellLogPlot* plot,
const QString& resultName,
const QString& wellName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* summaryCase );
static RimWellLogRftCurve* appendTrackAndCurveForBranchType( RimWellLogPlot* plot,
const QString& trackName,
const QString& resultName,
const QString& wellName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* summaryCase );
static RimWellLogRftCurve* createAndAddCurve( RimWellLogTrack* track,
const QString& resultName,
const QString& wellName,
RiaDefines::RftBranchType branchType,
RimSummaryCase* summaryCase );
static std::vector<RimPlotCurve*>
appendAdditionalDataSourceTrack( RimWellLogPlot* plot, const QString& wellName, RimSummaryCase* summaryCase );

View File

@ -112,7 +112,8 @@ void RifReaderOpmRft::values( const RifEclipseRftAddress& rftAddress, std::vecto
try
{
auto data = m_opm_rft->getRft<float>( resultName, wellName, y, m, d );
std::vector<float> data = resultAsFloat( resultName, wellName, y, m, d );
if ( !data.empty() )
{
if ( rftAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES )
@ -391,22 +392,17 @@ void RifReaderOpmRft::buildMetaData()
importWellNames();
auto reports = m_opm_rft->listOfRftReports();
for ( const auto& report : reports )
for ( const auto& [wellName, reportDate, reportTime] : reports )
{
auto [wellName, reportDate, reportTime] = report;
auto rftVectors = m_opm_rft->listOfRftArrays( wellName, reportDate );
auto results = m_opm_rft->listOfRftArrays( wellName, reportDate );
for ( const auto& rftVec : rftVectors )
for ( const auto& [name, arrayType, size] : results )
{
auto [resultDataName, arrType, itemCount] = rftVec;
int y = std::get<0>( reportDate );
int m = std::get<1>( reportDate );
int d = std::get<2>( reportDate );
const auto& [y, m, d] = reportDate;
auto dt = RiaQDateTimeTools::createUtcDateTime( QDate( y, m, d ) );
auto channelType = identifyChannelType( resultDataName );
auto channelType = identifyChannelType( name );
if ( channelType != RifEclipseRftAddress::RftWellLogChannelType::NONE )
{
auto adr = RifEclipseRftAddress::createAddress( QString::fromStdString( wellName ), dt, channelType );
@ -423,22 +419,17 @@ void RifReaderOpmRft::buildMetaData()
auto [wellName, reportDate] = segmentWellData.first;
auto segmentData = segmentWellData.second;
auto resultNameAndSizes = segmentData.resultNameAndSize();
int y = std::get<0>( reportDate );
int m = std::get<1>( reportDate );
int d = std::get<2>( reportDate );
auto dt = RiaQDateTimeTools::createUtcDateTime( QDate( y, m, d ) );
const auto& [y, m, d] = reportDate;
auto dt = RiaQDateTimeTools::createUtcDateTime( QDate( y, m, d ) );
m_rftSegmentTimeSteps.insert( dt );
for ( const auto& resultNameAndSize : resultNameAndSizes )
auto resultNameAndSizes = segmentData.resultNameAndSize();
for ( const auto& [name, arrayType, size] : resultNameAndSizes )
{
auto resultName = std::get<0>( resultNameAndSize );
auto adr = RifEclipseRftAddress::createSegmentAddress( QString::fromStdString( wellName ),
auto adr = RifEclipseRftAddress::createSegmentAddress( QString::fromStdString( wellName ),
dt,
QString::fromStdString( resultName ) );
QString::fromStdString( name ) );
m_addresses.insert( adr );
}
@ -508,11 +499,10 @@ void RifReaderOpmRft::buildSegmentData()
RifRftSegment segment;
segment.setSegmentData( segmentsForWellDate );
auto arraysAtWellDate = m_opm_rft->listOfRftArrays( wellName, date );
auto results = m_opm_rft->listOfRftArrays( wellName, date );
for ( const auto& rftResultMetaData : arraysAtWellDate )
for ( const auto& [name, arrayType, size] : results )
{
auto [name, arrayType, size] = rftResultMetaData;
if ( ( name.find( "SEG" ) == 0 ) && m_segmentResultItemCount == 0 )
{
m_segmentResultItemCount = size;
@ -523,9 +513,9 @@ void RifReaderOpmRft::buildSegmentData()
}
}
for ( const auto& rftResultMetaData : arraysAtWellDate )
for ( const auto& rftResultMetaData : results )
{
auto [name, arrayType, size] = rftResultMetaData;
const auto& [name, arrayType, size] = rftResultMetaData;
if ( size == static_cast<int64_t>( m_segmentResultItemCount ) ||
size == static_cast<int64_t>( m_connectionResultItemCount ) )
{
@ -551,8 +541,9 @@ void RifReaderOpmRft::segmentDataDebugLog() const
auto [wellName, date] = a.first;
auto segmentData = a.second;
std::cout << "\nWell: " << wellName << "Date : " << std::get<0>( date ) << " " << std::get<1>( date ) << " "
<< std::get<2>( date ) << " \n";
const auto& [y, m, d] = date;
std::cout << "\nWell: " << wellName << "Date : " << y << " " << m << " " << d << " \n";
for ( const auto& r : segmentData.topology() )
{
@ -606,11 +597,8 @@ void RifReaderOpmRft::buildSegmentBranchTypes( const RftSegmentKey& segmentKey )
auto date = segmentKey.second;
RifRftSegment& segmentRef = m_rftWellDateSegments[segmentKey];
int y = std::get<0>( date );
int m = std::get<1>( date );
int d = std::get<2>( date );
auto dt = RiaQDateTimeTools::createUtcDateTime( QDate( y, m, d ) );
const auto& [y, m, d] = date;
auto dt = RiaQDateTimeTools::createUtcDateTime( QDate( y, m, d ) );
std::vector<double> seglenstValues;
std::vector<double> seglenenValues;
@ -943,3 +931,41 @@ std::string RifReaderOpmRft::resultNameFromChannelType( RifEclipseRftAddress::Rf
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<float>
RifReaderOpmRft::resultAsFloat( const std::string& resultName, const std::string& wellName, int year, int month, int day ) const
{
Opm::EclIO::eclArrType resultDataType = Opm::EclIO::eclArrType::REAL;
auto results = m_opm_rft->listOfRftArrays( wellName, year, month, day );
for ( const auto& [name, arrayType, size] : results )
{
if ( resultName == name )
{
resultDataType = arrayType;
break;
}
}
if ( resultDataType == Opm::EclIO::eclArrType::INTE )
{
std::vector<float> data;
auto integerData = m_opm_rft->getRft<int>( resultName, wellName, year, month, day );
for ( auto val : integerData )
{
data.push_back( val );
}
return data;
}
else
{
return m_opm_rft->getRft<float>( resultName, wellName, year, month, day );
}
return {};
}

View File

@ -89,6 +89,9 @@ private:
static RifEclipseRftAddress::RftWellLogChannelType identifyChannelType( const std::string& resultName );
static std::string resultNameFromChannelType( RifEclipseRftAddress::RftWellLogChannelType channelType );
std::vector<float>
resultAsFloat( const std::string& resultName, const std::string& wellName, int year, int month, int day ) const;
private:
std::unique_ptr<Opm::EclIO::ERft> m_opm_rft;

View File

@ -327,9 +327,10 @@ std::vector<size_t> RifRftSegment::packerSegmentIndicesOnAnnulus( int branchInde
auto segment = m_topology[segmentIndex];
auto outflowSegmentNumber = segment.segNext();
auto candidateSegment = segmentData( outflowSegmentNumber );
auto candidateBranchType = branchType( candidateSegment->segBrno() );
auto candidateSegment = segmentData( outflowSegmentNumber );
if ( !candidateSegment ) continue;
auto candidateBranchType = branchType( candidateSegment->segBrno() );
if ( candidateBranchType == RiaDefines::RftBranchType::RFT_DEVICE )
{
packerSegmentIndices.push_back( segmentIndex );

View File

@ -21,6 +21,7 @@
#include "RiaGuiApplication.h"
#include "RiaOptionItemFactory.h"
#include "RiaPlotWindowRedrawScheduler.h"
#include "RiaPreferences.h"
#include "RiaQDateTimeTools.h"
#include "RiaTextStringTools.h"
@ -924,6 +925,9 @@ void RimDepthTrackPlot::onPlotsReordered( const SignalEmitter* emitter )
updateSubPlotNames();
recreatePlotWidgets();
loadDataAndUpdate();
RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots();
updateLayout();
}
//--------------------------------------------------------------------------------------------------

View File

@ -179,3 +179,31 @@ QList<caf::PdmOptionItemInfo> RimRftTools::segmentBranchIndexOptions( RifReaderR
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimRftTools::seglenstValues( RifReaderRftInterface* readerRft,
const QString& wellName,
const QDateTime& dateTime,
int segmentBranchIndex,
RiaDefines::RftBranchType segmentBranchType )
{
std::vector<double> seglenstValues;
auto resultNameSeglenst = RifEclipseRftAddress::createBranchSegmentAddress( wellName,
dateTime,
RiaDefines::segmentStartDepthResultName(),
segmentBranchIndex,
segmentBranchType );
readerRft->values( resultNameSeglenst, &seglenstValues );
if ( seglenstValues.size() > 2 )
{
// Segment 1 has zero length, assign seglenst to the start value of segment 2
// Ref mail dated June 10, 2022, topic "SELENST fix"
seglenstValues[0] = seglenstValues[1];
}
return seglenstValues;
}

View File

@ -46,4 +46,10 @@ public:
const QString& wellName,
const QDateTime& timeStep,
RiaDefines::RftBranchType branchType );
static std::vector<double> seglenstValues( RifReaderRftInterface* readerRft,
const QString& wellName,
const QDateTime& dateTime,
int segmentBranchIndex,
RiaDefines::RftBranchType segmentBranchType );
};

View File

@ -36,6 +36,21 @@
CAF_PDM_SOURCE_INIT( RimRftTopologyCurve, "RimRftTopologyCurve" );
namespace caf
{
template <>
void caf::AppEnum<RimRftTopologyCurve::CurveType>::setUp()
{
addItem( RimRftTopologyCurve::CurveType::PACKER, "PACKER", "Packer" );
addItem( RimRftTopologyCurve::CurveType::TUBING, "TUBING", "Tubing" );
addItem( RimRftTopologyCurve::CurveType::ANNULUS, "ANNULUS", "Annulus" );
addItem( RimRftTopologyCurve::CurveType::DEVICE, "DEVICE", "Device" );
setDefault( RimRftTopologyCurve::CurveType::TUBING );
}
} // End namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -52,7 +67,7 @@ RimRftTopologyCurve::RimRftTopologyCurve()
CAF_PDM_InitField( &m_segmentBranchIndex, "SegmentBranchIndex", -1, "Branch" );
CAF_PDM_InitFieldNoDefault( &m_segmentBranchType, "SegmentBranchType", "Completion" );
CAF_PDM_InitField( &m_isPackerCurve, "IsPackerCurve", false, "Packer Curve" );
CAF_PDM_InitFieldNoDefault( &m_curveType, "CurveType", "Curve Type" );
}
//--------------------------------------------------------------------------------------------------
@ -63,9 +78,9 @@ RimRftTopologyCurve* RimRftTopologyCurve::createPackerCurve( RimSummaryCase* su
const QString& wellName,
int segmentBranchIndex )
{
RimRftTopologyCurve* curve = new RimRftTopologyCurve();
auto* curve = new RimRftTopologyCurve();
curve->setDataSource( summaryCase, timeStep, wellName, segmentBranchIndex );
curve->m_isPackerCurve = true;
curve->m_curveType = CurveType::PACKER;
return curve;
}
@ -79,8 +94,25 @@ RimRftTopologyCurve* RimRftTopologyCurve::createTopologyCurve( RimSummaryCase*
int segmentBranchIndex,
RiaDefines::RftBranchType branchType )
{
RimRftTopologyCurve* curve = new RimRftTopologyCurve();
auto* curve = new RimRftTopologyCurve();
curve->setDataSource( summaryCase, timeStep, wellName, segmentBranchIndex );
switch ( branchType )
{
case RiaDefines::RftBranchType::RFT_TUBING:
curve->m_curveType = CurveType::TUBING;
break;
case RiaDefines::RftBranchType::RFT_DEVICE:
curve->m_curveType = CurveType::DEVICE;
break;
case RiaDefines::RftBranchType::RFT_ANNULUS:
curve->m_curveType = CurveType::ANNULUS;
break;
case RiaDefines::RftBranchType::RFT_UNKNOWN:
break;
default:
break;
}
curve->m_segmentBranchType = branchType;
return curve;
@ -124,25 +156,60 @@ QString RimRftTopologyCurve::wellLogChannelUnits() const
return "Topology curve units";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimRftTopologyCurve::colorForBranchType( CurveType curveType )
{
switch ( curveType )
{
case RimRftTopologyCurve::CurveType::PACKER:
return RiaColorTools::fromQColorTo3f( QColor( "DarkGoldenRod" ) );
break;
case RimRftTopologyCurve::CurveType::TUBING:
return colorForRftBranchType( RiaDefines::RftBranchType::RFT_TUBING );
break;
case RimRftTopologyCurve::CurveType::DEVICE:
return colorForRftBranchType( RiaDefines::RftBranchType::RFT_DEVICE );
break;
case RimRftTopologyCurve::CurveType::ANNULUS:
return colorForRftBranchType( RiaDefines::RftBranchType::RFT_ANNULUS );
break;
default:
break;
}
return RiaColorTools::fromQColorTo3f( QColor( "LightBrown" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimRftTopologyCurve::colorForRftBranchType( RiaDefines::RftBranchType branchType )
{
switch ( branchType )
{
case RiaDefines::RftBranchType::RFT_TUBING:
return RiaColorTools::fromQColorTo3f( QColor( "ForestGreen" ) );
case RiaDefines::RftBranchType::RFT_DEVICE:
return RiaColorTools::fromQColorTo3f( QColor( "IndianRed" ) );
case RiaDefines::RftBranchType::RFT_ANNULUS:
return RiaColorTools::fromQColorTo3f( QColor( "DeepSkyBlue" ) );
case RiaDefines::RftBranchType::RFT_UNKNOWN:
break;
default:
break;
}
return RiaColorTools::fromQColorTo3f( QColor( "LightBrown" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimRftTopologyCurve::createCurveAutoName()
{
QString text;
if ( m_isPackerCurve() )
{
text += "Packer";
}
else
{
if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_ANNULUS ) text += "Annulus";
if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_DEVICE ) text += "Device";
if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_TUBING ) text += "Tubing";
}
return text;
return m_curveType().uiText();
}
//--------------------------------------------------------------------------------------------------
@ -156,13 +223,10 @@ void RimRftTopologyCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
curveDataGroup->add( &m_summaryCase );
curveDataGroup->add( &m_wellName );
curveDataGroup->add( &m_timeStep );
curveDataGroup->add( &m_isPackerCurve );
curveDataGroup->add( &m_curveType );
curveDataGroup->add( &m_segmentBranchIndex );
if ( !m_isPackerCurve() )
{
curveDataGroup->add( &m_segmentBranchType );
}
curveDataGroup->add( &m_segmentBranchType );
RimStackablePlotCurve::defaultUiOrdering( uiOrdering );
@ -230,22 +294,16 @@ void RimRftTopologyCurve::onLoadDataAndUpdate( bool updateParentPlot )
// Update well path attributes, packers and casing based on RFT data
if ( rftReader )
{
std::vector<double> seglenstValues;
std::vector<double> seglenenValues;
std::vector<double> depths;
std::vector<double> propertyValues;
auto resultNameSeglenst = RifEclipseRftAddress::createSegmentAddress( m_wellName, m_timeStep, "SEGLENST" );
rftReader->values( resultNameSeglenst, &seglenstValues );
auto resultNameSeglenen = RifEclipseRftAddress::createSegmentAddress( m_wellName, m_timeStep, "SEGLENEN" );
rftReader->values( resultNameSeglenen, &seglenenValues );
std::vector<double> seglenstValues =
RimRftTools::seglenstValues( rftReader, m_wellName, m_timeStep, -1, RiaDefines::RftBranchType::RFT_UNKNOWN );
auto segment = rftReader->segmentForWell( m_wellName, m_timeStep );
auto segmentIndices = segment.segmentIndicesForBranchIndex( m_segmentBranchIndex(), m_segmentBranchType() );
if ( !segmentIndices.empty() )
{
std::vector<double> depths;
std::vector<double> propertyValues;
// Assign a static property value to each type of curve to make sure they all are separated and
// easily visible
double curveValue = 1.0;
@ -253,25 +311,23 @@ void RimRftTopologyCurve::onLoadDataAndUpdate( bool updateParentPlot )
if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_DEVICE ) curveValue = 3.0;
if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_ANNULUS ) curveValue = 4.0;
if ( m_isPackerCurve )
if ( m_curveType() == CurveType::PACKER )
{
curveValue = 3.5;
curveValue = 4.0;
}
// Adjust the location of each branch if multiple branches are visible at the same time
curveValue += m_segmentBranchIndex() * 0.2;
if ( m_isPackerCurve )
if ( m_curveType() == RimRftTopologyCurve::CurveType::PACKER )
{
auto packerSegmentIndices = segment.packerSegmentIndicesOnAnnulus( m_segmentBranchIndex() );
for ( auto segmentIndex : packerSegmentIndices )
{
depths.push_back( seglenstValues[segmentIndex] );
depths.push_back( seglenenValues[segmentIndex] );
propertyValues.push_back( curveValue );
propertyValues.push_back( curveValue );
}
}
else
@ -279,26 +335,24 @@ void RimRftTopologyCurve::onLoadDataAndUpdate( bool updateParentPlot )
for ( auto segmentIndex : segmentIndices )
{
depths.push_back( seglenstValues[segmentIndex] );
depths.push_back( seglenenValues[segmentIndex] );
propertyValues.push_back( curveValue );
propertyValues.push_back( curveValue );
}
}
RimDepthTrackPlot* wellLogPlot;
firstAncestorOrThisOfTypeAsserted( wellLogPlot );
RimWellLogPlot::DepthTypeEnum depthType = wellLogPlot->depthType();
RiaDefines::DepthUnitType displayUnit = wellLogPlot->depthUnit();
bool isExtractionCurve = false;
bool useLogarithmicScale = false;
setPropertyValuesAndDepths( propertyValues, depths, depthType, 0.0, displayUnit, isExtractionCurve, useLogarithmicScale );
// Assign curve values based on horizontal or vertical plot
setPropertyAndDepthValuesToPlotCurve( propertyValues, depths );
}
RimDepthTrackPlot* wellLogPlot;
firstAncestorOrThisOfTypeAsserted( wellLogPlot );
RimWellLogPlot::DepthTypeEnum depthType = wellLogPlot->depthType();
RiaDefines::DepthUnitType displayUnit = wellLogPlot->depthUnit();
bool isExtractionCurve = false;
bool useLogarithmicScale = false;
setPropertyValuesAndDepths( propertyValues, depths, depthType, 0.0, displayUnit, isExtractionCurve, useLogarithmicScale );
// Assign curve values based on horizontal or vertical plot
setPropertyAndDepthValuesToPlotCurve( propertyValues, depths );
if ( updateParentPlot )
{
updateZoomInParentPlot();
@ -325,35 +379,30 @@ void RimRftTopologyCurve::setAdditionalDataSources( const std::vector<RimPlotCur
//--------------------------------------------------------------------------------------------------
void RimRftTopologyCurve::applyDefaultAppearance()
{
if ( m_isPackerCurve() )
{
auto color = RiaColorTools::fromQColorTo3f( QColor( "DarkGoldenRod" ) );
int adjustedSymbolSize = symbolSize() * 2;
auto color = colorForBranchType( m_curveType() );
setColor( color );
if ( m_curveType() == RimRftTopologyCurve::CurveType::PACKER )
{
int adjustedSymbolSize = symbolSize() * 2;
setColor( color );
setSymbolSize( adjustedSymbolSize );
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
setSymbol( RiuPlotCurveSymbol::PointSymbolEnum::SYMBOL_RECT );
}
else
{
if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_TUBING )
if ( m_curveType() == RimRftTopologyCurve::CurveType::TUBING )
{
auto color = RiaColorTools::fromQColorTo3f( QColor( "ForestGreen" ) );
setColor( color );
setLineThickness( 5.0 );
}
else if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_DEVICE )
else if ( m_curveType() == RimRftTopologyCurve::CurveType::DEVICE )
{
auto color = RiaColorTools::fromQColorTo3f( QColor( "IndianRed" ) );
setColor( color );
setSymbolEdgeColor( color );
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
}
else if ( m_segmentBranchType() == RiaDefines::RftBranchType::RFT_ANNULUS )
else if ( m_curveType() == RimRftTopologyCurve::CurveType::ANNULUS )
{
auto color = RiaColorTools::fromQColorTo3f( QColor( "DeepSkyBlue" ) );
setColor( color );
setSymbolEdgeColor( color );
setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
}

View File

@ -35,6 +35,15 @@ class RimRftTopologyCurve : public RimWellLogCurve
{
CAF_PDM_HEADER_INIT;
public:
enum class CurveType
{
PACKER,
TUBING,
DEVICE,
ANNULUS
};
public:
RimRftTopologyCurve();
@ -57,6 +66,9 @@ public:
QString wellLogChannelUiName() const override;
QString wellLogChannelUnits() const override;
static cvf::Color3f colorForBranchType( CurveType curveType );
static cvf::Color3f colorForRftBranchType( RiaDefines::RftBranchType branchType );
protected:
QString createCurveAutoName() override;
@ -67,13 +79,12 @@ protected:
void onLoadDataAndUpdate( bool updateParentPlot ) override;
private:
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
caf::PdmField<QDateTime> m_timeStep;
caf::PdmField<QString> m_wellName;
caf::PdmField<int> m_segmentBranchIndex;
caf::PdmField<caf::AppEnum<RiaDefines::RftBranchType>> m_segmentBranchType;
caf::PdmField<bool> m_isPackerCurve;
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
caf::PdmField<QDateTime> m_timeStep;
caf::PdmField<QString> m_wellName;
caf::PdmField<int> m_segmentBranchIndex;
caf::PdmField<caf::AppEnum<RiaDefines::RftBranchType>> m_segmentBranchType;
caf::PdmField<caf::AppEnum<RimRftTopologyCurve::CurveType>> m_curveType;
public:
void setAdditionalDataSources( const std::vector<RimPlotCurve*>& additionalDataSources );

View File

@ -482,6 +482,14 @@ void RimWellLogRftCurve::assignColorFromResultName( const QString& resultName )
setFillColor( fillColor );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogRftCurve::setScaleFactor( double factor )
{
m_scaleFactor = factor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -539,7 +547,14 @@ std::map<QString, QString> RimWellLogRftCurve::createCurveNameKeyValueMap() cons
variableValueMap[RiaDefines::namingVariableWellBranch()] = branchText;
variableValueMap[RiaDefines::namingVariableResultType()] = m_segmentBranchType().uiText();
if ( isSegmentResult( m_segmentResultName() ) )
{
variableValueMap[RiaDefines::namingVariableResultType()] = m_segmentBranchType().uiText();
}
else
{
variableValueMap[RiaDefines::namingVariableResultType()] = "Reservoir";
}
}
if ( !m_timeStep().isNull() )
@ -707,8 +722,9 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
m_plotCurve->setPerPointLabels( perPointLabels );
auto propertyValues = this->curveData()->propertyValues();
auto depthValues = this->curveData()->depths( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, displayUnit );
auto propertyValues = this->curveData()->propertyValuesByIntervals();
auto depthValues =
this->curveData()->depthValuesByIntervals( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, displayUnit );
if ( !errors.empty() )
{
@ -719,6 +735,8 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
setPropertyAndDepthValuesToPlotCurve( propertyValues, depthValues );
}
m_plotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfType( wellLogTrack );
CVF_ASSERT( wellLogTrack );
@ -814,7 +832,10 @@ void RimWellLogRftCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder
else
{
curveDataGroup->add( &m_segmentResultName );
curveDataGroup->add( &m_segmentBranchType );
if ( isSegmentResult( m_segmentResultName() ) )
{
curveDataGroup->add( &m_segmentBranchType );
}
curveDataGroup->add( &m_segmentBranchIndex );
curveDataGroup->add( &m_curveColorByPhase );
}
@ -936,7 +957,7 @@ void RimWellLogRftCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
loadData = true;
}
else if ( changedField == &m_timeStep || changedField == &m_segmentResultName || changedField == &m_segmentBranchIndex ||
changedField == &m_rftDataType || changedField == &m_segmentBranchType )
changedField == &m_rftDataType || changedField == &m_segmentBranchType || m_scaleFactor )
{
loadData = true;
}
@ -1239,27 +1260,12 @@ std::vector<double> RimWellLogRftCurve::measuredDepthValues()
{
if ( m_rftDataType() == RftDataType::RFT_SEGMENT_DATA )
{
std::vector<double> values;
RifReaderRftInterface* reader = rftReader();
if ( reader )
{
auto depthAddress =
RifEclipseRftAddress::createBranchSegmentAddress( m_wellName(),
m_timeStep,
RiaDefines::segmentStartDepthResultName(),
segmentBranchIndex(),
m_segmentBranchType() );
reader->values( depthAddress, &values );
// Special handling of first segment
if ( values.size() > 2 && values.front() < 0.001 )
{
values[0] = values[1];
}
return RimRftTools::seglenstValues( reader, m_wellName(), m_timeStep, segmentBranchIndex(), m_segmentBranchType() );
}
return values;
return {};
}
if ( m_observedFmuRftData && !m_ensemble && !m_summaryCase )
@ -1378,3 +1384,11 @@ int RimWellLogRftCurve::segmentBranchIndex() const
{
return m_segmentBranchIndex();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogRftCurve::isSegmentResult( const QString& resultName )
{
return resultName.startsWith( "SEG" );
}

View File

@ -101,6 +101,8 @@ public:
void enableColorFromResultName( bool enable );
void assignColorFromResultName( const QString& resultName );
void setScaleFactor( double factor );
protected:
QString createCurveAutoName() override;
QString createCurveNameFromTemplate( const QString& templateText ) override;
@ -140,6 +142,8 @@ private:
int segmentBranchIndex() const;
static bool isSegmentResult( const QString& resultName );
private:
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase;
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;

View File

@ -184,8 +184,6 @@ RimWellLogTrack::RimWellLogTrack()
CAF_PDM_InitFieldNoDefault( &m_description, "TrackDescription", "Name" );
m_description.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitFieldNoDefault( &m_curves, "Curves", "" );
m_curves.uiCapability()->setUiTreeHidden( true );
auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_curves );

View File

@ -99,13 +99,10 @@ TEST( OpmSummaryTests, DISABLED_OpmImportRftData )
{
std::cout << "\n";
auto rftVectors = eRft.listOfRftArrays( i );
for ( const auto& rftVec : rftVectors )
auto results = eRft.listOfRftArrays( i );
for ( const auto& [name, arrayType, size] : results )
{
auto [name, arrType, itemCount] = rftVec;
std::cout << name << ", " << itemCount << "\n";
std::cout << name << ", " << size << "\n";
}
}
}

View File

@ -110,9 +110,9 @@ bool RiuWellLogPlot::showYAxis( int row, int column ) const
}
auto index = static_cast<size_t>( std::max( row, column ) );
if ( index < depthTrackPlot()->plots().size() )
if ( index < depthTrackPlot()->visiblePlots().size() )
{
auto track = dynamic_cast<RimWellLogTrack*>( depthTrackPlot()->plotByIndex( index ) );
auto track = dynamic_cast<RimWellLogTrack*>( depthTrackPlot()->visiblePlots()[index] );
if ( track )
{
return track->isPropertyAxisEnabled();