#1120 Well Alloc Plot: Simple TVD calculations

This commit is contained in:
Jacob Støren
2017-03-01 16:00:32 +01:00
parent 984762ab5d
commit 8f2affe670
7 changed files with 67 additions and 31 deletions

View File

@@ -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<double>& connNumbers = depthType == RimWellLogPlot::CONNECTION_NUMBER ? 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();
@@ -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<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));

View File

@@ -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);

View File

@@ -233,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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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<double>& RigAccWellFlowCalculator::pseudoLengthFromTop(size_t
return m_pseudoLengthFlowPrBranch[branchIdx].depthValuesFromTop;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>& 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<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
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<double> &accFlowPrTracer, const BranchFlow &downStreamBranchFlow) const
void RigAccWellFlowCalculator::addDownStreamBranchFlow(std::vector<double> *accFlowPrTracer, const BranchFlow &downStreamBranchFlow) const
{
size_t tracerIdx = 0;
for ( const auto & tracerName: m_tracerNames )
@@ -447,7 +455,7 @@ void RigAccWellFlowCalculator::addDownStreamBranchFlow(std::vector<double> &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<double> &accF
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigAccWellFlowCalculator::storeFlowOnDepth(BranchFlow &branchFlow, double depthValue, const std::vector<double>& accFlowPrTracer, const std::vector<double>& flowPrTracer)
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]);
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<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);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -74,6 +74,7 @@ public:
const std::vector<double>& tracerFlowPrConnection(const QString& tracerName, 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;
@@ -119,15 +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 addDownStreamBranchFlow(std::vector<double> &accFlowPrTracer, const BranchFlow &downStreamBranchFlow) const;
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;
};