#2063 Added support for showing RelPerm plot curves without end-point scaling

This commit is contained in:
sigurdp 2017-11-23 11:51:24 +01:00
parent 14c1b5a595
commit 65fe3ba902
4 changed files with 48 additions and 18 deletions

View File

@ -624,19 +624,24 @@ std::vector<RigFlowDiagSolverInterface::RelPermCurve> RigFlowDiagSolverInterface
curveIdentNameArr.push_back(std::make_pair(RelPermCurve::PCOG, "PCOG")); satFuncRequests.push_back(pcgo);
curveIdentNameArr.push_back(std::make_pair(RelPermCurve::PCOW, "PCOW")); satFuncRequests.push_back(pcow);
const bool useEPS = true;
std::vector<Opm::FlowDiagnostics::Graph> graphArr = m_opmFlowDiagStaticData->m_eclSaturationFunc->getSatFuncCurve(satFuncRequests, static_cast<int>(activeCellIndex), useEPS);
for (size_t i = 0; i < graphArr.size(); i++)
// Calculate and return curves both with and without endpoint scaling and tag them accordingly
// Must use two calls to achieve this
const std::array<RelPermCurve::EpsMode, 2> epsModeArr = { RelPermCurve::EPS_ON , RelPermCurve::EPS_OFF };
for (RelPermCurve::EpsMode epsMode : epsModeArr)
{
const RelPermCurve::Ident curveIdent = curveIdentNameArr[i].first;
const std::string curveName = curveIdentNameArr[i].second;
const Opm::FlowDiagnostics::Graph& srcGraph = graphArr[i];
if (srcGraph.first.size() > 0)
const bool useEps = epsMode == RelPermCurve::EPS_ON ? true : false;
std::vector<Opm::FlowDiagnostics::Graph> graphArr = m_opmFlowDiagStaticData->m_eclSaturationFunc->getSatFuncCurve(satFuncRequests, static_cast<int>(activeCellIndex), useEps);
for (size_t i = 0; i < graphArr.size(); i++)
{
const std::vector<double>& xVals = srcGraph.first;
const std::vector<double>& yVals = srcGraph.second;
retCurveArr.push_back({ curveIdent, curveName, xVals, yVals});
const RelPermCurve::Ident curveIdent = curveIdentNameArr[i].first;
const std::string curveName = curveIdentNameArr[i].second;
const Opm::FlowDiagnostics::Graph& srcGraph = graphArr[i];
if (srcGraph.first.size() > 0)
{
const std::vector<double>& xVals = srcGraph.first;
const std::vector<double>& yVals = srcGraph.second;
retCurveArr.push_back({ curveIdent, curveName, epsMode, xVals, yVals });
}
}
}

View File

@ -78,9 +78,11 @@ public:
struct RelPermCurve
{
enum Ident { KRW, KRG, KROW, KROG, PCOW, PCOG };
enum EpsMode { EPS_ON, EPS_OFF };
Ident ident;
std::string name;
EpsMode epsMode;
std::vector<double> xVals;
std::vector<double> yVals;
};

View File

@ -100,8 +100,11 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel(QDockWidget*
groupBoxLayout->addWidget(checkButtonList[i]);
}
m_showUnscaledCheckBox = new QCheckBox("Show Unscaled");
QVBoxLayout* leftLayout = new QVBoxLayout;
leftLayout->addWidget(groupBox);
leftLayout->addWidget(m_showUnscaledCheckBox);
leftLayout->addStretch(1);
QHBoxLayout* mainLayout = new QHBoxLayout();
@ -111,6 +114,7 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel(QDockWidget*
setLayout(mainLayout);
connect(m_selectedCurvesButtonGroup, SIGNAL(buttonClicked(int)), SLOT(slotButtonInButtonGroupClicked(int)));
connect(m_showUnscaledCheckBox, SIGNAL(stateChanged(int)), SLOT(slotUnscaledCheckBoxStateChanged(int)));
plotUiSelectedCurves();
}
@ -193,14 +197,21 @@ void RiuRelativePermeabilityPlotPanel::clearPlot()
//--------------------------------------------------------------------------------------------------
void RiuRelativePermeabilityPlotPanel::plotUiSelectedCurves()
{
// Determine which curves to actually plot based on selection in GUI
std::vector<RigFlowDiagSolverInterface::RelPermCurve> selectedCurves;
// Determine which curves to actually plot based on selection in GUI
const RigFlowDiagSolverInterface::RelPermCurve::EpsMode epsModeToShow = m_showUnscaledCheckBox->isChecked() ? RigFlowDiagSolverInterface::RelPermCurve::EPS_OFF : RigFlowDiagSolverInterface::RelPermCurve::EPS_ON;
for (size_t i = 0; i < m_allCurvesArr.size(); i++)
{
const RigFlowDiagSolverInterface::RelPermCurve::Ident curveIdent = m_allCurvesArr[i].ident;
if (m_selectedCurvesButtonGroup->button(curveIdent) && m_selectedCurvesButtonGroup->button(curveIdent)->isChecked())
{
selectedCurves.push_back(m_allCurvesArr[i]);
const RigFlowDiagSolverInterface::RelPermCurve::EpsMode curveEpsMode = m_allCurvesArr[i].epsMode;
if (curveEpsMode == epsModeToShow) {
if (m_selectedCurvesButtonGroup->button(curveIdent) && m_selectedCurvesButtonGroup->button(curveIdent)->isChecked())
{
selectedCurves.push_back(m_allCurvesArr[i]);
}
}
}
@ -286,12 +297,12 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(const std::vector<RigFlow
}
QString title = "Relative Permeability";
QString titleStr = "Relative Permeability";
if (!cellReferenceText.isEmpty())
{
title += ", " + cellReferenceText;
titleStr += ", " + cellReferenceText;
}
plot->setTitle(title);
plot->setTitle(titleStr);
plot->setAxisTitle(QwtPlot::xBottom, "Saturation");
plot->setAxisTitle(QwtPlot::yLeft, "Kr");
@ -313,3 +324,12 @@ void RiuRelativePermeabilityPlotPanel::slotButtonInButtonGroupClicked(int)
plotUiSelectedCurves();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuRelativePermeabilityPlotPanel::slotUnscaledCheckBoxStateChanged(int)
{
plotUiSelectedCurves();
}

View File

@ -24,6 +24,7 @@
class QDockWidget;
class QButtonGroup;
class QCheckBox;
class QwtPlot;
@ -50,6 +51,7 @@ private:
private slots:
void slotButtonInButtonGroupClicked(int);
void slotUnscaledCheckBoxStateChanged(int);
private:
std::vector<RigFlowDiagSolverInterface::RelPermCurve> m_allCurvesArr;
@ -58,5 +60,6 @@ private:
QString m_cellReferenceText;
QwtPlot* m_qwtPlot;
QButtonGroup* m_selectedCurvesButtonGroup;
QCheckBox* m_showUnscaledCheckBox;
};