Improves relative permeability plot display

Enhances the relative permeability plot by:

- Adding support for SATNUM and IMBNUM result display in cell reference information.
- Disabling the imbibition curve selection by default and enabling it dynamically based on the IMBNUM value.
- Removing the `satnum` argument from `calculateRelPermCurves` as it's no longer needed.
This commit is contained in:
Magne Sjaastad committed 2025-11-03 16:07:40 +01:00
1 parent 597cfd4d30
commit 186992ebb6
9 files changed
+83 -41

No files matched your search

@@ -668,6 +668,22 @@ std::set<QString> RiaResultNames::nncResultNames()
combinedRiTranResultName() };
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaResultNames::satnumResult()
{
return "SATNUM";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaResultNames::imbnumResult()
{
return "IMBNUM";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -120,6 +120,9 @@ QString formationBinaryAllanResultName();
QString formationAllanResultName();
std::set<QString> nncResultNames();
QString satnumResult();
QString imbnumResult();
// List of well path derived results
std::vector<QString> wbsAngleResultNames();
std::vector<QString> wbsDerivedResultNames();
@@ -661,7 +661,7 @@ RigFlowDiagDefines::FlowCharacteristicsResultFrame
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigFlowDiagDefines::RelPermCurve> RigFlowDiagSolverInterface::calculateRelPermCurves( size_t activeCellIndex, int satnum )
std::vector<RigFlowDiagDefines::RelPermCurve> RigFlowDiagSolverInterface::calculateRelPermCurves( size_t activeCellIndex )
{
using RawCurve = Opm::ECLSaturationFunc::RawCurve;
@@ -79,7 +79,7 @@ public:
const std::vector<size_t>& selected_cell_indices,
double max_pv_fraction );
std::vector<RigFlowDiagDefines::RelPermCurve> calculateRelPermCurves( size_t activeCellIndex, int satnum );
std::vector<RigFlowDiagDefines::RelPermCurve> calculateRelPermCurves( size_t activeCellIndex );
std::vector<RigFlowDiagDefines::PvtCurve> calculatePvtCurves( RigFlowDiagDefines::PvtCurveType pvtCurveType, int pvtNum );
bool calculatePvtDynamicPropertiesFvf( int pvtNum, double pressure, double rs, double rv, double* bo, double* bg );
@@ -149,11 +149,8 @@ bool RiuPvtPlotUpdater::queryDataAndUpdatePlot( const RimEclipseResultDefinition
&viscosityDynProps.mu_o,
&viscosityDynProps.mu_g );
QString cellRefText = RiuRelativePermeabilityPlotUpdater::constructCellReferenceText( eclipseCaseData,
gridIndex,
gridLocalCellIndex,
"PVTNUM",
cellPvtNumDouble );
QString cellRefText = RiuRelativePermeabilityPlotUpdater::constructCellReferenceText( eclipseCaseData, gridIndex, gridLocalCellIndex );
cellRefText += QString( ", PVTNUM: %1" ).arg( cellPvtNum );
m_targetPlotPanel->setPlotData( eclipseCaseData->unitsType(),
fvfCurveArr,
@@ -163,7 +163,7 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel( QWidget* par
m_showDrainageCheckBox = new QCheckBox( "Drainage" );
m_showImbibitionCheckBox = new QCheckBox( "Imbibition" );
m_showDrainageCheckBox->setChecked( true );
m_showImbibitionCheckBox->setChecked( true );
m_showImbibitionCheckBox->setChecked( false );
curveSetLayout->addWidget( m_showDrainageCheckBox );
curveSetLayout->addWidget( m_showImbibitionCheckBox );
@@ -278,6 +278,22 @@ void RiuRelativePermeabilityPlotPanel::setPlotData( RiaDefines::EclipseUnitSyste
plotUiSelectedCurves();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuRelativePermeabilityPlotPanel::enableImbibitionCurveSelection( bool enable )
{
if ( !enable )
{
m_showImbibitionCheckBox->setChecked( false );
m_showImbibitionCheckBox->setDisabled( true );
}
else
{
m_showImbibitionCheckBox->setDisabled( false );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -51,12 +51,15 @@ public:
RiuRelativePermeabilityPlotPanel( QWidget* parent );
~RiuRelativePermeabilityPlotPanel() override;
void setPlotData( RiaDefines::EclipseUnitSystem unitSystem,
const std::vector<RigFlowDiagDefines::RelPermCurve>& relPermCurves,
double swat,
double sgas,
const QString& caseName,
const QString& cellReferenceText );
void setPlotData( RiaDefines::EclipseUnitSystem unitSystem,
const std::vector<RigFlowDiagDefines::RelPermCurve>& relPermCurves,
double swat,
double sgas,
const QString& caseName,
const QString& cellReferenceText );
void enableImbibitionCurveSelection( bool enable );
void clearPlot();
RiuRelativePermeabilityPlotUpdater* plotUpdater();
void applyFontSizes( bool replot );
@@ -112,7 +112,10 @@ bool RiuRelativePermeabilityPlotUpdater::queryDataAndUpdatePlot( const RimEclips
RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::swat() ) );
cellResultsData->ensureKnownResultLoaded(
RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) );
cellResultsData->ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "SATNUM" ) );
cellResultsData->ensureKnownResultLoaded(
RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::satnumResult() ) );
cellResultsData->ensureKnownResultLoaded(
RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::imbnumResult() ) );
// Fetch SWAT and SGAS cell values for the selected cell
cvf::ref<RigResultAccessor> swatAccessor =
@@ -135,26 +138,40 @@ bool RiuRelativePermeabilityPlotUpdater::queryDataAndUpdatePlot( const RimEclips
RiaDefines::PorosityModelType::MATRIX_MODEL,
timeStepIndex,
RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE,
"SATNUM" ) );
RiaResultNames::satnumResult() ) );
if ( satnumAccessor.isNull() )
{
QString text = QString( "Could not read SATNUM value, not able to create relative permeability curves." );
RiaLogging::error( text );
cvf::ref<RigResultAccessor> imbnumAccessor =
RigResultAccessorFactory::createFromResultAddress( eclipseCaseData,
gridIndex,
RiaDefines::PorosityModelType::MATRIX_MODEL,
timeStepIndex,
RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE,
RiaResultNames::imbnumResult() ) );
return false;
}
const double cellSWAT = swatAccessor.notNull() ? swatAccessor->cellScalar( gridLocalCellIndex ) : HUGE_VAL;
const double cellSGAS = sgasAccessor.notNull() ? sgasAccessor->cellScalar( gridLocalCellIndex ) : HUGE_VAL;
const int cellSATNUM = satnumAccessor->cellScalar( gridLocalCellIndex );
const double cellSWAT = swatAccessor.notNull() ? swatAccessor->cellScalar( gridLocalCellIndex ) : HUGE_VAL;
const double cellSGAS = sgasAccessor.notNull() ? sgasAccessor->cellScalar( gridLocalCellIndex ) : HUGE_VAL;
std::vector<RigFlowDiagDefines::RelPermCurve> relPermCurveArr =
eclipseResultCase->flowDiagSolverInterface()->calculateRelPermCurves( activeCellIndex, cellSATNUM );
eclipseResultCase->flowDiagSolverInterface()->calculateRelPermCurves( activeCellIndex );
QString cellRefText = constructCellReferenceText( eclipseCaseData, gridIndex, gridLocalCellIndex, "SATNUM", cellSATNUM );
QString caseName = eclipseResultCase->caseUserDescription();
QString cellRefText = constructCellReferenceText( eclipseCaseData, gridIndex, gridLocalCellIndex );
if ( satnumAccessor.notNull() )
{
const int cellSATNUM = satnumAccessor->cellScalar( gridLocalCellIndex );
cellRefText += QString( ", SATNUM: %1" ).arg( cellSATNUM );
}
if ( imbnumAccessor.notNull() )
{
const int cellIMBNUM = imbnumAccessor->cellScalar( gridLocalCellIndex );
cellRefText += QString( ", IMBNUM: %1" ).arg( cellIMBNUM );
}
QString caseName = eclipseResultCase->caseUserDescription();
const bool enableImbibitionCurveSelection = ( imbnumAccessor.notNull() && imbnumAccessor->cellScalar( gridLocalCellIndex ) > 0 );
m_targetPlotPanel->enableImbibitionCurveSelection( enableImbibitionCurveSelection );
m_targetPlotPanel->setPlotData( eclipseCaseData->unitsType(), relPermCurveArr, cellSWAT, cellSGAS, caseName, cellRefText );
return true;
@@ -169,9 +186,7 @@ bool RiuRelativePermeabilityPlotUpdater::queryDataAndUpdatePlot( const RimEclips
//--------------------------------------------------------------------------------------------------
QString RiuRelativePermeabilityPlotUpdater::constructCellReferenceText( const RigEclipseCaseData* eclipseCaseData,
size_t gridIndex,
size_t gridLocalCellIndex,
const QString& valueName,
double cellValue )
size_t gridLocalCellIndex )
{
const size_t gridCount = eclipseCaseData ? eclipseCaseData->gridCount() : 0;
const RigGridBase* grid = gridIndex < gridCount ? eclipseCaseData->grid( gridIndex ) : nullptr;
@@ -196,10 +211,6 @@ QString RiuRelativePermeabilityPlotUpdater::constructCellReferenceText( const Ri
{
retText = QString( "LGR %1, Cell: [%2, %3, %4]" ).arg( gridIndex ).arg( i ).arg( j ).arg( k );
}
if ( cellValue != HUGE_VAL )
{
retText += QString( " (%1=%2)" ).arg( valueName ).arg( cellValue );
}
return retText;
}
@@ -34,11 +34,7 @@ class RiuRelativePermeabilityPlotUpdater : public RiuPlotUpdater
public:
RiuRelativePermeabilityPlotUpdater( RiuRelativePermeabilityPlotPanel* targetPlotPanel );
static QString constructCellReferenceText( const RigEclipseCaseData* eclipseCaseData,
size_t gridIndex,
size_t gridLocalCellIndex,
const QString& valueName,
double cellValue );
static QString constructCellReferenceText( const RigEclipseCaseData* eclipseCaseData, size_t gridIndex, size_t gridLocalCellIndex );
protected:
void clearPlot() override;