///////////////////////////////////////////////////////////////////////////////// // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RigHydrocarbonFlowTools.h" #include "RiaDefines.h" #include "RiaResultNames.h" #include "RigCaseCellResultsData.h" #include "RigEclipseResultAddress.h" #include "RigFloodingSettings.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RigHydrocarbonFlowTools::residualOilData( RigCaseCellResultsData& resultData, RigHydrocarbonFlowTools::ResultType resultType, const RigFloodingSettings& floodingSettings, std::size_t nSamples ) { std::vector residualOil; if ( ( resultType == RigHydrocarbonFlowTools::ResultType::MOBILE_OIL ) || ( resultType == RigHydrocarbonFlowTools::ResultType::MOBILE_HYDROCARBON ) ) { if ( floodingSettings.oilFlooding() == RigFloodingSettings::FloodingType::GAS_FLOODING ) { RigEclipseResultAddress address( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::sogcr() ); if ( resultData.ensureKnownResultLoaded( address ) ) { residualOil = resultData.cellScalarResults( address, 0 ); } } else if ( floodingSettings.oilFlooding() == RigFloodingSettings::FloodingType::WATER_FLOODING ) { RigEclipseResultAddress address( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::sowcr() ); if ( resultData.ensureKnownResultLoaded( address ) ) { residualOil = resultData.cellScalarResults( address, 0 ); } } else { residualOil.resize( nSamples, floodingSettings.oilUserDefFlooding() ); } } if ( residualOil.empty() ) residualOil.resize( nSamples, 0.0 ); return residualOil; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RigHydrocarbonFlowTools::residualGasData( RigCaseCellResultsData& resultData, RigHydrocarbonFlowTools::ResultType resultType, const RigFloodingSettings& floodingSettings, std::size_t nSamples ) { std::vector residualGas; if ( ( resultType == RigHydrocarbonFlowTools::ResultType::MOBILE_GAS ) || ( resultType == RigHydrocarbonFlowTools::ResultType::MOBILE_HYDROCARBON ) ) { if ( floodingSettings.gasFlooding() == RigFloodingSettings::FloodingType::GAS_FLOODING ) { RigEclipseResultAddress address( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::sgcr() ); if ( resultData.ensureKnownResultLoaded( address ) ) { residualGas = resultData.cellScalarResults( address, 0 ); } } else if ( floodingSettings.gasFlooding() == RigFloodingSettings::FloodingType::USER_DEFINED ) { residualGas.resize( nSamples, floodingSettings.gasUserDefFlooding() ); } } if ( residualGas.empty() ) residualGas.resize( nSamples, 0.0 ); return residualGas; }