mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Grid import using opm-common improvements (#11438)
* Update opm-common EGRID reader to support LGRs, NNCs, dual porosity, unit system info and time step filters * Rearrange well reading code into separate class * Update resdata library to not require an ecl_grid when reading well information. Only lgr names are needed, allows reused by opm_common reader
This commit is contained in:
@@ -819,14 +819,17 @@ QString RimFlowCharacteristicsPlot::curveDataAsText() const
|
||||
auto storageCapacityValues = a->second.m_storageCapFlowCapCurve.first;
|
||||
auto flowCapacityValues = a->second.m_storageCapFlowCapCurve.second;
|
||||
|
||||
if ( storageCapacityValues.size() < 2 || flowCapacityValues.size() < 2 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool extrapolate = false;
|
||||
std::vector<double> flowCapacitySamplingValues;
|
||||
for ( const auto storageCapacity : storageCapacitySamplingValues )
|
||||
{
|
||||
{
|
||||
double flowCapacity = interpolate( storageCapacityValues, flowCapacityValues, storageCapacity, extrapolate );
|
||||
flowCapacitySamplingValues.push_back( flowCapacity );
|
||||
}
|
||||
double flowCapacity = interpolate( storageCapacityValues, flowCapacityValues, storageCapacity, extrapolate );
|
||||
flowCapacitySamplingValues.push_back( flowCapacity );
|
||||
}
|
||||
|
||||
auto dimensionLessTimeValues = a->second.m_dimensionlessTimeSweepEfficiencyCurve.first;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "RifEclipseOutputFileTools.h"
|
||||
#include "RifEclipseRestartDataAccess.h"
|
||||
#include "RifInputPropertyLoader.h"
|
||||
#include "RifReaderEclipseOutput.h"
|
||||
#include "RifReaderEclipseRft.h"
|
||||
@@ -109,6 +110,28 @@ bool RimEclipseResultCase::openEclipseGridFile()
|
||||
return importGridAndResultMetaData( false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultCase::showTimeStepFilterGUI()
|
||||
{
|
||||
caf::PdmUiPropertyViewDialog propertyDialog( nullptr, m_timeStepFilter, "Time Step Filter", "", QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
|
||||
propertyDialog.resize( QSize( 400, 400 ) );
|
||||
|
||||
// Push arrow cursor onto the cursor stack so it takes over from the wait cursor.
|
||||
QApplication::setOverrideCursor( QCursor( Qt::ArrowCursor ) );
|
||||
// Show GUI to select time steps
|
||||
int dialogReturnValue = propertyDialog.exec();
|
||||
// Pop arrow cursor off the cursor stack so that the previous (wait) cursor takes over.
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
if ( dialogReturnValue != QDialog::Accepted ) return false;
|
||||
|
||||
m_timeStepFilter->updateFilteredTimeStepsFromUi();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -137,56 +160,48 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
||||
return false;
|
||||
}
|
||||
|
||||
auto defaultReader = RiaPreferences::current()->gridModelReader();
|
||||
auto readerType = RiaPreferences::current()->gridModelReader();
|
||||
|
||||
if ( defaultReader == RiaDefines::GridModelReader::RESDATA )
|
||||
// opmcommon reader only reads EGRID
|
||||
if ( !gridFileName().toLower().endsWith( ".egrid" ) )
|
||||
{
|
||||
readerType = RiaDefines::GridModelReader::RESDATA;
|
||||
}
|
||||
|
||||
if ( readerType == RiaDefines::GridModelReader::RESDATA )
|
||||
{
|
||||
auto readerEclipseOutput = new RifReaderEclipseOutput();
|
||||
|
||||
cvf::ref<RifEclipseRestartDataAccess> restartDataAccess = RifEclipseOutputFileTools::createDynamicResultAccess( gridFileName() );
|
||||
|
||||
std::vector<QDateTime> timeSteps;
|
||||
std::vector<double> daysSinceSimulationStart;
|
||||
|
||||
if ( restartDataAccess.notNull() )
|
||||
{
|
||||
std::vector<QDateTime> timeSteps;
|
||||
std::vector<double> daysSinceSimulationStart;
|
||||
|
||||
if ( restartDataAccess.notNull() )
|
||||
{
|
||||
restartDataAccess->timeSteps( &timeSteps, &daysSinceSimulationStart );
|
||||
}
|
||||
m_timeStepFilter->setTimeStepsFromFile( timeSteps );
|
||||
}
|
||||
|
||||
if ( showTimeStepFilter )
|
||||
{
|
||||
caf::PdmUiPropertyViewDialog propertyDialog( nullptr,
|
||||
m_timeStepFilter,
|
||||
"Time Step Filter",
|
||||
"",
|
||||
QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
|
||||
propertyDialog.resize( QSize( 400, 400 ) );
|
||||
|
||||
// Push arrow cursor onto the cursor stack so it takes over from the wait cursor.
|
||||
QApplication::setOverrideCursor( QCursor( Qt::ArrowCursor ) );
|
||||
// Show GUI to select time steps
|
||||
int dialogReturnValue = propertyDialog.exec();
|
||||
// Pop arrow cursor off the cursor stack so that the previous (wait) cursor takes over.
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
if ( dialogReturnValue != QDialog::Accepted )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_timeStepFilter->updateFilteredTimeStepsFromUi();
|
||||
restartDataAccess->timeSteps( &timeSteps, &daysSinceSimulationStart );
|
||||
}
|
||||
m_timeStepFilter->setTimeStepsFromFile( timeSteps );
|
||||
|
||||
readerEclipseOutput->setFileDataAccess( restartDataAccess.p() );
|
||||
readerEclipseOutput->setTimeStepFilter( m_timeStepFilter->filteredTimeSteps() );
|
||||
|
||||
readerInterface = readerEclipseOutput;
|
||||
}
|
||||
else
|
||||
{
|
||||
readerInterface = new RifReaderOpmCommon;
|
||||
auto readerOpmCommon = new RifReaderOpmCommon();
|
||||
|
||||
std::vector<QDateTime> timeSteps = readerOpmCommon->timeStepsOnFile( gridFileName() );
|
||||
m_timeStepFilter->setTimeStepsFromFile( timeSteps );
|
||||
|
||||
readerInterface = readerOpmCommon;
|
||||
}
|
||||
|
||||
if ( showTimeStepFilter )
|
||||
{
|
||||
if ( !showTimeStepFilterGUI() ) return false;
|
||||
|
||||
readerInterface->setTimeStepFilter( m_timeStepFilter->filteredTimeSteps() );
|
||||
}
|
||||
|
||||
readerInterface->setFilenamesWithFaults( filesContainingFaults() );
|
||||
|
||||
@@ -84,6 +84,7 @@ protected:
|
||||
private:
|
||||
void loadAndUpdateSourSimData();
|
||||
void ensureRftDataIsImported();
|
||||
bool showTimeStepFilterGUI();
|
||||
|
||||
cvf::ref<RifReaderInterface> createMockModel( QString modelName );
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
Reference in New Issue
Block a user