mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2235 RelPerm/PVT Plot: Added unit labels to relevant axes
This commit is contained in:
parent
3e5209d1a7
commit
01ae19ebbc
@ -108,3 +108,19 @@ double RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents(UnitSystem
|
||||
return oilEquivalentGasRate;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaEclipseUnitTools::unitStringPressure(UnitSystem unitSystem)
|
||||
{
|
||||
switch (unitSystem)
|
||||
{
|
||||
case RiaEclipseUnitTools::UNITS_METRIC: return "barsa";
|
||||
case RiaEclipseUnitTools::UNITS_FIELD: return "psia";
|
||||
case RiaEclipseUnitTools::UNITS_LAB: return "atma";
|
||||
case RiaEclipseUnitTools::UNITS_UNKNOWN: return "";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,5 +49,7 @@ public:
|
||||
static RiaDefines::DepthUnitType depthUnit(UnitSystem unit);
|
||||
|
||||
static double convertSurfaceGasFlowRateToOilEquivalents(UnitSystem, double eclGasFlowRate);
|
||||
|
||||
static QString unitStringPressure(UnitSystem unitSystem);
|
||||
};
|
||||
|
||||
|
@ -706,22 +706,56 @@ 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, 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++)
|
||||
if (pvtCurveType == PvtCurveType::PVT_CT_FVF)
|
||||
{
|
||||
const Opm::ECLPhaseIndex queryPhaseIndex = queryPhaseArr[i];
|
||||
const PvtCurve::Phase mapToPhase = mapToPhaseArr[i];
|
||||
|
||||
std::vector<Opm::ECLPVT::PVTGraph> graphArr = m_opmFlowDiagStaticData->m_eclPvtCurveCollection->getPvtCurve(rawCurveType, queryPhaseIndex, static_cast<int>(activeCellIndex));
|
||||
// Bo
|
||||
{
|
||||
std::vector<Opm::ECLPVT::PVTGraph> graphArr = m_opmFlowDiagStaticData->m_eclPvtCurveCollection->getPvtCurve(Opm::ECLPVT::RawCurve::FVF, Opm::ECLPhaseIndex::Liquid, static_cast<int>(activeCellIndex));
|
||||
for (Opm::ECLPVT::PVTGraph srcGraph : graphArr)
|
||||
{
|
||||
if (srcGraph.press.size() > 0)
|
||||
{
|
||||
retCurveArr.push_back({ mapToPhase, srcGraph.press, srcGraph.value});
|
||||
retCurveArr.push_back({ PvtCurve::Bo, PvtCurve::OIL, srcGraph.press, srcGraph.value });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bg
|
||||
{
|
||||
std::vector<Opm::ECLPVT::PVTGraph> graphArr = m_opmFlowDiagStaticData->m_eclPvtCurveCollection->getPvtCurve(Opm::ECLPVT::RawCurve::FVF, Opm::ECLPhaseIndex::Vapour, static_cast<int>(activeCellIndex));
|
||||
for (Opm::ECLPVT::PVTGraph srcGraph : graphArr)
|
||||
{
|
||||
if (srcGraph.press.size() > 0)
|
||||
{
|
||||
retCurveArr.push_back({ PvtCurve::Bg, PvtCurve::GAS, srcGraph.press, srcGraph.value });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (pvtCurveType == PvtCurveType::PVT_CT_VISCOSITY)
|
||||
{
|
||||
// Visc_o / mu_o
|
||||
{
|
||||
std::vector<Opm::ECLPVT::PVTGraph> graphArr = m_opmFlowDiagStaticData->m_eclPvtCurveCollection->getPvtCurve(Opm::ECLPVT::RawCurve::Viscosity, Opm::ECLPhaseIndex::Liquid, static_cast<int>(activeCellIndex));
|
||||
for (Opm::ECLPVT::PVTGraph srcGraph : graphArr)
|
||||
{
|
||||
if (srcGraph.press.size() > 0)
|
||||
{
|
||||
retCurveArr.push_back({ PvtCurve::Visc_o, PvtCurve::OIL, srcGraph.press, srcGraph.value });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Visc_g / mu_g
|
||||
{
|
||||
std::vector<Opm::ECLPVT::PVTGraph> graphArr = m_opmFlowDiagStaticData->m_eclPvtCurveCollection->getPvtCurve(Opm::ECLPVT::RawCurve::Viscosity, Opm::ECLPhaseIndex::Vapour, static_cast<int>(activeCellIndex));
|
||||
for (Opm::ECLPVT::PVTGraph srcGraph : graphArr)
|
||||
{
|
||||
if (srcGraph.press.size() > 0)
|
||||
{
|
||||
retCurveArr.push_back({ PvtCurve::Visc_g, PvtCurve::GAS, srcGraph.press, srcGraph.value });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
Ident ident;
|
||||
std::string name;
|
||||
EpsMode epsMode;
|
||||
std::vector<double> xVals;
|
||||
std::vector<double> saturationVals;
|
||||
std::vector<double> yVals;
|
||||
};
|
||||
|
||||
@ -96,9 +96,11 @@ public:
|
||||
struct PvtCurve
|
||||
{
|
||||
enum Phase { OIL, GAS };
|
||||
enum Ident { Unknown, Bo, Bg, Visc_o, Visc_g };
|
||||
|
||||
Ident ident;
|
||||
Phase phase;
|
||||
std::vector<double> xVals;
|
||||
std::vector<double> pressureVals;
|
||||
std::vector<double> yVals;
|
||||
};
|
||||
|
||||
|
@ -68,6 +68,7 @@ public:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuPvtPlotPanel::RiuPvtPlotPanel(QDockWidget* parent)
|
||||
: QWidget(parent),
|
||||
m_unitSystem(RiaEclipseUnitTools::UNITS_UNKNOWN),
|
||||
m_pressure(HUGE_VAL),
|
||||
m_plotUpdater(new RiuPvtPlotUpdater(this))
|
||||
{
|
||||
@ -132,10 +133,11 @@ void RiuPvtPlotPanel::setPlotDefaults(QwtPlot* plot)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPvtPlotPanel::setPlotData(const std::vector<RigFlowDiagSolverInterface::PvtCurve>& fvfCurveArr, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& viscosityCurveArr, FvfDynProps fvfDynProps, ViscosityDynProps viscosityDynProps, double pressure)
|
||||
void RiuPvtPlotPanel::setPlotData(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& fvfCurveArr, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& viscosityCurveArr, FvfDynProps fvfDynProps, ViscosityDynProps viscosityDynProps, double pressure)
|
||||
{
|
||||
//cvf::Trace::show("RiuPvtPlotPanel::setPlotData()");
|
||||
|
||||
m_unitSystem = unitSystem;
|
||||
m_allFvfCurvesArr = fvfCurveArr;
|
||||
m_allViscosityCurvesArr = viscosityCurveArr;
|
||||
m_fvfDynProps = fvfDynProps;
|
||||
@ -157,6 +159,7 @@ void RiuPvtPlotPanel::clearPlot()
|
||||
return;
|
||||
}
|
||||
|
||||
m_unitSystem = RiaEclipseUnitTools::UNITS_UNKNOWN;
|
||||
m_allFvfCurvesArr.clear();
|
||||
m_allViscosityCurvesArr.clear();
|
||||
m_fvfDynProps = FvfDynProps();
|
||||
@ -179,64 +182,86 @@ RiuPvtPlotUpdater* RiuPvtPlotPanel::plotUpdater()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPvtPlotPanel::plotUiSelectedCurves()
|
||||
{
|
||||
std::vector<RigFlowDiagSolverInterface::PvtCurve> selectedFvfCurves;
|
||||
std::vector<RigFlowDiagSolverInterface::PvtCurve> selectedViscosityCurves;
|
||||
|
||||
// Determine which curves (phase) to actually plot based on selection in GUI
|
||||
const int currComboIdx = m_phaseComboBox->currentIndex();
|
||||
const RigFlowDiagSolverInterface::PvtCurve::Phase phaseToPlot = static_cast<const RigFlowDiagSolverInterface::PvtCurve::Phase>(m_phaseComboBox->itemData(currComboIdx).toInt());
|
||||
|
||||
QString phaseString = "";
|
||||
if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::GAS)
|
||||
{
|
||||
phaseString = "Gas ";
|
||||
}
|
||||
else if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::OIL)
|
||||
{
|
||||
phaseString = "Oil ";
|
||||
}
|
||||
|
||||
// FVF plot
|
||||
{
|
||||
RigFlowDiagSolverInterface::PvtCurve::Ident curveIdentToPlot = RigFlowDiagSolverInterface::PvtCurve::Unknown;
|
||||
double fvfPointMarkerYValue = HUGE_VAL;
|
||||
|
||||
if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::GAS)
|
||||
{
|
||||
curveIdentToPlot = RigFlowDiagSolverInterface::PvtCurve::Bg;
|
||||
fvfPointMarkerYValue = m_fvfDynProps.bg;
|
||||
}
|
||||
else if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::OIL)
|
||||
{
|
||||
curveIdentToPlot = RigFlowDiagSolverInterface::PvtCurve::Bo;
|
||||
fvfPointMarkerYValue = m_fvfDynProps.bo;
|
||||
}
|
||||
|
||||
std::vector<RigFlowDiagSolverInterface::PvtCurve> selectedFvfCurves;
|
||||
for (RigFlowDiagSolverInterface::PvtCurve curve : m_allFvfCurvesArr)
|
||||
{
|
||||
if (curve.phase == phaseToPlot)
|
||||
if (curve.ident == curveIdentToPlot)
|
||||
{
|
||||
selectedFvfCurves.push_back(curve);
|
||||
}
|
||||
}
|
||||
|
||||
const QString plotTitle = QString("%1 Formation Volume Factor").arg(phaseString);
|
||||
const QString yAxisTitle = QString("%1 Formation Volume Factor [%2]").arg(phaseString).arg(unitStringFromCurveIdent(m_unitSystem, curveIdentToPlot));
|
||||
plotCurvesInQwt(m_unitSystem, selectedFvfCurves, m_pressure, fvfPointMarkerYValue, plotTitle, yAxisTitle, m_fvfPlot, &m_fvfPlotMarkers);
|
||||
}
|
||||
|
||||
// Viscosity plot
|
||||
{
|
||||
RigFlowDiagSolverInterface::PvtCurve::Ident curveIdentToPlot = RigFlowDiagSolverInterface::PvtCurve::Unknown;
|
||||
double viscosityPointMarkerYValue = HUGE_VAL;
|
||||
|
||||
if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::GAS)
|
||||
{
|
||||
curveIdentToPlot = RigFlowDiagSolverInterface::PvtCurve::Visc_g;
|
||||
viscosityPointMarkerYValue = m_viscosityDynProps.mu_g;
|
||||
}
|
||||
else if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::OIL)
|
||||
{
|
||||
curveIdentToPlot = RigFlowDiagSolverInterface::PvtCurve::Visc_o;
|
||||
viscosityPointMarkerYValue = m_viscosityDynProps.mu_o;
|
||||
}
|
||||
|
||||
std::vector<RigFlowDiagSolverInterface::PvtCurve> selectedViscosityCurves;
|
||||
for (RigFlowDiagSolverInterface::PvtCurve curve : m_allViscosityCurvesArr)
|
||||
{
|
||||
if (curve.phase == phaseToPlot)
|
||||
if (curve.ident == curveIdentToPlot)
|
||||
{
|
||||
selectedViscosityCurves.push_back(curve);
|
||||
}
|
||||
}
|
||||
|
||||
QString phaseString = "";
|
||||
double fvfPointMarkerYValue = HUGE_VAL;
|
||||
double viscosityPointMarkerYValue = HUGE_VAL;
|
||||
if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::GAS)
|
||||
{
|
||||
phaseString = "Gas ";
|
||||
fvfPointMarkerYValue = m_fvfDynProps.bg;
|
||||
viscosityPointMarkerYValue = m_viscosityDynProps.mu_g;
|
||||
const QString plotTitle = QString("%1 Viscosity").arg(phaseString);
|
||||
const QString yAxisTitle = QString("%1 Viscosity [%2]").arg(phaseString).arg(unitStringFromCurveIdent(m_unitSystem, curveIdentToPlot));
|
||||
plotCurvesInQwt(m_unitSystem, selectedViscosityCurves, m_pressure, viscosityPointMarkerYValue, plotTitle, yAxisTitle, m_viscosityPlot, &m_viscosityPlotMarkers);
|
||||
}
|
||||
else if (phaseToPlot == RigFlowDiagSolverInterface::PvtCurve::OIL)
|
||||
{
|
||||
phaseString = "Oil ";
|
||||
fvfPointMarkerYValue = m_fvfDynProps.bo;
|
||||
viscosityPointMarkerYValue = m_viscosityDynProps.mu_o;
|
||||
}
|
||||
|
||||
{
|
||||
const QString plotTitle = phaseString + "Formation Volume Factor";
|
||||
const QString yAxisTitle = phaseString + "Formation Volume Factor";
|
||||
plotCurvesInQwt(selectedFvfCurves, m_pressure, fvfPointMarkerYValue, plotTitle, yAxisTitle, m_fvfPlot, &m_fvfPlotMarkers);
|
||||
}
|
||||
|
||||
{
|
||||
const QString plotTitle = phaseString + "Viscosity";
|
||||
const QString yAxisTitle = phaseString + "Viscosity";
|
||||
plotCurvesInQwt(selectedViscosityCurves, m_pressure, viscosityPointMarkerYValue, plotTitle, yAxisTitle, m_viscosityPlot, &m_viscosityPlotMarkers);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPvtPlotPanel::plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterface::PvtCurve>& curveArr, double pressure, double pointMarkerYValue, QString plotTitle, QString yAxisTitle, QwtPlot* plot, std::vector<QwtPlotMarker*>* myPlotMarkers)
|
||||
void RiuPvtPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& curveArr, double pressure, double pointMarkerYValue, QString plotTitle, QString yAxisTitle, QwtPlot* plot, std::vector<QwtPlotMarker*>* myPlotMarkers)
|
||||
{
|
||||
plot->detachItems(QwtPlotItem::Rtti_PlotCurve);
|
||||
|
||||
@ -256,8 +281,8 @@ void RiuPvtPlotPanel::plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterfa
|
||||
const RigFlowDiagSolverInterface::PvtCurve& curve = curveArr[i];
|
||||
QwtPlotCurve* qwtCurve = new QwtPlotCurve();
|
||||
|
||||
CVF_ASSERT(curve.xVals.size() == curve.yVals.size());
|
||||
qwtCurve->setSamples(curve.xVals.data(), curve.yVals.data(), static_cast<int>(curve.xVals.size()));
|
||||
CVF_ASSERT(curve.pressureVals.size() == curve.yVals.size());
|
||||
qwtCurve->setSamples(curve.pressureVals.data(), curve.yVals.data(), static_cast<int>(curve.pressureVals.size()));
|
||||
|
||||
qwtCurve->setStyle(QwtPlotCurve::Lines);
|
||||
|
||||
@ -308,12 +333,52 @@ void RiuPvtPlotPanel::plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterfa
|
||||
|
||||
plot->setTitle(plotTitle);
|
||||
|
||||
plot->setAxisTitle(QwtPlot::xBottom, "Pressure");
|
||||
plot->setAxisTitle(QwtPlot::xBottom, QString("Pressure [%1]").arg(RiaEclipseUnitTools::unitStringPressure(unitSystem)));
|
||||
plot->setAxisTitle(QwtPlot::yLeft, yAxisTitle);
|
||||
|
||||
plot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuPvtPlotPanel::unitStringFromCurveIdent(RiaEclipseUnitTools::UnitSystem unitSystem, RigFlowDiagSolverInterface::PvtCurve::Ident curveIdent)
|
||||
{
|
||||
if (curveIdent == RigFlowDiagSolverInterface::PvtCurve::Bo)
|
||||
{
|
||||
switch (unitSystem)
|
||||
{
|
||||
case RiaEclipseUnitTools::UNITS_METRIC: return "rm3/sm3";
|
||||
case RiaEclipseUnitTools::UNITS_FIELD: return "rb/stb";
|
||||
case RiaEclipseUnitTools::UNITS_LAB: return "rcc/scc";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
else if (curveIdent == RigFlowDiagSolverInterface::PvtCurve::Bg)
|
||||
{
|
||||
switch (unitSystem)
|
||||
{
|
||||
case RiaEclipseUnitTools::UNITS_METRIC: return "rm3/sm3";
|
||||
case RiaEclipseUnitTools::UNITS_FIELD: return "rb/Mscf";
|
||||
case RiaEclipseUnitTools::UNITS_LAB: return "rcc/scc";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
else if (curveIdent == RigFlowDiagSolverInterface::PvtCurve::Visc_o ||
|
||||
curveIdent == RigFlowDiagSolverInterface::PvtCurve::Visc_g)
|
||||
{
|
||||
switch (unitSystem)
|
||||
{
|
||||
case RiaEclipseUnitTools::UNITS_METRIC: return "cP";
|
||||
case RiaEclipseUnitTools::UNITS_FIELD: return "cP";
|
||||
case RiaEclipseUnitTools::UNITS_LAB: return "cP";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "RigFlowDiagSolverInterface.h"
|
||||
#include "RiaEclipseUnitTools.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
@ -58,19 +59,21 @@ public:
|
||||
RiuPvtPlotPanel(QDockWidget* parent);
|
||||
virtual ~RiuPvtPlotPanel();
|
||||
|
||||
void setPlotData(const std::vector<RigFlowDiagSolverInterface::PvtCurve>& fvfCurveArr, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& viscosityCurveArr, FvfDynProps fvfDynProps, ViscosityDynProps viscosityDynProps, double pressure);
|
||||
void setPlotData(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& fvfCurveArr, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& viscosityCurveArr, FvfDynProps fvfDynProps, ViscosityDynProps viscosityDynProps, double pressure);
|
||||
void clearPlot();
|
||||
RiuPvtPlotUpdater* plotUpdater();
|
||||
|
||||
private:
|
||||
void plotUiSelectedCurves();
|
||||
static void setPlotDefaults(QwtPlot* plot);
|
||||
static void plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterface::PvtCurve>& curveArr, double pressure, double pointMarkerYValue, QString plotTitle, QString yAxisTitle, QwtPlot* plot, std::vector<QwtPlotMarker*>* myPlotMarkers);
|
||||
static void plotCurvesInQwt(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::PvtCurve>& curveArr, double pressure, double pointMarkerYValue, QString plotTitle, QString yAxisTitle, QwtPlot* plot, std::vector<QwtPlotMarker*>* myPlotMarkers);
|
||||
static QString unitStringFromCurveIdent(RiaEclipseUnitTools::UnitSystem unitSystem, RigFlowDiagSolverInterface::PvtCurve::Ident curveIdent);
|
||||
|
||||
private slots:
|
||||
void slotPhaseComboCurrentIndexChanged(int);
|
||||
|
||||
private:
|
||||
RiaEclipseUnitTools::UnitSystem m_unitSystem;
|
||||
std::vector<RigFlowDiagSolverInterface::PvtCurve> m_allFvfCurvesArr;
|
||||
std::vector<RigFlowDiagSolverInterface::PvtCurve> m_allViscosityCurvesArr;
|
||||
FvfDynProps m_fvfDynProps;
|
||||
|
@ -159,7 +159,7 @@ bool RiuPvtPlotUpdater::queryDataAndUpdatePlot(const RimEclipseView& eclipseView
|
||||
RiuPvtPlotPanel::ViscosityDynProps viscosityDynProps;
|
||||
eclipseResultCase->flowDiagSolverInterface()->calculatePvtDynamicPropertiesViscosity(activeCellIndex, cellPressure, cellRS, cellRV, &viscosityDynProps.mu_o, &viscosityDynProps.mu_g);
|
||||
|
||||
plotPanel->setPlotData(fvfCurveArr, viscosityCurveArr, fvfDynProps, viscosityDynProps, cellPressure);
|
||||
plotPanel->setPlotData(eclipseCaseData->unitsType(), fvfCurveArr, viscosityCurveArr, fvfDynProps, viscosityDynProps, cellPressure);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ public:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel(QDockWidget* parent)
|
||||
: QWidget(parent),
|
||||
m_unitSystem(RiaEclipseUnitTools::UNITS_UNKNOWN),
|
||||
m_swat(HUGE_VAL),
|
||||
m_sgas(HUGE_VAL),
|
||||
m_plotUpdater(new RiuRelativePermeabilityPlotUpdater(this))
|
||||
@ -157,10 +158,11 @@ void RiuRelativePermeabilityPlotPanel::setPlotDefaults(QwtPlot* plot)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuRelativePermeabilityPlotPanel::setPlotData(const std::vector<RigFlowDiagSolverInterface::RelPermCurve>& relPermCurves, double swat, double sgas, QString cellReferenceText)
|
||||
void RiuRelativePermeabilityPlotPanel::setPlotData(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::RelPermCurve>& relPermCurves, double swat, double sgas, QString cellReferenceText)
|
||||
{
|
||||
//cvf::Trace::show("Set RelPerm plot data");
|
||||
|
||||
m_unitSystem = unitSystem;
|
||||
m_allCurvesArr = relPermCurves;
|
||||
m_swat = swat;
|
||||
m_sgas = sgas;
|
||||
@ -181,12 +183,13 @@ void RiuRelativePermeabilityPlotPanel::clearPlot()
|
||||
return;
|
||||
}
|
||||
|
||||
m_unitSystem = RiaEclipseUnitTools::UNITS_UNKNOWN;
|
||||
m_allCurvesArr.clear();
|
||||
m_swat = HUGE_VAL;
|
||||
m_sgas = HUGE_VAL;
|
||||
m_cellReferenceText.clear();
|
||||
|
||||
plotCurvesInQwt(m_allCurvesArr, m_swat, m_sgas, m_cellReferenceText, false, m_qwtPlot, &m_myPlotMarkers);
|
||||
plotCurvesInQwt(m_unitSystem, m_allCurvesArr, m_swat, m_sgas, m_cellReferenceText, false, m_qwtPlot, &m_myPlotMarkers);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -222,13 +225,13 @@ void RiuRelativePermeabilityPlotPanel::plotUiSelectedCurves()
|
||||
}
|
||||
}
|
||||
|
||||
plotCurvesInQwt(selectedCurves, m_swat, m_sgas, m_cellReferenceText, useLogScale, m_qwtPlot, &m_myPlotMarkers);
|
||||
plotCurvesInQwt(m_unitSystem, selectedCurves, m_swat, m_sgas, m_cellReferenceText, useLogScale, m_qwtPlot, &m_myPlotMarkers);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterface::RelPermCurve>& curveArr, double swat, double sgas, QString cellReferenceText, bool logScaleLeftAxis, QwtPlot* plot, std::vector<QwtPlotMarker*>* myPlotMarkers)
|
||||
void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::RelPermCurve>& curveArr, double swat, double sgas, QString cellReferenceText, bool logScaleLeftAxis, QwtPlot* plot, std::vector<QwtPlotMarker*>* myPlotMarkers)
|
||||
{
|
||||
plot->detachItems(QwtPlotItem::Rtti_PlotCurve);
|
||||
|
||||
@ -244,7 +247,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(const std::vector<RigFlow
|
||||
|
||||
|
||||
//ValueRange leftYAxisValueRange;
|
||||
bool shouldEableRightYAxis = false;
|
||||
bool shouldEnableRightYAxis = false;
|
||||
|
||||
for (size_t i = 0; i < curveArr.size(); i++)
|
||||
{
|
||||
@ -266,10 +269,10 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(const std::vector<RigFlow
|
||||
//QwtPlotCurve* qwtCurve = new QwtPlotCurve(curve.name.c_str());
|
||||
RiuLineSegmentQwtPlotCurve* qwtCurve = new RiuLineSegmentQwtPlotCurve(curve.name.c_str());
|
||||
|
||||
CVF_ASSERT(curve.xVals.size() == curve.yVals.size());
|
||||
CVF_ASSERT(curve.saturationVals.size() == curve.yVals.size());
|
||||
//qwtCurve->setSamples(curve.xVals.data(), curve.yVals.data(), static_cast<int>(curve.xVals.size()));
|
||||
const bool includePositiveValuesOnly = (logScaleLeftAxis && plotOnWhichYAxis == LEFT_YAXIS);
|
||||
qwtCurve->setSamplesFromXValuesAndYValues(curve.xVals, curve.yVals, includePositiveValuesOnly);
|
||||
qwtCurve->setSamplesFromXValuesAndYValues(curve.saturationVals, curve.yVals, includePositiveValuesOnly);
|
||||
|
||||
qwtCurve->setTitle(curve.name.c_str());
|
||||
|
||||
@ -305,7 +308,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(const std::vector<RigFlow
|
||||
if (plotOnWhichYAxis == RIGHT_YAXIS)
|
||||
{
|
||||
qwtCurve->setYAxis(QwtPlot::yRight);
|
||||
shouldEableRightYAxis = true;
|
||||
shouldEnableRightYAxis = true;
|
||||
}
|
||||
|
||||
qwtCurve->attach(plot);
|
||||
@ -377,9 +380,9 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(const std::vector<RigFlow
|
||||
|
||||
plot->setAxisTitle(QwtPlot::xBottom, determineXAxisTitleFromCurveCollection(curveArr));
|
||||
plot->setAxisTitle(QwtPlot::yLeft, "Kr");
|
||||
plot->setAxisTitle(QwtPlot::yRight, "Pc");
|
||||
plot->setAxisTitle(QwtPlot::yRight, QString("Pc [%1]").arg(RiaEclipseUnitTools::unitStringPressure(unitSystem)));
|
||||
|
||||
plot->enableAxis(QwtPlot::yRight, shouldEableRightYAxis);
|
||||
plot->enableAxis(QwtPlot::yRight, shouldEnableRightYAxis);
|
||||
|
||||
plot->replot();
|
||||
}
|
||||
@ -439,7 +442,7 @@ void RiuRelativePermeabilityPlotPanel::addVerticalSaturationMarkerLine(double sa
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuRelativePermeabilityPlotPanel::addCurveConstSaturationIntersectionMarker(const RigFlowDiagSolverInterface::RelPermCurve& curve, double saturationValue, QColor markerColor, WhichYAxis whichYAxis, QwtPlot* plot, std::vector<QwtPlotMarker*>* myPlotMarkers)
|
||||
{
|
||||
const double yVal = interpolatedCurveYValue(curve.xVals, curve.yVals, saturationValue);
|
||||
const double yVal = interpolatedCurveYValue(curve.saturationVals, curve.yVals, saturationValue);
|
||||
if (yVal != HUGE_VAL)
|
||||
{
|
||||
QwtPlotMarker* pointMarker = new QwtPlotMarker;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "RigFlowDiagSolverInterface.h"
|
||||
#include "RiaEclipseUnitTools.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
@ -46,7 +47,7 @@ public:
|
||||
RiuRelativePermeabilityPlotPanel(QDockWidget* parent);
|
||||
virtual ~RiuRelativePermeabilityPlotPanel();
|
||||
|
||||
void setPlotData(const std::vector<RigFlowDiagSolverInterface::RelPermCurve>& relPermCurves, double swat, double sgas, QString cellReferenceText);
|
||||
void setPlotData(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::RelPermCurve>& relPermCurves, double swat, double sgas, QString cellReferenceText);
|
||||
void clearPlot();
|
||||
RiuRelativePermeabilityPlotUpdater* plotUpdater();
|
||||
|
||||
@ -70,7 +71,7 @@ private:
|
||||
|
||||
void plotUiSelectedCurves();
|
||||
static void setPlotDefaults(QwtPlot* plot);
|
||||
static void plotCurvesInQwt(const std::vector<RigFlowDiagSolverInterface::RelPermCurve>& curveArr, double swat, double sgas, QString cellReferenceText, bool logScaleLeftAxis, QwtPlot* plot, std::vector<QwtPlotMarker*>* myPlotMarkers);
|
||||
static void plotCurvesInQwt(RiaEclipseUnitTools::UnitSystem unitSystem, const std::vector<RigFlowDiagSolverInterface::RelPermCurve>& curveArr, double swat, double sgas, QString cellReferenceText, bool logScaleLeftAxis, QwtPlot* plot, std::vector<QwtPlotMarker*>* myPlotMarkers);
|
||||
static QString determineXAxisTitleFromCurveCollection(const std::vector<RigFlowDiagSolverInterface::RelPermCurve>& curveArr);
|
||||
static void addVerticalSaturationMarkerLine(double saturationValue, QString label, QColor color, QwtPlot* plot, std::vector<QwtPlotMarker*>* myPlotMarkers);
|
||||
static void addCurveConstSaturationIntersectionMarker(const RigFlowDiagSolverInterface::RelPermCurve& curve, double saturationValue, QColor markerColor, WhichYAxis whichYAxis, QwtPlot* plot, std::vector<QwtPlotMarker*>* myPlotMarkers);
|
||||
@ -82,6 +83,7 @@ private slots:
|
||||
void slotSomeCheckBoxStateChanged(int);
|
||||
|
||||
private:
|
||||
RiaEclipseUnitTools::UnitSystem m_unitSystem;
|
||||
std::vector<RigFlowDiagSolverInterface::RelPermCurve> m_allCurvesArr;
|
||||
double m_swat;
|
||||
double m_sgas;
|
||||
|
@ -154,7 +154,7 @@ bool RiuRelativePermeabilityPlotUpdater::queryDataAndUpdatePlot(const RimEclipse
|
||||
|
||||
QString cellRefText = constructCellReferenceText(eclipseCaseData, gridIndex, gridLocalCellIndex, cellSATNUM);
|
||||
|
||||
plotPanel->setPlotData(relPermCurveArr, cellSWAT, cellSGAS, cellRefText);
|
||||
plotPanel->setPlotData(eclipseCaseData->unitsType(), relPermCurveArr, cellSWAT, cellSGAS, cellRefText);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user