#1049 Reuse Opm::ECLGraph and Opm::Flowdiagnostics::Toolbox for each timestep.

This commit is contained in:
Jacob Støren 2017-01-06 14:41:00 +01:00
parent e455529b36
commit c19fc232c8
4 changed files with 305 additions and 202 deletions

View File

@ -160,167 +160,209 @@ std::vector<double>* RigFlowDiagResults::calculateDerivedResult(const RigFlowDia
{
if (resVarAddr.isNativeResult()) return nullptr;
size_t activeCellCount = this->activeCellInfo(resVarAddr)->reservoirActiveCellCount();
if (resVarAddr.variableName == RIG_FLD_TOF_RESNAME)
{
std::vector<const std::vector<double>* > injectorTOFs = findResultsForSelectedTracers(resVarAddr, frameIndex,
RIG_FLD_TOF_RESNAME, RimFlowDiagSolution::INJECTOR);
std::vector<const std::vector<double>* > injectorFractions = findResultsForSelectedTracers(resVarAddr, frameIndex,
RIG_FLD_CELL_FRACTION_RESNAME, RimFlowDiagSolution::INJECTOR);
std::vector<const std::vector<double>* > producerTOFs = findResultsForSelectedTracers(resVarAddr, frameIndex,
RIG_FLD_TOF_RESNAME, RimFlowDiagSolution::PRODUCER);
std::vector<const std::vector<double>* > producerFractions = findResultsForSelectedTracers(resVarAddr, frameIndex,
RIG_FLD_CELL_FRACTION_RESNAME, RimFlowDiagSolution::PRODUCER);
std::vector<double> injectorTotalFractions;
std::vector<double> injectorFractMultTof;
calculateSumOfFractionAndFractionMultTOF(activeCellCount, injectorFractions, injectorTOFs, &injectorTotalFractions, &injectorFractMultTof);
std::vector<double> producerTotalFractions;
std::vector<double> producerFractMultTof;
calculateSumOfFractionAndFractionMultTOF(activeCellCount, producerFractions, producerTOFs, &producerTotalFractions, &producerFractMultTof);
RigFlowDiagResultFrames* averageTofFrames = this->createScalarResult(resVarAddr);
std::vector<double>& averageTof = averageTofFrames->frameData(frameIndex);
averageTof.resize(activeCellCount, HUGE_VAL);
for (size_t acIdx = 0 ; acIdx < activeCellCount; ++acIdx)
{
if ( injectorTotalFractions[acIdx] == 0.0 && producerTotalFractions[acIdx] == 0.0 )
{
averageTof[acIdx] = HUGE_VAL;
}
else
{
double retVal = 0.0;
if (injectorTotalFractions[acIdx] != 0.0) retVal += (1.0/injectorTotalFractions[acIdx]) * injectorFractMultTof[acIdx];
if (producerTotalFractions[acIdx] != 0.0) retVal += (1.0/producerTotalFractions[acIdx]) * producerFractMultTof[acIdx];
averageTof[acIdx] = retVal;
}
}
/// Test to remove all averaging
// if (injectorTOFs.size()) averageTof = (*injectorTOFs[0]);
return &averageTof;
return calculateAverageTOFResult(resVarAddr, frameIndex);
}
else if (resVarAddr.variableName == RIG_FLD_CELL_FRACTION_RESNAME)
{
std::vector<const std::vector<double>* > fractions = findResultsForSelectedTracers(resVarAddr,
frameIndex,
RIG_FLD_CELL_FRACTION_RESNAME,
RimFlowDiagSolution::UNDEFINED);
RigFlowDiagResultFrames* sumOfFractionsFrames = this->createScalarResult(resVarAddr);
std::vector<double>& sumOfFractions = sumOfFractionsFrames->frameData(frameIndex);
calculateSumOfFractions(fractions, activeCellCount, &sumOfFractions);
return &sumOfFractions;
return calculateSumOfFractionsResult(resVarAddr, frameIndex);
}
else if ( resVarAddr.variableName == RIG_FLD_COMMUNICATION_RESNAME )
{
std::vector<const std::vector<double>* > injectorFractions = findResultsForSelectedTracers(resVarAddr,
frameIndex,
RIG_FLD_CELL_FRACTION_RESNAME,
RimFlowDiagSolution::INJECTOR);
std::vector<const std::vector<double>* > producerFractions = findResultsForSelectedTracers(resVarAddr,
frameIndex,
RIG_FLD_CELL_FRACTION_RESNAME,
RimFlowDiagSolution::PRODUCER);
std::vector<double> sumOfInjectorFractions;
calculateSumOfFractions(injectorFractions, activeCellCount, &sumOfInjectorFractions);
std::vector<double> sumOfProducerFractions;
calculateSumOfFractions(producerFractions, activeCellCount, &sumOfProducerFractions);
RigFlowDiagResultFrames* commFrames = this->createScalarResult(resVarAddr);
std::vector<double>& commPI = commFrames->frameData(frameIndex);
commPI.resize(activeCellCount, HUGE_VAL);
for ( size_t acIdx = 0 ; acIdx < activeCellCount; ++acIdx )
{
if ( (sumOfInjectorFractions)[acIdx] == HUGE_VAL ) continue;
if ( (sumOfProducerFractions)[acIdx] == HUGE_VAL ) continue;
(commPI)[acIdx] = (sumOfInjectorFractions)[acIdx] * (sumOfProducerFractions)[acIdx];
}
return &commPI;
return calculateCommunicationResult(resVarAddr, frameIndex);
}
else if ( resVarAddr.variableName == RIG_FLD_MAX_FRACTION_TRACER_RESNAME )
{
std::vector<int> selectedTracerIdxToGlobalTracerIdx;
{
selectedTracerIdxToGlobalTracerIdx.resize(resVarAddr.selectedTracerNames.size(), -1);
std::vector<QString> allTracerNames = m_flowDiagSolution->tracerNames();
int selTracerIdx = 0;
for ( const std::string& tracerName: resVarAddr.selectedTracerNames )
{
for ( int globIdx = 0; globIdx < allTracerNames.size(); ++globIdx )
{
if ( allTracerNames[globIdx].toStdString() == tracerName )
{
selectedTracerIdxToGlobalTracerIdx[selTracerIdx] = globIdx;
break;
}
}
++selTracerIdx;
}
}
RigFlowDiagResultFrames* maxFractionTracerIdxFrames = this->createScalarResult(resVarAddr);
std::vector<double>& maxFractionTracerIdx = maxFractionTracerIdxFrames->frameData(frameIndex);
{
std::vector<const std::vector<double>* > fractions = findResultsForSelectedTracers(resVarAddr,
frameIndex,
RIG_FLD_CELL_FRACTION_RESNAME,
RimFlowDiagSolution::UNDEFINED);
maxFractionTracerIdx.resize(activeCellCount, HUGE_VAL);
std::vector<double> maxFraction;
maxFraction.resize(activeCellCount, -HUGE_VAL);
for ( size_t frIdx = 0; frIdx < fractions.size(); ++frIdx )
{
const std::vector<double> * fr = fractions[frIdx];
for ( size_t acIdx = 0 ; acIdx < activeCellCount; ++acIdx )
{
if ( (*fr)[acIdx] == HUGE_VAL) continue;
if ( maxFraction[acIdx] < (*fr)[acIdx] )
{
maxFraction[acIdx] = (*fr)[acIdx];
maxFractionTracerIdx[acIdx] = frIdx;
}
}
}
}
for ( size_t acIdx = 0 ; acIdx < activeCellCount; ++acIdx )
{
if (maxFractionTracerIdx[acIdx] == HUGE_VAL) continue;
double selectedTracerIdx = static_cast<int>( maxFractionTracerIdx[acIdx]);
maxFractionTracerIdx[acIdx] = selectedTracerIdxToGlobalTracerIdx[selectedTracerIdx];
}
return &maxFractionTracerIdx;
return calculateTracerWithMaxFractionResult(resVarAddr, frameIndex);
}
return nullptr;
}
std::vector<const std::vector<double>* > RigFlowDiagResults::findResultsForSelectedTracers(const RigFlowDiagResultAddress& resVarAddr,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double>* RigFlowDiagResults::calculateAverageTOFResult(const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex)
{
std::vector<const std::vector<double>* > injectorTOFs = findResultsForSelectedTracers(resVarAddr, frameIndex,
RIG_FLD_TOF_RESNAME, RimFlowDiagSolution::INJECTOR);
std::vector<const std::vector<double>* > injectorFractions = findResultsForSelectedTracers(resVarAddr, frameIndex,
RIG_FLD_CELL_FRACTION_RESNAME, RimFlowDiagSolution::INJECTOR);
std::vector<const std::vector<double>* > producerTOFs = findResultsForSelectedTracers(resVarAddr, frameIndex,
RIG_FLD_TOF_RESNAME, RimFlowDiagSolution::PRODUCER);
std::vector<const std::vector<double>* > producerFractions = findResultsForSelectedTracers(resVarAddr, frameIndex,
RIG_FLD_CELL_FRACTION_RESNAME, RimFlowDiagSolution::PRODUCER);
size_t activeCellCount = this->activeCellInfo(resVarAddr)->reservoirActiveCellCount();
std::vector<double> injectorTotalFractions;
std::vector<double> injectorFractMultTof;
calculateSumOfFractionAndFractionMultTOF(activeCellCount, injectorFractions, injectorTOFs, &injectorTotalFractions, &injectorFractMultTof);
std::vector<double> producerTotalFractions;
std::vector<double> producerFractMultTof;
calculateSumOfFractionAndFractionMultTOF(activeCellCount, producerFractions, producerTOFs, &producerTotalFractions, &producerFractMultTof);
RigFlowDiagResultFrames* averageTofFrames = this->createScalarResult(resVarAddr);
std::vector<double>& averageTof = averageTofFrames->frameData(frameIndex);
averageTof.resize(activeCellCount, HUGE_VAL);
for ( size_t acIdx = 0 ; acIdx < activeCellCount; ++acIdx )
{
if ( injectorTotalFractions[acIdx] == 0.0 && producerTotalFractions[acIdx] == 0.0 )
{
averageTof[acIdx] = HUGE_VAL;
}
else
{
double retVal = 0.0;
if ( injectorTotalFractions[acIdx] != 0.0 ) retVal += (1.0/injectorTotalFractions[acIdx]) * injectorFractMultTof[acIdx];
if ( producerTotalFractions[acIdx] != 0.0 ) retVal += (1.0/producerTotalFractions[acIdx]) * producerFractMultTof[acIdx];
averageTof[acIdx] = retVal;
}
}
/// Test to remove all averaging
// if (injectorTOFs.size()) averageTof = (*injectorTOFs[0]);
return &averageTof;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double>* RigFlowDiagResults::calculateSumOfFractionsResult(const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex)
{
std::vector<const std::vector<double>* > fractions = findResultsForSelectedTracers(resVarAddr,
frameIndex,
RIG_FLD_CELL_FRACTION_RESNAME,
RimFlowDiagSolution::UNDEFINED);
RigFlowDiagResultFrames* sumOfFractionsFrames = this->createScalarResult(resVarAddr);
std::vector<double>& sumOfFractions = sumOfFractionsFrames->frameData(frameIndex);
size_t activeCellCount = this->activeCellInfo(resVarAddr)->reservoirActiveCellCount();
calculateSumOfFractions(fractions, activeCellCount, &sumOfFractions);
return &sumOfFractions;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double>* RigFlowDiagResults::calculateTracerWithMaxFractionResult(const RigFlowDiagResultAddress &resVarAddr, size_t frameIndex)
{
std::vector<int> selectedTracerIdxToGlobalTracerIdx;
{
selectedTracerIdxToGlobalTracerIdx.resize(resVarAddr.selectedTracerNames.size(), -1);
std::vector<QString> allTracerNames = m_flowDiagSolution->tracerNames();
int selTracerIdx = 0;
for ( const std::string& tracerName: resVarAddr.selectedTracerNames )
{
for ( int globIdx = 0; globIdx < allTracerNames.size(); ++globIdx )
{
if ( allTracerNames[globIdx].toStdString() == tracerName )
{
selectedTracerIdxToGlobalTracerIdx[selTracerIdx] = globIdx;
break;
}
}
++selTracerIdx;
}
}
size_t activeCellCount = this->activeCellInfo(resVarAddr)->reservoirActiveCellCount();
RigFlowDiagResultFrames* maxFractionTracerIdxFrames = this->createScalarResult(resVarAddr);
std::vector<double>& maxFractionTracerIdx = maxFractionTracerIdxFrames->frameData(frameIndex);
{
std::vector<const std::vector<double>* > fractions = findResultsForSelectedTracers(resVarAddr,
frameIndex,
RIG_FLD_CELL_FRACTION_RESNAME,
RimFlowDiagSolution::UNDEFINED);
maxFractionTracerIdx.resize(activeCellCount, HUGE_VAL);
std::vector<double> maxFraction;
maxFraction.resize(activeCellCount, -HUGE_VAL);
for ( size_t frIdx = 0; frIdx < fractions.size(); ++frIdx )
{
const std::vector<double> * fr = fractions[frIdx];
for ( size_t acIdx = 0 ; acIdx < activeCellCount; ++acIdx )
{
if ( (*fr)[acIdx] == HUGE_VAL ) continue;
if ( maxFraction[acIdx] < (*fr)[acIdx] )
{
maxFraction[acIdx] = (*fr)[acIdx];
maxFractionTracerIdx[acIdx] = frIdx;
}
}
}
}
for ( size_t acIdx = 0 ; acIdx < activeCellCount; ++acIdx )
{
if ( maxFractionTracerIdx[acIdx] == HUGE_VAL ) continue;
double selectedTracerIdx = static_cast<int>(maxFractionTracerIdx[acIdx]);
maxFractionTracerIdx[acIdx] = selectedTracerIdxToGlobalTracerIdx[selectedTracerIdx];
}
return &maxFractionTracerIdx;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double>* RigFlowDiagResults::calculateCommunicationResult(const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex)
{
std::vector<const std::vector<double>* > injectorFractions = findResultsForSelectedTracers(resVarAddr,
frameIndex,
RIG_FLD_CELL_FRACTION_RESNAME,
RimFlowDiagSolution::INJECTOR);
std::vector<const std::vector<double>* > producerFractions = findResultsForSelectedTracers(resVarAddr,
frameIndex,
RIG_FLD_CELL_FRACTION_RESNAME,
RimFlowDiagSolution::PRODUCER);
size_t activeCellCount = this->activeCellInfo(resVarAddr)->reservoirActiveCellCount();
std::vector<double> sumOfInjectorFractions;
calculateSumOfFractions(injectorFractions, activeCellCount, &sumOfInjectorFractions);
std::vector<double> sumOfProducerFractions;
calculateSumOfFractions(producerFractions, activeCellCount, &sumOfProducerFractions);
RigFlowDiagResultFrames* commFrames = this->createScalarResult(resVarAddr);
std::vector<double>& commPI = commFrames->frameData(frameIndex);
commPI.resize(activeCellCount, HUGE_VAL);
for ( size_t acIdx = 0 ; acIdx < activeCellCount; ++acIdx )
{
if ( (sumOfInjectorFractions)[acIdx] == HUGE_VAL ) continue;
if ( (sumOfProducerFractions)[acIdx] == HUGE_VAL ) continue;
(commPI)[acIdx] = (sumOfInjectorFractions)[acIdx] * (sumOfProducerFractions)[acIdx];
}
return &commPI;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<const std::vector<double>* > RigFlowDiagResults::findResultsForSelectedTracers(const RigFlowDiagResultAddress& resVarAddr,
size_t frameIndex,
const std::string& nativeResultName,
RimFlowDiagSolution::TracerStatusType wantedTracerType)

View File

@ -64,6 +64,14 @@ private:
std::vector<double>* calculateDerivedResult(const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex);
std::vector<double>* calculateAverageTOFResult(const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex);
std::vector<double>* calculateSumOfFractionsResult(const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex);
std::vector<double>* calculateTracerWithMaxFractionResult(const RigFlowDiagResultAddress &resVarAddr, size_t frameIndex);
std::vector<double>* calculateCommunicationResult(const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex);
std::vector<const std::vector<double>* > findResultsForSelectedTracers(const RigFlowDiagResultAddress& resVarAddr,
size_t frameIndex,
const std::string& nativeResultName,

View File

@ -98,13 +98,26 @@ void RigFlowDiagTimeStepResult::addResult(const RigFlowDiagResultAddress& resAdd
}
}
class RigOpmFldStaticData : public cvf::Object
{
public:
RigOpmFldStaticData(const std::string& grid, const std::string& init) : eclGraph(Opm::ECLGraph::load(grid, init)), m_hasUnifiedRestartFile(false) {}
Opm::ECLGraph eclGraph;
std::unique_ptr<Opm::FlowDiagnostics::Toolbox> fldToolbox;
bool m_hasUnifiedRestartFile;
QStringList restartFileNames;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagSolverInterface::RigFlowDiagSolverInterface(RimEclipseResultCase * eclipseCase)
: m_eclipseCase(eclipseCase)
{
}
//--------------------------------------------------------------------------------------------------
@ -115,6 +128,7 @@ RigFlowDiagSolverInterface::~RigFlowDiagSolverInterface()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -126,86 +140,122 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
RigFlowDiagTimeStepResult result(m_eclipseCase->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->reservoirActiveCellCount());
// Get set of files
QString gridFileName = m_eclipseCase->gridFileName();
QStringList m_filesWithSameBaseName;
if ( !RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(gridFileName, &m_filesWithSameBaseName) ) return result;
QString initFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_INIT_FILE);
Opm::ECLGraph graph = Opm::ECLGraph::load(gridFileName.toStdString(),
initFileName.toStdString());
// Look for unified restart file
QString restartFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_UNIFIED_RESTART_FILE);
if ( restartFileName.isEmpty() )
if ( m_opmFldData.isNull() )
{
// Look for set of restart files (one file per time step)
// Get set of files
QString gridFileName = m_eclipseCase->gridFileName();
QStringList restartFileNames;
restartFileNames = RifEclipseOutputFileTools::filterFileNamesOfType(m_filesWithSameBaseName, ECL_RESTART_FILE);
QStringList m_filesWithSameBaseName;
size_t restartFileCount = static_cast<size_t>(restartFileNames.size());
size_t maxTimeStepCount = m_eclipseCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount();
if ( !RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(gridFileName, &m_filesWithSameBaseName) ) return result;
if (restartFileCount <= timeStepIndex && restartFileCount != maxTimeStepCount )
QString initFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_INIT_FILE);
m_opmFldData = new RigOpmFldStaticData(gridFileName.toStdString(),
initFileName.toStdString());
const Opm::FlowDiagnostics::ConnectivityGraph connGraph =
Opm::FlowDiagnostics::ConnectivityGraph{ static_cast<int>(m_opmFldData->eclGraph.numCells()),
m_opmFldData->eclGraph.neighbours() };
// Create the Toolbox.
m_opmFldData->fldToolbox.reset(new Opm::FlowDiagnostics::Toolbox{ connGraph });
m_opmFldData->fldToolbox->assignPoreVolume( m_opmFldData->eclGraph.poreVolume());
// Look for unified restart file
QString restartFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_UNIFIED_RESTART_FILE);
if ( !restartFileName.isEmpty() )
{
QMessageBox::critical(nullptr, "ResInsight", "Flow Diagnostics: Could not find all the restart files. Results will not be loaded.");
return result;
m_opmFldData->eclGraph.assignFluxDataSource(restartFileName.toStdString());
m_opmFldData->m_hasUnifiedRestartFile = true;
}
else
{
restartFileNames.sort(); // To make sure they are sorted in increasing *.X000N order. Hack. Should probably be actual time stored on file.
restartFileName = restartFileNames[static_cast<int>(timeStepIndex)];
m_opmFldData->restartFileNames = RifEclipseOutputFileTools::filterFileNamesOfType(m_filesWithSameBaseName, ECL_RESTART_FILE);
size_t restartFileCount = static_cast<size_t>(m_opmFldData->restartFileNames.size());
size_t maxTimeStepCount = m_eclipseCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount();
if (restartFileCount <= timeStepIndex && restartFileCount != maxTimeStepCount )
{
QMessageBox::critical(nullptr, "ResInsight", "Flow Diagnostics: Could not find all the restart files. Results will not be loaded.");
return result;
}
m_opmFldData->restartFileNames.sort(); // To make sure they are sorted in increasing *.X000N order. Hack. Should probably be actual time stored on file.
m_opmFldData->m_hasUnifiedRestartFile = false;
}
}
graph.assignFluxDataSource(restartFileName.toStdString());
if ( ! graph.selectReportStep(static_cast<int>(timeStepIndex)) )
if ( ! m_opmFldData->m_hasUnifiedRestartFile )
{
QString restartFileName = m_opmFldData->restartFileNames[static_cast<int>(timeStepIndex)];
m_opmFldData->eclGraph.assignFluxDataSource(restartFileName.toStdString());
}
if ( ! m_opmFldData->eclGraph.selectReportStep(static_cast<int>(timeStepIndex)) )
{
QMessageBox::critical(nullptr, "ResInsight", "Flow Diagnostics: Could not find the requested timestep in the result file. Results will not be loaded.");
return result;
}
// Set up flow Toolbox with timestep data
{
Toolbox fdTool = RigFlowDiagInterfaceTools::initialiseFlowDiagnostics(graph);
Opm::FlowDiagnostics::ConnectionValues connectionsVals = RigFlowDiagInterfaceTools::Hack::convert_flux_to_SI( RigFlowDiagInterfaceTools::extractFluxField(m_opmFldData->eclGraph));
m_opmFldData->fldToolbox->assignConnectionFlux(connectionsVals);
Opm::ECLWellSolution wsol = Opm::ECLWellSolution{};
const std::vector<Opm::ECLWellSolution::WellData> well_fluxes =
wsol.solution(m_opmFldData->eclGraph.rawResultData(), m_opmFldData->eclGraph.numGrids());
m_opmFldData->fldToolbox->assignInflowFlux(RigFlowDiagInterfaceTools::extractWellFlows(m_opmFldData->eclGraph, well_fluxes));
}
// Injection Solution
{
std::vector<CellSet> injectorCellSet;
for ( const auto& tIt: injectorTracers )
{
std::vector<CellSet> injectorCellSet;
for ( const auto& tIt: injectorTracers )
{
injectorCellSet.push_back(CellSet(CellSetID(tIt.first), tIt.second));
}
Solution injSol = fdTool.computeInjectionDiagnostics(injectorCellSet).fd;
for ( const CellSetID& tracerId: injSol.startPoints() )
{
CellSetValues tofVals = injSol.timeOfFlight(tracerId);
result.setInjectorTracerTOF(tracerId.to_string(), tofVals);
CellSetValues fracVals = injSol.concentration(tracerId);
result.setInjectorTracerFraction(tracerId.to_string(), fracVals);
}
injectorCellSet.push_back(CellSet(CellSetID(tIt.first), tIt.second));
}
Solution injSol = m_opmFldData->fldToolbox->computeInjectionDiagnostics(injectorCellSet).fd;
for ( const CellSetID& tracerId: injSol.startPoints() )
{
std::vector<CellSet> prodjCellSet;
for ( const auto& tIt: producerTracers )
{
prodjCellSet.push_back(CellSet(CellSetID(tIt.first), tIt.second));
}
Solution prodSol = fdTool.computeProductionDiagnostics(prodjCellSet).fd;
for ( const CellSetID& tracerId: prodSol.startPoints() )
{
CellSetValues tofVals = prodSol.timeOfFlight(tracerId);
result.setProducerTracerTOF(tracerId.to_string(), tofVals);
CellSetValues fracVals = prodSol.concentration(tracerId);
result.setInjectorTracerFraction(tracerId.to_string(), fracVals);
}
CellSetValues tofVals = injSol.timeOfFlight(tracerId);
result.setInjectorTracerTOF(tracerId.to_string(), tofVals);
CellSetValues fracVals = injSol.concentration(tracerId);
result.setInjectorTracerFraction(tracerId.to_string(), fracVals);
}
}
// Producer Solution
{
std::vector<CellSet> prodjCellSet;
for ( const auto& tIt: producerTracers )
{
prodjCellSet.push_back(CellSet(CellSetID(tIt.first), tIt.second));
}
Solution prodSol = m_opmFldData->fldToolbox->computeProductionDiagnostics(prodjCellSet).fd;
for ( const CellSetID& tracerId: prodSol.startPoints() )
{
CellSetValues tofVals = prodSol.timeOfFlight(tracerId);
result.setProducerTracerTOF(tracerId.to_string(), tofVals);
CellSetValues fracVals = prodSol.concentration(tracerId);
result.setInjectorTracerFraction(tracerId.to_string(), fracVals);
}
}
return result; // Relying on implicit move constructor
}

View File

@ -52,6 +52,7 @@ private:
class RigCaseData;
class RigOpmFldStaticData;
class RigFlowDiagSolverInterface : public cvf::Object
{
@ -66,6 +67,8 @@ public:
private:
RimEclipseResultCase * m_eclipseCase;
cvf::ref<RigOpmFldStaticData> m_opmFldData;
};