#1304 Absolute simplest fix to make things run. Remove tracer on connection cells iif well flow for cell has inconsistent direction with the with the sum of well fluxes in the same cell.

This commit is contained in:
Jacob Støren 2017-03-09 16:05:48 +01:00
parent b60139c558
commit 5d0df1c86f
2 changed files with 40 additions and 4 deletions

View File

@ -64,7 +64,10 @@ namespace RigFlowDiagInterfaceTools {
const auto& ijk = completion.ijk;
const int cell_index = G.activeCell(ijk, grid_index);
if (cell_index >= 0) {
inflow.emplace(cell_index, completion.reservoir_inflow_rate);
auto iterIsInsertedPair = inflow.emplace(cell_index, completion.reservoir_inflow_rate);
if (!iterIsInsertedPair.second){ // Not inserted, We had something there already
iterIsInsertedPair.first->second += completion.reservoir_inflow_rate; // Accumulate the flow at this connection
}
}
}
}

View File

@ -225,7 +225,40 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
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));
Opm::FlowDiagnostics::CellSetValues sumWellFluxPrCell = RigFlowDiagInterfaceTools::extractWellFlows(m_opmFldData->eclGraph, well_fluxes);
m_opmFldData->fldToolbox->assignInflowFlux(sumWellFluxPrCell);
for ( auto& tracerCellIdxsPair: injectorTracers )
{
std::vector<int> filteredCellIndices;
for (int activeCellIdx : tracerCellIdxsPair.second)
{
auto activeCellIdxFluxPair = sumWellFluxPrCell.find(activeCellIdx);
if (activeCellIdxFluxPair->second > 0 )
{
filteredCellIndices.push_back(activeCellIdx);
}
}
if (tracerCellIdxsPair.second.size() != filteredCellIndices.size()) tracerCellIdxsPair.second = filteredCellIndices;
}
for ( auto& tracerCellIdxsPair: producerTracers )
{
std::vector<int> filteredCellIndices;
for (int activeCellIdx : tracerCellIdxsPair.second)
{
auto activeCellIdxFluxPair = sumWellFluxPrCell.find(activeCellIdx);
if (activeCellIdxFluxPair->second < 0 )
{
filteredCellIndices.push_back(activeCellIdx);
}
}
if (tracerCellIdxsPair.second.size() != filteredCellIndices.size()) tracerCellIdxsPair.second = filteredCellIndices;
}
}
progressInfo.incrementProgress();
@ -252,7 +285,7 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
result.setTracerFraction(tracerId.to_string(), fracVals);
}
}
catch (...)
catch (const std::exception& e)
{
CVF_ASSERT(false);
}
@ -281,7 +314,7 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
result.setTracerFraction(tracerId.to_string(), fracVals);
}
}
catch (...)
catch (const std::exception& e)
{
CVF_ASSERT(false);
}