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:
@@ -41,7 +41,6 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -887,6 +886,14 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
addStaticScalarResult(RiaDefines::STATIC_NATIVE, RiaDefines::combinedRiAreaNormTranResultName(), false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//Mobile Pore Volume
|
||||
{
|
||||
if (findScalarResultIndex(RiaDefines::STATIC_NATIVE, "PORV") != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
addStaticScalarResult(RiaDefines::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName(), false, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1065,6 +1072,10 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
|
||||
progressInfo.incrementProgress();
|
||||
}
|
||||
}
|
||||
else if (resultName == RiaDefines::mobilePoreVolumeName())
|
||||
{
|
||||
computeMobilePV();
|
||||
}
|
||||
|
||||
if (type == RiaDefines::GENERATED)
|
||||
{
|
||||
@@ -2242,6 +2253,59 @@ double RigCaseCellResultsData::darchysValue()
|
||||
return RiaEclipseUnitTools::darcysConstant(m_ownerCaseData->unitsType());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCaseCellResultsData::computeMobilePV()
|
||||
{
|
||||
std::vector<double> porvDataTemp;
|
||||
std::vector<double> swcrDataTemp;
|
||||
std::vector<double> multpvDataTemp;
|
||||
|
||||
const std::vector<double>* porvResults = nullptr;
|
||||
const std::vector<double>* swcrResults = nullptr;
|
||||
const std::vector<double>* multpvResults = nullptr;
|
||||
|
||||
porvResults = RigCaseCellResultsData::getResultIndexableStaticResult(this->activeCellInfo(), this, "PORV", porvDataTemp);
|
||||
swcrResults = RigCaseCellResultsData::getResultIndexableStaticResult(this->activeCellInfo(), this, "SWCR", swcrDataTemp);
|
||||
multpvResults = RigCaseCellResultsData::getResultIndexableStaticResult(this->activeCellInfo(), this, "MULTPV", multpvDataTemp);
|
||||
|
||||
CVF_ASSERT(!porvResults->empty());
|
||||
|
||||
size_t mobPVIdx = this->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName(), false);
|
||||
|
||||
std::vector<double> &mobPVResults = this->cellScalarResults(mobPVIdx)[0];
|
||||
|
||||
// Set up output container to correct number of results
|
||||
mobPVResults.resize(porvResults->size());
|
||||
|
||||
if (!(multpvResults || swcrResults))
|
||||
{
|
||||
mobPVResults.assign(porvResults->begin(), porvResults->end());
|
||||
}
|
||||
else if (!multpvResults)
|
||||
{
|
||||
for (size_t vIdx = 0; vIdx < porvResults->size(); ++vIdx)
|
||||
{
|
||||
mobPVResults[vIdx] = (*porvResults)[vIdx] * (1.0 - (*swcrResults)[vIdx]);
|
||||
}
|
||||
}
|
||||
else if (!swcrResults)
|
||||
{
|
||||
for (size_t vIdx = 0; vIdx < porvResults->size(); ++vIdx)
|
||||
{
|
||||
mobPVResults[vIdx] = (*multpvResults)[vIdx] * (*porvResults)[vIdx];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t vIdx = 0; vIdx < porvResults->size(); ++vIdx)
|
||||
{
|
||||
mobPVResults[vIdx] = (*multpvResults)[vIdx] * (*porvResults)[vIdx] * (1.0 - (*swcrResults)[vIdx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
int reportStepNumber(size_t scalarResultIndex, size_t timeStepIndex) const;
|
||||
std::vector<int> reportStepNumbers(size_t scalarResultIndex) const;
|
||||
|
||||
std::vector<RigEclipseTimeStepInfo> timeStepInfos(size_t scalarResultIndex) const;
|
||||
std::vector<RigEclipseTimeStepInfo> timeStepInfos(size_t scalarResultIndex) const;
|
||||
void setTimeStepInfos(size_t scalarResultIndex, const std::vector<RigEclipseTimeStepInfo>& timeStepInfos);
|
||||
|
||||
size_t findOrLoadScalarResultForTimeStep(RiaDefines::ResultCatType type, const QString& resultName, size_t timeStepIndex);
|
||||
@@ -118,26 +118,30 @@ public:
|
||||
bool updateResultName(RiaDefines::ResultCatType resultType, QString& oldName, const QString& newName);
|
||||
|
||||
static const std::vector<double>* getResultIndexableStaticResult(RigActiveCellInfo* actCellInfo,
|
||||
public:
|
||||
const std::vector<RigEclipseResultInfo>& infoForEachResultIndex() { return m_resultInfos;}
|
||||
RigCaseCellResultsData* gridCellResults,
|
||||
QString porvResultName,
|
||||
std::vector<double> &activeCellsResultsTempContainer);
|
||||
|
||||
bool mustBeCalculated(size_t scalarResultIndex) const;
|
||||
void setMustBeCalculated(size_t scalarResultIndex);
|
||||
void eraseAllSourSimData();
|
||||
public:
|
||||
const std::vector<RigEclipseResultInfo>& infoForEachResultIndex() { return m_resultInfos;}
|
||||
|
||||
bool mustBeCalculated(size_t scalarResultIndex) const;
|
||||
void setMustBeCalculated(size_t scalarResultIndex);
|
||||
void eraseAllSourSimData();
|
||||
|
||||
|
||||
public:
|
||||
size_t addStaticScalarResult(RiaDefines::ResultCatType type,
|
||||
const QString& resultName,
|
||||
bool needsToBeStored,
|
||||
size_t resultValueCount);
|
||||
size_t addStaticScalarResult(RiaDefines::ResultCatType type,
|
||||
const QString& resultName,
|
||||
bool needsToBeStored,
|
||||
size_t resultValueCount);
|
||||
|
||||
bool
|
||||
findTransmissibilityResults(size_t& tranX, size_t& tranY, size_t& tranZ) const;
|
||||
findTransmissibilityResults(size_t& tranX, size_t& tranY, size_t& tranZ) const;
|
||||
private: // from RimReservoirCellResultsStorage
|
||||
void computeSOILForTimeStep(size_t timeStepIndex);
|
||||
void testAndComputeSgasForTimeStep(size_t timeStepIndex);
|
||||
|
||||
|
||||
void computeRiTransComponent(const QString& riTransComponentResultName);
|
||||
void computeNncCombRiTrans();
|
||||
|
||||
@@ -149,19 +153,20 @@ private: // from RimReservoirCellResultsStorage
|
||||
void computeCompletionTypeForTimeStep(size_t timeStep);
|
||||
double darchysValue();
|
||||
|
||||
void computeMobilePV();
|
||||
|
||||
bool isDataPresent(size_t scalarResultIndex) const;
|
||||
|
||||
cvf::ref<RifReaderInterface> m_readerInterface;
|
||||
|
||||
private:
|
||||
std::vector< std::vector< std::vector<double> > > m_cellScalarResults; ///< Scalar results on the complete reservoir for each Result index (ResultVariable) and timestep
|
||||
cvf::Collection<RigStatisticsDataCache> m_statisticsDataCache;
|
||||
|
||||
private:
|
||||
std::vector< std::vector< std::vector<double> > > m_cellScalarResults; ///< Scalar results on the complete reservoir for each Result index (ResultVariable) and timestep
|
||||
cvf::Collection<RigStatisticsDataCache> m_statisticsDataCache;
|
||||
std::vector<RigEclipseResultInfo> m_resultInfos;
|
||||
|
||||
private:
|
||||
std::vector<RigEclipseResultInfo> m_resultInfos;
|
||||
|
||||
RigMainGrid* m_ownerMainGrid;
|
||||
RigEclipseCaseData* m_ownerCaseData;
|
||||
RigActiveCellInfo* m_activeCellInfo;
|
||||
RigMainGrid* m_ownerMainGrid;
|
||||
RigEclipseCaseData* m_ownerCaseData;
|
||||
RigActiveCellInfo* m_activeCellInfo;
|
||||
};
|
||||
|
||||
@@ -20,10 +20,12 @@
|
||||
|
||||
#include "RigEclipseNativeVisibleCellsStatCalc.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "RigStatisticsMath.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigStatisticsMath.h"
|
||||
#include "RigWeightedMeanCalc.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -98,4 +100,18 @@ size_t RigEclipseNativeVisibleCellsStatCalc::timeStepCount()
|
||||
return m_caseData->timeStepCount(m_scalarResultIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigEclipseNativeVisibleCellsStatCalc::mobileVolumeWeightedMean(size_t timeStepIndex, double &result)
|
||||
{
|
||||
size_t mobPVResultIndex = m_caseData->findOrLoadScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName());
|
||||
|
||||
const std::vector<double>& weights = m_caseData->cellScalarResults(mobPVResultIndex)[0];
|
||||
const std::vector<double>& values = m_caseData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
|
||||
|
||||
const RigActiveCellInfo* actCellInfo = m_caseData->activeCellInfo();
|
||||
|
||||
RigWeightedMeanCalc::weightedMeanOverCells(&weights, &values, m_cellVisibilities.p(), actCellInfo, m_caseData->isUsingGlobalActiveIndex(m_scalarResultIndex), &result);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ public:
|
||||
virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator);
|
||||
virtual void uniqueValues(size_t timeStepIndex, std::set<int>& values);
|
||||
virtual size_t timeStepCount();
|
||||
virtual void mobileVolumeWeightedMean(size_t timeStepIndex, double &result);
|
||||
|
||||
|
||||
private:
|
||||
RigCaseCellResultsData* m_caseData;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator);
|
||||
virtual void uniqueValues(size_t timeStepIndex, std::set<int>& values);
|
||||
virtual size_t timeStepCount();
|
||||
virtual void mobileVolumeWeightedMean(size_t timeStepIndex, double &result);
|
||||
|
||||
private:
|
||||
RigFlowDiagResults* m_resultsData;
|
||||
@@ -72,8 +73,4 @@ private:
|
||||
if ( cellResultIndex != cvf::UNDEFINED_SIZE_T ) accumulator.addValue((*values)[cellResultIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfArray.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
Reference in New Issue
Block a user