ResInsight/ApplicationCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp

229 lines
9.3 KiB
C++
Raw Normal View History

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimSaturationPressurePlot.h"
2019-03-19 08:26:31 -05:00
#include "RigCaseCellResultsData.h"
2019-03-19 03:28:00 -05:00
#include "RigEclipseCaseData.h"
#include "RigEquil.h"
#include "RimEclipseResultCase.h"
2019-03-19 03:28:00 -05:00
#include "RimEclipseResultDefinition.h"
#include "RimGridCrossPlotCurveSet.h"
#include "RimPlotAxisAnnotation.h"
#include "RimPlotAxisProperties.h"
2019-03-19 03:28:00 -05:00
#include "CellFilters/RimPlotCellPropertyFilter.h"
CAF_PDM_SOURCE_INIT(RimSaturationPressurePlot, "RimSaturationPressurePlot");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSaturationPressurePlot::RimSaturationPressurePlot()
{
CAF_PDM_InitObject("Saturation Pressure Plot", ":/SummaryXPlotLight16x16.png", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2019-03-19 08:54:24 -05:00
void RimSaturationPressurePlot::assignCaseAndEquilibriumRegion(RiaDefines::PorosityModelType porosityModel,
2019-03-19 03:28:00 -05:00
RimEclipseResultCase* eclipseResultCase,
int zeroBasedEquilRegionIndex)
{
2019-03-18 08:31:06 -05:00
nameConfig()->addDataSetNames = false;
2019-03-19 03:28:00 -05:00
QString caseName = eclipseResultCase->caseUserDescription();
QString plotTitle = QString("%1 - EQLNUM %2").arg(caseName).arg(zeroBasedEquilRegionIndex + 1);
2019-03-18 08:31:06 -05:00
nameConfig()->setCustomName(plotTitle);
2019-03-19 03:28:00 -05:00
auto equilData = eclipseResultCase->eclipseCaseData()->equilData();
auto eq = equilData[zeroBasedEquilRegionIndex];
double gasOilContactDepth = eq.gasOilContactDepth();
double waterOilContactDepth = eq.waterOilContactDepth();
{
2019-03-19 08:26:31 -05:00
// Blue PRESSURE curve with data for specified EQLNUM value
RimGridCrossPlotCurveSet* curveSet = createCurveSet();
2019-03-19 08:26:31 -05:00
curveSet->configureForPressureSaturationCurves(eclipseResultCase, "PRESSURE");
2019-03-18 08:31:06 -05:00
curveSet->setCustomColor(cvf::Color3::BLUE);
2019-03-19 03:28:00 -05:00
2019-03-19 08:26:31 -05:00
RimPlotCellPropertyFilter* cellFilter =
createEquilibriumRegionPropertyFilter(eclipseResultCase, zeroBasedEquilRegionIndex);
2019-03-19 03:28:00 -05:00
curveSet->addCellFilter(cellFilter);
}
2019-03-19 08:26:31 -05:00
{
2019-03-19 08:26:31 -05:00
// Red dew pressure (PDEW) curve with data for specified EQLNUM value, filtered on depth by gasOilContact
RimGridCrossPlotCurveSet* curveSet = createCurveSet();
2019-03-19 08:26:31 -05:00
curveSet->configureForPressureSaturationCurves(eclipseResultCase, "PDEW");
2019-03-18 08:31:06 -05:00
curveSet->setCustomColor(cvf::Color3::RED);
2019-03-19 03:28:00 -05:00
2019-03-19 08:26:31 -05:00
RimPlotCellPropertyFilter* cellFilter =
createEquilibriumRegionPropertyFilter(eclipseResultCase, zeroBasedEquilRegionIndex);
curveSet->addCellFilter(cellFilter);
2019-03-19 03:28:00 -05:00
{
2019-03-19 08:54:24 -05:00
RigCaseCellResultsData* caseCellResultsData = eclipseResultCase->eclipseCaseData()->results(porosityModel);
2019-03-19 03:28:00 -05:00
if (caseCellResultsData)
{
RigEclipseResultAddress depthResultAddress(RiaDefines::STATIC_NATIVE, "DEPTH");
double minDepth = 0.0;
double maxDepth = 0.0;
caseCellResultsData->minMaxCellScalarValues(depthResultAddress, minDepth, maxDepth);
maxDepth = gasOilContactDepth;
2019-03-19 08:26:31 -05:00
RimPlotCellPropertyFilter* depthCellFilter = createDepthPropertyFilter(eclipseResultCase, minDepth, maxDepth);
2019-03-19 03:28:00 -05:00
curveSet->addCellFilter(depthCellFilter);
}
}
}
2019-03-19 03:28:00 -05:00
{
2019-03-19 08:26:31 -05:00
// Green bubble point pressure (PBUB) curve with data for specified EQLNUM value, filtered on depth between gasOilContact
// and waterOilContactDepth
RimGridCrossPlotCurveSet* curveSet = createCurveSet();
2019-03-19 08:26:31 -05:00
curveSet->configureForPressureSaturationCurves(eclipseResultCase, "PBUB");
2019-03-18 08:31:06 -05:00
curveSet->setCustomColor(cvf::Color3::GREEN);
2019-03-19 03:28:00 -05:00
{
RimPlotCellPropertyFilter* cellFilter = new RimPlotCellPropertyFilter();
{
RimEclipseResultDefinition* resultDefinition = new RimEclipseResultDefinition();
resultDefinition->setEclipseCase(eclipseResultCase);
resultDefinition->setResultType(RiaDefines::STATIC_NATIVE);
resultDefinition->setResultVariable("EQLNUM");
cellFilter->setResultDefinition(resultDefinition);
}
cellFilter->setValueRange(zeroBasedEquilRegionIndex + 1, zeroBasedEquilRegionIndex + 1);
curveSet->addCellFilter(cellFilter);
}
2019-03-19 08:26:31 -05:00
2019-03-19 03:28:00 -05:00
{
2019-03-19 08:54:24 -05:00
RigCaseCellResultsData* caseCellResultsData = eclipseResultCase->eclipseCaseData()->results(porosityModel);
2019-03-19 03:28:00 -05:00
if (caseCellResultsData)
{
RigEclipseResultAddress depthResultAddress(RiaDefines::STATIC_NATIVE, "DEPTH");
double minDepth = 0.0;
double maxDepth = 0.0;
caseCellResultsData->minMaxCellScalarValues(depthResultAddress, minDepth, maxDepth);
minDepth = gasOilContactDepth;
maxDepth = waterOilContactDepth;
2019-03-19 08:26:31 -05:00
RimPlotCellPropertyFilter* depthCellFilter = createDepthPropertyFilter(eclipseResultCase, minDepth, maxDepth);
2019-03-19 03:28:00 -05:00
curveSet->addCellFilter(depthCellFilter);
}
}
}
RimPlotAxisProperties* yAxisProps = yAxisProperties();
yAxisProps->setInvertedAxis(true);
{
RimPlotAxisAnnotation* annotation = new RimPlotAxisAnnotation;
2019-03-19 03:28:00 -05:00
annotation->setEquilibriumData(
eclipseResultCase, zeroBasedEquilRegionIndex, RimPlotAxisAnnotation::PL_EQUIL_GAS_OIL_CONTACT);
yAxisProps->appendAnnotation(annotation);
}
{
RimPlotAxisAnnotation* annotation = new RimPlotAxisAnnotation;
2019-03-19 03:28:00 -05:00
annotation->setEquilibriumData(
eclipseResultCase, zeroBasedEquilRegionIndex, RimPlotAxisAnnotation::PL_EQUIL_WATER_OIL_CONTACT);
yAxisProps->appendAnnotation(annotation);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSaturationPressurePlot::initAfterRead()
{
yAxisProperties()->showAnnotationObjectsInProjectTree();
RimGridCrossPlot::initAfterRead();
}
2019-03-19 08:26:31 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimSaturationPressurePlot::xAxisParameterString() const
{
return "";
}
2019-03-19 08:26:31 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotCellPropertyFilter*
RimSaturationPressurePlot::createEquilibriumRegionPropertyFilter(RimEclipseResultCase* eclipseResultCase,
int zeroBasedEquilRegionIndex)
{
RimPlotCellPropertyFilter* cellFilter = new RimPlotCellPropertyFilter();
RimEclipseResultDefinition* resultDefinition = new RimEclipseResultDefinition();
resultDefinition->setEclipseCase(eclipseResultCase);
resultDefinition->setResultType(RiaDefines::STATIC_NATIVE);
resultDefinition->setResultVariable("EQLNUM");
cellFilter->setResultDefinition(resultDefinition);
cellFilter->setValueRange(zeroBasedEquilRegionIndex + 1, zeroBasedEquilRegionIndex + 1);
return cellFilter;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotCellPropertyFilter* RimSaturationPressurePlot::createDepthPropertyFilter(RimEclipseResultCase* eclipseResultCase,
double minDepth,
double maxDepth)
{
RimPlotCellPropertyFilter* depthCellFilter = new RimPlotCellPropertyFilter();
RimEclipseResultDefinition* resultDefinition = new RimEclipseResultDefinition();
resultDefinition->setEclipseCase(eclipseResultCase);
resultDefinition->setResultType(RiaDefines::STATIC_NATIVE);
resultDefinition->setResultVariable("DEPTH");
depthCellFilter->setResultDefinition(resultDefinition);
depthCellFilter->setValueRange(minDepth, maxDepth);
return depthCellFilter;
}