mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1114 First working well communication lines operative
This commit is contained in:
@@ -38,6 +38,7 @@ RigFlowDiagResults::RigFlowDiagResults(RimFlowDiagSolution* flowSolution, size_t
|
||||
|
||||
m_timeStepCount = timeStepCount;
|
||||
m_hasAtemptedNativeResults.resize(timeStepCount, false);
|
||||
m_injProdPairFluxCommunicationTimesteps.resize(timeStepCount);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -88,10 +89,20 @@ const std::vector<double>* RigFlowDiagResults::findOrCalculateResult(const RigFl
|
||||
|
||||
if (!solverInterface()) return nullptr;
|
||||
|
||||
if (!m_hasAtemptedNativeResults[frameIndex])
|
||||
calculateNativeResultsIfNotPreviouslyAttempted(frameIndex);
|
||||
|
||||
return findScalarResultFrame(resVarAddr, frameIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFlowDiagResults::calculateNativeResultsIfNotPreviouslyAttempted(size_t frameIndex)
|
||||
{
|
||||
if ( !m_hasAtemptedNativeResults[frameIndex] )
|
||||
{
|
||||
|
||||
RigFlowDiagTimeStepResult nativeTimestepResults = solverInterface()->calculate(frameIndex,
|
||||
|
||||
RigFlowDiagTimeStepResult nativeTimestepResults = solverInterface()->calculate(frameIndex,
|
||||
m_flowDiagSolution->allInjectorTracerActiveCellIndices(frameIndex),
|
||||
m_flowDiagSolution->allProducerTracerActiveCellIndices(frameIndex));
|
||||
|
||||
@@ -105,10 +116,10 @@ const std::vector<double>* RigFlowDiagResults::findOrCalculateResult(const RigFl
|
||||
nativeResFrames->frameData(frameIndex).swap(resIt.second);
|
||||
}
|
||||
|
||||
m_injProdPairFluxCommunicationTimesteps[frameIndex].swap(nativeTimestepResults.injProdWellPairFluxes());
|
||||
|
||||
m_hasAtemptedNativeResults[frameIndex] = true;
|
||||
}
|
||||
|
||||
return findScalarResultFrame(resVarAddr, frameIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -583,3 +594,40 @@ const std::vector<int>& RigFlowDiagResults::uniqueCellScalarValues(const RigFlow
|
||||
{
|
||||
return this->statistics(resVarAddr)->uniqueCellScalarValues(frameIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<double, double> RigFlowDiagResults::injectorProducerPairFluxes(const std::string& injTracername,
|
||||
const std::string& prodTracerName,
|
||||
int frameIndex)
|
||||
{
|
||||
calculateNativeResultsIfNotPreviouslyAttempted(frameIndex);
|
||||
|
||||
auto commPair = m_injProdPairFluxCommunicationTimesteps[frameIndex].find(std::make_pair(injTracername, prodTracerName));
|
||||
if (commPair != m_injProdPairFluxCommunicationTimesteps[frameIndex].end())
|
||||
{
|
||||
return commPair->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::make_pair(0.0, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigFlowDiagResults::maxAbsPairFlux(int frameIndex)
|
||||
{
|
||||
calculateNativeResultsIfNotPreviouslyAttempted(frameIndex);
|
||||
double maxFlux = 0.0;
|
||||
|
||||
for (const auto& commPair : m_injProdPairFluxCommunicationTimesteps[frameIndex])
|
||||
{
|
||||
if (fabs(commPair.second.first) > maxFlux ) maxFlux = commPair.second.first;
|
||||
if (fabs(commPair.second.second) > maxFlux ) maxFlux = commPair.second.second;
|
||||
}
|
||||
|
||||
return maxFlux;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user