mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1202 Flow: Handle separate phase solutions
This commit is contained in:
parent
03480c38c4
commit
efb79ac753
@ -120,7 +120,7 @@ void RimFlowCharacteristicsPlot::updateCurrentTimeStep()
|
||||
if (!m_flowDiagSolution()) return;
|
||||
|
||||
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
|
||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps();
|
||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
|
||||
|
||||
if (m_currentlyPlottedTimeSteps == calculatedTimesteps) return;
|
||||
|
||||
@ -172,7 +172,7 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
|
||||
if ( m_flowDiagSolution )
|
||||
{
|
||||
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
|
||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps();
|
||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
|
||||
|
||||
QStringList timeStepDates = m_case->timeStepStrings();
|
||||
|
||||
@ -264,7 +264,7 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate()
|
||||
if (m_flowDiagSolution && m_flowCharPlotWidget)
|
||||
{
|
||||
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
|
||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps();
|
||||
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL);
|
||||
|
||||
if (m_timeStepSelectionType == SELECT_AVAILABLE)
|
||||
{
|
||||
|
@ -341,7 +341,7 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
|
||||
{
|
||||
if ( m_flowDiagSolution->tracerStatusInTimeStep(tracerName, m_timeStep) == requestedTracerType )
|
||||
{
|
||||
RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, tracerName.toStdString());
|
||||
RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, RigFlowDiagResultAddress::PHASE_ALL, tracerName.toStdString());
|
||||
const std::vector<double>* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep);
|
||||
if (tracerCellFractions) tracerCellFractionValues[tracerName] = tracerCellFractions;
|
||||
}
|
||||
|
@ -82,6 +82,7 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
|
||||
m_selectedTracers.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowTracerSelectionMode, "FlowTracerSelectionMode", "Tracers", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_phaseSelection, "PhaseSelection", "Phases", "", "", "");
|
||||
|
||||
// Ui only fields
|
||||
|
||||
@ -131,6 +132,7 @@ void RimEclipseResultDefinition::simpleCopy(const RimEclipseResultDefinition* ot
|
||||
this->setFlowSolution(other->m_flowSolution());
|
||||
this->setSelectedTracers(other->m_selectedTracers());
|
||||
m_flowTracerSelectionMode = other->m_flowTracerSelectionMode();
|
||||
m_phaseSelection = other->m_phaseSelection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -239,6 +241,11 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
if (&m_phaseSelection == changedField)
|
||||
{
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
if (&m_selectedTracersUiFieldFilter == changedField)
|
||||
{
|
||||
auto visibleTracerNames = tracerNamesMatchingFilter();
|
||||
@ -713,7 +720,7 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
|
||||
}
|
||||
}
|
||||
|
||||
return RigFlowDiagResultAddress(m_resultVariable().toStdString(), selTracerNames);
|
||||
return RigFlowDiagResultAddress(m_resultVariable().toStdString(), m_phaseSelection(), selTracerNames);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1020,6 +1027,8 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
|
||||
uiOrdering.add(&m_selectedTracersUiField);
|
||||
}
|
||||
|
||||
uiOrdering.add(&m_phaseSelection);
|
||||
|
||||
if ( m_flowSolution() == nullptr )
|
||||
{
|
||||
assignFlowSolutionFromCase();
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "RigFlowDiagResultAddress.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
@ -33,7 +35,6 @@ class RimEclipseCase;
|
||||
class RimEclipseView;
|
||||
class RimReservoirCellResultsStorage;
|
||||
class RimFlowDiagSolution;
|
||||
class RigFlowDiagResultAddress;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
@ -124,6 +125,7 @@ protected:
|
||||
|
||||
caf::PdmField< caf::AppEnum< FlowTracerSelectionType > > m_flowTracerSelectionMode;
|
||||
caf::PdmPtrField<RimFlowDiagSolution*> m_flowSolutionUiField;
|
||||
caf::PdmField< RigFlowDiagResultAddress::PhaseSelectionEnum > m_phaseSelection;
|
||||
|
||||
caf::PdmField<QString> m_selectedTracersUiFieldFilter;
|
||||
caf::PdmField<std::vector<QString> > m_selectedTracersUiField;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RigFlowDiagResultAddress.h"
|
||||
|
||||
#include <opm/flowdiagnostics/ConnectivityGraph.hpp>
|
||||
#include <opm/flowdiagnostics/ConnectionValues.hpp>
|
||||
@ -35,15 +36,34 @@
|
||||
|
||||
namespace RigFlowDiagInterfaceTools {
|
||||
|
||||
std::vector<Opm::ECLPhaseIndex> getPhases(RigFlowDiagResultAddress::PhaseSelection phaseSelection)
|
||||
{
|
||||
std::vector<Opm::ECLPhaseIndex> phases;
|
||||
|
||||
if (phaseSelection & RigFlowDiagResultAddress::PHASE_GAS)
|
||||
{
|
||||
phases.push_back(Opm::ECLPhaseIndex::Vapour);
|
||||
}
|
||||
if (phaseSelection & RigFlowDiagResultAddress::PHASE_OIL)
|
||||
{
|
||||
phases.push_back(Opm::ECLPhaseIndex::Liquid);
|
||||
}
|
||||
if (phaseSelection & RigFlowDiagResultAddress::PHASE_WAT)
|
||||
{
|
||||
phases.push_back(Opm::ECLPhaseIndex::Aqua);
|
||||
}
|
||||
|
||||
return phases;
|
||||
}
|
||||
|
||||
template <class FluxCalc>
|
||||
inline Opm::FlowDiagnostics::ConnectionValues
|
||||
extractFluxField(const Opm::ECLGraph& G,
|
||||
FluxCalc&& getFlux)
|
||||
FluxCalc&& getFlux,
|
||||
std::vector<Opm::ECLPhaseIndex> actPh)
|
||||
{
|
||||
using ConnVals = Opm::FlowDiagnostics::ConnectionValues;
|
||||
|
||||
const auto actPh = G.activePhases();
|
||||
|
||||
auto flux = ConnVals(ConnVals::NumConnections{ G.numConnections() },
|
||||
ConnVals::NumPhases{ actPh.size() });
|
||||
|
||||
@ -70,7 +90,8 @@ namespace RigFlowDiagInterfaceTools {
|
||||
|
||||
inline Opm::FlowDiagnostics::ConnectionValues
|
||||
extractFluxFieldFromRestartFile(const Opm::ECLGraph& G,
|
||||
const Opm::ECLRestartData& rstrt)
|
||||
const Opm::ECLRestartData& rstrt,
|
||||
RigFlowDiagResultAddress::PhaseSelection phaseSelection)
|
||||
{
|
||||
auto getFlux = [&G, &rstrt]
|
||||
(const Opm::ECLPhaseIndex p)
|
||||
@ -78,13 +99,14 @@ namespace RigFlowDiagInterfaceTools {
|
||||
return G.flux(rstrt, p);
|
||||
};
|
||||
|
||||
return extractFluxField(G, getFlux);
|
||||
return extractFluxField(G, getFlux, getPhases(phaseSelection));
|
||||
}
|
||||
|
||||
inline Opm::FlowDiagnostics::ConnectionValues
|
||||
calculateFluxField(const Opm::ECLGraph& G,
|
||||
const Opm::ECLInitFileData& init,
|
||||
const Opm::ECLRestartData& rstrt)
|
||||
const Opm::ECLRestartData& rstrt,
|
||||
RigFlowDiagResultAddress::PhaseSelection phaseSelection)
|
||||
{
|
||||
auto satfunc = Opm::ECLSaturationFunc(G, init);
|
||||
|
||||
@ -96,7 +118,7 @@ namespace RigFlowDiagInterfaceTools {
|
||||
return calc.flux(rstrt, p);
|
||||
};
|
||||
|
||||
return extractFluxField(G, getFlux);
|
||||
return extractFluxField(G, getFlux, getPhases(phaseSelection));
|
||||
}
|
||||
|
||||
template <class WellFluxes>
|
||||
|
@ -18,6 +18,19 @@
|
||||
|
||||
#include "RigFlowDiagResultAddress.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void RigFlowDiagResultAddress::PhaseSelectionEnum::setUp()
|
||||
{
|
||||
addItem(RigFlowDiagResultAddress::PHASE_ALL, "PHASE_ALL", "All");
|
||||
addItem(RigFlowDiagResultAddress::PHASE_OIL, "PHASE_OIL", "Oil");
|
||||
addItem(RigFlowDiagResultAddress::PHASE_GAS, "PHASE_GAS", "Gas");
|
||||
addItem(RigFlowDiagResultAddress::PHASE_WAT, "PHASE_WAT", "Water");
|
||||
|
||||
setDefault(RigFlowDiagResultAddress::PHASE_ALL);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -35,6 +48,10 @@ std::string RigFlowDiagResultAddress::uiText() const
|
||||
std::string uiVarname = variableName;
|
||||
|
||||
std::string uitext = uiVarname;
|
||||
if (phaseSelection != PHASE_ALL)
|
||||
{
|
||||
uitext += " (" + RigFlowDiagResultAddress::PhaseSelectionEnum(phaseSelection).uiText().toStdString() + ")";
|
||||
}
|
||||
uitext += " (";
|
||||
for (const std::string& tracerName : selectedTracerNames)
|
||||
{
|
||||
@ -49,6 +66,11 @@ std::string RigFlowDiagResultAddress::uiText() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RigFlowDiagResultAddress::uiShortText() const
|
||||
{
|
||||
return variableName;
|
||||
std::string uitext = variableName;
|
||||
if (phaseSelection != PHASE_ALL)
|
||||
{
|
||||
uitext += " (" + RigFlowDiagResultAddress::PhaseSelectionEnum(phaseSelection).uiText().toStdString() + ")";
|
||||
}
|
||||
return uitext;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include <string>
|
||||
#include <set>
|
||||
|
||||
@ -37,11 +39,24 @@ class RigFlowDiagResultAddress
|
||||
{
|
||||
|
||||
public:
|
||||
RigFlowDiagResultAddress(const std::string& aVariableName, const std::set<std::string>& someSelectedTracerNames)
|
||||
: variableName(aVariableName), selectedTracerNames(someSelectedTracerNames) {}
|
||||
enum PhaseSelection
|
||||
{
|
||||
PHASE_ALL = 0b111,
|
||||
PHASE_OIL = 0b001,
|
||||
PHASE_GAS = 0b010,
|
||||
PHASE_WAT = 0b100,
|
||||
};
|
||||
|
||||
RigFlowDiagResultAddress(const std::string& aVariableName, const std::string& tracerName)
|
||||
: variableName(aVariableName)
|
||||
typedef caf::AppEnum<PhaseSelection> PhaseSelectionEnum;
|
||||
|
||||
RigFlowDiagResultAddress(const std::string& aVariableName, PhaseSelection phaseSelection, const std::set<std::string>& someSelectedTracerNames)
|
||||
: variableName(aVariableName),
|
||||
phaseSelection(phaseSelection),
|
||||
selectedTracerNames(someSelectedTracerNames) {}
|
||||
|
||||
RigFlowDiagResultAddress(const std::string& aVariableName, PhaseSelection phaseSelection, const std::string& tracerName)
|
||||
: variableName(aVariableName),
|
||||
phaseSelection(phaseSelection)
|
||||
{
|
||||
selectedTracerNames.insert(tracerName);
|
||||
}
|
||||
@ -53,6 +68,7 @@ public:
|
||||
|
||||
std::string variableName;
|
||||
std::set<std::string> selectedTracerNames;
|
||||
PhaseSelection phaseSelection;
|
||||
|
||||
bool operator< (const RigFlowDiagResultAddress& other) const
|
||||
{
|
||||
@ -60,6 +76,10 @@ public:
|
||||
{
|
||||
return selectedTracerNames < other.selectedTracerNames;
|
||||
}
|
||||
if (phaseSelection != other.phaseSelection)
|
||||
{
|
||||
return phaseSelection < other.phaseSelection;
|
||||
}
|
||||
|
||||
return variableName < other.variableName;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ RigFlowDiagResults::RigFlowDiagResults(RimFlowDiagSolution* flowSolution, size_t
|
||||
{
|
||||
|
||||
m_timeStepCount = timeStepCount;
|
||||
m_hasAtemptedNativeResults.resize(timeStepCount, false);
|
||||
m_hasAtemptedNativeResults.resize(timeStepCount);
|
||||
m_injProdPairFluxCommunicationTimesteps.resize(timeStepCount);
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ const std::vector<double>* RigFlowDiagResults::findOrCalculateResult(const RigFl
|
||||
|
||||
if (!solverInterface()) return nullptr;
|
||||
|
||||
calculateNativeResultsIfNotPreviouslyAttempted(frameIndex);
|
||||
calculateNativeResultsIfNotPreviouslyAttempted(frameIndex, resVarAddr.phaseSelection);
|
||||
|
||||
return findScalarResultFrame(resVarAddr, frameIndex);
|
||||
}
|
||||
@ -99,12 +99,14 @@ const std::vector<double>* RigFlowDiagResults::findOrCalculateResult(const RigFl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFlowDiagResults::calculateNativeResultsIfNotPreviouslyAttempted(size_t frameIndex)
|
||||
void RigFlowDiagResults::calculateNativeResultsIfNotPreviouslyAttempted(size_t frameIndex, RigFlowDiagResultAddress::PhaseSelection phaseSelection)
|
||||
{
|
||||
if ( !m_hasAtemptedNativeResults[frameIndex] )
|
||||
auto it = m_hasAtemptedNativeResults[frameIndex].find(phaseSelection);
|
||||
if ( it == m_hasAtemptedNativeResults[frameIndex].end() || !it->second )
|
||||
{
|
||||
|
||||
RigFlowDiagTimeStepResult nativeTimestepResults = solverInterface()->calculate(frameIndex,
|
||||
phaseSelection,
|
||||
m_flowDiagSolution->allInjectorTracerActiveCellIndices(frameIndex),
|
||||
m_flowDiagSolution->allProducerTracerActiveCellIndices(frameIndex));
|
||||
|
||||
@ -118,9 +120,9 @@ void RigFlowDiagResults::calculateNativeResultsIfNotPreviouslyAttempted(size_t f
|
||||
nativeResFrames->frameData(frameIndex).swap(resIt.second);
|
||||
}
|
||||
|
||||
m_injProdPairFluxCommunicationTimesteps[frameIndex].swap(nativeTimestepResults.injProdWellPairFluxes());
|
||||
m_injProdPairFluxCommunicationTimesteps[frameIndex][phaseSelection].swap(nativeTimestepResults.injProdWellPairFluxes());
|
||||
|
||||
m_hasAtemptedNativeResults[frameIndex] = true;
|
||||
m_hasAtemptedNativeResults[frameIndex][phaseSelection] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -421,7 +423,7 @@ std::vector<const std::vector<double>* > RigFlowDiagResults::findResultsForSelec
|
||||
if (tracerType != RimFlowDiagSolution::CLOSED
|
||||
&& ( tracerType == wantedTracerType || wantedTracerType == RimFlowDiagSolution::UNDEFINED) )
|
||||
{
|
||||
selectedTracersResults.push_back(findOrCalculateResult(RigFlowDiagResultAddress(nativeResultName, tracerName), frameIndex));
|
||||
selectedTracersResults.push_back(findOrCalculateResult(RigFlowDiagResultAddress(nativeResultName, resVarAddr.phaseSelection, tracerName), frameIndex));
|
||||
}
|
||||
}
|
||||
|
||||
@ -448,7 +450,7 @@ RigFlowDiagResults::findNamedResultsForSelectedTracers(const RigFlowDiagResultAd
|
||||
if (tracerType != RimFlowDiagSolution::CLOSED
|
||||
&& ( tracerType == wantedTracerType || wantedTracerType == RimFlowDiagSolution::UNDEFINED) )
|
||||
{
|
||||
selectedTracersResults.push_back(std::make_pair(tracerName, findOrCalculateResult(RigFlowDiagResultAddress(nativeResultName, tracerName), frameIndex)));
|
||||
selectedTracersResults.push_back(std::make_pair(tracerName, findOrCalculateResult(RigFlowDiagResultAddress(nativeResultName, resVarAddr.phaseSelection, tracerName), frameIndex)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -625,10 +627,10 @@ std::pair<double, double> RigFlowDiagResults::injectorProducerPairFluxes(const s
|
||||
const std::string& prodTracerName,
|
||||
int frameIndex)
|
||||
{
|
||||
calculateNativeResultsIfNotPreviouslyAttempted(frameIndex);
|
||||
calculateNativeResultsIfNotPreviouslyAttempted(frameIndex, RigFlowDiagResultAddress::PHASE_ALL);
|
||||
|
||||
auto commPair = m_injProdPairFluxCommunicationTimesteps[frameIndex].find(std::make_pair(injTracername, prodTracerName));
|
||||
if (commPair != m_injProdPairFluxCommunicationTimesteps[frameIndex].end())
|
||||
auto commPair = m_injProdPairFluxCommunicationTimesteps[frameIndex][RigFlowDiagResultAddress::PHASE_ALL].find(std::make_pair(injTracername, prodTracerName));
|
||||
if (commPair != m_injProdPairFluxCommunicationTimesteps[frameIndex][RigFlowDiagResultAddress::PHASE_ALL].end())
|
||||
{
|
||||
return commPair->second;
|
||||
}
|
||||
@ -643,10 +645,10 @@ std::pair<double, double> RigFlowDiagResults::injectorProducerPairFluxes(const s
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigFlowDiagResults::maxAbsPairFlux(int frameIndex)
|
||||
{
|
||||
calculateNativeResultsIfNotPreviouslyAttempted(frameIndex);
|
||||
calculateNativeResultsIfNotPreviouslyAttempted(frameIndex, RigFlowDiagResultAddress::PHASE_ALL);
|
||||
double maxFlux = 0.0;
|
||||
|
||||
for (const auto& commPair : m_injProdPairFluxCommunicationTimesteps[frameIndex])
|
||||
for (const auto& commPair : m_injProdPairFluxCommunicationTimesteps[frameIndex][RigFlowDiagResultAddress::PHASE_ALL])
|
||||
{
|
||||
if (fabs(commPair.second.first) > maxFlux ) maxFlux = fabs(commPair.second.first);
|
||||
if (fabs(commPair.second.second) > maxFlux ) maxFlux = fabs(commPair.second.second);
|
||||
@ -658,12 +660,16 @@ double RigFlowDiagResults::maxAbsPairFlux(int frameIndex)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<int> RigFlowDiagResults::calculatedTimeSteps()
|
||||
std::vector<int> RigFlowDiagResults::calculatedTimeSteps(RigFlowDiagResultAddress::PhaseSelection phaseSelection)
|
||||
{
|
||||
std::vector<int> timestepIndices;
|
||||
for (size_t tsIdx = 0; tsIdx < m_timeStepCount; ++tsIdx)
|
||||
{
|
||||
if (m_hasAtemptedNativeResults[tsIdx]) timestepIndices.push_back(static_cast<int>(tsIdx));
|
||||
auto it = m_hasAtemptedNativeResults[tsIdx].find(phaseSelection);
|
||||
if (it != m_hasAtemptedNativeResults[tsIdx].end() && it->second)
|
||||
{
|
||||
timestepIndices.push_back(static_cast<int>(tsIdx));
|
||||
}
|
||||
}
|
||||
|
||||
return timestepIndices;
|
||||
@ -692,8 +698,8 @@ RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame RigFlowDiagResults::f
|
||||
}
|
||||
}
|
||||
|
||||
RigFlowDiagResultAddress injectorAddress(RIG_FLD_TOF_RESNAME, injectorNames);
|
||||
RigFlowDiagResultAddress producerAddress(RIG_FLD_TOF_RESNAME, producerNames);
|
||||
RigFlowDiagResultAddress injectorAddress(RIG_FLD_TOF_RESNAME, RigFlowDiagResultAddress::PHASE_ALL, injectorNames);
|
||||
RigFlowDiagResultAddress producerAddress(RIG_FLD_TOF_RESNAME, RigFlowDiagResultAddress::PHASE_ALL, producerNames);
|
||||
|
||||
const std::vector<double>* injectorResults = resultValues(injectorAddress, frameIndex);
|
||||
const std::vector<double>* producerResults = resultValues(producerAddress, frameIndex);
|
||||
|
@ -64,14 +64,14 @@ public:
|
||||
std::pair<double, double> injectorProducerPairFluxes(const std::string& injTracername, const std::string& prodTracerName, int frameIndex);
|
||||
double maxAbsPairFlux(int frameIndex);
|
||||
|
||||
std::vector<int> calculatedTimeSteps();
|
||||
std::vector<int> calculatedTimeSteps(RigFlowDiagResultAddress::PhaseSelection phaseSelection);
|
||||
|
||||
|
||||
RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame flowCharacteristicsResults(int frameIndex, double max_pv_fraction);
|
||||
|
||||
private:
|
||||
const std::vector<double>* findOrCalculateResult (const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex);
|
||||
void calculateNativeResultsIfNotPreviouslyAttempted(size_t frameIndex);
|
||||
void calculateNativeResultsIfNotPreviouslyAttempted(size_t frameIndex, RigFlowDiagResultAddress::PhaseSelection phaseSelection);
|
||||
|
||||
std::vector<double>* calculateDerivedResult(const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex);
|
||||
|
||||
@ -117,13 +117,13 @@ private:
|
||||
size_t m_timeStepCount;
|
||||
caf::PdmPointer<RimFlowDiagSolution> m_flowDiagSolution;
|
||||
|
||||
std::vector<bool> m_hasAtemptedNativeResults;
|
||||
std::vector< std::map<RigFlowDiagResultAddress::PhaseSelection, bool > > m_hasAtemptedNativeResults;
|
||||
|
||||
std::map< RigFlowDiagResultAddress, cvf::ref<RigFlowDiagResultFrames> > m_resultSets;
|
||||
std::map< RigFlowDiagResultAddress, cvf::ref<RigStatisticsDataCache> > m_resultStatistics;
|
||||
|
||||
using InjectorProducerCommunicationMap = std::map< std::pair<std::string, std::string>, std::pair<double, double> >;
|
||||
std::vector<InjectorProducerCommunicationMap> m_injProdPairFluxCommunicationTimesteps;
|
||||
std::vector< std::map<RigFlowDiagResultAddress::PhaseSelection, InjectorProducerCommunicationMap> > m_injProdPairFluxCommunicationTimesteps;
|
||||
};
|
||||
|
||||
|
||||
|
@ -49,12 +49,14 @@ RigFlowDiagTimeStepResult::RigFlowDiagTimeStepResult(size_t activeCellCount)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFlowDiagTimeStepResult::setTracerTOF(const std::string& tracerName, const std::map<int, double>& cellValues)
|
||||
void RigFlowDiagTimeStepResult::setTracerTOF(const std::string& tracerName,
|
||||
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
|
||||
const std::map<int, double>& cellValues)
|
||||
{
|
||||
std::set<std::string> tracers;
|
||||
tracers.insert(tracerName);
|
||||
|
||||
RigFlowDiagResultAddress resAddr(RIG_FLD_TOF_RESNAME, tracers);
|
||||
RigFlowDiagResultAddress resAddr(RIG_FLD_TOF_RESNAME, phaseSelection, tracers);
|
||||
|
||||
this->addResult(resAddr, cellValues);
|
||||
|
||||
@ -68,12 +70,14 @@ void RigFlowDiagTimeStepResult::setTracerTOF(const std::string& tracerName, cons
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFlowDiagTimeStepResult::setTracerFraction(const std::string& tracerName, const std::map<int, double>& cellValues)
|
||||
void RigFlowDiagTimeStepResult::setTracerFraction(const std::string& tracerName,
|
||||
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
|
||||
const std::map<int, double>& cellValues)
|
||||
{
|
||||
std::set<std::string> tracers;
|
||||
tracers.insert(tracerName);
|
||||
|
||||
this->addResult(RigFlowDiagResultAddress(RIG_FLD_CELL_FRACTION_RESNAME, tracers), cellValues);
|
||||
this->addResult(RigFlowDiagResultAddress(RIG_FLD_CELL_FRACTION_RESNAME, phaseSelection, tracers), cellValues);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -148,6 +152,7 @@ RigFlowDiagSolverInterface::~RigFlowDiagSolverInterface()
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepIndex,
|
||||
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
|
||||
std::map<std::string, std::vector<int> > injectorTracers,
|
||||
std::map<std::string, std::vector<int> > producerTracers)
|
||||
{
|
||||
@ -254,13 +259,14 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
||||
if (m_eclipseCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes())
|
||||
{
|
||||
Opm::FlowDiagnostics::ConnectionValues connectionsVals = RigFlowDiagInterfaceTools::extractFluxFieldFromRestartFile(*(m_opmFlowDiagStaticData->m_eclGraph),
|
||||
*currentRestartData);
|
||||
*currentRestartData,
|
||||
phaseSelection);
|
||||
m_opmFlowDiagStaticData->m_fldToolbox->assignConnectionFlux(connectionsVals);
|
||||
}
|
||||
else
|
||||
{
|
||||
Opm::ECLInitFileData init(getInitFileName());
|
||||
Opm::FlowDiagnostics::ConnectionValues connectionVals = RigFlowDiagInterfaceTools::calculateFluxField((*m_opmFlowDiagStaticData->m_eclGraph), init, *currentRestartData);
|
||||
Opm::FlowDiagnostics::ConnectionValues connectionVals = RigFlowDiagInterfaceTools::calculateFluxField((*m_opmFlowDiagStaticData->m_eclGraph), init, *currentRestartData, phaseSelection);
|
||||
m_opmFlowDiagStaticData->m_fldToolbox->assignConnectionFlux(connectionVals);
|
||||
}
|
||||
|
||||
@ -343,9 +349,9 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
||||
for ( const CellSetID& tracerId: injectorSolution->fd.startPoints() )
|
||||
{
|
||||
CellSetValues tofVals = injectorSolution->fd.timeOfFlight(tracerId);
|
||||
result.setTracerTOF(tracerId.to_string(), tofVals);
|
||||
result.setTracerTOF(tracerId.to_string(), phaseSelection, tofVals);
|
||||
CellSetValues fracVals = injectorSolution->fd.concentration(tracerId);
|
||||
result.setTracerFraction(tracerId.to_string(), fracVals);
|
||||
result.setTracerFraction(tracerId.to_string(), phaseSelection, fracVals);
|
||||
}
|
||||
|
||||
progressInfo.incrementProgress();
|
||||
@ -373,9 +379,9 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
||||
for ( const CellSetID& tracerId: producerSolution->fd.startPoints() )
|
||||
{
|
||||
CellSetValues tofVals = producerSolution->fd.timeOfFlight(tracerId);
|
||||
result.setTracerTOF(tracerId.to_string(), tofVals);
|
||||
result.setTracerTOF(tracerId.to_string(), phaseSelection, tofVals);
|
||||
CellSetValues fracVals = producerSolution->fd.concentration(tracerId);
|
||||
result.setTracerFraction(tracerId.to_string(), fracVals);
|
||||
result.setTracerFraction(tracerId.to_string(), phaseSelection, fracVals);
|
||||
}
|
||||
|
||||
progressInfo.incrementProgress();
|
||||
|
@ -35,8 +35,8 @@ class RigFlowDiagTimeStepResult
|
||||
public:
|
||||
explicit RigFlowDiagTimeStepResult(size_t activeCellCount);
|
||||
|
||||
void setTracerTOF (const std::string& tracerName, const std::map<int, double>& cellValues);
|
||||
void setTracerFraction(const std::string& tracerName, const std::map<int, double>& cellValues);
|
||||
void setTracerTOF (const std::string& tracerName, RigFlowDiagResultAddress::PhaseSelection phaseSelection, const std::map<int, double>& cellValues);
|
||||
void setTracerFraction(const std::string& tracerName, RigFlowDiagResultAddress::PhaseSelection phaseSelection, const std::map<int, double>& cellValues);
|
||||
void setInjProdWellPairFlux(const std::string& injectorTracerName,
|
||||
const std::string& producerTracerName,
|
||||
const std::pair<double, double>& injProdFluxes) ;
|
||||
@ -80,6 +80,7 @@ public:
|
||||
virtual ~RigFlowDiagSolverInterface();
|
||||
|
||||
RigFlowDiagTimeStepResult calculate(size_t timestep,
|
||||
RigFlowDiagResultAddress::PhaseSelection phaseSelection,
|
||||
std::map<std::string, std::vector<int> > injectorTracers,
|
||||
std::map<std::string, std::vector<int> > producerTracers);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user