mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 06:38:13 -05:00
Well target updates (#14619)
Support well target mapping calculations for ensembles.
This commit is contained in:
19 files changed
+248
-81
No files matched your search
@@ -24,6 +24,7 @@
|
||||
#include "RiaEclipseUnitTools.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPorosityModel.h"
|
||||
#include "RiaPreferencesGrid.h"
|
||||
#include "RiaQStringFormatter.h"
|
||||
#include "RiaResultNames.h"
|
||||
#include "RiaWeightedMeanCalculator.h"
|
||||
@@ -364,27 +365,32 @@ RimRegularGridCase* RigWellTargetMapping::generateEnsembleCandidates( const std:
|
||||
VolumesType volumesType,
|
||||
VolumeResultType volumeResultType,
|
||||
const RigFloodingSettings& floodingSettings,
|
||||
const ClusteringLimits& limits )
|
||||
const ClusteringLimits& limits,
|
||||
double expandBoundingBoxXYPercent,
|
||||
double expandBoundingBoxZPercent )
|
||||
{
|
||||
RiaLogging::debug( "Generating ensemble statistics" );
|
||||
|
||||
caf::ProgressInfo progInfo( cases.size() * 2, "Generating ensemble statistics" );
|
||||
|
||||
for ( auto eclipseCase : cases )
|
||||
{
|
||||
auto task = progInfo.task( "Generating realization statistics.", 1 );
|
||||
|
||||
generateCandidates( eclipseCase, timeStepIdx, volumeType, volumesType, volumeResultType, floodingSettings, limits, false );
|
||||
}
|
||||
caf::ProgressInfo progInfo( cases.size(), "Generating ensemble statistics" );
|
||||
|
||||
cvf::BoundingBox boundingBox;
|
||||
for ( auto eclipseCase : cases )
|
||||
{
|
||||
cvf::BoundingBox bb =
|
||||
RigWellTargetMappingTools::computeBoundingBoxForResult( *eclipseCase, RigWellTargetMapping::wellTargetResultName(), timeStepIdx );
|
||||
boundingBox.add( bb );
|
||||
if ( eclipseCase->eclipseCaseData() != nullptr )
|
||||
{
|
||||
boundingBox.add( eclipseCase->activeCellsBoundingBox() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !boundingBox.isValid() )
|
||||
{
|
||||
RiaLogging::error( "Failed to compute valid bounding box for ensemble statistics. At least one view must be opened" );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
boundingBox.expandPercent( expandBoundingBoxXYPercent, expandBoundingBoxZPercent );
|
||||
|
||||
RiaLogging::debug( QString( "Clusters bounding box min: [%1 %2 %3]" )
|
||||
.arg( boundingBox.min().x() )
|
||||
.arg( boundingBox.min().y() )
|
||||
@@ -414,13 +420,44 @@ RimRegularGridCase* RigWellTargetMapping::generateEnsembleCandidates( const std:
|
||||
resultNamesAndSamples["TOTAL_SFIPOIL"] = {};
|
||||
resultNamesAndSamples["TOTAL_SFIPGAS"] = {};
|
||||
|
||||
auto readerSettings = RiaPreferencesGrid::gridOnlyReaderSettings();
|
||||
readerSettings.onlyLoadActiveCells = true;
|
||||
|
||||
auto oldReaderType = RiaPreferencesGrid::current()->gridModelReaderOverride();
|
||||
RiaPreferencesGrid::current()->setGridModelReaderOverride( RiaDefines::GridModelReader::OPM_COMMON );
|
||||
|
||||
for ( auto eclipseCase : cases )
|
||||
{
|
||||
auto task = progInfo.task( "Accumulating results.", 1 );
|
||||
auto task = progInfo.task( "Generating realization statistics.", 1 );
|
||||
|
||||
RigWellTargetMappingTools::accumulateResultsForSingleCase( *eclipseCase, *targetCase, resultNamesAndSamples, occurrence, timeStepIdx );
|
||||
bool closeGrid = ( !eclipseCase->isReservoirCaseOpen() );
|
||||
|
||||
if ( closeGrid )
|
||||
{
|
||||
RiaLogging::debug( QString( "Opening grid for case: %1" ).arg( eclipseCase->gridFileName() ).toStdString() );
|
||||
}
|
||||
|
||||
auto oldReaderSettings = eclipseCase->readerSettings();
|
||||
if ( closeGrid )
|
||||
{
|
||||
eclipseCase->setReaderSettings( readerSettings );
|
||||
}
|
||||
|
||||
if ( eclipseCase->ensureReservoirCaseIsOpen() )
|
||||
{
|
||||
generateCandidates( eclipseCase, timeStepIdx, volumeType, volumesType, volumeResultType, floodingSettings, limits, false );
|
||||
RigWellTargetMappingTools::accumulateResultsForSingleCase( *eclipseCase, *targetCase, resultNamesAndSamples, occurrence, timeStepIdx );
|
||||
}
|
||||
if ( closeGrid )
|
||||
{
|
||||
eclipseCase->closeReservoirCase();
|
||||
eclipseCase->setReaderSettings( oldReaderSettings );
|
||||
RiaLogging::debug( QString( "Closing grid for case: %1" ).arg( eclipseCase->gridFileName() ).toStdString() );
|
||||
}
|
||||
}
|
||||
|
||||
RiaPreferencesGrid::current()->setGridModelReaderOverride( oldReaderType );
|
||||
|
||||
auto createFractionVector = []( const std::vector<int>& occurrence, int maxRealizationCount ) -> std::vector<double>
|
||||
{
|
||||
std::vector<double> fractions( occurrence.size() );
|
||||
|
||||
@@ -95,7 +95,9 @@ public:
|
||||
VolumesType volumesType,
|
||||
VolumeResultType volumeResultType,
|
||||
const RigFloodingSettings& floodingSettings,
|
||||
const ClusteringLimits& limits );
|
||||
const ClusteringLimits& limits,
|
||||
double expandBoundingBoxXYPercent,
|
||||
double expandBoundingBoxZPercent );
|
||||
|
||||
static QString wellTargetResultName();
|
||||
};
|
||||
@@ -474,6 +474,7 @@ std::vector<ReservoirCellIndex> RigWellTargetMappingTools::findCandidates( RimEc
|
||||
double transmissibility = data.transmissibilityNNC->at( nncResultIdx );
|
||||
|
||||
ActiveCellIndex otherResultIndex = resultsData->activeCellInfo()->cellResultIndex( otherCellIdx );
|
||||
if ( otherResultIndex.value() == cvf::UNDEFINED_SIZE_T ) continue;
|
||||
|
||||
double permeability = data.permeabilityX[otherResultIndex.value()];
|
||||
|
||||
|
||||
Reference in new issue
Block a user