mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1113, #1112 Made stacked curves. Now the accumulated well flow by connection graphs is up to speed.
This commit is contained in:
parent
a4ce5f532d
commit
8e4e7f098f
@ -152,6 +152,8 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
|
||||
if (!wellResults) return;
|
||||
|
||||
// Set up the Accumulated Well Flow Calculator
|
||||
|
||||
std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
|
||||
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
|
||||
|
||||
@ -206,6 +208,8 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
|
||||
}
|
||||
|
||||
// Create tracks and curves from the calculated data
|
||||
|
||||
size_t branchCount = pipeBranchesCLCoords.size();
|
||||
for (size_t brIdx = 0; brIdx < branchCount; ++brIdx)
|
||||
{
|
||||
@ -220,8 +224,6 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
|
||||
accumulatedWellFlowPlot()->addTrack(plotTrack);
|
||||
|
||||
|
||||
|
||||
if ( m_flowDiagSolution )
|
||||
{
|
||||
std::vector<double> connNumbers;
|
||||
@ -233,9 +235,7 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
std::vector<QString> tracerNames = wfCalculator->tracerNames();
|
||||
for (const QString& tracerName: tracerNames)
|
||||
{
|
||||
std::vector<double> accFlow;
|
||||
|
||||
accFlow = wfCalculator->accumulatedTracerFlowPrConnection(tracerName, brIdx);
|
||||
const std::vector<double>& accFlow = wfCalculator->accumulatedTracerFlowPrConnection(tracerName, brIdx);
|
||||
|
||||
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
|
||||
curve->setFlowValues(tracerName, connNumbers, accFlow);
|
||||
@ -247,12 +247,12 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
else
|
||||
{
|
||||
std::vector<double> connNumbers;
|
||||
std::vector<double> accFlow;
|
||||
{
|
||||
const std::vector<size_t>& connNumbersSize_t = wfCalculator->connectionNumbersFromTop(brIdx);
|
||||
for ( size_t conNumb : connNumbersSize_t ) connNumbers.push_back(static_cast<double>(conNumb));
|
||||
}
|
||||
|
||||
accFlow = wfCalculator->accumulatedTotalFlowPrConnection(brIdx);
|
||||
|
||||
const std::vector<size_t>& connNumbersSize_t = wfCalculator->connectionNumbersFromTop(brIdx);
|
||||
for ( size_t conNumb : connNumbersSize_t ) connNumbers.push_back(static_cast<double>(conNumb));
|
||||
const std::vector<double>& accFlow = wfCalculator->accumulatedTotalFlowPrConnection(brIdx);
|
||||
|
||||
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
|
||||
curve->setFlowValues("Total", connNumbers, accFlow);
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
#include "qwt_plot.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
|
||||
|
||||
@ -40,6 +42,7 @@ CAF_PDM_SOURCE_INIT(RimWellFlowRateCurve, "RimWellFlowRateCurve");
|
||||
RimWellFlowRateCurve::RimWellFlowRateCurve()
|
||||
{
|
||||
CAF_PDM_InitObject("Flow Rate Curve", "", "", "");
|
||||
m_curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -96,15 +99,9 @@ void RimWellFlowRateCurve::onLoadDataAndUpdate()
|
||||
|
||||
if (isCurveVisible())
|
||||
{
|
||||
RimWellLogPlot* wellLogPlot;
|
||||
firstAncestorOrThisOfType(wellLogPlot);
|
||||
CVF_ASSERT(wellLogPlot);
|
||||
|
||||
m_qwtPlotCurve->setTitle(createCurveAutoName());
|
||||
|
||||
RimDefines::DepthUnitType displayUnit = RimDefines::UNIT_METER;
|
||||
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->measuredDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
|
||||
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
|
||||
updateStackedPlotData();
|
||||
|
||||
updateZoomInParentPlot();
|
||||
|
||||
@ -112,6 +109,64 @@ void RimWellFlowRateCurve::onLoadDataAndUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::updateCurveAppearance()
|
||||
{
|
||||
RimWellLogCurve::updateCurveAppearance();
|
||||
|
||||
m_qwtPlotCurve->setStyle(QwtPlotCurve::Steps);
|
||||
QColor curveQColor = QColor (m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte());
|
||||
m_qwtPlotCurve->setBrush(QBrush( curveQColor));
|
||||
|
||||
QPen curvePen = m_qwtPlotCurve->pen();
|
||||
curvePen.setColor(curveQColor.darker());
|
||||
m_qwtPlotCurve->setPen(curvePen);
|
||||
m_qwtPlotCurve->setOrientation(Qt::Horizontal);
|
||||
m_qwtPlotCurve->setBaseline(0.0);
|
||||
m_qwtPlotCurve->setCurveAttribute(QwtPlotCurve::Inverted, true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::updateStackedPlotData()
|
||||
{
|
||||
RimWellLogTrack* wellLogTrack;
|
||||
firstAncestorOrThisOfType(wellLogTrack);
|
||||
|
||||
RimDefines::DepthUnitType displayUnit = RimDefines::UNIT_METER;
|
||||
|
||||
std::vector<double> depthValues = m_curveData->measuredDepthPlotValues(displayUnit);
|
||||
if (depthValues.size()) depthValues.insert(depthValues.begin(), depthValues[0]); // Insert the first depth position again, to make room for a real 0 value
|
||||
std::vector<double> stackedValues(depthValues.size(), 0.0);
|
||||
|
||||
std::vector<RimWellFlowRateCurve*> stackedCurves = wellLogTrack->visibleStackedCurves();
|
||||
double zPos = -0.1;
|
||||
for ( RimWellFlowRateCurve * stCurve: stackedCurves )
|
||||
{
|
||||
std::vector<double> values = stCurve->curveData()->xPlotValues();
|
||||
for ( size_t i = 0; i < values.size(); ++i )
|
||||
{
|
||||
stackedValues[i+1] += values[i];
|
||||
}
|
||||
|
||||
if ( stCurve == this ) break;
|
||||
zPos -= 1.0;
|
||||
}
|
||||
|
||||
|
||||
m_qwtPlotCurve->setSamples(stackedValues.data(), depthValues.data(), static_cast<int>(depthValues.size()));
|
||||
|
||||
std::vector< std::pair<size_t, size_t> > polyLineStartStopIndices = m_curveData->polylineStartStopIndices();
|
||||
polyLineStartStopIndices.front().second += 1;
|
||||
m_qwtPlotCurve->setLineSegmentStartStopIndices(polyLineStartStopIndices);
|
||||
|
||||
m_qwtPlotCurve->setZ(zPos);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
virtual ~RimWellFlowRateCurve();
|
||||
|
||||
void setFlowValues(const QString& tracerName , const std::vector<double>& measuredDepths, const std::vector<double>& flowRates);
|
||||
void updateStackedPlotData();
|
||||
|
||||
virtual QString wellName() const override;
|
||||
virtual QString wellLogChannelName() const override;
|
||||
@ -46,6 +47,7 @@ public:
|
||||
protected:
|
||||
virtual QString createCurveAutoName() override;
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
virtual void updateCurveAppearance() override;
|
||||
|
||||
private:
|
||||
RimWellAllocationPlot* wellAllocationPlot() const;
|
||||
|
@ -86,7 +86,7 @@ protected:
|
||||
virtual void onLoadDataAndUpdate() = 0;
|
||||
|
||||
void updateCurvePresentation();
|
||||
void updateCurveAppearance();
|
||||
virtual void updateCurveAppearance();
|
||||
|
||||
void updateOptionSensitivity();
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "qwt_scale_engine.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "RimWellFlowRateCurve.h"
|
||||
|
||||
#define RI_LOGPLOTTRACK_MINX_DEFAULT -10.0
|
||||
#define RI_LOGPLOTTRACK_MAXX_DEFAULT 100.0
|
||||
@ -311,6 +312,9 @@ void RimWellLogTrack::updateXZoomAndParentPlotDepthZoom()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::updateXZoom()
|
||||
{
|
||||
std::vector<RimWellFlowRateCurve*> stackCurves = visibleStackedCurves();
|
||||
for (RimWellFlowRateCurve* stCurve: stackCurves) stCurve->updateStackedPlotData();
|
||||
|
||||
if (!m_isAutoScaleXEnabled())
|
||||
{
|
||||
m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax);
|
||||
@ -459,3 +463,21 @@ void RimWellLogTrack::setLogarithmicScale(bool enable)
|
||||
updateAxisScaleEngine();
|
||||
computeAndSetXRangeMinForLogarithmicScale();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellFlowRateCurve*> RimWellLogTrack::visibleStackedCurves()
|
||||
{
|
||||
std::vector<RimWellFlowRateCurve*> stackedCurves;
|
||||
for (RimWellLogCurve* curve: curves)
|
||||
{
|
||||
if (curve && curve->isCurveVisible() )
|
||||
{
|
||||
RimWellFlowRateCurve* wfrCurve = dynamic_cast<RimWellFlowRateCurve*>(curve);
|
||||
if (wfrCurve) stackedCurves.push_back(wfrCurve);
|
||||
}
|
||||
}
|
||||
|
||||
return stackedCurves;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
class RimWellLogCurve;
|
||||
class RiuWellLogTrack;
|
||||
class RimWellFlowRateCurve;
|
||||
|
||||
class QwtPlotCurve;
|
||||
|
||||
@ -66,6 +67,7 @@ public:
|
||||
|
||||
void setLogarithmicScale(bool enable);
|
||||
|
||||
std::vector<RimWellFlowRateCurve*> visibleStackedCurves();
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
@ -120,7 +120,11 @@ void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection(size_t branc
|
||||
size_t tracerIdx = 0;
|
||||
for ( const auto & tracerFractionIt: (*m_tracerCellFractionValues) )
|
||||
{
|
||||
accFlow[tracerIdx] += (*tracerFractionIt.second)[resCellIndex] * branchCells[clSegIdx].flowRate();
|
||||
double cellTracerFraction = (*tracerFractionIt.second)[resCellIndex];
|
||||
if (cellTracerFraction != HUGE_VAL && cellTracerFraction == cellTracerFraction)
|
||||
{
|
||||
accFlow[tracerIdx] += (*tracerFractionIt.second)[resCellIndex] * branchCells[clSegIdx].flowRate();
|
||||
}
|
||||
tracerIdx++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user