Fixed crash when creating well alloc plot

This commit is contained in:
Jacob Støren 2017-03-23 12:32:02 +01:00
parent cde71ef07a
commit fd23ec242e
2 changed files with 11 additions and 7 deletions

View File

@ -358,7 +358,7 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
{
RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, tracerName.toStdString());
const std::vector<double>* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep);
tracerCellFractionValues[tracerName] = tracerCellFractions;
if (tracerCellFractions) tracerCellFractionValues[tracerName] = tracerCellFractions;
}
}
}

View File

@ -650,15 +650,19 @@ std::vector<double> RigAccWellFlowCalculator::calculateWellCellFlowPrTracer(cons
wellCell.m_gridCellIndex);
size_t tracerIdx = 0;
double totalTracerFractionInCell = 0.0;
for ( const auto & tracerFractionIt: (*m_tracerCellFractionValues) )
for ( const auto & tracerFractionValsPair: (*m_tracerCellFractionValues) )
{
double cellTracerFraction = (*tracerFractionIt.second)[resCellIndex];
if ( cellTracerFraction != HUGE_VAL && cellTracerFraction == cellTracerFraction )
const std::vector<double>* fractionVals = tracerFractionValsPair.second ;
if ( fractionVals )
{
double tracerFlow = cellTracerFraction * wellCell.flowRate();
flowPrTracer[tracerIdx] = tracerFlow;
double cellTracerFraction = (*fractionVals)[resCellIndex];
if ( cellTracerFraction != HUGE_VAL && cellTracerFraction == cellTracerFraction )
{
double tracerFlow = cellTracerFraction * wellCell.flowRate();
flowPrTracer[tracerIdx] = tracerFlow;
totalTracerFractionInCell += cellTracerFraction;
totalTracerFractionInCell += cellTracerFraction;
}
}
tracerIdx++;
}