mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge remote-tracking branch 'refs/remotes/origin/dev'
Conflicts: ResInsightVersion.cmake
This commit is contained in:
commit
ac9f405c96
@ -18,6 +18,10 @@
|
||||
|
||||
#include "RicShowContributingWellsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimView.h"
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
|
||||
#include <QAction>
|
||||
@ -29,7 +33,21 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFeature, "RicShowContributingWellsFe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowContributingWellsFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return false;
|
||||
|
||||
RimEclipseResultCase* eclCase = nullptr;
|
||||
activeView->firstAncestorOrThisOfType(eclCase);
|
||||
if (eclCase)
|
||||
{
|
||||
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions();
|
||||
if (flowSols.size() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -20,10 +20,12 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimView.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
@ -39,7 +41,21 @@ CAF_CMD_SOURCE_INIT(RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlot
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowWellAllocationPlotFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return false;
|
||||
|
||||
RimEclipseResultCase* eclCase = nullptr;
|
||||
activeView->firstAncestorOrThisOfType(eclCase);
|
||||
if (eclCase)
|
||||
{
|
||||
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions();
|
||||
if (flowSols.size() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -84,11 +84,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
|
||||
|
||||
RigSingleWellResultsData* wellResults = well->wellResults();
|
||||
|
||||
if (wellResults->m_staticWellCells.m_wellResultBranches.size() == 0)
|
||||
{
|
||||
wellResults->computeStaticWellCellPath();
|
||||
}
|
||||
if (wellResults->m_staticWellCells.m_wellResultBranches.size() == 0) return;
|
||||
if (wellResults->staticWellCells().m_wellResultBranches.size() == 0) return;
|
||||
|
||||
if (!wellResults->hasWellResult(frameIndex)) return;
|
||||
|
||||
|
@ -164,7 +164,8 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
|
||||
{
|
||||
for (const RigWellResultPoint& wrp: wBr.m_branchResultPoints)
|
||||
{
|
||||
if (wrp.isValid() && wrp.m_isOpen)
|
||||
if (wrp.isValid() && wrp.m_isOpen
|
||||
&& ( (useInjectors && wrp.flowRate() < 0.0) || (!useInjectors && wrp.flowRate() > 0.0) ) )
|
||||
{
|
||||
RigGridBase * grid = mainGrid->gridByIndex(wrp.m_gridIndex);
|
||||
size_t reservoirCellIndex = grid->reservoirCellIndex(wrp.m_gridCellIndex);
|
||||
|
@ -232,6 +232,10 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
m_contributingTracerNames = wfCalculator->tracerNames();
|
||||
}
|
||||
|
||||
auto depthType = accumulatedWellFlowPlot()->depthType();
|
||||
|
||||
if ( depthType == RimWellLogPlot::MEASURED_DEPTH ) return;
|
||||
|
||||
// Create tracks and curves from the calculated data
|
||||
|
||||
size_t branchCount = pipeBranchesCLCoords.size();
|
||||
@ -246,27 +250,50 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
|
||||
accumulatedWellFlowPlot()->addTrack(plotTrack);
|
||||
|
||||
std::vector<double> connNumbers = wfCalculator->connectionNumbersFromTop(brIdx);
|
||||
|
||||
const std::vector<double>& 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<double>();
|
||||
|
||||
if ( m_flowDiagSolution )
|
||||
{
|
||||
std::vector<QString> tracerNames = wfCalculator->tracerNames();
|
||||
for (const QString& tracerName: tracerNames)
|
||||
{
|
||||
const std::vector<double>& accFlow = m_flowType == ACCUMULATED ?
|
||||
wfCalculator->accumulatedTracerFlowPrConnection(tracerName, brIdx):
|
||||
wfCalculator->tracerFlowPrConnection(tracerName, brIdx);
|
||||
const std::vector<double>* 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 || 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
|
||||
{
|
||||
const std::vector<double>& accFlow = m_flowType == ACCUMULATED ?
|
||||
wfCalculator->accumulatedFlowPrConnection(brIdx):
|
||||
wfCalculator->flowPrConnection(brIdx);
|
||||
const std::vector<double>* accFlow = nullptr;
|
||||
if (depthType == RimWellLogPlot::CONNECTION_NUMBER)
|
||||
{
|
||||
accFlow = &(m_flowType == ACCUMULATED ?
|
||||
wfCalculator->accumulatedFlowPrConnection(brIdx):
|
||||
wfCalculator->flowPrConnection( brIdx));
|
||||
}
|
||||
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);
|
||||
@ -377,12 +404,12 @@ void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTr
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::addStackedCurve(const QString& tracerName,
|
||||
const std::vector<double>& connNumbers,
|
||||
const std::vector<double>& depthValues,
|
||||
const std::vector<double>& 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));
|
||||
|
@ -95,7 +95,7 @@ private:
|
||||
void updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack);
|
||||
|
||||
void addStackedCurve(const QString& tracerName,
|
||||
const std::vector<double>& connNumbers,
|
||||
const std::vector<double>& depthValues,
|
||||
const std::vector<double>& accFlow,
|
||||
RimWellLogTrack* plotTrack);
|
||||
|
||||
|
@ -118,8 +118,12 @@ void RimWellFlowRateCurve::onLoadDataAndUpdate()
|
||||
void RimWellFlowRateCurve::updateCurveAppearance()
|
||||
{
|
||||
RimWellLogCurve::updateCurveAppearance();
|
||||
|
||||
m_qwtPlotCurve->setStyle(QwtPlotCurve::Steps);
|
||||
|
||||
if ( isUsingConnectionNumberDepthType() )
|
||||
{
|
||||
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));
|
||||
|
||||
@ -158,7 +162,7 @@ void RimWellFlowRateCurve::updateStackedPlotData()
|
||||
RimDefines::DepthUnitType displayUnit = RimDefines::UNIT_NONE;
|
||||
|
||||
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< std::pair<size_t, size_t> > polyLineStartStopIndices = m_curveData->polylineStartStopIndices();
|
||||
std::vector<double> stackedValues(depthValues.size(), 0.0);
|
||||
|
||||
std::vector<RimWellFlowRateCurve*> stackedCurves = wellLogTrack->visibleStackedCurves();
|
||||
@ -168,29 +172,53 @@ void RimWellFlowRateCurve::updateStackedPlotData()
|
||||
std::vector<double> values = stCurve->curveData()->xPlotValues();
|
||||
for ( size_t i = 0; i < values.size(); ++i )
|
||||
{
|
||||
stackedValues[i+1] += values[i];
|
||||
stackedValues[i] += values[i];
|
||||
}
|
||||
|
||||
if ( stCurve == this ) break;
|
||||
zPos -= 1.0;
|
||||
}
|
||||
|
||||
|
||||
// Insert the first depth position again, to add a <maxdepth, 0.0> value pair
|
||||
|
||||
if ( depthValues.size() ) // Should we really do this for all curve variants ?
|
||||
{
|
||||
depthValues.insert(depthValues.begin(), depthValues[0]);
|
||||
stackedValues.insert(stackedValues.begin(), 0.0);
|
||||
polyLineStartStopIndices.front().second += 1;
|
||||
}
|
||||
|
||||
// Add a dummy point for the zeroth connection to make the "end" distribution show better.
|
||||
|
||||
stackedValues.push_back(stackedValues.back());
|
||||
depthValues.push_back(0.0);
|
||||
std::vector< std::pair<size_t, size_t> > polyLineStartStopIndices = m_curveData->polylineStartStopIndices();
|
||||
|
||||
if ( isFirstTrack ) polyLineStartStopIndices.front().second += 2;
|
||||
else polyLineStartStopIndices.front().second += 1;
|
||||
if ( isFirstTrack && isUsingConnectionNumberDepthType() )
|
||||
{
|
||||
stackedValues.push_back(stackedValues.back());
|
||||
depthValues.push_back(0.0);
|
||||
|
||||
polyLineStartStopIndices.front().second += 1;
|
||||
}
|
||||
|
||||
m_qwtPlotCurve->setSamples(stackedValues.data(), depthValues.data(), static_cast<int>(depthValues.size()));
|
||||
m_qwtPlotCurve->setLineSegmentStartStopIndices(polyLineStartStopIndices);
|
||||
|
||||
|
||||
m_qwtPlotCurve->setZ(zPos);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellFlowRateCurve::isUsingConnectionNumberDepthType() const
|
||||
{
|
||||
RimWellLogPlot* wellLogPlot;
|
||||
firstAncestorOrThisOfType(wellLogPlot);
|
||||
if ( wellLogPlot && wellLogPlot->depthType() == RimWellLogPlot::CONNECTION_NUMBER )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -205,7 +233,7 @@ RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellFlowRateCurve::setFlowValuesPrConnection(const QString& tracerName, const std::vector<double>& connectionNumbers, const std::vector<double>& flowRates)
|
||||
void RimWellFlowRateCurve::setFlowValuesPrDepthValue(const QString& tracerName, const std::vector<double>& connectionNumbers, const std::vector<double>& flowRates)
|
||||
{
|
||||
m_curveData = new RigWellLogCurveData;
|
||||
m_curveData->setValuesAndMD(flowRates, connectionNumbers, RimDefines::UNIT_NONE, false);
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
RimWellFlowRateCurve();
|
||||
virtual ~RimWellFlowRateCurve();
|
||||
|
||||
void setFlowValuesPrConnection(const QString& tracerName , const std::vector<double>& connectionNumbers, const std::vector<double>& flowRates);
|
||||
void setFlowValuesPrDepthValue(const QString& tracerName , const std::vector<double>& connectionNumbers, const std::vector<double>& flowRates);
|
||||
void updateStackedPlotData();
|
||||
|
||||
virtual QString wellName() const override;
|
||||
@ -50,6 +50,7 @@ protected:
|
||||
virtual void updateCurveAppearance() override;
|
||||
|
||||
private:
|
||||
bool isUsingConnectionNumberDepthType() const;
|
||||
RimWellAllocationPlot* wellAllocationPlot() const;
|
||||
|
||||
QString m_tracerName;
|
||||
|
@ -346,6 +346,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
else if (dynamic_cast<RimEclipseWell*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewSimWellIntersectionFeature";
|
||||
commandIds << "RicShowWellAllocationPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseWellCollection*>(uiItem))
|
||||
{
|
||||
@ -457,6 +458,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
}
|
||||
else if (dynamic_cast<RimEclipseWell*>(uiItem))
|
||||
{
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicEclipseWellShowLabelFeature";
|
||||
commandIds << "RicEclipseWellShowHeadFeature";
|
||||
commandIds << "RicEclipseWellShowPipeFeature";
|
||||
|
@ -367,6 +367,10 @@ void RimEclipseView::createDisplayModel()
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: This assignment must be done here, as m_visibleGridParts is used in code triggered by
|
||||
// m_reservoirGridPartManager->appendStaticGeometryPartsToModel()
|
||||
m_visibleGridParts = geometryTypesToAdd;
|
||||
|
||||
size_t frameIdx;
|
||||
for (frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx)
|
||||
{
|
||||
@ -378,8 +382,6 @@ void RimEclipseView::createDisplayModel()
|
||||
|
||||
// Set static colors
|
||||
this->updateStaticCellColors();
|
||||
|
||||
m_visibleGridParts = geometryTypesToAdd;
|
||||
}
|
||||
|
||||
m_reservoirGridPartManager->clearWatertightGeometryFlags();
|
||||
|
@ -254,7 +254,7 @@ bool RimEclipseWell::intersectsStaticWellCellsFilteredCells() const
|
||||
if (this->wellResults() == nullptr) return false;
|
||||
|
||||
// NOTE: Read out static well cells, union of well cells across all time steps
|
||||
const RigWellResultFrame& wrsf = this->wellResults()->m_staticWellCells;
|
||||
const RigWellResultFrame& wrsf = this->wellResults()->staticWellCells();
|
||||
|
||||
// NOTE: Use first time step for visibility evaluation
|
||||
size_t frameIndex = 0;
|
||||
|
@ -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();
|
||||
}
|
||||
@ -394,7 +400,10 @@ void RimWellLogPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
{
|
||||
uiOrdering.add(&m_userName);
|
||||
uiOrdering.add(&m_depthType);
|
||||
if ( m_depthType() != CONNECTION_NUMBER )
|
||||
|
||||
RimWellAllocationPlot* wap;
|
||||
firstAncestorOrThisOfType(wap);
|
||||
if (!wap)
|
||||
{
|
||||
uiOrdering.add(&m_depthUnit);
|
||||
}
|
||||
@ -674,8 +683,10 @@ void RimWellLogPlot::updateDisabledDepthTypes()
|
||||
if (wap)
|
||||
{
|
||||
m_disabledDepthTypes.insert(MEASURED_DEPTH);
|
||||
m_disabledDepthTypes.insert(TRUE_VERTICAL_DEPTH);
|
||||
m_disabledDepthTypes.insert(PSEUDO_LENGTH);
|
||||
if (m_disabledDepthTypes.count(m_depthType() ))
|
||||
{
|
||||
m_depthType = CONNECTION_NUMBER;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
#include "RigSimulationWellCoordsAndMD.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -61,6 +62,7 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto
|
||||
m_smallContributionsThreshold(smallContribThreshold)
|
||||
{
|
||||
m_connectionFlowPrBranch.resize(m_pipeBranchesCellIds.size());
|
||||
m_pseudoLengthFlowPrBranch.resize(m_pipeBranchesCellIds.size());
|
||||
|
||||
if (isWellFlowConsistent(isProducer))
|
||||
{
|
||||
@ -70,6 +72,7 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto
|
||||
m_tracerNames.push_back(RIG_RESERVOIR_TRACER_NAME);
|
||||
|
||||
calculateAccumulatedFlowPrConnection(0, 1);
|
||||
calculateFlowPrPseudoLength(0, 0.0);
|
||||
sortTracers();
|
||||
groupSmallContributions();
|
||||
}
|
||||
@ -80,6 +83,8 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto
|
||||
m_tracerNames.push_back(RIG_FLOW_TOTAL_NAME);
|
||||
|
||||
calculateAccumulatedFlowPrConnection(0, 1);
|
||||
calculateFlowPrPseudoLength(0, 0.0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,10 +101,20 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto
|
||||
m_smallContributionsThreshold(smallContribThreshold)
|
||||
{
|
||||
m_connectionFlowPrBranch.resize(m_pipeBranchesCellIds.size());
|
||||
m_pseudoLengthFlowPrBranch.resize(m_pipeBranchesCellIds.size());
|
||||
|
||||
m_tracerNames.push_back(RIG_FLOW_TOTAL_NAME);
|
||||
|
||||
calculateAccumulatedFlowPrConnection(0, 1);
|
||||
calculateFlowPrPseudoLength(0, 0.0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>& RigAccWellFlowCalculator::connectionNumbersFromTop(size_t branchIdx) const
|
||||
{
|
||||
return m_connectionFlowPrBranch[branchIdx].depthValuesFromTop;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -154,14 +169,76 @@ const std::vector<double>& RigAccWellFlowCalculator::tracerFlowPrConnection(cons
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>& RigAccWellFlowCalculator::connectionNumbersFromTop(size_t branchIdx) const
|
||||
const std::vector<double>& RigAccWellFlowCalculator::pseudoLengthFromTop(size_t branchIdx) const
|
||||
{
|
||||
return m_connectionFlowPrBranch[branchIdx].depthValuesFromTop;
|
||||
return m_pseudoLengthFlowPrBranch[branchIdx].depthValuesFromTop;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>& RigAccWellFlowCalculator::trueVerticalDepth(size_t branchIdx) const
|
||||
{
|
||||
return m_pseudoLengthFlowPrBranch[branchIdx].trueVerticalDepth;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>& RigAccWellFlowCalculator::accumulatedFlowPrPseudoLength(size_t branchIdx) const
|
||||
{
|
||||
return accumulatedTracerFlowPrPseudoLength(RIG_FLOW_TOTAL_NAME, branchIdx);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>& RigAccWellFlowCalculator::accumulatedTracerFlowPrPseudoLength(const QString& tracerName, size_t branchIdx) const
|
||||
{
|
||||
auto flowPrTracerIt = m_pseudoLengthFlowPrBranch[branchIdx].accFlowPrTracer.find(tracerName);
|
||||
if ( flowPrTracerIt != m_pseudoLengthFlowPrBranch[branchIdx].accFlowPrTracer.end())
|
||||
{
|
||||
return flowPrTracerIt->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(false);
|
||||
static std::vector<double> dummy;
|
||||
return dummy;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>& RigAccWellFlowCalculator::flowPrPseudoLength(size_t branchIdx) const
|
||||
{
|
||||
return tracerFlowPrPseudoLength(RIG_FLOW_TOTAL_NAME, branchIdx);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>& RigAccWellFlowCalculator::tracerFlowPrPseudoLength(const QString& tracerName, size_t branchIdx) const
|
||||
{
|
||||
auto flowPrTracerIt = m_pseudoLengthFlowPrBranch[branchIdx].flowPrTracer.find(tracerName);
|
||||
if ( flowPrTracerIt != m_pseudoLengthFlowPrBranch[branchIdx].flowPrTracer.end())
|
||||
{
|
||||
return flowPrTracerIt->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(false);
|
||||
static std::vector<double> dummy;
|
||||
return dummy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -253,86 +330,211 @@ void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection(size_t branc
|
||||
}
|
||||
|
||||
// Accumulate the connection-cell's fraction flows
|
||||
std::vector<double> flowPrTracer(m_tracerNames.size(), 0.0);
|
||||
|
||||
if ( m_tracerCellFractionValues )
|
||||
std::vector<double> flowPrTracer = calculateFlowPrTracer(branchCells, clSegIdx);
|
||||
|
||||
for (size_t tIdx = 0; tIdx < flowPrTracer.size(); ++tIdx)
|
||||
{
|
||||
if ( branchCells[clSegIdx].isCell() && branchCells[clSegIdx].m_isOpen )
|
||||
{
|
||||
size_t resCellIndex = m_cellIndexCalculator.resultCellIndex(branchCells[clSegIdx].m_gridIndex,
|
||||
branchCells[clSegIdx].m_gridCellIndex);
|
||||
size_t tracerIdx = 0;
|
||||
double totalTracerFractionInCell = 0.0;
|
||||
for ( const auto & tracerFractionIt: (*m_tracerCellFractionValues) )
|
||||
{
|
||||
double cellTracerFraction = (*tracerFractionIt.second)[resCellIndex];
|
||||
if (cellTracerFraction != HUGE_VAL && cellTracerFraction == cellTracerFraction)
|
||||
{
|
||||
double tracerFlow = cellTracerFraction * branchCells[clSegIdx].flowRate();
|
||||
flowPrTracer[tracerIdx] = tracerFlow;
|
||||
accFlowPrTracer[tracerIdx] += tracerFlow;
|
||||
|
||||
totalTracerFractionInCell += cellTracerFraction;
|
||||
}
|
||||
tracerIdx++;
|
||||
}
|
||||
|
||||
double reservoirFraction = 1.0 - totalTracerFractionInCell;
|
||||
double reservoirTracerFlow = reservoirFraction * branchCells[clSegIdx].flowRate();
|
||||
flowPrTracer[tracerIdx] = reservoirTracerFlow;
|
||||
accFlowPrTracer[tracerIdx] += reservoirTracerFlow;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
accFlowPrTracer[0] += branchCells[clSegIdx].flowRate();
|
||||
flowPrTracer[0] = branchCells[clSegIdx].flowRate();
|
||||
accFlowPrTracer[tIdx] += flowPrTracer[tIdx];
|
||||
}
|
||||
|
||||
// Add the total accumulated (fraction) flows from any branches connected to this cell
|
||||
|
||||
size_t connNumFromTop = connectionIndexFromTop(resPointToConnectionIndexFromBottom, clSegIdx) + startConnectionNumberFromTop;
|
||||
|
||||
std::vector<size_t> downstreamBranches = findDownstreamBranchIdxs(branchCells[clSegIdx]);
|
||||
for ( size_t dsBidx : downstreamBranches )
|
||||
std::vector<size_t> downStreamBranchIndices = findDownStreamBranchIdxs(branchCells[clSegIdx]);
|
||||
for ( size_t dsBidx : downStreamBranchIndices )
|
||||
{
|
||||
if ( dsBidx != branchIdx && m_connectionFlowPrBranch[dsBidx].depthValuesFromTop.size() == 0 ) // Not this branch or already calculated
|
||||
BranchFlow &downStreamBranchFlow = m_connectionFlowPrBranch[dsBidx];
|
||||
if ( dsBidx != branchIdx && downStreamBranchFlow.depthValuesFromTop.size() == 0 ) // Not this branch or already calculated
|
||||
{
|
||||
calculateAccumulatedFlowPrConnection(dsBidx, connNumFromTop);
|
||||
BranchFlow& accConnFlowFractionsDsBranch = m_connectionFlowPrBranch[dsBidx];
|
||||
|
||||
size_t tracerIdx = 0;
|
||||
for ( const auto & tracerName: m_tracerNames )
|
||||
{
|
||||
accFlowPrTracer[tracerIdx] += accConnFlowFractionsDsBranch.accFlowPrTracer[tracerName].back();
|
||||
tracerIdx++;
|
||||
}
|
||||
addDownStreamBranchFlow(&accFlowPrTracer, downStreamBranchFlow);
|
||||
}
|
||||
}
|
||||
|
||||
// Push back the accumulated result into the storage
|
||||
{
|
||||
std::vector<double>& connNumbersFromTop = m_connectionFlowPrBranch[branchIdx].depthValuesFromTop;
|
||||
std::map<QString, std::vector<double> >& branchAccFlowPrTracer = m_connectionFlowPrBranch[branchIdx].accFlowPrTracer;
|
||||
std::map<QString, std::vector<double> >& branchFlowPrTracer = m_connectionFlowPrBranch[branchIdx].flowPrTracer;
|
||||
|
||||
size_t tracerIdx = 0;
|
||||
for ( const auto & tracerName: m_tracerNames )
|
||||
{
|
||||
branchAccFlowPrTracer[tracerName].push_back(accFlowPrTracer[tracerIdx]);
|
||||
branchFlowPrTracer[tracerName].push_back(flowPrTracer[tracerIdx]);
|
||||
tracerIdx++;
|
||||
}
|
||||
BranchFlow& branchFlow = m_connectionFlowPrBranch[branchIdx];
|
||||
|
||||
|
||||
connNumbersFromTop.push_back(connNumFromTop);
|
||||
}
|
||||
storeFlowOnDepth(&branchFlow, connNumFromTop, accFlowPrTracer, flowPrTracer);
|
||||
|
||||
--clSegIdx;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigAccWellFlowCalculator::calculateFlowPrPseudoLength(size_t branchIdx, double startPseudoLengthFromTop)
|
||||
{
|
||||
const std::vector<RigWellResultPoint>& branchCells = m_pipeBranchesCellIds[branchIdx];
|
||||
const std::vector <cvf::Vec3d>& branchClPoints = m_pipeBranchesCLCoords[branchIdx];
|
||||
|
||||
RigSimulationWellCoordsAndMD mdCalculator(branchClPoints);
|
||||
|
||||
size_t prevConnIndx = -1;
|
||||
int clSegIdx = static_cast<int>(branchCells.size()) - 1;
|
||||
|
||||
std::vector<double> accFlowPrTracer(m_tracerNames.size(), 0.0);
|
||||
|
||||
BranchFlow& branchFlow = m_pseudoLengthFlowPrBranch[branchIdx];
|
||||
|
||||
RigWellResultPoint previousResultPoint;
|
||||
|
||||
while ( clSegIdx >= 0 )
|
||||
{
|
||||
int cellBottomPointIndex = -1;
|
||||
int cellUpperPointIndex = -1;
|
||||
int currentSegmentIndex = -1;
|
||||
|
||||
// Find the complete cell span
|
||||
{
|
||||
cellBottomPointIndex = clSegIdx + 1;
|
||||
|
||||
previousResultPoint = branchCells[clSegIdx];
|
||||
--clSegIdx;
|
||||
while ( clSegIdx >= 0 && previousResultPoint.isEqual(branchCells[clSegIdx]) ) { --clSegIdx; }
|
||||
|
||||
cellUpperPointIndex = clSegIdx + 1;
|
||||
currentSegmentIndex = cellUpperPointIndex;
|
||||
}
|
||||
|
||||
std::vector<double> 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
|
||||
|
||||
storeFlowOnDepthWTvd(&branchFlow, pseudoLengthFromTop_lower, tvd_lower, accFlowPrTracer, flowPrTracer);
|
||||
|
||||
// Accumulate the connection-cell's fraction flows
|
||||
|
||||
for (size_t tIdx = 0; tIdx < flowPrTracer.size(); ++tIdx)
|
||||
{
|
||||
accFlowPrTracer[tIdx] += flowPrTracer[tIdx];
|
||||
}
|
||||
|
||||
double pseudoLengthFromTop_upper = mdCalculator.measuredDepths()[cellUpperPointIndex] + startPseudoLengthFromTop;
|
||||
double tvd_upper = -mdCalculator.wellPathPoints()[cellUpperPointIndex][2];
|
||||
|
||||
// Push back the accumulated result into the storage
|
||||
|
||||
storeFlowOnDepthWTvd(&branchFlow, pseudoLengthFromTop_upper, tvd_upper, accFlowPrTracer, flowPrTracer);
|
||||
|
||||
// Add the total accumulated (fraction) flows from any branches connected to this cell
|
||||
|
||||
std::vector<size_t> downStreamBranchIndices = findDownStreamBranchIdxs(branchCells[cellUpperPointIndex]);
|
||||
for ( size_t dsBidx : downStreamBranchIndices )
|
||||
{
|
||||
BranchFlow &downStreamBranchFlow = m_pseudoLengthFlowPrBranch[dsBidx];
|
||||
if ( dsBidx != branchIdx && downStreamBranchFlow.depthValuesFromTop.size() == 0 ) // Not this branch or already calculated
|
||||
{
|
||||
calculateFlowPrPseudoLength(dsBidx, pseudoLengthFromTop_upper);
|
||||
addDownStreamBranchFlow(&accFlowPrTracer, downStreamBranchFlow);
|
||||
}
|
||||
}
|
||||
|
||||
// Push back the accumulated result after adding the branch result into the storage
|
||||
|
||||
if (downStreamBranchIndices.size()) storeFlowOnDepthWTvd(&branchFlow, pseudoLengthFromTop_upper, tvd_upper, accFlowPrTracer, flowPrTracer);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigAccWellFlowCalculator::addDownStreamBranchFlow(std::vector<double> *accFlowPrTracer, const BranchFlow &downStreamBranchFlow) const
|
||||
{
|
||||
size_t tracerIdx = 0;
|
||||
for ( const auto & tracerName: m_tracerNames )
|
||||
{
|
||||
auto tracerFlowPair = downStreamBranchFlow.accFlowPrTracer.find(tracerName);
|
||||
if ( tracerFlowPair != downStreamBranchFlow.accFlowPrTracer.end() )
|
||||
{
|
||||
(*accFlowPrTracer)[tracerIdx] += tracerFlowPair->second.back(); // The topmost accumulated value in the branch
|
||||
}
|
||||
tracerIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigAccWellFlowCalculator::storeFlowOnDepth(BranchFlow* branchFlow, double depthValue, const std::vector<double>& accFlowPrTracer, const std::vector<double>& 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);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigAccWellFlowCalculator::storeFlowOnDepthWTvd(BranchFlow *branchFlow, double depthValue, double trueVerticalDepth, const std::vector<double>& accFlowPrTracer, const std::vector<double>& 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);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigAccWellFlowCalculator::calculateFlowPrTracer(const std::vector<RigWellResultPoint>& branchCells,
|
||||
int clSegIdx) const
|
||||
{
|
||||
std::vector<double> flowPrTracer(m_tracerNames.size(), 0.0);
|
||||
if ( m_tracerCellFractionValues )
|
||||
{
|
||||
if ( branchCells[clSegIdx].isCell() && branchCells[clSegIdx].m_isOpen )
|
||||
{
|
||||
size_t resCellIndex = m_cellIndexCalculator.resultCellIndex(branchCells[clSegIdx].m_gridIndex,
|
||||
branchCells[clSegIdx].m_gridCellIndex);
|
||||
size_t tracerIdx = 0;
|
||||
double totalTracerFractionInCell = 0.0;
|
||||
for ( const auto & tracerFractionIt: (*m_tracerCellFractionValues) )
|
||||
{
|
||||
double cellTracerFraction = (*tracerFractionIt.second)[resCellIndex];
|
||||
if ( cellTracerFraction != HUGE_VAL && cellTracerFraction == cellTracerFraction )
|
||||
{
|
||||
double tracerFlow = cellTracerFraction * branchCells[clSegIdx].flowRate();
|
||||
flowPrTracer[tracerIdx] = tracerFlow;
|
||||
|
||||
totalTracerFractionInCell += cellTracerFraction;
|
||||
}
|
||||
tracerIdx++;
|
||||
}
|
||||
|
||||
double reservoirFraction = 1.0 - totalTracerFractionInCell;
|
||||
double reservoirTracerFlow = reservoirFraction * branchCells[clSegIdx].flowRate();
|
||||
flowPrTracer[tracerIdx] = reservoirTracerFlow;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flowPrTracer[0] = branchCells[clSegIdx].flowRate();
|
||||
}
|
||||
|
||||
return flowPrTracer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -386,7 +588,7 @@ size_t RigAccWellFlowCalculator::connectionIndexFromTop(const std::vector<size_t
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<size_t> RigAccWellFlowCalculator::findDownstreamBranchIdxs(const RigWellResultPoint& connectionPoint) const
|
||||
std::vector<size_t> RigAccWellFlowCalculator::findDownStreamBranchIdxs(const RigWellResultPoint& connectionPoint) const
|
||||
{
|
||||
std::vector<size_t> downStreamBranchIdxs;
|
||||
|
||||
@ -457,8 +659,14 @@ void RigAccWellFlowCalculator::groupSmallContributions()
|
||||
|
||||
for ( BranchFlow& brRes : m_connectionFlowPrBranch )
|
||||
{
|
||||
groupSmallTracers( brRes.accFlowPrTracer, tracersToGroup);
|
||||
groupSmallTracers( brRes.flowPrTracer, tracersToGroup);
|
||||
groupSmallTracers( &brRes.accFlowPrTracer, tracersToGroup);
|
||||
groupSmallTracers( &brRes.flowPrTracer, tracersToGroup);
|
||||
}
|
||||
|
||||
for ( BranchFlow& brRes : m_pseudoLengthFlowPrBranch )
|
||||
{
|
||||
groupSmallTracers( &brRes.accFlowPrTracer, tracersToGroup);
|
||||
groupSmallTracers( &brRes.flowPrTracer, tracersToGroup);
|
||||
}
|
||||
|
||||
// Remove the grouped tracer names from the tracerName list, and replace with the "Others" name
|
||||
@ -483,18 +691,18 @@ void RigAccWellFlowCalculator::groupSmallContributions()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigAccWellFlowCalculator::groupSmallTracers(std::map<QString, std::vector<double>> &branchFlowSet, std::vector<QString> tracersToGroup)
|
||||
void RigAccWellFlowCalculator::groupSmallTracers(std::map<QString, std::vector<double> >* branchFlowSet, const std::vector<QString>& tracersToGroup)
|
||||
{
|
||||
if ( branchFlowSet.empty() ) return;
|
||||
if ( branchFlowSet->empty() ) return;
|
||||
|
||||
size_t depthCount = branchFlowSet.begin()->second.size();
|
||||
size_t depthCount = branchFlowSet->begin()->second.size();
|
||||
std::vector<double> groupedAccFlowValues(depthCount, 0.0);
|
||||
|
||||
for ( const QString& tracername:tracersToGroup )
|
||||
{
|
||||
auto it = branchFlowSet.find(tracername);
|
||||
auto it = branchFlowSet->find(tracername);
|
||||
|
||||
if ( it != branchFlowSet.end() )
|
||||
if ( it != branchFlowSet->end() )
|
||||
{
|
||||
const std::vector<double>& tracerVals = it->second;
|
||||
for ( size_t cIdx = 0; cIdx < groupedAccFlowValues.size(); ++cIdx )
|
||||
@ -503,9 +711,9 @@ void RigAccWellFlowCalculator::groupSmallTracers(std::map<QString, std::vector<d
|
||||
}
|
||||
}
|
||||
|
||||
branchFlowSet.erase(it);
|
||||
branchFlowSet->erase(it);
|
||||
}
|
||||
|
||||
branchFlowSet[RIG_TINY_TRACER_GROUP_NAME] = groupedAccFlowValues;
|
||||
(*branchFlowSet)[RIG_TINY_TRACER_GROUP_NAME] = groupedAccFlowValues;
|
||||
}
|
||||
|
||||
|
@ -67,29 +67,45 @@ public:
|
||||
const std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds,
|
||||
double smallContribThreshold);
|
||||
|
||||
const std::vector<double>& connectionNumbersFromTop(size_t branchIdx) const;
|
||||
const std::vector<double>& accumulatedFlowPrConnection( size_t branchIdx) const;
|
||||
const std::vector<double>& accumulatedTracerFlowPrConnection(const QString& tracerName, size_t branchIdx) const;
|
||||
const std::vector<double>& flowPrConnection( size_t branchIdx) const;
|
||||
const std::vector<double>& tracerFlowPrConnection(const QString& tracerName, size_t branchIdx) const;
|
||||
const std::vector<double>& connectionNumbersFromTop(size_t branchIdx) const;
|
||||
|
||||
const std::vector<double>& pseudoLengthFromTop(size_t branchIdx) const;
|
||||
const std::vector<double>& trueVerticalDepth(size_t branchIdx) const;
|
||||
const std::vector<double>& accumulatedFlowPrPseudoLength( size_t branchIdx) const;
|
||||
const std::vector<double>& accumulatedTracerFlowPrPseudoLength(const QString& tracerName, size_t branchIdx) const;
|
||||
const std::vector<double>& flowPrPseudoLength( size_t branchIdx) const;
|
||||
const std::vector<double>& tracerFlowPrPseudoLength(const QString& tracerName, size_t branchIdx) const;
|
||||
|
||||
|
||||
const std::vector<QString>& tracerNames() const { return m_tracerNames;}
|
||||
|
||||
std::vector<std::pair<QString, double> > totalTracerFractions() const;
|
||||
|
||||
private:
|
||||
|
||||
void calculateAccumulatedFlowPrConnection( size_t branchIdx, size_t startConnectionNumberFromTop);
|
||||
void calculateFlowPrPseudoLength(size_t branchIdx, double startPseudoLengthFromTop);
|
||||
void calculateAccumulatedFlowPrConnection( size_t branchIdx,
|
||||
size_t startConnectionNumberFromTop);
|
||||
void calculateFlowPrPseudoLength(size_t branchIdx,
|
||||
double startPseudoLengthFromTop);
|
||||
|
||||
|
||||
|
||||
std::vector<double> calculateFlowPrTracer(const std::vector<RigWellResultPoint> &branchCells, int clSegIdx) const;
|
||||
|
||||
void sortTracers();
|
||||
void groupSmallContributions();
|
||||
|
||||
void groupSmallTracers(std::map<QString, std::vector<double>> &branchFlowSet,
|
||||
std::vector<QString> tracersToGroup);
|
||||
void groupSmallTracers(std::map<QString, std::vector<double> >* branchFlowSet,
|
||||
const std::vector<QString>& tracersToGroup);
|
||||
|
||||
bool isWellFlowConsistent(bool isProducer) const;
|
||||
std::vector<size_t> wrpToConnectionIndexFromBottom( const std::vector<RigWellResultPoint> &branchCells) const;
|
||||
static size_t connectionIndexFromTop( const std::vector<size_t>& resPointToConnectionIndexFromBottom, size_t clSegIdx) ;
|
||||
std::vector<size_t> findDownstreamBranchIdxs( const RigWellResultPoint& connectionPoint) const;
|
||||
std::vector<size_t> findDownStreamBranchIdxs( const RigWellResultPoint& connectionPoint) const;
|
||||
|
||||
std::vector<std::pair<QString, double> > totalWellFlowPrTracer() const;
|
||||
|
||||
@ -104,13 +120,26 @@ private:
|
||||
struct BranchFlow
|
||||
{
|
||||
std::vector<double> depthValuesFromTop;
|
||||
std::vector<double> trueVerticalDepth;
|
||||
std::map<QString, std::vector<double> > accFlowPrTracer;
|
||||
std::map<QString, std::vector<double> > flowPrTracer;
|
||||
};
|
||||
|
||||
|
||||
void storeFlowOnDepth(BranchFlow *branchFlow,
|
||||
double depthValue,
|
||||
const std::vector<double>& accFlowPrTracer,
|
||||
const std::vector<double>& flowPrTracer);
|
||||
void storeFlowOnDepthWTvd(BranchFlow *branchFlow,
|
||||
double depthValue,
|
||||
double trueVerticalDepth,
|
||||
const std::vector<double>& accFlowPrTracer,
|
||||
const std::vector<double>& flowPrTracer);
|
||||
|
||||
void addDownStreamBranchFlow(std::vector<double> *accFlowPrTracer,
|
||||
const BranchFlow &downStreamBranchFlow) const;
|
||||
|
||||
std::vector< BranchFlow > m_connectionFlowPrBranch;
|
||||
std::vector< BranchFlow > m_pseudoLengthFlowPrBranch;
|
||||
std::vector< BranchFlow > m_tvdFlowPrBranch;
|
||||
|
||||
};
|
||||
|
||||
|
@ -220,7 +220,7 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
||||
|
||||
progressInfo.incrementProgress();
|
||||
|
||||
Opm::ECLWellSolution wsol = Opm::ECLWellSolution{};
|
||||
Opm::ECLWellSolution wsol = Opm::ECLWellSolution{-1.0 , false};
|
||||
|
||||
const std::vector<Opm::ECLWellSolution::WellData> well_fluxes =
|
||||
wsol.solution(m_opmFldData->eclGraph.rawResultData(), m_opmFldData->eclGraph.numGrids());
|
||||
|
@ -93,13 +93,7 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellF
|
||||
|
||||
if (timeStepIndex < 0)
|
||||
{
|
||||
// Make sure we have computed the static representation of the well
|
||||
if (wellResults->m_staticWellCells.m_wellResultBranches.size() == 0)
|
||||
{
|
||||
wellResults->computeStaticWellCellPath();
|
||||
}
|
||||
|
||||
wellFramePtr = &wellResults->m_staticWellCells;
|
||||
wellFramePtr = &wellResults->staticWellCells();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -278,6 +278,20 @@ RigWellResultFrame::WellProductionType RigSingleWellResultsData::wellProductionT
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigWellResultFrame& RigSingleWellResultsData::staticWellCells() const
|
||||
{
|
||||
// Make sure we have computed the static representation of the well
|
||||
if (m_staticWellCells.m_wellResultBranches.size() == 0)
|
||||
{
|
||||
computeStaticWellCellPath();
|
||||
}
|
||||
|
||||
return m_staticWellCells;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
||||
@ -139,7 +149,8 @@ public:
|
||||
bool isOpen(size_t resultTimeStepIndex) const;
|
||||
RigWellResultFrame::WellProductionType wellProductionType(size_t resultTimeStepIndex) const;
|
||||
|
||||
void computeStaticWellCellPath() const ;
|
||||
const RigWellResultFrame& staticWellCells() const;
|
||||
|
||||
void computeMappingFromResultTimeIndicesToWellTimeIndices(const std::vector<QDateTime>& resultTimes);
|
||||
|
||||
public: // Todo: Clean up this regarding public members and constness etc.
|
||||
@ -149,6 +160,9 @@ public: // Todo: Clean up this regarding public members and constness etc.
|
||||
std::vector< RigWellResultFrame > m_wellCellsTimeSteps;
|
||||
mutable RigWellResultFrame m_staticWellCells;
|
||||
|
||||
private:
|
||||
void computeStaticWellCellPath() const;
|
||||
|
||||
private:
|
||||
bool m_isMultiSegmentWell;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user