diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 60dd3d962c..c2a9cd2c91 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -234,8 +234,7 @@ void RimWellAllocationPlot::updateFromWell() auto depthType = accumulatedWellFlowPlot()->depthType(); - if ( depthType == RimWellLogPlot::MEASURED_DEPTH - || depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH) return; + if ( depthType == RimWellLogPlot::MEASURED_DEPTH ) return; // Create tracks and curves from the calculated data @@ -251,10 +250,11 @@ void RimWellAllocationPlot::updateFromWell() accumulatedWellFlowPlot()->addTrack(plotTrack); - const std::vector& connNumbers = depthType == RimWellLogPlot::CONNECTION_NUMBER ? wfCalculator->connectionNumbersFromTop(brIdx) : + const std::vector& depthValues = depthType == RimWellLogPlot::CONNECTION_NUMBER ? wfCalculator->connectionNumbersFromTop(brIdx) : depthType == RimWellLogPlot::PSEUDO_LENGTH ? wfCalculator->pseudoLengthFromTop(brIdx) : + depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? wfCalculator->trueVerticalDepth(brIdx) : std::vector(); - + if ( m_flowDiagSolution ) { std::vector tracerNames = wfCalculator->tracerNames(); @@ -267,14 +267,14 @@ void RimWellAllocationPlot::updateFromWell() wfCalculator->accumulatedTracerFlowPrConnection(tracerName, brIdx): wfCalculator->tracerFlowPrConnection(tracerName, brIdx)); } - else if ( depthType == RimWellLogPlot::PSEUDO_LENGTH) + else if ( depthType == RimWellLogPlot::PSEUDO_LENGTH || depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH) { accFlow = &(m_flowType == ACCUMULATED ? wfCalculator->accumulatedTracerFlowPrPseudoLength(tracerName, brIdx): wfCalculator->tracerFlowPrPseudoLength(tracerName, brIdx)); } - addStackedCurve(tracerName, connNumbers, *accFlow, plotTrack); + addStackedCurve(tracerName, depthValues, *accFlow, plotTrack); } } else @@ -286,14 +286,14 @@ void RimWellAllocationPlot::updateFromWell() wfCalculator->accumulatedFlowPrConnection(brIdx): wfCalculator->flowPrConnection( brIdx)); } - else if ( depthType == RimWellLogPlot::PSEUDO_LENGTH) + else if ( depthType == RimWellLogPlot::PSEUDO_LENGTH || depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH) { accFlow = &(m_flowType == ACCUMULATED ? wfCalculator->accumulatedFlowPrPseudoLength(brIdx): wfCalculator->flowPrPseudoLength( brIdx)); } - addStackedCurve("Total", connNumbers, *accFlow, plotTrack); + addStackedCurve("Total", depthValues, *accFlow, plotTrack); } updateWellFlowPlotXAxisTitle(plotTrack); @@ -404,12 +404,12 @@ void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTr /// //-------------------------------------------------------------------------------------------------- void RimWellAllocationPlot::addStackedCurve(const QString& tracerName, - const std::vector& connNumbers, + const std::vector& depthValues, const std::vector& accFlow, RimWellLogTrack* plotTrack) { RimWellFlowRateCurve* curve = new RimWellFlowRateCurve; - curve->setFlowValuesPrConnection(tracerName, connNumbers, accFlow); + curve->setFlowValuesPrDepthValue(tracerName, depthValues, accFlow); if ( m_flowDiagSolution ) curve->setColor(m_flowDiagSolution->tracerColor(tracerName)); diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h index a6d0636b59..b0e5467de3 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h @@ -95,7 +95,7 @@ private: void updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack); void addStackedCurve(const QString& tracerName, - const std::vector& connNumbers, + const std::vector& depthValues, const std::vector& accFlow, RimWellLogTrack* plotTrack); diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp index e4f348d196..ebe49f5658 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp @@ -233,7 +233,7 @@ RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellFlowRateCurve::setFlowValuesPrConnection(const QString& tracerName, const std::vector& connectionNumbers, const std::vector& flowRates) +void RimWellFlowRateCurve::setFlowValuesPrDepthValue(const QString& tracerName, const std::vector& connectionNumbers, const std::vector& flowRates) { m_curveData = new RigWellLogCurveData; m_curveData->setValuesAndMD(flowRates, connectionNumbers, RimDefines::UNIT_NONE, false); diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h index a797602452..5523bea6d7 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellFlowRateCurve.h @@ -38,7 +38,7 @@ public: RimWellFlowRateCurve(); virtual ~RimWellFlowRateCurve(); - void setFlowValuesPrConnection(const QString& tracerName , const std::vector& connectionNumbers, const std::vector& flowRates); + void setFlowValuesPrDepthValue(const QString& tracerName , const std::vector& connectionNumbers, const std::vector& flowRates); void updateStackedPlotData(); virtual QString wellName() const override; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index d1be6570c8..b49808f64c 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -680,7 +680,6 @@ void RimWellLogPlot::updateDisabledDepthTypes() if (wap) { m_disabledDepthTypes.insert(MEASURED_DEPTH); - m_disabledDepthTypes.insert(TRUE_VERTICAL_DEPTH); if (m_disabledDepthTypes.count(m_depthType() )) { m_depthType = CONNECTION_NUMBER; diff --git a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp index 492f4e4690..8e28b2379e 100644 --- a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp +++ b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp @@ -63,7 +63,6 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto { m_connectionFlowPrBranch.resize(m_pipeBranchesCellIds.size()); m_pseudoLengthFlowPrBranch.resize(m_pipeBranchesCellIds.size()); - m_tvdFlowPrBranch.resize(m_pipeBranchesCellIds.size()); if (isWellFlowConsistent(isProducer)) { @@ -103,7 +102,6 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto { m_connectionFlowPrBranch.resize(m_pipeBranchesCellIds.size()); m_pseudoLengthFlowPrBranch.resize(m_pipeBranchesCellIds.size()); - m_tvdFlowPrBranch.resize(m_pipeBranchesCellIds.size()); m_tracerNames.push_back(RIG_FLOW_TOTAL_NAME); @@ -180,6 +178,14 @@ const std::vector& RigAccWellFlowCalculator::pseudoLengthFromTop(size_t return m_pseudoLengthFlowPrBranch[branchIdx].depthValuesFromTop; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector& RigAccWellFlowCalculator::trueVerticalDepth(size_t branchIdx) const +{ + return m_pseudoLengthFlowPrBranch[branchIdx].trueVerticalDepth; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -343,7 +349,7 @@ void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection(size_t branc if ( dsBidx != branchIdx && downStreamBranchFlow.depthValuesFromTop.size() == 0 ) // Not this branch or already calculated { calculateAccumulatedFlowPrConnection(dsBidx, connNumFromTop); - addDownStreamBranchFlow(accFlowPrTracer, downStreamBranchFlow); + addDownStreamBranchFlow(&accFlowPrTracer, downStreamBranchFlow); } } @@ -351,7 +357,7 @@ void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection(size_t branc BranchFlow& branchFlow = m_connectionFlowPrBranch[branchIdx]; - storeFlowOnDepth(branchFlow, connNumFromTop, accFlowPrTracer, flowPrTracer); + storeFlowOnDepth(&branchFlow, connNumFromTop, accFlowPrTracer, flowPrTracer); --clSegIdx; @@ -398,10 +404,11 @@ void RigAccWellFlowCalculator::calculateFlowPrPseudoLength(size_t branchIdx, dou std::vector flowPrTracer = calculateFlowPrTracer(branchCells, currentSegmentIndex); double pseudoLengthFromTop_lower = mdCalculator.measuredDepths()[cellBottomPointIndex] + startPseudoLengthFromTop; + double tvd_lower = -mdCalculator.wellPathPoints()[cellBottomPointIndex][2]; // Push back the new start-of-cell flow, with the previously accumulated result into the storage - storeFlowOnDepth(branchFlow, pseudoLengthFromTop_lower, accFlowPrTracer, flowPrTracer); + storeFlowOnDepthWTvd(&branchFlow, pseudoLengthFromTop_lower, tvd_lower, accFlowPrTracer, flowPrTracer); // Accumulate the connection-cell's fraction flows @@ -411,10 +418,11 @@ void RigAccWellFlowCalculator::calculateFlowPrPseudoLength(size_t branchIdx, dou } double pseudoLengthFromTop_upper = mdCalculator.measuredDepths()[cellUpperPointIndex] + startPseudoLengthFromTop; + double tvd_upper = -mdCalculator.wellPathPoints()[cellUpperPointIndex][2]; // Push back the accumulated result into the storage - storeFlowOnDepth(branchFlow, pseudoLengthFromTop_upper, accFlowPrTracer, flowPrTracer); + storeFlowOnDepthWTvd(&branchFlow, pseudoLengthFromTop_upper, tvd_upper, accFlowPrTracer, flowPrTracer); // Add the total accumulated (fraction) flows from any branches connected to this cell @@ -425,13 +433,13 @@ void RigAccWellFlowCalculator::calculateFlowPrPseudoLength(size_t branchIdx, dou if ( dsBidx != branchIdx && downStreamBranchFlow.depthValuesFromTop.size() == 0 ) // Not this branch or already calculated { calculateFlowPrPseudoLength(dsBidx, pseudoLengthFromTop_upper); - addDownStreamBranchFlow(accFlowPrTracer, downStreamBranchFlow); + addDownStreamBranchFlow(&accFlowPrTracer, downStreamBranchFlow); } } // Push back the accumulated result after adding the branch result into the storage - if (downStreamBranchIndices.size()) storeFlowOnDepth(branchFlow, pseudoLengthFromTop_upper, accFlowPrTracer, flowPrTracer); + if (downStreamBranchIndices.size()) storeFlowOnDepthWTvd(&branchFlow, pseudoLengthFromTop_upper, tvd_upper, accFlowPrTracer, flowPrTracer); } } @@ -439,7 +447,7 @@ void RigAccWellFlowCalculator::calculateFlowPrPseudoLength(size_t branchIdx, dou //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigAccWellFlowCalculator::addDownStreamBranchFlow(std::vector &accFlowPrTracer, const BranchFlow &downStreamBranchFlow) const +void RigAccWellFlowCalculator::addDownStreamBranchFlow(std::vector *accFlowPrTracer, const BranchFlow &downStreamBranchFlow) const { size_t tracerIdx = 0; for ( const auto & tracerName: m_tracerNames ) @@ -447,7 +455,7 @@ void RigAccWellFlowCalculator::addDownStreamBranchFlow(std::vector &accF auto tracerFlowPair = downStreamBranchFlow.accFlowPrTracer.find(tracerName); if ( tracerFlowPair != downStreamBranchFlow.accFlowPrTracer.end() ) { - accFlowPrTracer[tracerIdx] += tracerFlowPair->second.back(); // The topmost accumulated value in the branch + (*accFlowPrTracer)[tracerIdx] += tracerFlowPair->second.back(); // The topmost accumulated value in the branch } tracerIdx++; } @@ -456,17 +464,34 @@ void RigAccWellFlowCalculator::addDownStreamBranchFlow(std::vector &accF //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigAccWellFlowCalculator::storeFlowOnDepth(BranchFlow &branchFlow, double depthValue, const std::vector& accFlowPrTracer, const std::vector& flowPrTracer) +void RigAccWellFlowCalculator::storeFlowOnDepth(BranchFlow* branchFlow, double depthValue, const std::vector& accFlowPrTracer, const std::vector& flowPrTracer) { size_t tracerIdx = 0; for ( const auto & tracerName: m_tracerNames ) { - branchFlow.accFlowPrTracer[tracerName].push_back(accFlowPrTracer[tracerIdx]); - branchFlow.flowPrTracer[tracerName].push_back(flowPrTracer[tracerIdx]); + branchFlow->accFlowPrTracer[tracerName].push_back(accFlowPrTracer[tracerIdx]); + branchFlow->flowPrTracer[tracerName].push_back(flowPrTracer[tracerIdx]); tracerIdx++; } - branchFlow.depthValuesFromTop.push_back(depthValue); + branchFlow->depthValuesFromTop.push_back(depthValue); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigAccWellFlowCalculator::storeFlowOnDepthWTvd(BranchFlow *branchFlow, double depthValue, double trueVerticalDepth, const std::vector& accFlowPrTracer, const std::vector& flowPrTracer) +{ + size_t tracerIdx = 0; + for ( const auto & tracerName: m_tracerNames ) + { + branchFlow->accFlowPrTracer[tracerName].push_back(accFlowPrTracer[tracerIdx]); + branchFlow->flowPrTracer[tracerName].push_back(flowPrTracer[tracerIdx]); + tracerIdx++; + } + + branchFlow->depthValuesFromTop.push_back(depthValue); + branchFlow->trueVerticalDepth.push_back(trueVerticalDepth); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.h b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.h index 21b08a8154..e779ce2224 100644 --- a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.h +++ b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.h @@ -74,6 +74,7 @@ public: const std::vector& tracerFlowPrConnection(const QString& tracerName, size_t branchIdx) const; const std::vector& pseudoLengthFromTop(size_t branchIdx) const; + const std::vector& trueVerticalDepth(size_t branchIdx) const; const std::vector& accumulatedFlowPrPseudoLength( size_t branchIdx) const; const std::vector& accumulatedTracerFlowPrPseudoLength(const QString& tracerName, size_t branchIdx) const; const std::vector& flowPrPseudoLength( size_t branchIdx) const; @@ -119,15 +120,26 @@ private: struct BranchFlow { std::vector depthValuesFromTop; + std::vector trueVerticalDepth; std::map > accFlowPrTracer; std::map > flowPrTracer; }; - void storeFlowOnDepth(BranchFlow &branchFlow, double depthValue, const std::vector& accFlowPrTracer, const std::vector& flowPrTracer); - void addDownStreamBranchFlow(std::vector &accFlowPrTracer, const BranchFlow &downStreamBranchFlow) const; + + void storeFlowOnDepth(BranchFlow *branchFlow, + double depthValue, + const std::vector& accFlowPrTracer, + const std::vector& flowPrTracer); + void storeFlowOnDepthWTvd(BranchFlow *branchFlow, + double depthValue, + double trueVerticalDepth, + const std::vector& accFlowPrTracer, + const std::vector& flowPrTracer); + + void addDownStreamBranchFlow(std::vector *accFlowPrTracer, + const BranchFlow &downStreamBranchFlow) const; std::vector< BranchFlow > m_connectionFlowPrBranch; std::vector< BranchFlow > m_pseudoLengthFlowPrBranch; - std::vector< BranchFlow > m_tvdFlowPrBranch; };