#724 Grid Case Group Statistics: Add option to include in-active cell value as zero

This commit is contained in:
Magne Sjaastad 2016-09-01 18:08:51 +02:00
parent 8098578545
commit f1451a1126
4 changed files with 36 additions and 3 deletions

View File

@ -109,6 +109,8 @@ RimEclipseStatisticsCase::RimEclipseStatisticsCase()
CAF_PDM_InitField(&m_highPercentile, "HighPercentile", 90.0, "High", "", "", "");
CAF_PDM_InitField(&m_wellDataSourceCase, "WellDataSourceCase", RimDefines::undefinedResultName(), "Well Data Source Case", "", "", "" );
CAF_PDM_InitField(&m_useZeroAsInactiveCellValue, "UseZeroAsInactiveCellValue", false, "Use Zero as Inactive Cell Value", "", "", "");
}
//--------------------------------------------------------------------------------------------------
@ -255,6 +257,12 @@ void RimEclipseStatisticsCase::computeStatistics()
}
RimEclipseStatisticsCaseEvaluator stat(sourceCases, timeStepIndices, statisticsConfig, resultCase);
if (m_useZeroAsInactiveCellValue)
{
stat.useZeroAsValueForInActiveCellsBasedOnUnionOfActiveCells(gridCaseGroup);
}
stat.evaluateForResults(resultSpecification);
}
@ -341,6 +349,8 @@ void RimEclipseStatisticsCase::defineUiOrdering(QString uiConfigName, caf::PdmUi
group->add(&m_lowPercentile);
group->add(&m_midPercentile);
group->add(&m_highPercentile);
uiOrdering.add(&m_useZeroAsInactiveCellValue);
}
QList<caf::PdmOptionItemInfo> toOptionList(const QStringList& varList)

View File

@ -119,4 +119,6 @@ private:
caf::PdmField<double > m_highPercentile;
caf::PdmField<QString> m_wellDataSourceCase;
caf::PdmField< bool > m_useZeroAsInactiveCellValue;
};

View File

@ -27,6 +27,7 @@
#include "RigResultModifierFactory.h"
#include "RigStatisticsMath.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimReservoirCellResultsStorage.h"
#include "cafProgressInfo.h"
@ -203,12 +204,19 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults(const QList<ResSpec>&
{
// Extract the cell values from each of the cases and assemble them into one vector
bool foundAnyValidValues = false;
for (size_t caseIdx = 0; caseIdx < sourceDataAccessList.size(); caseIdx++)
{
double val = sourceDataAccessList.at(caseIdx)->cellScalar(cellIdx);
// If identical grid case group is set, treat huge_val as zero in the statistical computation
if (m_identicalGridCaseGroup && m_identicalGridCaseGroup->unionOfActiveCells(poroModel)->isActive(reservoirCellIndex))
{
if (val == HUGE_VAL)
{
val = 0.0;
}
}
values[caseIdx] = val;
if (val != HUGE_VAL)
@ -217,6 +225,7 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults(const QList<ResSpec>&
}
}
// Do the real statistics calculations
@ -311,7 +320,8 @@ RimEclipseStatisticsCaseEvaluator::RimEclipseStatisticsCaseEvaluator(const std::
m_statisticsConfig(statisticsConfig),
m_destinationCase(destinationCase),
m_reservoirCellCount(0),
m_timeStepIndices(timeStepIndices)
m_timeStepIndices(timeStepIndices),
m_identicalGridCaseGroup(NULL)
{
if (sourceCases.size() > 0)
{
@ -321,3 +331,11 @@ RimEclipseStatisticsCaseEvaluator::RimEclipseStatisticsCaseEvaluator(const std::
CVF_ASSERT(m_destinationCase);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseStatisticsCaseEvaluator::useZeroAsValueForInActiveCellsBasedOnUnionOfActiveCells(RimIdenticalGridCaseGroup* identicalGridCaseGroup)
{
m_identicalGridCaseGroup = identicalGridCaseGroup;
}

View File

@ -73,6 +73,8 @@ public:
QString m_resVarName;
};
void useZeroAsValueForInActiveCellsBasedOnUnionOfActiveCells(RimIdenticalGridCaseGroup* identicalGridCaseGroup);
void evaluateForResults(const QList<ResSpec >& resultSpecification);
private:
@ -88,5 +90,6 @@ private:
size_t m_reservoirCellCount;
RimStatisticsConfig m_statisticsConfig;
RigCaseData* m_destinationCase;
RimIdenticalGridCaseGroup* m_identicalGridCaseGroup;
};