From 1fba5e13c4e6847283111ab27742d7daadfa809f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Thu, 9 Nov 2017 15:19:42 +0100 Subject: [PATCH] #2119 Support total reservoir flow from Grid wells in PLT plot --- .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 7 +- .../RigAccWellFlowCalculator.cpp | 79 +++++++++++-------- .../RigAccWellFlowCalculator.h | 3 +- 3 files changed, 51 insertions(+), 38 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index ffc8d19c62..e02ab5ad7f 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -830,11 +830,11 @@ void RimWellPltPlot::syncCurvesFromUiSelection() { if ( resultPointCalc->pipeBranchCLCoords().size() ) { - + RigAccWellFlowCalculator wfAccumulator(resultPointCalc->pipeBranchCLCoords(), resultPointCalc->pipeBranchWellResultPoints(), resultPointCalc->pipeBranchMeasuredDepths(), - 0.0); + false); // m_phaseSelectionMode() != FLOW_TYPE_PHASE_SPLIT); The total flow is reservoir conditions must be careful const std::vector& depthValues = wfAccumulator.pseudoLengthFromTop(0); std::vector tracerNames = wfAccumulator.tracerNames(); @@ -847,7 +847,8 @@ void RimWellPltPlot::syncCurvesFromUiSelection() if ( tracerName == RIG_FLOW_OIL_NAME && selectedPhases.count(FLOW_PHASE_OIL) || tracerName == RIG_FLOW_GAS_NAME && selectedPhases.count(FLOW_PHASE_GAS) - || tracerName == RIG_FLOW_WATER_NAME && selectedPhases.count(FLOW_PHASE_WATER) ) + || tracerName == RIG_FLOW_WATER_NAME && selectedPhases.count(FLOW_PHASE_WATER) + || tracerName == RIG_FLOW_TOTAL_NAME && selectedPhases.count(FLOW_PHASE_TOTAL) ) { const std::vector accFlow = wfAccumulator.accumulatedTracerFlowPrPseudoLength(tracerName, 0); addStackedCurve(curveName + ", " + tracerName, diff --git a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp index 76cccb0905..a453d98ca4 100644 --- a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp +++ b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp @@ -46,8 +46,6 @@ size_t RigEclCellIndexCalculator::resultCellIndex(size_t gridIndex, size_t gridC /// //================================================================================================== -#define USE_WELL_PHASE_RATES - //-------------------------------------------------------------------------------------------------- /// /// The pipeBranchesWellResultPoints are describing the lines between the points, starting with the first line @@ -64,7 +62,8 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto m_tracerCellFractionValues(&tracerCellFractionValues), m_cellIndexCalculator(cellIndexCalculator), m_smallContributionsThreshold(smallContribThreshold), - m_isProducer(isProducer) + m_isProducer(isProducer), + m_useTotalWellPhaseRateOnly(false) { m_connectionFlowPrBranch.resize(m_pipeBranchesWellResultPoints.size()); m_pseudoLengthFlowPrBranch.resize(m_pipeBranchesWellResultPoints.size()); @@ -93,24 +92,29 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto m_tracerCellFractionValues(nullptr), m_cellIndexCalculator(RigEclCellIndexCalculator(nullptr, nullptr)), m_smallContributionsThreshold(smallContribThreshold), - m_isProducer(true) + m_isProducer(true), + m_useTotalWellPhaseRateOnly(false) { m_connectionFlowPrBranch.resize(m_pipeBranchesWellResultPoints.size()); m_pseudoLengthFlowPrBranch.resize(m_pipeBranchesWellResultPoints.size()); -#ifdef USE_WELL_PHASE_RATES - m_tracerNames.push_back(RIG_FLOW_OIL_NAME); - m_tracerNames.push_back(RIG_FLOW_GAS_NAME); - m_tracerNames.push_back(RIG_FLOW_WATER_NAME); -#else - m_tracerNames.push_back(RIG_FLOW_TOTAL_NAME); -#endif + if ( !m_useTotalWellPhaseRateOnly ) + { + m_tracerNames.push_back(RIG_FLOW_OIL_NAME); + m_tracerNames.push_back(RIG_FLOW_GAS_NAME); + m_tracerNames.push_back(RIG_FLOW_WATER_NAME); + } + else + { + m_tracerNames.push_back(RIG_FLOW_TOTAL_NAME); + } + initializePipeBranchesMeasuredDepths(); calculateAccumulatedFlowPrConnection(0, 1); calculateFlowPrPseudoLength(0, 0.0); -#ifdef USE_WELL_PHASE_RATES - sortTracers(); -#endif + + if ( !m_useTotalWellPhaseRateOnly ) sortTracers(); + } @@ -120,11 +124,12 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector& pipeBranchCLCoords, const std::vector & pipeBranchesWellResultPoints, const std::vector & pipeBranchMeasuredDepths, - double smallContribThreshold) + bool totalFlowOnly) : m_tracerCellFractionValues(nullptr), m_cellIndexCalculator(RigEclCellIndexCalculator(nullptr, nullptr)), - m_smallContributionsThreshold(smallContribThreshold), - m_isProducer(true) + m_smallContributionsThreshold(0.0), + m_isProducer(true), + m_useTotalWellPhaseRateOnly(totalFlowOnly) { m_pipeBranchesCLCoords.push_back(pipeBranchCLCoords); m_pipeBranchesWellResultPoints.push_back(pipeBranchesWellResultPoints); @@ -134,19 +139,22 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector m_pseudoLengthFlowPrBranch.resize(m_pipeBranchesWellResultPoints.size()); - #ifdef USE_WELL_PHASE_RATES - m_tracerNames.push_back(RIG_FLOW_OIL_NAME); - m_tracerNames.push_back(RIG_FLOW_GAS_NAME); - m_tracerNames.push_back(RIG_FLOW_WATER_NAME); - #else - m_tracerNames.push_back(RIG_FLOW_TOTAL_NAME); - #endif + if ( !m_useTotalWellPhaseRateOnly ) + { + m_tracerNames.push_back(RIG_FLOW_OIL_NAME); + m_tracerNames.push_back(RIG_FLOW_GAS_NAME); + m_tracerNames.push_back(RIG_FLOW_WATER_NAME); + } + else + { + m_tracerNames.push_back(RIG_FLOW_TOTAL_NAME); + } + initializePipeBranchesMeasuredDepths(); calculateAccumulatedFlowPrConnection(0, 1); calculateFlowPrPseudoLength(0, 0.0); - #ifdef USE_WELL_PHASE_RATES - sortTracers(); - #endif + + if ( !m_useTotalWellPhaseRateOnly ) sortTracers(); } //-------------------------------------------------------------------------------------------------- @@ -717,13 +725,16 @@ std::vector RigAccWellFlowCalculator::calculateWellCellFlowPrTracer(cons } else { - #ifdef USE_WELL_PHASE_RATES - flowPrTracer[0] = wellCell.oilRate(); - flowPrTracer[1] = wellCell.gasRate(); - flowPrTracer[2] = wellCell.waterRate(); - #else - flowPrTracer[0] = wellCell.flowRate(); - #endif + if ( !m_useTotalWellPhaseRateOnly ) + { + flowPrTracer[0] = wellCell.oilRate(); + flowPrTracer[1] = wellCell.gasRate(); + flowPrTracer[2] = wellCell.waterRate(); + } + else + { + flowPrTracer[0] = wellCell.flowRate(); + } } return flowPrTracer; diff --git a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.h b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.h index 6d238309d0..f541cd6257 100644 --- a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.h +++ b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.h @@ -70,7 +70,7 @@ public: RigAccWellFlowCalculator(const std::vector & pipeBranchCLCoords, const std::vector & pipeBranchCellIds, const std::vector & pipeBranchMeasuredDepths, - double smallContribThreshold); + bool totalFlowOnly); const std::vector& connectionNumbersFromTop(size_t branchIdx) const; const std::vector& accumulatedTracerFlowPrConnection(const QString& tracerName, size_t branchIdx) const; @@ -123,6 +123,7 @@ private: std::vector m_tracerNames; double m_smallContributionsThreshold; bool m_isProducer; + bool m_useTotalWellPhaseRateOnly; struct BranchFlow {