#10916 Create derived result used to identify NNC cells

This commit is contained in:
Magne Sjaastad 2023-12-06 15:06:01 +01:00
parent 30807438d1
commit 81ab903151
7 changed files with 155 additions and 0 deletions

View File

@ -251,6 +251,14 @@ QString RiaResultNames::combinedRiMultResultName()
return "riMULTXYZ";
}
//--------------------------------------------------------------------------------------------------
/// Result containing 1 for cells with NNCs and 0 for cells without NNCs
//--------------------------------------------------------------------------------------------------
QString RiaResultNames::riNncCells()
{
return "riNncCells";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -56,6 +56,8 @@ QString riMultYResultName();
QString riMultZResultName();
QString combinedRiMultResultName();
QString riNncCells();
QString riAreaNormTranXResultName();
QString riAreaNormTranYResultName();
QString riAreaNormTranZResultName();

View File

@ -7,6 +7,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RigOilVolumeResultCalculator.h
${CMAKE_CURRENT_LIST_DIR}/RigCellVolumeResultCalculator.h
${CMAKE_CURRENT_LIST_DIR}/RigAllanUtil.h
${CMAKE_CURRENT_LIST_DIR}/RigCellsWithNncsCalculator.h
)
set(SOURCE_GROUP_SOURCE_FILES
@ -18,6 +19,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RigOilVolumeResultCalculator.cpp
${CMAKE_CURRENT_LIST_DIR}/RigCellVolumeResultCalculator.cpp
${CMAKE_CURRENT_LIST_DIR}/RigAllanUtil.cpp
${CMAKE_CURRENT_LIST_DIR}/RigCellsWithNncsCalculator.cpp
)
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@ -0,0 +1,87 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigCellsWithNncsCalculator.h"
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseResultAddress.h"
#include "RigMainGrid.h"
#include "RigNNCData.h"
//==================================================================================================
///
//==================================================================================================
RigCellsWithNncsCalculator::RigCellsWithNncsCalculator( RigCaseCellResultsData& resultsData )
: RigEclipseResultCalculator( resultsData )
{
}
//==================================================================================================
///
//==================================================================================================
RigCellsWithNncsCalculator::~RigCellsWithNncsCalculator()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigCellsWithNncsCalculator::isMatching( const RigEclipseResultAddress& resVarAddr ) const
{
return ( resVarAddr.resultName() == RiaResultNames::riNncCells() && resVarAddr.resultCatType() == RiaDefines::ResultCatType::STATIC_NATIVE );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCellsWithNncsCalculator::calculate( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex )
{
if ( !m_resultsData ) return;
if ( !m_resultsData->m_ownerCaseData ) return;
if ( m_resultsData->activeCellInfo()->reservoirActiveCellCount() == 0 ) return;
auto nncData = m_resultsData->m_ownerMainGrid->nncData();
auto connections = nncData->allConnections();
std::set<size_t> uniqueReservoirIndices;
for ( size_t i = 0; i < nncData->eclipseConnectionCount(); i++ )
{
uniqueReservoirIndices.insert( connections[i].c1GlobIdx() );
uniqueReservoirIndices.insert( connections[i].c2GlobIdx() );
}
size_t scalarResultIndex = m_resultsData->findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE,
RiaResultNames::riNncCells() ),
false );
if ( m_resultsData->m_cellScalarResults[scalarResultIndex].empty() )
{
m_resultsData->m_cellScalarResults[scalarResultIndex].resize( 1 );
}
std::vector<double>& resultValues = m_resultsData->m_cellScalarResults[scalarResultIndex][0];
size_t cellResultCount = m_resultsData->m_activeCellInfo->reservoirActiveCellCount();
resultValues.resize( cellResultCount, 0 );
for ( auto reservoirCellIndex : uniqueReservoirIndices )
{
size_t resultIndex = m_resultsData->activeCellInfo()->cellResultIndex( reservoirCellIndex );
resultValues[resultIndex] = 1.0;
}
}

View File

@ -0,0 +1,33 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RigEclipseResultCalculator.h"
//==================================================================================================
///
//==================================================================================================
class RigCellsWithNncsCalculator : public RigEclipseResultCalculator
{
public:
RigCellsWithNncsCalculator( RigCaseCellResultsData& resultsData );
~RigCellsWithNncsCalculator() override;
bool isMatching( const RigEclipseResultAddress& resVarAddr ) const override;
void calculate( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex ) override;
};

View File

@ -33,6 +33,7 @@
#include "RigAllanUtil.h"
#include "RigCaseCellResultCalculator.h"
#include "RigCellVolumeResultCalculator.h"
#include "RigCellsWithNncsCalculator.h"
#include "RigEclipseAllanFaultsStatCalc.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseMultiPropertyStatCalc.h"
@ -1116,6 +1117,12 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::faultDistanceName() ),
needsToBeStored );
}
// NNC cells, 1 for cells with NNC and 0 for other cells
{
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riNncCells() ),
needsToBeStored );
}
}
//--------------------------------------------------------------------------------------------------
@ -1325,6 +1332,10 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
{
computeFaultDistance();
}
else if ( resultName == RiaResultNames::riNncCells() )
{
computeNncsCells();
}
}
else if ( type == RiaDefines::ResultCatType::DYNAMIC_NATIVE )
{
@ -1896,6 +1907,16 @@ void RigCaseCellResultsData::computeFaultDistance()
calculator.calculate( addr, 0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::computeNncsCells()
{
RigEclipseResultAddress addr( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::riNncCells() );
RigCellsWithNncsCalculator calculator( *this );
calculator.calculate( addr, 0 );
}
namespace RigTransmissibilityCalcTools
{
void calculateConnectionGeometry( const RigCell& c1,

View File

@ -163,6 +163,7 @@ private:
friend class RigIndexIjkResultCalculator;
friend class RigOilVolumeResultCalculator;
friend class RigCellVolumeResultCalculator;
friend class RigCellsWithNncsCalculator;
size_t findOrLoadKnownScalarResultForTimeStep( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex );
size_t findOrCreateScalarResultIndex( const RigEclipseResultAddress& resVarAddr, bool needsToBeStored );
@ -196,6 +197,7 @@ private:
void computeIndexResults();
void computeFaultDistance();
void computeNncsCells();
bool isDataPresent( size_t scalarResultIndex ) const;