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

@@ -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 );