#1291 The accumulated flow from branches with segment count <= 3 is now shown as direct inflow on the "master" branch. In pseudo length mode they are plotted as pure lines at the "top" of the cell/segement of the stem, to separate such contributions from real cell connections on the stem

This commit is contained in:
Jacob Støren 2017-03-10 14:50:27 +01:00
parent 1e1c5b0398
commit 38b4e3b729
2 changed files with 16 additions and 48 deletions

View File

@ -338,7 +338,7 @@ void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection(size_t branc
{
const std::vector<RigWellResultPoint>& branchCells = m_pipeBranchesCellIds[branchIdx];
std::vector<size_t> resPointToConnectionIndexFromBottom = wrpToConnectionIndexFromBottom(branchCells);
std::vector<size_t> resPointUniqueIndexFromBottom = wrpToUniqueWrpIndexFromBottom(branchCells);
size_t prevConnIndx = -1;
int clSegIdx = static_cast<int>(branchCells.size()) - 1;
@ -349,13 +349,13 @@ void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection(size_t branc
{
// Skip point if referring to the same cell as the previous centerline segment did
{
if ( resPointToConnectionIndexFromBottom[clSegIdx] == prevConnIndx )
if ( resPointUniqueIndexFromBottom[clSegIdx] == prevConnIndx )
{
--clSegIdx;
continue;
}
prevConnIndx = resPointToConnectionIndexFromBottom[clSegIdx];
prevConnIndx = resPointUniqueIndexFromBottom[clSegIdx];
}
// Accumulate the connection-cell's fraction flows
@ -378,7 +378,7 @@ void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection(size_t branc
// Add the total accumulated (fraction) flows from any branches connected to this cell
size_t connNumFromTop = connectionIndexFromTop(resPointToConnectionIndexFromBottom, clSegIdx) + startConnectionNumberFromTop;
size_t connNumFromTop = connectionIndexFromTop(resPointUniqueIndexFromBottom, clSegIdx) + startConnectionNumberFromTop;
std::vector<size_t> downStreamBranchIndices = findDownStreamBranchIdxs(branchCells[clSegIdx]);
for ( size_t dsBidx : downStreamBranchIndices )
@ -388,6 +388,11 @@ void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection(size_t branc
{
calculateAccumulatedFlowPrConnection(dsBidx, connNumFromTop);
addDownStreamBranchFlow(&accFlowPrTracer, downStreamBranchFlow);
if (m_pipeBranchesCellIds[dsBidx].size() <= 3)
{
// Short branch. Will not be visible. Show branch flow as addition to this connections direct flow
addDownStreamBranchFlow(&flowPrTracer, downStreamBranchFlow);
}
}
}
@ -483,6 +488,11 @@ void RigAccWellFlowCalculator::calculateFlowPrPseudoLength(size_t branchIdx, dou
{
calculateFlowPrPseudoLength(dsBidx, pseudoLengthFromTop_upper);
addDownStreamBranchFlow(&accFlowPrTracer, downStreamBranchFlow);
if (m_pipeBranchesCellIds[dsBidx].size() <= 3)
{
// Short branch. Will not be visible. Show branch flow as addition to this connections direct flow
addDownStreamBranchFlow(&flowPrTracer, downStreamBranchFlow);
}
}
}
@ -599,48 +609,7 @@ std::vector<double> RigAccWellFlowCalculator::calculateFlowPrTracer(const RigWel
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigAccWellFlowCalculator::calculateFlowPrTracer(const RigWellResultPoint& wellCell ) const
{
std::vector<double> flowPrTracer(m_tracerNames.size(), 0.0);
if ( m_tracerCellFractionValues )
{
if ( wellCell.isCell() && wellCell.m_isOpen )
{
size_t resCellIndex = m_cellIndexCalculator.resultCellIndex(wellCell.m_gridIndex,
wellCell.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 * wellCell.flowRate();
flowPrTracer[tracerIdx] = tracerFlow;
totalTracerFractionInCell += cellTracerFraction;
}
tracerIdx++;
}
double reservoirFraction = 1.0 - totalTracerFractionInCell;
double reservoirTracerFlow = reservoirFraction * wellCell.flowRate();
flowPrTracer[tracerIdx] = reservoirTracerFlow;
}
}
else
{
flowPrTracer[0] = wellCell.flowRate();
}
return flowPrTracer;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<size_t> RigAccWellFlowCalculator::wrpToConnectionIndexFromBottom(const std::vector<RigWellResultPoint> &branchCells) const
std::vector<size_t> RigAccWellFlowCalculator::wrpToUniqueWrpIndexFromBottom(const std::vector<RigWellResultPoint> &branchCells) const
{
std::vector<size_t> resPointToConnectionIndexFromBottom;
resPointToConnectionIndexFromBottom.resize(branchCells.size(), -1);

View File

@ -93,7 +93,6 @@ private:
void calculateFlowPrPseudoLength(size_t branchIdx,
double startPseudoLengthFromTop);
std::vector<double> calculateFlowPrTracer(const RigWellResultPoint& wellCell) const;
std::vector<double> calculateFlowPrTracer(const RigWellResultPoint& wellCell,
const std::vector<double>& currentAccumulatedFlowPrTracer ) const;
void sortTracers();
@ -103,7 +102,7 @@ private:
const std::vector<QString>& tracersToGroup);
bool isWellFlowConsistent(bool isProducer) const;
std::vector<size_t> wrpToConnectionIndexFromBottom( const std::vector<RigWellResultPoint> &branchCells) const;
std::vector<size_t> wrpToUniqueWrpIndexFromBottom( 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;