mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#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:
parent
aa1bbbe2d9
commit
3b1775ad4d
@ -682,8 +682,8 @@ std::vector<RigFlowDiagSolverInterface::PvtCurve> RigFlowDiagSolverInterface::ca
|
||||
// Requesting FVF or 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<PvtCurve::Phase, 3> mapToPhaseArr = { PvtCurve::GAS, PvtCurve::OIL, PvtCurve::WATER };
|
||||
const std::array<Opm::ECLPhaseIndex, 2> queryPhaseArr = { Opm::ECLPhaseIndex::Vapour, Opm::ECLPhaseIndex::Liquid };
|
||||
const std::array<PvtCurve::Phase, 2> mapToPhaseArr = { PvtCurve::GAS, PvtCurve::OIL };
|
||||
|
||||
for (size_t i = 0; i < queryPhaseArr.size(); i++)
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
|
||||
struct PvtCurve
|
||||
{
|
||||
enum Phase { OIL, GAS, WATER };
|
||||
enum Phase { OIL, GAS };
|
||||
|
||||
Phase phase;
|
||||
std::vector<double> xVals;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "qwt_plot_curve.h"
|
||||
#include "qwt_legend.h"
|
||||
#include "qwt_symbol.h"
|
||||
#include "qwt_plot_marker.h"
|
||||
|
||||
#include <QDockWidget>
|
||||
#include <QHBoxLayout>
|
||||
@ -65,13 +66,13 @@ public:
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuPvtPlotPanel::RiuPvtPlotPanel(QDockWidget* parent)
|
||||
: QWidget(parent)
|
||||
: QWidget(parent),
|
||||
m_pressure(HUGE_VAL)
|
||||
{
|
||||
m_phaseComboBox = new QComboBox(this);
|
||||
m_phaseComboBox->setEditable(false);
|
||||
m_phaseComboBox->addItem("Oil", QVariant(RigFlowDiagSolverInterface::PvtCurve::OIL));
|
||||
m_phaseComboBox->addItem("Gas", QVariant(RigFlowDiagSolverInterface::PvtCurve::GAS));
|
||||
m_phaseComboBox->addItem("Water", QVariant(RigFlowDiagSolverInterface::PvtCurve::WATER));
|
||||
|
||||
QHBoxLayout* comboLayout = new QHBoxLayout();
|
||||
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()");
|
||||
|
||||
m_allFvfCurvesArr = fvfCurveArr;
|
||||
m_allViscosityCurvesArr = viscosityCurveArr;
|
||||
m_pressure = pressure;
|
||||
|
||||
m_cellReferenceText = cellReferenceText;
|
||||
|
||||
@ -155,6 +157,7 @@ void RiuPvtPlotPanel::clearPlot()
|
||||
|
||||
m_allFvfCurvesArr.clear();
|
||||
m_allViscosityCurvesArr.clear();
|
||||
m_pressure = HUGE_VAL;
|
||||
|
||||
m_cellReferenceText.clear();
|
||||
|
||||
@ -192,18 +195,17 @@ void RiuPvtPlotPanel::plotUiSelectedCurves()
|
||||
QString phaseString = "";
|
||||
if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::GAS) phaseString = "Gas ";
|
||||
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 yAxisTitle = "";
|
||||
plotCurvesInQwt(selectedFvfCurves, plotTitle, yAxisTitle, m_fvfPlot);
|
||||
const QString yAxisTitle = phaseString + "Formation Volume Factor";
|
||||
plotCurvesInQwt(selectedFvfCurves, m_pressure, plotTitle, yAxisTitle, m_fvfPlot);
|
||||
}
|
||||
|
||||
{
|
||||
const QString plotTitle = 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_PlotMarker);
|
||||
|
||||
for (size_t i = 0; i < curveArr.size(); i++)
|
||||
{
|
||||
@ -229,15 +232,32 @@ void RiuPvtPlotPanel::plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterfa
|
||||
QColor curveClr = Qt::magenta;
|
||||
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::WATER) curveClr = QColor(Qt::blue);
|
||||
const QPen curvePen(curveClr);
|
||||
qwtCurve->setPen(curvePen);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
@ -247,6 +267,22 @@ void RiuPvtPlotPanel::plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterfa
|
||||
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);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -40,13 +40,14 @@ public:
|
||||
RiuPvtPlotPanel(QDockWidget* parent);
|
||||
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();
|
||||
|
||||
private:
|
||||
void plotUiSelectedCurves();
|
||||
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:
|
||||
void slotPhaseComboCurrentIndexChanged(int);
|
||||
@ -54,6 +55,7 @@ private slots:
|
||||
private:
|
||||
std::vector<RigFlowDiagSolverInterface::PvtCurve> m_allFvfCurvesArr;
|
||||
std::vector<RigFlowDiagSolverInterface::PvtCurve> m_allViscosityCurvesArr;
|
||||
double m_pressure;
|
||||
QString m_cellReferenceText;
|
||||
|
||||
QComboBox* m_phaseComboBox;
|
||||
|
@ -377,20 +377,27 @@ void RiuSelectionChangedHandler::updatePvtPlot(const RiuSelectionItem* selection
|
||||
if (pvtPlotPanel->isVisible() && selectionItem && selectionItem->type() == RiuSelectionItem::ECLIPSE_SELECTION_OBJECT)
|
||||
{
|
||||
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())
|
||||
{
|
||||
size_t activeCellIndex = CellLookupHelper::mapToActiveCellIndex(eclipseResultCase->eclipseCaseData(), eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_gridLocalCellIndex);
|
||||
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> viscosityCurveArr = eclipseResultCase->flowDiagSolverInterface()->calculatePvtCurvesForActiveCell(RigFlowDiagSolverInterface::PVT_CT_VISCOSITY, activeCellIndex);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user