mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 15:10:22 -05:00
Refactor: Move residual oil/gas extraction to RigHydrocarbonTools.
This commit is contained in:
1 parent
55bd7a6fdd
commit
395e294b00
5 files changed
+148
-75
No files matched your search
@@ -82,6 +82,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigWeightedMeanCalc.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigPolygonTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigFloodingSettings.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigHydrocarbonFlowTools.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -164,6 +165,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigWeightedMeanCalc.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigPolygonTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigFloodingSettings.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigHydrocarbonFlowTools.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
+14
-65
@@ -27,6 +27,7 @@
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEclipseResultAddress.h"
|
||||
#include "RigHexIntersectionTools.h"
|
||||
#include "RigHydrocarbonFlowTools.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -170,8 +171,19 @@ std::vector<double> RigEclipseContourMapProjection::calculateColumnResult( RigCa
|
||||
|
||||
const auto nSamples = poroResults.size();
|
||||
|
||||
std::vector<double> residualOil = residualOilData( resultData, resultAggregation, floodingSettings, nSamples );
|
||||
std::vector<double> residualGas = residualGasData( resultData, resultAggregation, floodingSettings, nSamples );
|
||||
auto mapToFlowResultType = []( RigContourMapCalculator::ResultAggregationType t1 )
|
||||
{
|
||||
if ( t1 == RigContourMapCalculator::ResultAggregationType::MOBILE_OIL_COLUMN )
|
||||
return RigHydrocarbonFlowTools::ResultType::MOBILE_OIL;
|
||||
if ( t1 == RigContourMapCalculator::ResultAggregationType::MOBILE_GAS_COLUMN )
|
||||
return RigHydrocarbonFlowTools::ResultType::MOBILE_GAS;
|
||||
if ( t1 == RigContourMapCalculator::ResultAggregationType::MOBILE_HYDROCARBON_COLUMN )
|
||||
return RigHydrocarbonFlowTools::ResultType::MOBILE_HYDROCARBON;
|
||||
return RigHydrocarbonFlowTools::ResultType::NONE;
|
||||
};
|
||||
auto flowResultType = mapToFlowResultType( resultAggregation );
|
||||
std::vector<double> residualOil = RigHydrocarbonFlowTools::residualOilData( resultData, flowResultType, floodingSettings, nSamples );
|
||||
std::vector<double> residualGas = RigHydrocarbonFlowTools::residualGasData( resultData, flowResultType, floodingSettings, nSamples );
|
||||
|
||||
std::vector<double> resultValues( nSamples, 0.0 );
|
||||
|
||||
@@ -375,66 +387,3 @@ std::set<RigEclipseResultAddress> RigEclipseContourMapProjection::neededResults(
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
std::vector<double> RigEclipseContourMapProjection::residualOilData( RigCaseCellResultsData& resultData,
|
||||
RigContourMapCalculator::ResultAggregationType resultAggregation,
|
||||
RigFloodingSettings& floodingSettings,
|
||||
size_t nSamples )
|
||||
{
|
||||
std::vector<double> residualOil;
|
||||
|
||||
if ( ( resultAggregation == RigContourMapCalculator::MOBILE_OIL_COLUMN ) ||
|
||||
( resultAggregation == RigContourMapCalculator::MOBILE_HYDROCARBON_COLUMN ) )
|
||||
{
|
||||
if ( floodingSettings.oilFlooding() == RigFloodingSettings::FloodingType::GAS_FLOODING )
|
||||
{
|
||||
residualOil =
|
||||
resultData.cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::sogcr() ), 0 );
|
||||
}
|
||||
else if ( floodingSettings.oilFlooding() == RigFloodingSettings::FloodingType::WATER_FLOODING )
|
||||
{
|
||||
residualOil =
|
||||
resultData.cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::sowcr() ), 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
residualOil.resize( nSamples, floodingSettings.oilUserDefFlooding() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( residualOil.empty() ) residualOil.resize( nSamples, 0.0 );
|
||||
|
||||
return residualOil;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigEclipseContourMapProjection::residualGasData( RigCaseCellResultsData& resultData,
|
||||
RigContourMapCalculator::ResultAggregationType resultAggregation,
|
||||
RigFloodingSettings& floodingSettings,
|
||||
size_t nSamples )
|
||||
{
|
||||
std::vector<double> residualGas;
|
||||
|
||||
if ( ( resultAggregation == RigContourMapCalculator::MOBILE_GAS_COLUMN ) ||
|
||||
( resultAggregation == RigContourMapCalculator::MOBILE_HYDROCARBON_COLUMN ) )
|
||||
{
|
||||
if ( floodingSettings.gasFlooding() == RigFloodingSettings::FloodingType::GAS_FLOODING )
|
||||
{
|
||||
residualGas =
|
||||
resultData.cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::sgcr() ), 0 );
|
||||
}
|
||||
else if ( floodingSettings.gasFlooding() == RigFloodingSettings::FloodingType::USER_DEFINED )
|
||||
{
|
||||
residualGas.resize( nSamples, floodingSettings.gasUserDefFlooding() );
|
||||
}
|
||||
}
|
||||
if ( residualGas.empty() ) residualGas.resize( nSamples, 0.0 );
|
||||
|
||||
return residualGas;
|
||||
}
|
||||
@@ -85,16 +85,6 @@ protected:
|
||||
static std::set<RigEclipseResultAddress> neededResults( RigContourMapCalculator::ResultAggregationType resultAggregation,
|
||||
RigFloodingSettings& floodingSettings );
|
||||
|
||||
static std::vector<double> residualOilData( RigCaseCellResultsData& resultData,
|
||||
RigContourMapCalculator::ResultAggregationType resultAggregation,
|
||||
RigFloodingSettings& floodingSettings,
|
||||
size_t nSamples );
|
||||
|
||||
static std::vector<double> residualGasData( RigCaseCellResultsData& resultData,
|
||||
RigContourMapCalculator::ResultAggregationType resultAggregation,
|
||||
RigFloodingSettings& floodingSettings,
|
||||
size_t nSamples );
|
||||
|
||||
protected:
|
||||
RigEclipseCaseData& m_eclipseCaseData;
|
||||
RigCaseCellResultsData& m_resultData;
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2025 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 "RigHydrocarbonFlowTools.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaResultNames.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseResultAddress.h"
|
||||
#include "RigFloodingSettings.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigHydrocarbonFlowTools::residualOilData( RigCaseCellResultsData& resultData,
|
||||
RigHydrocarbonFlowTools::ResultType resultType,
|
||||
const RigFloodingSettings& floodingSettings,
|
||||
std::size_t nSamples )
|
||||
{
|
||||
std::vector<double> residualOil;
|
||||
|
||||
if ( ( resultType == RigHydrocarbonFlowTools::ResultType::MOBILE_OIL ) ||
|
||||
( resultType == RigHydrocarbonFlowTools::ResultType::MOBILE_HYDROCARBON ) )
|
||||
{
|
||||
if ( floodingSettings.oilFlooding() == RigFloodingSettings::FloodingType::GAS_FLOODING )
|
||||
{
|
||||
residualOil =
|
||||
resultData.cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::sogcr() ), 0 );
|
||||
}
|
||||
else if ( floodingSettings.oilFlooding() == RigFloodingSettings::FloodingType::WATER_FLOODING )
|
||||
{
|
||||
residualOil =
|
||||
resultData.cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::sowcr() ), 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
residualOil.resize( nSamples, floodingSettings.oilUserDefFlooding() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( residualOil.empty() ) residualOil.resize( nSamples, 0.0 );
|
||||
|
||||
return residualOil;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigHydrocarbonFlowTools::residualGasData( RigCaseCellResultsData& resultData,
|
||||
RigHydrocarbonFlowTools::ResultType resultType,
|
||||
const RigFloodingSettings& floodingSettings,
|
||||
std::size_t nSamples )
|
||||
{
|
||||
std::vector<double> residualGas;
|
||||
if ( ( resultType == RigHydrocarbonFlowTools::ResultType::MOBILE_GAS ) ||
|
||||
( resultType == RigHydrocarbonFlowTools::ResultType::MOBILE_HYDROCARBON ) )
|
||||
{
|
||||
if ( floodingSettings.gasFlooding() == RigFloodingSettings::FloodingType::GAS_FLOODING )
|
||||
{
|
||||
residualGas =
|
||||
resultData.cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::sgcr() ), 0 );
|
||||
}
|
||||
else if ( floodingSettings.gasFlooding() == RigFloodingSettings::FloodingType::USER_DEFINED )
|
||||
{
|
||||
residualGas.resize( nSamples, floodingSettings.gasUserDefFlooding() );
|
||||
}
|
||||
}
|
||||
if ( residualGas.empty() ) residualGas.resize( nSamples, 0.0 );
|
||||
|
||||
return residualGas;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2025 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 <vector>
|
||||
|
||||
class RigCaseCellResultsData;
|
||||
class RigFloodingSettings;
|
||||
|
||||
class RigHydrocarbonFlowTools
|
||||
{
|
||||
public:
|
||||
enum class ResultType
|
||||
{
|
||||
NONE,
|
||||
MOBILE_OIL,
|
||||
MOBILE_GAS,
|
||||
MOBILE_HYDROCARBON
|
||||
};
|
||||
|
||||
static std::vector<double> residualOilData( RigCaseCellResultsData& resultData,
|
||||
RigHydrocarbonFlowTools::ResultType resultType,
|
||||
const RigFloodingSettings& floodingSettings,
|
||||
std::size_t nSamples );
|
||||
|
||||
static std::vector<double> residualGasData( RigCaseCellResultsData& resultData,
|
||||
RigHydrocarbonFlowTools::ResultType resultType,
|
||||
const RigFloodingSettings& floodingSettings,
|
||||
std::size_t nSamples );
|
||||
};
|
||||
Reference in new issue
Block a user