mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
PVT Plot: Added header in PVT plot panel containing cell info
This commit is contained in:
parent
ebe60d8b16
commit
127f5b40b4
@ -504,11 +504,18 @@ RiuPvtPlotPanel::RiuPvtPlotPanel(QDockWidget* parent)
|
||||
m_phaseComboBox->addItem("Oil", QVariant(RigFlowDiagSolverInterface::PvtCurve::OIL));
|
||||
m_phaseComboBox->addItem("Gas", QVariant(RigFlowDiagSolverInterface::PvtCurve::GAS));
|
||||
|
||||
QHBoxLayout* comboLayout = new QHBoxLayout();
|
||||
comboLayout->addWidget(new QLabel("Phase:"));
|
||||
comboLayout->addWidget(m_phaseComboBox);
|
||||
comboLayout->addStretch(1);
|
||||
comboLayout->setContentsMargins(5, 5, 0, 0);
|
||||
m_titleLabel = new QLabel("", this);
|
||||
m_titleLabel->setAlignment(Qt::AlignHCenter);
|
||||
QFont font = m_titleLabel->font();
|
||||
font.setPixelSize(14);
|
||||
font.setBold(true);
|
||||
m_titleLabel->setFont(font);
|
||||
|
||||
QHBoxLayout* topLayout = new QHBoxLayout();
|
||||
topLayout->addWidget(new QLabel("Phase:"));
|
||||
topLayout->addWidget(m_phaseComboBox);
|
||||
topLayout->addWidget(m_titleLabel, 1);
|
||||
topLayout->setContentsMargins(5, 5, 0, 0);
|
||||
|
||||
m_fvfPlot = new RiuPvtPlotWidget(this);
|
||||
m_viscosityPlot = new RiuPvtPlotWidget(this);
|
||||
@ -520,7 +527,7 @@ RiuPvtPlotPanel::RiuPvtPlotPanel(QDockWidget* parent)
|
||||
plotLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout();
|
||||
mainLayout->addLayout(comboLayout);
|
||||
mainLayout->addLayout(topLayout);
|
||||
mainLayout->addLayout(plotLayout);
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
@ -541,7 +548,7 @@ RiuPvtPlotPanel::~RiuPvtPlotPanel()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPvtPlotPanel::setPlotData(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& fvfCurveArr, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& viscosityCurveArr, FvfDynProps fvfDynProps, ViscosityDynProps viscosityDynProps, CellValues cellValues)
|
||||
void RiuPvtPlotPanel::setPlotData(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& fvfCurveArr, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& viscosityCurveArr, FvfDynProps fvfDynProps, ViscosityDynProps viscosityDynProps, CellValues cellValues, QString cellReferenceText)
|
||||
{
|
||||
//cvf::Trace::show("RiuPvtPlotPanel::setPlotData()");
|
||||
|
||||
@ -551,6 +558,7 @@ void RiuPvtPlotPanel::setPlotData(RiaEclipseUnitTools::UnitSystem unitSystem, co
|
||||
m_fvfDynProps = fvfDynProps;
|
||||
m_viscosityDynProps = viscosityDynProps;
|
||||
m_cellValues = cellValues;
|
||||
m_cellReferenceText = cellReferenceText;
|
||||
|
||||
plotUiSelectedCurves();
|
||||
}
|
||||
@ -562,7 +570,7 @@ void RiuPvtPlotPanel::clearPlot()
|
||||
{
|
||||
//cvf::Trace::show("RiuPvtPlotPanel::clearPlot()");
|
||||
|
||||
if (m_allFvfCurvesArr.empty() && m_allViscosityCurvesArr.empty())
|
||||
if (m_allFvfCurvesArr.empty() && m_allViscosityCurvesArr.empty() && m_cellReferenceText.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -573,6 +581,7 @@ void RiuPvtPlotPanel::clearPlot()
|
||||
m_fvfDynProps = FvfDynProps();
|
||||
m_viscosityDynProps = ViscosityDynProps();
|
||||
m_cellValues = CellValues();
|
||||
m_cellReferenceText.clear();
|
||||
|
||||
plotUiSelectedCurves();
|
||||
}
|
||||
@ -625,7 +634,7 @@ void RiuPvtPlotPanel::plotUiSelectedCurves()
|
||||
curveIdentToPlot = RigFlowDiagSolverInterface::PvtCurve::Bo;
|
||||
pointMarkerFvfValue = m_fvfDynProps.bo;
|
||||
pointMarkerLabel = QString("%1 (%2)").arg(pointMarkerFvfValue).arg(m_cellValues.pressure);
|
||||
if (m_cellValues.rv != HUGE_VAL)
|
||||
if (m_cellValues.rs != HUGE_VAL)
|
||||
{
|
||||
pointMarkerLabel += QString("\nRs = %1").arg(m_cellValues.rs);
|
||||
}
|
||||
@ -685,6 +694,15 @@ void RiuPvtPlotPanel::plotUiSelectedCurves()
|
||||
const QString yAxisTitle = QString("%1 Viscosity [%2]").arg(phaseString).arg(unitLabelFromCurveIdent(m_unitSystem, curveIdentToPlot));
|
||||
m_viscosityPlot->plotCurves(m_unitSystem, selectedViscosityCurves, m_cellValues.pressure, pointMarkerViscosityValue, pointMarkerLabel, plotTitle, yAxisTitle);
|
||||
}
|
||||
|
||||
// Update the label on top in our panel
|
||||
QString titleStr = "PVT";
|
||||
if (!m_cellReferenceText.isEmpty())
|
||||
{
|
||||
titleStr += ", " + m_cellReferenceText;
|
||||
}
|
||||
|
||||
m_titleLabel->setText(titleStr);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -28,14 +28,17 @@
|
||||
#include <memory>
|
||||
|
||||
class RiuPvtPlotUpdater;
|
||||
class RiuPvtQwtPicker;
|
||||
class RiuPvtPlotPanel;
|
||||
|
||||
class QDockWidget;
|
||||
class QwtPlot;
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
|
||||
class QwtPlot;
|
||||
class QwtPlotMarker;
|
||||
class QwtPlotCurve;
|
||||
|
||||
class RiuPvtQwtPicker;
|
||||
class RiuPvtPlotPanel;
|
||||
|
||||
|
||||
|
||||
@ -118,7 +121,7 @@ public:
|
||||
RiuPvtPlotPanel(QDockWidget* parent);
|
||||
virtual ~RiuPvtPlotPanel();
|
||||
|
||||
void setPlotData(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& fvfCurveArr, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& viscosityCurveArr, FvfDynProps fvfDynProps, ViscosityDynProps viscosityDynProps, CellValues cellValues);
|
||||
void setPlotData(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& fvfCurveArr, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& viscosityCurveArr, FvfDynProps fvfDynProps, ViscosityDynProps viscosityDynProps, CellValues cellValues, QString cellReferenceText);
|
||||
void clearPlot();
|
||||
RiuPvtPlotUpdater* plotUpdater();
|
||||
|
||||
@ -136,8 +139,10 @@ private:
|
||||
FvfDynProps m_fvfDynProps;
|
||||
ViscosityDynProps m_viscosityDynProps;
|
||||
CellValues m_cellValues;
|
||||
QString m_cellReferenceText;
|
||||
|
||||
QComboBox* m_phaseComboBox;
|
||||
QLabel* m_titleLabel;
|
||||
|
||||
RiuPvtPlotWidget* m_fvfPlot;
|
||||
RiuPvtPlotWidget* m_viscosityPlot;
|
||||
|
@ -144,22 +144,30 @@ bool RiuPvtPlotUpdater::queryDataAndUpdatePlot(const RimEclipseView& eclipseView
|
||||
cellResultsData->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "RS");
|
||||
cellResultsData->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "RV");
|
||||
cellResultsData->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "PRESSURE");
|
||||
cellResultsData->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PVTNUM");
|
||||
|
||||
cvf::ref<RigResultAccessor> rsAccessor = RigResultAccessorFactory::createFromNameAndType(eclipseCaseData, gridIndex, RiaDefines::MATRIX_MODEL, timeStepIndex, "RS", RiaDefines::DYNAMIC_NATIVE);
|
||||
cvf::ref<RigResultAccessor> rvAccessor = RigResultAccessorFactory::createFromNameAndType(eclipseCaseData, gridIndex, RiaDefines::MATRIX_MODEL, timeStepIndex, "RV", RiaDefines::DYNAMIC_NATIVE);
|
||||
cvf::ref<RigResultAccessor> pressureAccessor = RigResultAccessorFactory::createFromNameAndType(eclipseCaseData, gridIndex, RiaDefines::MATRIX_MODEL, timeStepIndex, "PRESSURE", RiaDefines::DYNAMIC_NATIVE);
|
||||
cvf::ref<RigResultAccessor> pvtnumAccessor = RigResultAccessorFactory::createFromNameAndType(eclipseCaseData, gridIndex, RiaDefines::MATRIX_MODEL, timeStepIndex, "PVTNUM", RiaDefines::STATIC_NATIVE);
|
||||
|
||||
RiuPvtPlotPanel::CellValues cellValues;
|
||||
cellValues.rs = rsAccessor.notNull() ? rsAccessor->cellScalar(gridLocalCellIndex) : HUGE_VAL;
|
||||
cellValues.rv = rvAccessor.notNull() ? rvAccessor->cellScalar(gridLocalCellIndex) : HUGE_VAL;
|
||||
cellValues.pressure = pressureAccessor.notNull() ? pressureAccessor->cellScalar(gridLocalCellIndex) : HUGE_VAL;
|
||||
|
||||
const double cellPVTNUM = pvtnumAccessor.notNull() ? pvtnumAccessor->cellScalar(gridLocalCellIndex) : HUGE_VAL;
|
||||
|
||||
|
||||
RiuPvtPlotPanel::FvfDynProps fvfDynProps;
|
||||
eclipseResultCase->flowDiagSolverInterface()->calculatePvtDynamicPropertiesFvf(activeCellIndex, cellValues.pressure, cellValues.rs, cellValues.rv, &fvfDynProps.bo, &fvfDynProps.bg);
|
||||
|
||||
RiuPvtPlotPanel::ViscosityDynProps viscosityDynProps;
|
||||
eclipseResultCase->flowDiagSolverInterface()->calculatePvtDynamicPropertiesViscosity(activeCellIndex, cellValues.pressure, cellValues.rs, cellValues.rv, &viscosityDynProps.mu_o, &viscosityDynProps.mu_g);
|
||||
|
||||
plotPanel->setPlotData(eclipseCaseData->unitsType(), fvfCurveArr, viscosityCurveArr, fvfDynProps, viscosityDynProps, cellValues);
|
||||
QString cellRefText = constructCellReferenceText(eclipseCaseData, gridIndex, gridLocalCellIndex, cellPVTNUM);
|
||||
|
||||
plotPanel->setPlotData(eclipseCaseData->unitsType(), fvfCurveArr, viscosityCurveArr, fvfDynProps, viscosityDynProps, cellValues, cellRefText);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -169,3 +177,37 @@ bool RiuPvtPlotUpdater::queryDataAndUpdatePlot(const RimEclipseView& eclipseView
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuPvtPlotUpdater::constructCellReferenceText(const RigEclipseCaseData* eclipseCaseData, size_t gridIndex, size_t gridLocalCellIndex, double pvtnum)
|
||||
{
|
||||
const size_t gridCount = eclipseCaseData ? eclipseCaseData->gridCount() : 0;
|
||||
const RigGridBase* grid = gridIndex < gridCount ? eclipseCaseData->grid(gridIndex) : NULL;
|
||||
if (grid && gridLocalCellIndex < grid->cellCount())
|
||||
{
|
||||
size_t i = 0;
|
||||
size_t j = 0;
|
||||
size_t k = 0;
|
||||
if (grid->ijkFromCellIndex(gridLocalCellIndex, &i, &j, &k))
|
||||
{
|
||||
// Adjust to 1-based Eclipse indexing
|
||||
i++;
|
||||
j++;
|
||||
k++;
|
||||
|
||||
QString retText = QString("Grid index %1, Cell: [%2, %3, %4]").arg(gridIndex).arg(i).arg(j).arg(k);
|
||||
|
||||
if (pvtnum != HUGE_VAL)
|
||||
{
|
||||
retText += QString(" (PVTNUM=%1)").arg(pvtnum);
|
||||
}
|
||||
|
||||
return retText;
|
||||
}
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,6 +25,7 @@ class RiuSelectionItem;
|
||||
class RiuPvtPlotPanel;
|
||||
class RimView;
|
||||
class RimEclipseView;
|
||||
class RigEclipseCaseData;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
@ -41,7 +42,8 @@ public:
|
||||
void updateOnTimeStepChanged(RimView* changedView);
|
||||
|
||||
private:
|
||||
static bool queryDataAndUpdatePlot(const RimEclipseView& eclipseView, size_t gridIndex, size_t gridLocalCellIndex, RiuPvtPlotPanel* plotPanel);
|
||||
static bool queryDataAndUpdatePlot(const RimEclipseView& eclipseView, size_t gridIndex, size_t gridLocalCellIndex, RiuPvtPlotPanel* plotPanel);
|
||||
static QString constructCellReferenceText(const RigEclipseCaseData* eclipseCaseData, size_t gridIndex, size_t gridLocalCellIndex, double pvtnum);
|
||||
|
||||
private:
|
||||
QPointer<RiuPvtPlotPanel> m_targetPlotPanel;
|
||||
|
Loading…
Reference in New Issue
Block a user