diff --git a/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp index a1d6c2beed..a3fc23a568 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp @@ -120,7 +120,7 @@ void RimFlowCharacteristicsPlot::updateCurrentTimeStep() if (!m_flowDiagSolution()) return; RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults(); - std::vector calculatedTimesteps = flowResult->calculatedTimeSteps(); + std::vector calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL); if (m_currentlyPlottedTimeSteps == calculatedTimesteps) return; @@ -172,7 +172,7 @@ QList RimFlowCharacteristicsPlot::calculateValueOptions( if ( m_flowDiagSolution ) { RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults(); - std::vector calculatedTimesteps = flowResult->calculatedTimeSteps(); + std::vector 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 calculatedTimesteps = flowResult->calculatedTimeSteps(); + std::vector calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL); if (m_timeStepSelectionType == SELECT_AVAILABLE) { diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 17be765928..e606cbea8d 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -341,7 +341,7 @@ std::map *> 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* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep); if (tracerCellFractions) tracerCellFractionValues[tracerName] = tracerCellFractions; } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index ffd376ee1f..aeeb4a6d4f 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -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(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h index 5eb61ed8bf..dcbb8720a4 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h @@ -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 m_flowSolutionUiField; + caf::PdmField< RigFlowDiagResultAddress::PhaseSelectionEnum > m_phaseSelection; caf::PdmField m_selectedTracersUiFieldFilter; caf::PdmField > m_selectedTracersUiField; diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagInterfaceTools.h b/ApplicationCode/ReservoirDataModel/RigFlowDiagInterfaceTools.h index 4a76a16929..b8b61a88c1 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagInterfaceTools.h +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagInterfaceTools.h @@ -18,6 +18,7 @@ #pragma once +#include "RigFlowDiagResultAddress.h" #include #include @@ -35,15 +36,34 @@ namespace RigFlowDiagInterfaceTools { + std::vector getPhases(RigFlowDiagResultAddress::PhaseSelection phaseSelection) + { + std::vector 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 inline Opm::FlowDiagnostics::ConnectionValues extractFluxField(const Opm::ECLGraph& G, - FluxCalc&& getFlux) + FluxCalc&& getFlux, + std::vector 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 diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.cpp b/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.cpp index e41c37d665..0469dc0ac2 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.cpp @@ -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; } diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.h b/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.h index 7b0844988e..d1a80d738d 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.h +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.h @@ -17,6 +17,8 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once +#include "cafAppEnum.h" + #include #include @@ -37,11 +39,24 @@ class RigFlowDiagResultAddress { public: - RigFlowDiagResultAddress(const std::string& aVariableName, const std::set& 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 PhaseSelectionEnum; + + RigFlowDiagResultAddress(const std::string& aVariableName, PhaseSelection phaseSelection, const std::set& 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 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; } diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.cpp b/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.cpp index 2073e0942b..e8f500c436 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.cpp @@ -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* 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* 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* > 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 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 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 RigFlowDiagResults::calculatedTimeSteps() +std::vector RigFlowDiagResults::calculatedTimeSteps(RigFlowDiagResultAddress::PhaseSelection phaseSelection) { std::vector timestepIndices; for (size_t tsIdx = 0; tsIdx < m_timeStepCount; ++tsIdx) { - if (m_hasAtemptedNativeResults[tsIdx]) timestepIndices.push_back(static_cast(tsIdx)); + auto it = m_hasAtemptedNativeResults[tsIdx].find(phaseSelection); + if (it != m_hasAtemptedNativeResults[tsIdx].end() && it->second) + { + timestepIndices.push_back(static_cast(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* injectorResults = resultValues(injectorAddress, frameIndex); const std::vector* producerResults = resultValues(producerAddress, frameIndex); diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.h b/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.h index de8f328237..2935e451fc 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.h +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.h @@ -64,14 +64,14 @@ public: std::pair injectorProducerPairFluxes(const std::string& injTracername, const std::string& prodTracerName, int frameIndex); double maxAbsPairFlux(int frameIndex); - std::vector calculatedTimeSteps(); + std::vector calculatedTimeSteps(RigFlowDiagResultAddress::PhaseSelection phaseSelection); RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame flowCharacteristicsResults(int frameIndex, double max_pv_fraction); private: const std::vector* findOrCalculateResult (const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex); - void calculateNativeResultsIfNotPreviouslyAttempted(size_t frameIndex); + void calculateNativeResultsIfNotPreviouslyAttempted(size_t frameIndex, RigFlowDiagResultAddress::PhaseSelection phaseSelection); std::vector* calculateDerivedResult(const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex); @@ -117,13 +117,13 @@ private: size_t m_timeStepCount; caf::PdmPointer m_flowDiagSolution; - std::vector m_hasAtemptedNativeResults; + std::vector< std::map > m_hasAtemptedNativeResults; std::map< RigFlowDiagResultAddress, cvf::ref > m_resultSets; std::map< RigFlowDiagResultAddress, cvf::ref > m_resultStatistics; using InjectorProducerCommunicationMap = std::map< std::pair, std::pair >; - std::vector m_injProdPairFluxCommunicationTimesteps; + std::vector< std::map > m_injProdPairFluxCommunicationTimesteps; }; diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp index 0c587adf30..3d74d710d6 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp @@ -49,12 +49,14 @@ RigFlowDiagTimeStepResult::RigFlowDiagTimeStepResult(size_t activeCellCount) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigFlowDiagTimeStepResult::setTracerTOF(const std::string& tracerName, const std::map& cellValues) +void RigFlowDiagTimeStepResult::setTracerTOF(const std::string& tracerName, + RigFlowDiagResultAddress::PhaseSelection phaseSelection, + const std::map& cellValues) { std::set 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& cellValues) +void RigFlowDiagTimeStepResult::setTracerFraction(const std::string& tracerName, + RigFlowDiagResultAddress::PhaseSelection phaseSelection, + const std::map& cellValues) { std::set 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 > injectorTracers, std::map > 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(); diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.h b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.h index 405fb1b243..eee1f75860 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.h +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.h @@ -35,8 +35,8 @@ class RigFlowDiagTimeStepResult public: explicit RigFlowDiagTimeStepResult(size_t activeCellCount); - void setTracerTOF (const std::string& tracerName, const std::map& cellValues); - void setTracerFraction(const std::string& tracerName, const std::map& cellValues); + void setTracerTOF (const std::string& tracerName, RigFlowDiagResultAddress::PhaseSelection phaseSelection, const std::map& cellValues); + void setTracerFraction(const std::string& tracerName, RigFlowDiagResultAddress::PhaseSelection phaseSelection, const std::map& cellValues); void setInjProdWellPairFlux(const std::string& injectorTracerName, const std::string& producerTracerName, const std::pair& injProdFluxes) ; @@ -80,6 +80,7 @@ public: virtual ~RigFlowDiagSolverInterface(); RigFlowDiagTimeStepResult calculate(size_t timestep, + RigFlowDiagResultAddress::PhaseSelection phaseSelection, std::map > injectorTracers, std::map > producerTracers);