#2035 Add constructor for singel branch data with MD to well flow accumulator

This commit is contained in:
Jacob Støren 2017-11-03 17:13:03 +01:00
parent c5fd04f3f6
commit bf8e4ed4ed
2 changed files with 66 additions and 9 deletions

View File

@ -72,6 +72,7 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto
m_tracerNames.push_back(RIG_RESERVOIR_TRACER_NAME);
initializePipeBranchesMeasuredDepths();
calculateAccumulatedFlowPrConnection(0, 1);
calculateFlowPrPseudoLength(0, 0.0);
sortTracers();
@ -102,7 +103,7 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto
#else
m_tracerNames.push_back(RIG_FLOW_TOTAL_NAME);
#endif
initializePipeBranchesMeasuredDepths();
calculateAccumulatedFlowPrConnection(0, 1);
calculateFlowPrPseudoLength(0, 0.0);
#ifdef USE_WELL_PHASE_RATES
@ -110,6 +111,54 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto
#endif
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector<cvf::Vec3d>& pipeBranchCLCoords,
const std::vector <RigWellResultPoint> & pipeBranchCellIds,
const std::vector <double> & pipeBranchMeasuredDepths,
double smallContribThreshold)
: m_tracerCellFractionValues(nullptr),
m_cellIndexCalculator(RigEclCellIndexCalculator(nullptr, nullptr)),
m_smallContributionsThreshold(smallContribThreshold),
m_isProducer(true)
{
m_connectionFlowPrBranch.resize(m_pipeBranchesCellIds.size());
m_pseudoLengthFlowPrBranch.resize(m_pipeBranchesCellIds.size());
m_pipeBranchesCLCoords.push_back(pipeBranchCLCoords);
m_pipeBranchesCellIds.push_back(pipeBranchCellIds);
m_pipeBranchesMeasuredDepths.push_back(pipeBranchMeasuredDepths);
#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
initializePipeBranchesMeasuredDepths();
calculateAccumulatedFlowPrConnection(0, 1);
calculateFlowPrPseudoLength(0, 0.0);
#ifdef USE_WELL_PHASE_RATES
sortTracers();
#endif
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigAccWellFlowCalculator::initializePipeBranchesMeasuredDepths()
{
for (const auto & branchClPoints: m_pipeBranchesCLCoords)
{
RigSimulationWellCoordsAndMD mdCalculator(branchClPoints);
m_pipeBranchesMeasuredDepths.push_back(mdCalculator.measuredDepths());
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -401,8 +450,7 @@ void RigAccWellFlowCalculator::calculateFlowPrPseudoLength(size_t branchIdx, dou
{
const std::vector<RigWellResultPoint>& branchCells = m_pipeBranchesCellIds[branchIdx];
const std::vector <cvf::Vec3d>& branchClPoints = m_pipeBranchesCLCoords[branchIdx];
RigSimulationWellCoordsAndMD mdCalculator(branchClPoints);
const std::vector <double>& branchMDs = m_pipeBranchesMeasuredDepths[branchIdx];
int clSegIdx = static_cast<int>(branchCells.size()) - 1;
@ -432,8 +480,8 @@ void RigAccWellFlowCalculator::calculateFlowPrPseudoLength(size_t branchIdx, dou
const RigWellResultPoint& wellCell = branchCells[currentSegmentIndex];
std::vector<double> flowPrTracerToAccumulate = calculateWellCellFlowPrTracer( wellCell, accFlowPrTracer);
double pseudoLengthFromTop_lower = mdCalculator.measuredDepths()[cellBottomPointIndex] + startPseudoLengthFromTop;
double tvd_lower = -mdCalculator.wellPathPoints()[cellBottomPointIndex][2];
double pseudoLengthFromTop_lower = branchMDs[cellBottomPointIndex] + startPseudoLengthFromTop;
double tvd_lower = -branchClPoints[cellBottomPointIndex][2];
// Push back the new start-of-cell flow, with the previously accumulated result into the storage
@ -455,8 +503,8 @@ void RigAccWellFlowCalculator::calculateFlowPrPseudoLength(size_t branchIdx, dou
addDownStreamBranchFlow(&accFlowPrTracer, flowPrTracerToAccumulate);
double pseudoLengthFromTop_upper = mdCalculator.measuredDepths()[cellUpperPointIndex] + startPseudoLengthFromTop;
double tvd_upper = -mdCalculator.wellPathPoints()[cellUpperPointIndex][2];
double pseudoLengthFromTop_upper = branchMDs[cellUpperPointIndex] + startPseudoLengthFromTop;
double tvd_upper = -branchClPoints[cellUpperPointIndex][2];
// Push back the accumulated result into the storage

View File

@ -67,6 +67,11 @@ public:
const std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds,
double smallContribThreshold);
RigAccWellFlowCalculator(const std::vector <cvf::Vec3d> & pipeBranchCLCoords,
const std::vector <RigWellResultPoint> & pipeBranchCellIds,
const std::vector <double> & pipeBranchMeasuredDepths,
double smallContribThreshold);
const std::vector<double>& connectionNumbersFromTop(size_t branchIdx) const;
const std::vector<double>& accumulatedTracerFlowPrConnection(const QString& tracerName, size_t branchIdx) const;
const std::vector<double>& tracerFlowPrConnection(const QString& tracerName, size_t branchIdx) const;
@ -82,6 +87,8 @@ public:
std::vector<std::pair<QString, double> > totalTracerFractions() const;
private:
void initializePipeBranchesMeasuredDepths();
bool isConnectionFlowConsistent(const RigWellResultPoint &wellCell) const;
bool isFlowRateConsistent(double flowRate) const;
@ -107,8 +114,10 @@ private:
std::vector<std::pair<QString, double> > totalWellFlowPrTracer() const;
const std::vector< std::vector <cvf::Vec3d> >& m_pipeBranchesCLCoords;
const std::vector< std::vector <RigWellResultPoint> >& m_pipeBranchesCellIds;
std::vector< std::vector <cvf::Vec3d> > m_pipeBranchesCLCoords;
std::vector< std::vector <RigWellResultPoint> > m_pipeBranchesCellIds;
std::vector< std::vector <double> > m_pipeBranchesMeasuredDepths;
const std::map<QString, const std::vector<double>* >* m_tracerCellFractionValues;
RigEclCellIndexCalculator m_cellIndexCalculator;
std::vector<QString> m_tracerNames;