#1994 PVT Plot: Removed water phase from plot, started implementing display of pressure marker, but this is not yet active.

This commit is contained in:
sigurdp 2017-11-28 09:12:12 +01:00
parent aa1bbbe2d9
commit 3b1775ad4d
5 changed files with 62 additions and 17 deletions

View File

@ -682,8 +682,8 @@ std::vector<RigFlowDiagSolverInterface::PvtCurve> RigFlowDiagSolverInterface::ca
// Requesting FVF or Viscosity // Requesting FVF or Viscosity
const Opm::ECLPVT::RawCurve rawCurveType = (pvtCurveType == PvtCurveType::PVT_CT_FVF) ? Opm::ECLPVT::RawCurve::FVF : Opm::ECLPVT::RawCurve::Viscosity; const Opm::ECLPVT::RawCurve rawCurveType = (pvtCurveType == PvtCurveType::PVT_CT_FVF) ? Opm::ECLPVT::RawCurve::FVF : Opm::ECLPVT::RawCurve::Viscosity;
const std::array<Opm::ECLPhaseIndex, 3> queryPhaseArr = { Opm::ECLPhaseIndex::Vapour, Opm::ECLPhaseIndex::Liquid, Opm::ECLPhaseIndex::Aqua }; const std::array<Opm::ECLPhaseIndex, 2> queryPhaseArr = { Opm::ECLPhaseIndex::Vapour, Opm::ECLPhaseIndex::Liquid };
const std::array<PvtCurve::Phase, 3> mapToPhaseArr = { PvtCurve::GAS, PvtCurve::OIL, PvtCurve::WATER }; const std::array<PvtCurve::Phase, 2> mapToPhaseArr = { PvtCurve::GAS, PvtCurve::OIL };
for (size_t i = 0; i < queryPhaseArr.size(); i++) for (size_t i = 0; i < queryPhaseArr.size(); i++)
{ {

View File

@ -95,7 +95,7 @@ public:
struct PvtCurve struct PvtCurve
{ {
enum Phase { OIL, GAS, WATER }; enum Phase { OIL, GAS };
Phase phase; Phase phase;
std::vector<double> xVals; std::vector<double> xVals;

View File

@ -29,6 +29,7 @@
#include "qwt_plot_curve.h" #include "qwt_plot_curve.h"
#include "qwt_legend.h" #include "qwt_legend.h"
#include "qwt_symbol.h" #include "qwt_symbol.h"
#include "qwt_plot_marker.h"
#include <QDockWidget> #include <QDockWidget>
#include <QHBoxLayout> #include <QHBoxLayout>
@ -65,13 +66,13 @@ public:
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuPvtPlotPanel::RiuPvtPlotPanel(QDockWidget* parent) RiuPvtPlotPanel::RiuPvtPlotPanel(QDockWidget* parent)
: QWidget(parent) : QWidget(parent),
m_pressure(HUGE_VAL)
{ {
m_phaseComboBox = new QComboBox(this); m_phaseComboBox = new QComboBox(this);
m_phaseComboBox->setEditable(false); m_phaseComboBox->setEditable(false);
m_phaseComboBox->addItem("Oil", QVariant(RigFlowDiagSolverInterface::PvtCurve::OIL)); m_phaseComboBox->addItem("Oil", QVariant(RigFlowDiagSolverInterface::PvtCurve::OIL));
m_phaseComboBox->addItem("Gas", QVariant(RigFlowDiagSolverInterface::PvtCurve::GAS)); m_phaseComboBox->addItem("Gas", QVariant(RigFlowDiagSolverInterface::PvtCurve::GAS));
m_phaseComboBox->addItem("Water", QVariant(RigFlowDiagSolverInterface::PvtCurve::WATER));
QHBoxLayout* comboLayout = new QHBoxLayout(); QHBoxLayout* comboLayout = new QHBoxLayout();
comboLayout->addWidget(new QLabel("Phase:")); comboLayout->addWidget(new QLabel("Phase:"));
@ -129,12 +130,13 @@ void RiuPvtPlotPanel::setPlotDefaults(QwtPlot* plot)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuPvtPlotPanel::setPlotData(const std::vector<RigFlowDiagSolverInterface::PvtCurve>& fvfCurveArr, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& viscosityCurveArr, QString cellReferenceText) void RiuPvtPlotPanel::setPlotData(const std::vector<RigFlowDiagSolverInterface::PvtCurve>& fvfCurveArr, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& viscosityCurveArr, double pressure, QString cellReferenceText)
{ {
//cvf::Trace::show("RiuPvtPlotPanel::setPlotData()"); //cvf::Trace::show("RiuPvtPlotPanel::setPlotData()");
m_allFvfCurvesArr = fvfCurveArr; m_allFvfCurvesArr = fvfCurveArr;
m_allViscosityCurvesArr = viscosityCurveArr; m_allViscosityCurvesArr = viscosityCurveArr;
m_pressure = pressure;
m_cellReferenceText = cellReferenceText; m_cellReferenceText = cellReferenceText;
@ -155,6 +157,7 @@ void RiuPvtPlotPanel::clearPlot()
m_allFvfCurvesArr.clear(); m_allFvfCurvesArr.clear();
m_allViscosityCurvesArr.clear(); m_allViscosityCurvesArr.clear();
m_pressure = HUGE_VAL;
m_cellReferenceText.clear(); m_cellReferenceText.clear();
@ -192,18 +195,17 @@ void RiuPvtPlotPanel::plotUiSelectedCurves()
QString phaseString = ""; QString phaseString = "";
if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::GAS) phaseString = "Gas "; if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::GAS) phaseString = "Gas ";
else if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::OIL) phaseString = "Oil "; else if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::OIL) phaseString = "Oil ";
else if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::WATER) phaseString = "Water ";
{ {
const QString plotTitle = phaseString + "Formation Volume Factor"; const QString plotTitle = phaseString + "Formation Volume Factor";
const QString yAxisTitle = ""; const QString yAxisTitle = phaseString + "Formation Volume Factor";
plotCurvesInQwt(selectedFvfCurves, plotTitle, yAxisTitle, m_fvfPlot); plotCurvesInQwt(selectedFvfCurves, m_pressure, plotTitle, yAxisTitle, m_fvfPlot);
} }
{ {
const QString plotTitle = phaseString + "Viscosity"; const QString plotTitle = phaseString + "Viscosity";
const QString yAxisTitle = phaseString + "Viscosity"; const QString yAxisTitle = phaseString + "Viscosity";
plotCurvesInQwt(selectedViscosityCurves, plotTitle, yAxisTitle, m_viscosityPlot); plotCurvesInQwt(selectedViscosityCurves, m_pressure, plotTitle, yAxisTitle, m_viscosityPlot);
} }
@ -212,9 +214,10 @@ void RiuPvtPlotPanel::plotUiSelectedCurves()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuPvtPlotPanel::plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterface::PvtCurve>& curveArr, QString plotTitle, QString yAxisTitle, QwtPlot* plot) void RiuPvtPlotPanel::plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterface::PvtCurve>& curveArr, double pressure, QString plotTitle, QString yAxisTitle, QwtPlot* plot)
{ {
plot->detachItems(QwtPlotItem::Rtti_PlotCurve); plot->detachItems(QwtPlotItem::Rtti_PlotCurve);
plot->detachItems(QwtPlotItem::Rtti_PlotMarker);
for (size_t i = 0; i < curveArr.size(); i++) for (size_t i = 0; i < curveArr.size(); i++)
{ {
@ -229,15 +232,32 @@ void RiuPvtPlotPanel::plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterfa
QColor curveClr = Qt::magenta; QColor curveClr = Qt::magenta;
if (curve.phase == RigFlowDiagSolverInterface::PvtCurve::GAS) curveClr = QColor(Qt::red); if (curve.phase == RigFlowDiagSolverInterface::PvtCurve::GAS) curveClr = QColor(Qt::red);
else if (curve.phase == RigFlowDiagSolverInterface::PvtCurve::OIL) curveClr = QColor(Qt::green); else if (curve.phase == RigFlowDiagSolverInterface::PvtCurve::OIL) curveClr = QColor(Qt::green);
else if (curve.phase == RigFlowDiagSolverInterface::PvtCurve::WATER) curveClr = QColor(Qt::blue);
const QPen curvePen(curveClr); const QPen curvePen(curveClr);
qwtCurve->setPen(curvePen); qwtCurve->setPen(curvePen);
qwtCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true); qwtCurve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
QwtSymbol* curveSymbol = new QwtSymbol(QwtSymbol::Ellipse);
curveSymbol->setSize(6, 6);
curveSymbol->setPen(curvePen);
curveSymbol->setBrush(Qt::NoBrush);
qwtCurve->setSymbol(curveSymbol);
qwtCurve->attach(plot); qwtCurve->attach(plot);
} }
// Add vertical marker lines to indicate cell pressure
if (pressure != HUGE_VAL)
{
QwtPlotMarker* lineMarker = new QwtPlotMarker;
lineMarker->setXValue(pressure);
lineMarker->setLineStyle(QwtPlotMarker::VLine);
lineMarker->setLinePen(QPen(Qt::black, 1, Qt::DashLine));
lineMarker->setLabel(QString("Pressure"));
lineMarker->setLabelAlignment(Qt::AlignTop | Qt::AlignRight);
lineMarker->setLabelOrientation(Qt::Vertical);
lineMarker->attach(plot);
}
plot->setTitle(plotTitle); plot->setTitle(plotTitle);
@ -247,6 +267,22 @@ void RiuPvtPlotPanel::plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterfa
plot->replot(); plot->replot();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuPvtPlotPanel::addVerticalPressureMarkerLine(double pressureValue, QColor color, QwtPlot* plot)
{
QwtPlotMarker* lineMarker = new QwtPlotMarker;
lineMarker->setXValue(pressureValue);
lineMarker->setLineStyle(QwtPlotMarker::VLine);
lineMarker->setLinePen(QPen(color, 1, Qt::DashLine));
lineMarker->setLabel(QString("PRESSURE"));
lineMarker->setLabelAlignment(Qt::AlignTop | Qt::AlignRight);
lineMarker->setLabelOrientation(Qt::Vertical);
lineMarker->attach(plot);
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -40,13 +40,14 @@ public:
RiuPvtPlotPanel(QDockWidget* parent); RiuPvtPlotPanel(QDockWidget* parent);
virtual ~RiuPvtPlotPanel(); virtual ~RiuPvtPlotPanel();
void setPlotData(const std::vector<RigFlowDiagSolverInterface::PvtCurve>& fvfCurveArr, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& viscosityCurveArr, QString cellReferenceText); void setPlotData(const std::vector<RigFlowDiagSolverInterface::PvtCurve>& fvfCurveArr, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& viscosityCurveArr, double pressure, QString cellReferenceText);
void clearPlot(); void clearPlot();
private: private:
void plotUiSelectedCurves(); void plotUiSelectedCurves();
static void setPlotDefaults(QwtPlot* plot); static void setPlotDefaults(QwtPlot* plot);
static void plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterface::PvtCurve>& curveArr, QString plotTitle, QString yAxisTitle, QwtPlot* plot); static void plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterface::PvtCurve>& curveArr, double pressure, QString plotTitle, QString yAxisTitle, QwtPlot* plot);
static void addVerticalPressureMarkerLine(double pressureValue, QColor color, QwtPlot* plot);
private slots: private slots:
void slotPhaseComboCurrentIndexChanged(int); void slotPhaseComboCurrentIndexChanged(int);
@ -54,6 +55,7 @@ private slots:
private: private:
std::vector<RigFlowDiagSolverInterface::PvtCurve> m_allFvfCurvesArr; std::vector<RigFlowDiagSolverInterface::PvtCurve> m_allFvfCurvesArr;
std::vector<RigFlowDiagSolverInterface::PvtCurve> m_allViscosityCurvesArr; std::vector<RigFlowDiagSolverInterface::PvtCurve> m_allViscosityCurvesArr;
double m_pressure;
QString m_cellReferenceText; QString m_cellReferenceText;
QComboBox* m_phaseComboBox; QComboBox* m_phaseComboBox;

View File

@ -377,20 +377,27 @@ void RiuSelectionChangedHandler::updatePvtPlot(const RiuSelectionItem* selection
if (pvtPlotPanel->isVisible() && selectionItem && selectionItem->type() == RiuSelectionItem::ECLIPSE_SELECTION_OBJECT) if (pvtPlotPanel->isVisible() && selectionItem && selectionItem->type() == RiuSelectionItem::ECLIPSE_SELECTION_OBJECT)
{ {
const RiuEclipseSelectionItem* eclipseSelectionItem = static_cast<const RiuEclipseSelectionItem*>(selectionItem); const RiuEclipseSelectionItem* eclipseSelectionItem = static_cast<const RiuEclipseSelectionItem*>(selectionItem);
RimEclipseResultCase* eclipseResultCase = dynamic_cast<RimEclipseResultCase*>(eclipseSelectionItem->m_view->eclipseCase()); const RimEclipseView* eclipseView = eclipseSelectionItem->m_view.p();
RimEclipseResultCase* eclipseResultCase = dynamic_cast<RimEclipseResultCase*>(eclipseView->eclipseCase());
if (eclipseResultCase && eclipseResultCase->flowDiagSolverInterface()) if (eclipseResultCase && eclipseResultCase->flowDiagSolverInterface())
{ {
size_t activeCellIndex = CellLookupHelper::mapToActiveCellIndex(eclipseResultCase->eclipseCaseData(), eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_gridLocalCellIndex); size_t activeCellIndex = CellLookupHelper::mapToActiveCellIndex(eclipseResultCase->eclipseCaseData(), eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_gridLocalCellIndex);
if (activeCellIndex != cvf::UNDEFINED_SIZE_T) if (activeCellIndex != cvf::UNDEFINED_SIZE_T)
{ {
cvf::Trace::show("Update PVT plots for active cell index: %d", static_cast<int>(activeCellIndex)); //cvf::Trace::show("Update PVT plots for active cell index: %d", static_cast<int>(activeCellIndex));
std::vector<RigFlowDiagSolverInterface::PvtCurve> fvfCurveArr = eclipseResultCase->flowDiagSolverInterface()->calculatePvtCurvesForActiveCell(RigFlowDiagSolverInterface::PVT_CT_FVF, activeCellIndex); std::vector<RigFlowDiagSolverInterface::PvtCurve> fvfCurveArr = eclipseResultCase->flowDiagSolverInterface()->calculatePvtCurvesForActiveCell(RigFlowDiagSolverInterface::PVT_CT_FVF, activeCellIndex);
std::vector<RigFlowDiagSolverInterface::PvtCurve> viscosityCurveArr = eclipseResultCase->flowDiagSolverInterface()->calculatePvtCurvesForActiveCell(RigFlowDiagSolverInterface::PVT_CT_VISCOSITY, activeCellIndex); std::vector<RigFlowDiagSolverInterface::PvtCurve> viscosityCurveArr = eclipseResultCase->flowDiagSolverInterface()->calculatePvtCurvesForActiveCell(RigFlowDiagSolverInterface::PVT_CT_VISCOSITY, activeCellIndex);
QString cellRefText = CellLookupHelper::cellReferenceText(eclipseResultCase->eclipseCaseData(), eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_gridLocalCellIndex); QString cellRefText = CellLookupHelper::cellReferenceText(eclipseResultCase->eclipseCaseData(), eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_gridLocalCellIndex);
pvtPlotPanel->setPlotData(fvfCurveArr, viscosityCurveArr, cellRefText); //const size_t timeStepIndex = static_cast<size_t>(eclipseView->currentTimeStep());
//cvf::ref<RigResultAccessor> pressureAccessor = RigResultAccessorFactory::createFromNameAndType(eclipseResultCase->eclipseCaseData(), eclipseSelectionItem->m_gridIndex, RiaDefines::MATRIX_MODEL, timeStepIndex, "PRESSURE", RiaDefines::DYNAMIC_NATIVE);
//const double cellPressure = pressureAccessor.notNull() ? pressureAccessor->cellScalar(eclipseSelectionItem->m_gridLocalCellIndex) : HUGE_VAL;
const double cellPressure = HUGE_VAL;
pvtPlotPanel->setPlotData(fvfCurveArr, viscosityCurveArr, cellPressure, cellRefText);
mustClearPlot = false; mustClearPlot = false;
} }
} }