Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,14 @@ void RimEclipseStatisticsCase::computeStatistics()
calculationName ) );
}

bool clearGridCalculationMemory = m_dataSourceForStatistics() == DataSourceType::GRID_CALCULATION;
RimEclipseStatisticsCaseEvaluator stat( sourceCases, timeStepIndices, statisticsConfig, resultCase, gridCaseGroup, clearGridCalculationMemory );
bool clearGridCalculationMemory = m_dataSourceForStatistics() == DataSourceType::GRID_CALCULATION;
RimEclipseStatisticsCaseEvaluator stat( sourceCases,
timeStepIndices,
statisticsConfig,
resultCase,
gridCaseGroup->unionOfActiveCells( RiaDefines::PorosityModelType::MATRIX_MODEL ),
gridCaseGroup->unionOfActiveCells( RiaDefines::PorosityModelType::FRACTURE_MODEL ),
clearGridCalculationMemory );

if ( m_useZeroAsInactiveCellValue )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "RiaLogging.h"

#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultInfo.h"
Expand All @@ -32,13 +33,10 @@
#include "RigStatisticsMath.h"

#include "RimEclipseView.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimReservoirCellResultsStorage.h"

#include "cafProgressInfo.h"

#include <QDebug>

#include <algorithm>

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -210,6 +208,10 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults( const QList<ResSpec>
visibility = filterView->currentTotalCellVisibility();
}

auto destinationActiveCellInfo = m_destinationCase->activeCellInfo( poroModel );
auto unionActiveCells = ( poroModel == RiaDefines::PorosityModelType::MATRIX_MODEL ) ? m_unionOfMatrixActiveCells
: m_unionOfFractureActiveCells;

// Loop over the cells in the grid, get the case values, and calculate the cell statistics
#pragma omp parallel for schedule( dynamic ) firstprivate( statParams, values )
for ( int cellIdx = 0; cellIdx < cellCount; cellIdx++ )
Expand All @@ -218,7 +220,7 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults( const QList<ResSpec>

if ( visibility.notNull() && !visibility->val( reservoirCellIndex ) ) continue;

if ( m_destinationCase->activeCellInfo( poroModel )->isActive( reservoirCellIndex ) )
if ( destinationActiveCellInfo->isActive( reservoirCellIndex ) )
{
// Extract the cell values from each of the cases and assemble them into one vector

Expand All @@ -230,7 +232,7 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults( const QList<ResSpec>
// Replace huge_val with zero in the statistical computation for the following case
if ( m_useZeroAsInactiveCellValue || resultName.toUpper() == "ACTNUM" )
{
if ( m_identicalGridCaseGroup->unionOfActiveCells( poroModel )->isActive( reservoirCellIndex ) && val == HUGE_VAL )
if ( unionActiveCells && unionActiveCells->isActive( reservoirCellIndex ) && val == HUGE_VAL )
{
val = 0.0;
}
Expand Down Expand Up @@ -404,14 +406,16 @@ RimEclipseStatisticsCaseEvaluator::RimEclipseStatisticsCaseEvaluator( const std:
const std::vector<int>& timeStepIndices,
const RimStatisticsConfig& statisticsConfig,
RigEclipseCaseData* destinationCase,
RimIdenticalGridCaseGroup* identicalGridCaseGroup,
RigActiveCellInfo* unionOfMatrixActiveCells,
RigActiveCellInfo* unionOfFractureActiveCells,
bool clearGridCalculationMemory )
: m_sourceCases( sourceCases )
, m_statisticsConfig( statisticsConfig )
, m_destinationCase( destinationCase )
, m_reservoirCellCount( 0 )
, m_timeStepIndices( timeStepIndices )
, m_identicalGridCaseGroup( identicalGridCaseGroup )
, m_unionOfMatrixActiveCells( unionOfMatrixActiveCells )
, m_unionOfFractureActiveCells( unionOfFractureActiveCells )
, m_useZeroAsInactiveCellValue( false )
, m_clearGridCalculationMemory( clearGridCalculationMemory )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <cmath>
#include <vector>

class RigActiveCellInfo;
class RimEclipseCase;
class RigEclipseCaseData;
class RigCaseCellResultsData;
Expand Down Expand Up @@ -57,7 +58,8 @@ class RimEclipseStatisticsCaseEvaluator
const std::vector<int>& timeStepIndices,
const RimStatisticsConfig& statisticsConfig,
RigEclipseCaseData* destinationCase,
RimIdenticalGridCaseGroup* identicalGridCaseGroup,
RigActiveCellInfo* unionOfMatrixActiveCells,
RigActiveCellInfo* unionOfFractureActiveCells,
bool clearGridCalculationMemory );

struct ResSpec
Expand Down Expand Up @@ -108,10 +110,11 @@ class RimEclipseStatisticsCaseEvaluator
std::vector<RimEclipseCase*> m_sourceCases;
std::vector<int> m_timeStepIndices;

size_t m_reservoirCellCount;
RimStatisticsConfig m_statisticsConfig;
RigEclipseCaseData* m_destinationCase;
RimIdenticalGridCaseGroup* m_identicalGridCaseGroup;
bool m_useZeroAsInactiveCellValue;
bool m_clearGridCalculationMemory;
size_t m_reservoirCellCount;
RimStatisticsConfig m_statisticsConfig;
RigEclipseCaseData* m_destinationCase;
RigActiveCellInfo* m_unionOfMatrixActiveCells;
RigActiveCellInfo* m_unionOfFractureActiveCells;
bool m_useZeroAsInactiveCellValue;
bool m_clearGridCalculationMemory;
};