mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add result calculator for PORV*SOIL, PORV*SGAS, and PORV*(SOIL+SGAS).
This commit is contained in:
@@ -325,6 +325,30 @@ QString RiaResultNames::riOilVolumeResultName()
|
||||
return "riOILVOLUME";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaResultNames::riPorvSoil()
|
||||
{
|
||||
return "riPORV*SOIL";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaResultNames::riPorvSgas()
|
||||
{
|
||||
return "riPORV*SGAS";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaResultNames::riPorvSoilSgas()
|
||||
{
|
||||
return "riPORV*(SOIL+SGAS)";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -67,6 +67,9 @@ QString combinedRiAreaNormTranResultName();
|
||||
QString riCellVolumeResultName();
|
||||
QString riOilVolumeResultName();
|
||||
QString mobilePoreVolumeName();
|
||||
QString riPorvSoil();
|
||||
QString riPorvSgas();
|
||||
QString riPorvSoilSgas();
|
||||
|
||||
QString faultReactAssessmentPrefix();
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigCellVolumeResultCalculator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigAllanUtil.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigCellsWithNncsCalculator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigPorvSoilSgasResultCalculator.cpp
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -20,6 +21,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigCellVolumeResultCalculator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigAllanUtil.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigCellsWithNncsCalculator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigPorvSoilSgasResultCalculator.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024- 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 "RigPorvSoilSgasResultCalculator.h"
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaResultNames.h"
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseResultAddress.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
RigPorvSoilSgasResultCalculator::RigPorvSoilSgasResultCalculator( RigCaseCellResultsData& resultsData )
|
||||
: RigEclipseResultCalculator( resultsData )
|
||||
{
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
RigPorvSoilSgasResultCalculator::~RigPorvSoilSgasResultCalculator()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigPorvSoilSgasResultCalculator::isMatching( const RigEclipseResultAddress& resVarAddr ) const
|
||||
{
|
||||
return ( ( resVarAddr.resultName() == RiaResultNames::riPorvSoil() || resVarAddr.resultName() == RiaResultNames::riPorvSgas() ||
|
||||
resVarAddr.resultName() == RiaResultNames::riPorvSoilSgas() ) &&
|
||||
resVarAddr.resultCatType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigPorvSoilSgasResultCalculator::calculate( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex )
|
||||
{
|
||||
RigEclipseResultAddress soilAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() );
|
||||
RigEclipseResultAddress sgasAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() );
|
||||
RigEclipseResultAddress porvAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORV" );
|
||||
|
||||
if ( resVarAddr.resultName() == RiaResultNames::riPorvSoil() )
|
||||
{
|
||||
calculateProduct( porvAddress, soilAddress, resVarAddr );
|
||||
}
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::riPorvSgas() )
|
||||
{
|
||||
calculateProduct( porvAddress, sgasAddress, resVarAddr );
|
||||
}
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::riPorvSoilSgas() )
|
||||
{
|
||||
RigEclipseResultAddress soilAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::riPorvSoil() );
|
||||
RigEclipseResultAddress sgasAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::riPorvSgas() );
|
||||
|
||||
calculateSum( soilAddress, sgasAddress, resVarAddr );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigPorvSoilSgasResultCalculator::calculateProduct( const RigEclipseResultAddress& in1Addr,
|
||||
const RigEclipseResultAddress& in2Addr,
|
||||
const RigEclipseResultAddress& outAddr )
|
||||
{
|
||||
calculate( in1Addr, in2Addr, outAddr, std::multiplies<double>{} );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigPorvSoilSgasResultCalculator::calculateSum( const RigEclipseResultAddress& in1Addr,
|
||||
const RigEclipseResultAddress& in2Addr,
|
||||
const RigEclipseResultAddress& outAddr )
|
||||
{
|
||||
calculate( in1Addr, in2Addr, outAddr, std::plus<double>{} );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigPorvSoilSgasResultCalculator::calculate( const RigEclipseResultAddress& in1Addr,
|
||||
const RigEclipseResultAddress& in2Addr,
|
||||
const RigEclipseResultAddress& outAddr,
|
||||
std::function<double( double, double )> op )
|
||||
{
|
||||
size_t in1Idx = m_resultsData->findOrLoadKnownScalarResult( in1Addr );
|
||||
size_t in2Idx = m_resultsData->findOrLoadKnownScalarResult( in2Addr );
|
||||
|
||||
size_t outIdx = m_resultsData->findOrCreateScalarResultIndex( outAddr, false );
|
||||
m_resultsData->m_cellScalarResults[outIdx].resize( m_resultsData->maxTimeStepCount() );
|
||||
|
||||
size_t activeCellCount = m_resultsData->m_activeCellInfo->reservoirActiveCellCount();
|
||||
for ( size_t timeStepIdx = 0; timeStepIdx < m_resultsData->maxTimeStepCount(); timeStepIdx++ )
|
||||
{
|
||||
size_t timeStep1Idx = in1Addr.resultCatType() != RiaDefines::ResultCatType::STATIC_NATIVE ? timeStepIdx : 0;
|
||||
const std::vector<double>& in1Results = m_resultsData->m_cellScalarResults[in1Idx][timeStep1Idx];
|
||||
size_t timeStep2Idx = in2Addr.resultCatType() != RiaDefines::ResultCatType::STATIC_NATIVE ? timeStepIdx : 0;
|
||||
const std::vector<double>& in2Results = m_resultsData->m_cellScalarResults[in2Idx][timeStep2Idx];
|
||||
|
||||
std::vector<double>& outResults = m_resultsData->m_cellScalarResults[outIdx][timeStepIdx];
|
||||
outResults.resize( activeCellCount, 0.0 );
|
||||
|
||||
bool res1ActiveOnly = in1Results.size() == activeCellCount;
|
||||
bool res2ActiveOnly = in2Results.size() == activeCellCount;
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int nativeResvCellIndex = 0; nativeResvCellIndex < static_cast<int>( m_resultsData->m_ownerMainGrid->globalCellArray().size() );
|
||||
nativeResvCellIndex++ )
|
||||
{
|
||||
size_t resultIndex = m_resultsData->activeCellInfo()->cellResultIndex( nativeResvCellIndex );
|
||||
if ( resultIndex != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
size_t idx1 = res1ActiveOnly ? resultIndex : nativeResvCellIndex;
|
||||
size_t idx2 = res2ActiveOnly ? resultIndex : nativeResvCellIndex;
|
||||
outResults[resultIndex] = op( in1Results[idx1], in2Results[idx2] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024- 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 <cstddef>
|
||||
#include <functional>
|
||||
|
||||
#include "RigEclipseResultCalculator.h"
|
||||
|
||||
class RigCaseCellResultsData;
|
||||
class RigEclipseResultAddress;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigPorvSoilSgasResultCalculator : public RigEclipseResultCalculator
|
||||
{
|
||||
public:
|
||||
RigPorvSoilSgasResultCalculator( RigCaseCellResultsData& resultsData );
|
||||
~RigPorvSoilSgasResultCalculator() override;
|
||||
bool isMatching( const RigEclipseResultAddress& resVarAddr ) const override;
|
||||
void calculate( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex ) override;
|
||||
|
||||
private:
|
||||
void calculateProduct( const RigEclipseResultAddress& in1Addr,
|
||||
const RigEclipseResultAddress& in2Addr,
|
||||
const RigEclipseResultAddress& outAddr );
|
||||
void calculateSum( const RigEclipseResultAddress& in1Addr, const RigEclipseResultAddress& in2Addr, const RigEclipseResultAddress& outAddr );
|
||||
void calculate( const RigEclipseResultAddress& in1Addr,
|
||||
const RigEclipseResultAddress& in2Addr,
|
||||
const RigEclipseResultAddress& outAddr,
|
||||
std::function<double( double, double )> op );
|
||||
};
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigMobilePoreVolumeResultCalculator.h"
|
||||
#include "RigOilVolumeResultCalculator.h"
|
||||
#include "RigPorvSoilSgasResultCalculator.h"
|
||||
#include "RigSoilResultCalculator.h"
|
||||
#include "RigStatisticsDataCache.h"
|
||||
#include "RigStatisticsMath.h"
|
||||
@@ -1140,6 +1141,30 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
findOrCreateScalarResultIndex( RiaResultNames::staticIntegerAddress( RiaResultNames::indexKResultName() ), needsToBeStored );
|
||||
}
|
||||
|
||||
if ( hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "PORV" ) ) )
|
||||
{
|
||||
bool hasSgas = hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) );
|
||||
bool hasSoil = hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ) );
|
||||
if ( hasSoil )
|
||||
{
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::riPorvSoil() ),
|
||||
needsToBeStored );
|
||||
}
|
||||
|
||||
if ( hasSgas )
|
||||
{
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::riPorvSgas() ),
|
||||
needsToBeStored );
|
||||
}
|
||||
|
||||
if ( hasSoil && hasSgas )
|
||||
{
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE,
|
||||
RiaResultNames::riPorvSoilSgas() ),
|
||||
needsToBeStored );
|
||||
}
|
||||
}
|
||||
|
||||
// Fault distance
|
||||
{
|
||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::faultDistanceName() ),
|
||||
@@ -1496,6 +1521,11 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
|
||||
computeCellVolumes();
|
||||
computeOilVolumes();
|
||||
}
|
||||
else if ( resultName == RiaResultNames::riPorvSoil() || resultName == RiaResultNames::riPorvSgas() ||
|
||||
resultName == RiaResultNames::riPorvSoilSgas() )
|
||||
{
|
||||
computePorvSoilSgas();
|
||||
}
|
||||
|
||||
// Allan results
|
||||
if ( resultName == RiaResultNames::formationAllanResultName() || resultName == RiaResultNames::formationBinaryAllanResultName() )
|
||||
@@ -1535,7 +1565,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigCaseCellResultsData::findOrLoadKnownScalarResultByResultTypeOrder( const RigEclipseResultAddress& resVarAddr,
|
||||
size_t RigCaseCellResultsData::findOrLoadKnownScalarResultByResultTypeOrder( const RigEclipseResultAddress& resVarAddr,
|
||||
const std::vector<RiaDefines::ResultCatType>& resultCategorySearchOrder )
|
||||
{
|
||||
std::set<RiaDefines::ResultCatType> otherResultTypesToSearch = { RiaDefines::ResultCatType::STATIC_NATIVE,
|
||||
@@ -2726,6 +2756,24 @@ void RigCaseCellResultsData::computeOilVolumes()
|
||||
calculator.calculate( addr, -1 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCaseCellResultsData::computePorvSoilSgas()
|
||||
{
|
||||
std::vector<QString> results = { RiaResultNames::riPorvSoil(), RiaResultNames::riPorvSgas(), RiaResultNames::riPorvSoilSgas() };
|
||||
|
||||
RigPorvSoilSgasResultCalculator calculator( *this );
|
||||
|
||||
for ( QString resultName : results )
|
||||
{
|
||||
RigEclipseResultAddress addr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, resultName );
|
||||
|
||||
// Computes for all time steps
|
||||
calculator.calculate( addr, -1 );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -170,6 +170,7 @@ private:
|
||||
friend class RigOilVolumeResultCalculator;
|
||||
friend class RigCellVolumeResultCalculator;
|
||||
friend class RigCellsWithNncsCalculator;
|
||||
friend class RigPorvSoilSgasResultCalculator;
|
||||
|
||||
size_t findOrCreateScalarResultIndex( const RigEclipseResultAddress& resVarAddr, bool needsToBeStored );
|
||||
|
||||
@@ -199,6 +200,7 @@ private:
|
||||
|
||||
void computeOilVolumes();
|
||||
void computeMobilePV();
|
||||
void computePorvSoilSgas();
|
||||
|
||||
void computeIndexResults();
|
||||
void computeFaultDistance();
|
||||
|
||||
Reference in New Issue
Block a user