diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index c4075dcf55..60dd3d962c 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -232,6 +232,11 @@ void RimWellAllocationPlot::updateFromWell() m_contributingTracerNames = wfCalculator->tracerNames(); } + auto depthType = accumulatedWellFlowPlot()->depthType(); + + if ( depthType == RimWellLogPlot::MEASURED_DEPTH + || depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH) return; + // Create tracks and curves from the calculated data size_t branchCount = pipeBranchesCLCoords.size(); @@ -246,27 +251,49 @@ void RimWellAllocationPlot::updateFromWell() accumulatedWellFlowPlot()->addTrack(plotTrack); - std::vector connNumbers = wfCalculator->connectionNumbersFromTop(brIdx); + const std::vector& connNumbers = depthType == RimWellLogPlot::CONNECTION_NUMBER ? wfCalculator->connectionNumbersFromTop(brIdx) : + depthType == RimWellLogPlot::PSEUDO_LENGTH ? wfCalculator->pseudoLengthFromTop(brIdx) : + std::vector(); if ( m_flowDiagSolution ) { std::vector tracerNames = wfCalculator->tracerNames(); for (const QString& tracerName: tracerNames) { - const std::vector& accFlow = m_flowType == ACCUMULATED ? - wfCalculator->accumulatedTracerFlowPrConnection(tracerName, brIdx): - wfCalculator->tracerFlowPrConnection(tracerName, brIdx); + const std::vector* accFlow = nullptr; + if (depthType == RimWellLogPlot::CONNECTION_NUMBER) + { + accFlow = &(m_flowType == ACCUMULATED ? + wfCalculator->accumulatedTracerFlowPrConnection(tracerName, brIdx): + wfCalculator->tracerFlowPrConnection(tracerName, brIdx)); + } + else if ( depthType == RimWellLogPlot::PSEUDO_LENGTH) + { + accFlow = &(m_flowType == ACCUMULATED ? + wfCalculator->accumulatedTracerFlowPrPseudoLength(tracerName, brIdx): + wfCalculator->tracerFlowPrPseudoLength(tracerName, brIdx)); + } - addStackedCurve(tracerName, connNumbers, accFlow, plotTrack); + addStackedCurve(tracerName, connNumbers, *accFlow, plotTrack); } } else { - const std::vector& accFlow = m_flowType == ACCUMULATED ? - wfCalculator->accumulatedFlowPrConnection(brIdx): - wfCalculator->flowPrConnection(brIdx); + const std::vector* accFlow = nullptr; + if (depthType == RimWellLogPlot::CONNECTION_NUMBER) + { + accFlow = &(m_flowType == ACCUMULATED ? + wfCalculator->accumulatedFlowPrConnection(brIdx): + wfCalculator->flowPrConnection( brIdx)); + } + else if ( depthType == RimWellLogPlot::PSEUDO_LENGTH) + { + accFlow = &(m_flowType == ACCUMULATED ? + wfCalculator->accumulatedFlowPrPseudoLength(brIdx): + wfCalculator->flowPrPseudoLength( brIdx)); + } - addStackedCurve("Total", connNumbers, accFlow, plotTrack); + addStackedCurve("Total", connNumbers, *accFlow, plotTrack); } updateWellFlowPlotXAxisTitle(plotTrack); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index cb45faaf2d..47b457f19a 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -115,9 +115,15 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c { updateMdiWindowTitle(); } - - if ( changedField == &m_depthType - || changedField == &m_depthUnit) + + if ( changedField == &m_depthType ) + { + RimWellAllocationPlot* wellAllocPlot; + firstAncestorOrThisOfType(wellAllocPlot); + if (wellAllocPlot) wellAllocPlot->loadDataAndUpdate(); + else updateTracks(); + } + if ( changedField == &m_depthUnit) { updateTracks(); } @@ -675,7 +681,7 @@ void RimWellLogPlot::updateDisabledDepthTypes() { m_disabledDepthTypes.insert(MEASURED_DEPTH); m_disabledDepthTypes.insert(TRUE_VERTICAL_DEPTH); - m_disabledDepthTypes.insert(PSEUDO_LENGTH); + // m_disabledDepthTypes.insert(PSEUDO_LENGTH); } else { diff --git a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp index 39ed14ff47..45785caa1d 100644 --- a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp +++ b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp @@ -374,9 +374,12 @@ void RigAccWellFlowCalculator::calculateFlowPrPseudoLength(size_t branchIdx, dou std::vector accFlowPrTracer(m_tracerNames.size(), 0.0); BranchFlow& branchFlow = m_pseudoLengthFlowPrBranch[branchIdx]; + + RigWellResultPoint previousResultPoint; while ( clSegIdx >= 0 ) { + if (previousResultPoint.isEqual(branchCells[clSegIdx])) { --clSegIdx; continue; } // Todo: Do the skipping within one cell to get the complete length span of the cell into the graph std::vector flowPrTracer = calculateFlowPrTracer(branchCells, clSegIdx); @@ -411,6 +414,8 @@ void RigAccWellFlowCalculator::calculateFlowPrPseudoLength(size_t branchIdx, dou storeFlowOnDepth(branchFlow, pseudoLengthFromTop_upper, accFlowPrTracer, flowPrTracer); + previousResultPoint = branchCells[clSegIdx]; + --clSegIdx; } diff --git a/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h b/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h index 200995f7cb..6f163af24a 100644 --- a/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h +++ b/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h @@ -70,6 +70,16 @@ struct RigWellResultPoint } } + bool isEqual(const RigWellResultPoint& other ) const + { + return ( m_gridIndex == other.m_gridIndex + && m_gridCellIndex == other.m_gridCellIndex + && m_isOpen == other.m_isOpen + && m_ertBranchId == other.m_ertBranchId + && m_ertSegmentId == other.m_ertSegmentId + && m_flowRate == other.m_flowRate); + } + size_t m_gridIndex; size_t m_gridCellIndex; //< Index to cell which is included in the well