2017-01-31 08:28:15 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 Statoil ASA
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
|
|
|
|
2017-02-17 04:13:27 -06:00
|
|
|
class RigMainGrid;
|
|
|
|
class RigActiveCellInfo;
|
2017-01-31 08:28:15 -06:00
|
|
|
|
|
|
|
class RigEclCellIndexCalculator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RigEclCellIndexCalculator(const RigMainGrid* mainGrid, const RigActiveCellInfo* activeCellInfo)
|
|
|
|
: m_mainGrid(mainGrid), m_activeCellInfo(activeCellInfo)
|
|
|
|
{}
|
|
|
|
|
2017-02-17 04:13:27 -06:00
|
|
|
size_t resultCellIndex(size_t gridIndex, size_t gridCellIndex) const;
|
2017-01-31 08:28:15 -06:00
|
|
|
|
|
|
|
private:
|
|
|
|
const RigMainGrid* m_mainGrid;
|
|
|
|
const RigActiveCellInfo* m_activeCellInfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
|
|
|
|
2017-02-17 04:13:27 -06:00
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <QString>
|
|
|
|
#include "cvfBase.h"
|
|
|
|
#include "cvfVector3.h"
|
|
|
|
|
|
|
|
struct RigWellResultPoint;
|
|
|
|
|
2017-01-31 08:28:15 -06:00
|
|
|
class RigAccWellFlowCalculator
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
2017-02-15 01:46:23 -06:00
|
|
|
RigAccWellFlowCalculator(const std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
2017-01-31 08:28:15 -06:00
|
|
|
const std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds,
|
2017-02-15 01:46:23 -06:00
|
|
|
const std::map<QString, const std::vector<double>* >& tracerCellFractionValues,
|
|
|
|
const RigEclCellIndexCalculator cellIndexCalculator,
|
2017-02-15 05:29:36 -06:00
|
|
|
double smallContribThreshold,
|
|
|
|
bool isProducer);
|
2017-01-31 08:28:15 -06:00
|
|
|
|
2017-02-15 01:46:23 -06:00
|
|
|
RigAccWellFlowCalculator(const std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
|
|
|
|
const std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds,
|
|
|
|
double smallContribThreshold);
|
2017-01-31 08:28:15 -06:00
|
|
|
|
2017-02-17 08:48:42 -06:00
|
|
|
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;
|
2017-02-17 04:33:21 -06:00
|
|
|
const std::vector<double>& connectionNumbersFromTop(size_t branchIdx) const;
|
2017-02-17 04:13:27 -06:00
|
|
|
const std::vector<QString>& tracerNames() const { return m_tracerNames;}
|
|
|
|
|
2017-02-17 08:48:42 -06:00
|
|
|
std::vector<std::pair<QString, double> > totalTracerFractions() const;
|
2017-02-15 01:46:23 -06:00
|
|
|
|
2017-01-31 08:28:15 -06:00
|
|
|
private:
|
|
|
|
|
2017-02-17 04:13:27 -06:00
|
|
|
void calculateAccumulatedFlowPrConnection( size_t branchIdx, size_t startConnectionNumberFromTop);
|
|
|
|
void sortTracers();
|
|
|
|
void groupSmallContributions();
|
2017-02-15 01:46:23 -06:00
|
|
|
|
2017-02-17 08:48:42 -06:00
|
|
|
void groupSmallTracers(std::map<QString, std::vector<double>> &branchFlowSet,
|
|
|
|
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<std::pair<QString, double> > totalWellFlowPrTracer() const;
|
|
|
|
|
|
|
|
|
2017-02-17 04:13:27 -06:00
|
|
|
const std::vector< std::vector <cvf::Vec3d> >& m_pipeBranchesCLCoords;
|
|
|
|
const std::vector< std::vector <RigWellResultPoint> >& m_pipeBranchesCellIds;
|
|
|
|
const std::map<QString, const std::vector<double>* >* m_tracerCellFractionValues;
|
|
|
|
RigEclCellIndexCalculator m_cellIndexCalculator;
|
|
|
|
std::vector<QString> m_tracerNames;
|
|
|
|
double m_smallContributionsThreshold;
|
2017-01-31 08:28:15 -06:00
|
|
|
|
2017-02-17 04:33:21 -06:00
|
|
|
struct BranchFlow
|
2017-01-31 08:28:15 -06:00
|
|
|
{
|
2017-02-17 04:33:21 -06:00
|
|
|
std::vector<double> depthValuesFromTop;
|
2017-02-17 04:13:27 -06:00
|
|
|
std::map<QString, std::vector<double> > accFlowPrTracer;
|
|
|
|
std::map<QString, std::vector<double> > flowPrTracer;
|
|
|
|
};
|
|
|
|
|
2017-02-17 08:48:42 -06:00
|
|
|
std::vector< BranchFlow > m_connectionFlowPrBranch;
|
|
|
|
std::vector< BranchFlow > m_pseudoLengthFlowPrBranch;
|
|
|
|
std::vector< BranchFlow > m_tvdFlowPrBranch;
|
2017-01-31 08:28:15 -06:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|