mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2146 Num Flooded PV: Add volume weighted mean for visible cells and current time step
This commit is contained in:
@@ -17,12 +17,17 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "RigFlowDiagVisibleCellsStatCalc.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigStatisticsMath.h"
|
||||
#include "RigWeightedMeanCalc.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "RigStatisticsMath.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -33,7 +38,6 @@ RigFlowDiagVisibleCellsStatCalc::RigFlowDiagVisibleCellsStatCalc(RigFlowDiagResu
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -45,7 +49,6 @@ void RigFlowDiagVisibleCellsStatCalc::minMaxCellScalarValues(size_t timeStepInde
|
||||
max = acc.max;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -69,7 +72,6 @@ void RigFlowDiagVisibleCellsStatCalc::valueSumAndSampleCount(size_t timeStepInde
|
||||
sampleCount = acc.sampleCount;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -96,4 +98,24 @@ size_t RigFlowDiagVisibleCellsStatCalc::timeStepCount()
|
||||
return m_resultsData->timeStepCount();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFlowDiagVisibleCellsStatCalc::mobileVolumeWeightedMean(size_t timeStepIndex, double &result)
|
||||
{
|
||||
RimEclipseResultCase* eclCase = nullptr;
|
||||
m_resultsData->flowDiagSolution()->firstAncestorOrThisOfType(eclCase);
|
||||
if (!eclCase) return;
|
||||
|
||||
RigCaseCellResultsData* caseCellResultsData = eclCase->results(RiaDefines::MATRIX_MODEL);
|
||||
|
||||
size_t mobPVResultIndex = caseCellResultsData->findOrLoadScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName());
|
||||
|
||||
const std::vector<double>& weights = caseCellResultsData->cellScalarResults(mobPVResultIndex, 0);
|
||||
const std::vector<double>* values = m_resultsData->resultValues(m_resVarAddr, timeStepIndex);
|
||||
|
||||
const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo(m_resVarAddr);
|
||||
|
||||
RigWeightedMeanCalc::weightedMeanOverCells(&weights, values, m_cellVisibilities.p(), actCellInfo, true, &result);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user