2016-12-16 07:17:56 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2016- 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
|
|
|
|
|
|
|
|
#include "RigFlowDiagResultAddress.h"
|
|
|
|
|
2017-08-09 07:10:39 -05:00
|
|
|
#include "RigFlowDiagSolverInterface.h"
|
|
|
|
|
2017-03-28 02:47:06 -05:00
|
|
|
#include "RimFlowDiagSolution.h"
|
|
|
|
|
|
|
|
#include "cafPdmPointer.h"
|
2017-08-17 04:24:51 -05:00
|
|
|
#include "cafAppEnum.h"
|
2017-03-28 02:47:06 -05:00
|
|
|
|
2016-12-16 07:17:56 -06:00
|
|
|
#include "cvfBase.h"
|
|
|
|
#include "cvfObject.h"
|
2017-08-24 02:27:08 -05:00
|
|
|
#include "cvfArray.h"
|
2016-12-16 07:17:56 -06:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
|
2017-02-17 04:13:27 -06:00
|
|
|
class RigFlowDiagResultFrames;
|
|
|
|
class RigStatisticsDataCache;
|
2016-12-20 08:33:39 -06:00
|
|
|
class RigActiveCellInfo;
|
2016-12-16 07:17:56 -06:00
|
|
|
|
|
|
|
class RigFlowDiagResults: public cvf::Object
|
|
|
|
{
|
2017-08-17 04:24:51 -05:00
|
|
|
|
|
|
|
public:
|
2017-08-21 04:42:08 -05:00
|
|
|
enum CellFilter
|
2017-08-17 04:24:51 -05:00
|
|
|
{
|
|
|
|
CELLS_ACTIVE,
|
2017-08-24 02:27:08 -05:00
|
|
|
CELLS_VISIBLE,
|
2017-08-17 04:24:51 -05:00
|
|
|
CELLS_COMMUNICATION,
|
|
|
|
CELLS_FLOODED,
|
2017-08-24 02:27:08 -05:00
|
|
|
CELLS_DRAINED,
|
2017-08-17 04:24:51 -05:00
|
|
|
};
|
|
|
|
|
2017-08-21 04:42:08 -05:00
|
|
|
typedef caf::AppEnum<CellFilter> CellFilterEnum;
|
2016-12-16 07:17:56 -06:00
|
|
|
public:
|
2016-12-17 03:46:57 -06:00
|
|
|
RigFlowDiagResults(RimFlowDiagSolution* flowSolution, size_t timeStepCount);
|
2018-10-18 12:45:57 -05:00
|
|
|
~RigFlowDiagResults() override;
|
2016-12-16 07:17:56 -06:00
|
|
|
|
2017-11-16 04:52:21 -06:00
|
|
|
const std::vector<double>* resultValues(const RigFlowDiagResultAddress& resVarAddr, size_t timeStepIndex);
|
2017-01-02 07:46:12 -06:00
|
|
|
size_t timeStepCount() { return m_timeStepCount; }
|
|
|
|
const RigActiveCellInfo * activeCellInfo(const RigFlowDiagResultAddress& resVarAddr);
|
|
|
|
|
2017-11-16 04:52:21 -06:00
|
|
|
void minMaxScalarValues (const RigFlowDiagResultAddress& resVarAddr, int timeStepIndex, double* localMin, double* localMax);
|
2017-01-02 07:46:12 -06:00
|
|
|
void minMaxScalarValues (const RigFlowDiagResultAddress& resVarAddr, double* globalMin, double* globalMax);
|
2017-11-16 04:52:21 -06:00
|
|
|
void posNegClosestToZero(const RigFlowDiagResultAddress& resVarAddr, int timeStepIndex, double* localPosClosestToZero, double* localNegClosestToZero);
|
2017-01-02 07:46:12 -06:00
|
|
|
void posNegClosestToZero(const RigFlowDiagResultAddress& resVarAddr, double* globalPosClosestToZero, double* globalNegClosestToZero);
|
|
|
|
void meanScalarValue(const RigFlowDiagResultAddress& resVarAddr, double* meanValue);
|
2017-11-16 04:52:21 -06:00
|
|
|
void meanScalarValue(const RigFlowDiagResultAddress& resVarAddr, int timeStepIndex, double* meanValue);
|
2017-01-02 07:46:12 -06:00
|
|
|
void p10p90ScalarValues(const RigFlowDiagResultAddress& resVarAddr, double* p10, double* p90);
|
2017-11-16 04:52:21 -06:00
|
|
|
void p10p90ScalarValues(const RigFlowDiagResultAddress& resVarAddr, int timeStepIndex, double* p10, double* p90);
|
2017-01-02 07:46:12 -06:00
|
|
|
void sumScalarValue(const RigFlowDiagResultAddress& resVarAddr, double* sum);
|
2017-11-16 04:54:16 -06:00
|
|
|
void sumScalarValue(const RigFlowDiagResultAddress& resVarAddr, int timeStepIndex, double* sum);
|
2017-01-02 07:46:12 -06:00
|
|
|
const std::vector<size_t>& scalarValuesHistogram(const RigFlowDiagResultAddress& resVarAddr);
|
2017-11-16 04:52:21 -06:00
|
|
|
const std::vector<size_t>& scalarValuesHistogram(const RigFlowDiagResultAddress& resVarAddr, int timeStepIndex);
|
2017-01-02 07:46:12 -06:00
|
|
|
const std::vector<int>& uniqueCellScalarValues(const RigFlowDiagResultAddress& resVarAddr);
|
2017-11-16 04:52:21 -06:00
|
|
|
const std::vector<int>& uniqueCellScalarValues(const RigFlowDiagResultAddress& resVarAddr, int timeStepIndex);
|
2017-11-16 07:59:55 -06:00
|
|
|
void mobileVolumeWeightedMean(const RigFlowDiagResultAddress& resVarAddr, int timeStepIndex, double* mean);
|
2016-12-16 07:17:56 -06:00
|
|
|
|
2017-11-16 04:54:16 -06:00
|
|
|
std::pair<double, double> injectorProducerPairFluxes(const std::string& injTracername, const std::string& prodTracerName, int timeStepIndex);
|
|
|
|
double maxAbsPairFlux(int timeStepIndex);
|
2017-03-14 13:21:55 -05:00
|
|
|
|
2017-08-10 08:08:30 -05:00
|
|
|
std::vector<int> calculatedTimeSteps(RigFlowDiagResultAddress::PhaseSelection phaseSelection);
|
2017-03-24 09:10:39 -05:00
|
|
|
|
|
|
|
|
2017-11-16 04:54:16 -06:00
|
|
|
RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame flowCharacteristicsResults(int timeStepIndex,
|
2017-08-21 04:42:08 -05:00
|
|
|
CellFilter cellSelection,
|
2017-08-17 04:24:51 -05:00
|
|
|
const std::vector<QString>& tracerNames,
|
2017-08-29 09:21:19 -05:00
|
|
|
double max_pv_fraction,
|
|
|
|
double minCommunication,
|
|
|
|
int maxTof);
|
2017-03-24 09:10:39 -05:00
|
|
|
|
2017-11-16 04:54:16 -06:00
|
|
|
RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame flowCharacteristicsResults(int timeStepIndex,
|
2017-08-24 02:27:08 -05:00
|
|
|
const std::vector<char>& visibleActiveCells,
|
|
|
|
double max_pv_fraction);
|
|
|
|
|
2017-11-16 01:12:19 -06:00
|
|
|
RimFlowDiagSolution* flowDiagSolution();
|
|
|
|
|
2016-12-16 07:17:56 -06:00
|
|
|
private:
|
2017-11-16 04:54:16 -06:00
|
|
|
const std::vector<double>* findOrCalculateResult (const RigFlowDiagResultAddress& resVarAddr, size_t timeStepIndex);
|
|
|
|
void calculateNativeResultsIfNotPreviouslyAttempted(size_t timeStepIndex, RigFlowDiagResultAddress::PhaseSelection phaseSelection);
|
2017-03-14 13:21:55 -05:00
|
|
|
|
2017-11-16 04:54:16 -06:00
|
|
|
std::vector<double>* calculateDerivedResult(const RigFlowDiagResultAddress& resVarAddr, size_t timeStepIndex);
|
2017-01-02 06:34:51 -06:00
|
|
|
|
|
|
|
|
2017-01-06 07:41:00 -06:00
|
|
|
|
|
|
|
|
2017-11-16 04:54:16 -06:00
|
|
|
std::vector<double>* calculateAverageTOFResult(const RigFlowDiagResultAddress& resVarAddr, size_t timeStepIndex);
|
|
|
|
std::vector<double>* calculateSumOfFractionsResult(const RigFlowDiagResultAddress& resVarAddr, size_t timeStepIndex);
|
|
|
|
std::vector<double>* calculateTracerWithMaxFractionResult(const RigFlowDiagResultAddress &resVarAddr, size_t timeStepIndex);
|
|
|
|
std::vector<double>* calculateCommunicationResult(const RigFlowDiagResultAddress& resVarAddr, size_t timeStepIndex);
|
2017-09-05 05:01:59 -05:00
|
|
|
void calculateNumFloodedPV(const RigFlowDiagResultAddress& resVarAddr);
|
2017-01-06 07:41:00 -06:00
|
|
|
|
|
|
|
|
2017-01-02 07:46:12 -06:00
|
|
|
std::vector<const std::vector<double>* > findResultsForSelectedTracers(const RigFlowDiagResultAddress& resVarAddr,
|
2017-11-16 04:54:16 -06:00
|
|
|
size_t timeStepIndex,
|
2017-01-02 07:46:12 -06:00
|
|
|
const std::string& nativeResultName,
|
|
|
|
RimFlowDiagSolution::TracerStatusType wantedTracerType);
|
2017-03-21 09:56:36 -05:00
|
|
|
std::vector< std::pair<std::string, const std::vector<double>*> >
|
|
|
|
findNamedResultsForSelectedTracers(const RigFlowDiagResultAddress& resVarAddr,
|
2017-11-16 04:54:16 -06:00
|
|
|
size_t timeStepIndex,
|
2017-03-21 09:56:36 -05:00
|
|
|
const std::string& nativeResultName,
|
|
|
|
RimFlowDiagSolution::TracerStatusType wantedTracerType);
|
|
|
|
|
2017-01-02 07:46:12 -06:00
|
|
|
void calculateSumOfFractionAndFractionMultTOF(size_t activeCellCount,
|
|
|
|
const std::vector<const std::vector<double> *>& injectorFractions,
|
|
|
|
const std::vector<const std::vector<double> *>& injectorTOFs,
|
|
|
|
std::vector<double> *injectorTotalFractions,
|
|
|
|
std::vector<double> *injectorFractMultTof);
|
2016-12-20 04:41:05 -06:00
|
|
|
|
2017-01-02 07:46:12 -06:00
|
|
|
void calculateSumOfFractions(const std::vector<const std::vector<double> *> &fractions,
|
|
|
|
size_t activeCellCount,
|
|
|
|
std::vector<double>* sumOfFractions);
|
2016-12-17 03:46:57 -06:00
|
|
|
|
2017-01-02 07:46:12 -06:00
|
|
|
RigStatisticsDataCache* statistics(const RigFlowDiagResultAddress& resVarAddr);
|
|
|
|
|
|
|
|
RigFlowDiagResultFrames* createScalarResult(const RigFlowDiagResultAddress& resVarAddr);
|
|
|
|
RigFlowDiagResultFrames* findScalarResult (const RigFlowDiagResultAddress& resVarAddr) ;
|
2017-11-16 04:54:16 -06:00
|
|
|
std::vector<double>* findScalarResultFrame (const RigFlowDiagResultAddress& resVarAddr, size_t timeStepIndex);
|
2016-12-16 07:17:56 -06:00
|
|
|
|
2017-01-02 07:46:12 -06:00
|
|
|
//void deleteScalarResult(const RigFlowDiagResultAddress& resVarAddr);
|
2016-12-17 03:46:57 -06:00
|
|
|
|
2017-01-02 07:46:12 -06:00
|
|
|
RigFlowDiagSolverInterface* solverInterface();
|
|
|
|
|
|
|
|
size_t m_timeStepCount;
|
|
|
|
caf::PdmPointer<RimFlowDiagSolution> m_flowDiagSolution;
|
2016-12-16 07:17:56 -06:00
|
|
|
|
2017-08-10 08:08:30 -05:00
|
|
|
std::vector< std::map<RigFlowDiagResultAddress::PhaseSelection, bool > > m_hasAtemptedNativeResults;
|
2016-12-16 07:17:56 -06:00
|
|
|
|
2017-01-02 07:46:12 -06:00
|
|
|
std::map< RigFlowDiagResultAddress, cvf::ref<RigFlowDiagResultFrames> > m_resultSets;
|
|
|
|
std::map< RigFlowDiagResultAddress, cvf::ref<RigStatisticsDataCache> > m_resultStatistics;
|
2016-12-16 07:17:56 -06:00
|
|
|
|
2017-03-17 03:46:49 -05:00
|
|
|
using InjectorProducerCommunicationMap = std::map< std::pair<std::string, std::string>, std::pair<double, double> >;
|
2017-08-10 08:08:30 -05:00
|
|
|
std::vector< std::map<RigFlowDiagResultAddress::PhaseSelection, InjectorProducerCommunicationMap> > m_injProdPairFluxCommunicationTimesteps;
|
2016-12-16 07:17:56 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|