mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1980 PLT Plot: Map data cells and MD in RFTCurves
This commit is contained in:
parent
e3666a21fe
commit
c9d8afc803
@ -19,27 +19,41 @@
|
|||||||
|
|
||||||
#include "RimWellLogRftCurve.h"
|
#include "RimWellLogRftCurve.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
#include "RiaEclipseUnitTools.h"
|
#include "RiaEclipseUnitTools.h"
|
||||||
|
|
||||||
#include "RimEclipseResultCase.h"
|
#include "RimEclipseResultCase.h"
|
||||||
|
#include "RimMainPlotCollection.h"
|
||||||
|
#include "RimProject.h"
|
||||||
#include "RimTools.h"
|
#include "RimTools.h"
|
||||||
#include "RimWellLogPlot.h"
|
#include "RimWellLogPlot.h"
|
||||||
|
#include "RimWellLogPlotCollection.h"
|
||||||
|
#include "RimWellPath.h"
|
||||||
|
|
||||||
#include "RigEclipseCaseData.h"
|
#include "RigEclipseCaseData.h"
|
||||||
|
#include "RigEclipseWellLogExtractor.h"
|
||||||
|
#include "RigMainGrid.h"
|
||||||
#include "RigWellLogCurveData.h"
|
#include "RigWellLogCurveData.h"
|
||||||
|
#include "RigWellPath.h"
|
||||||
|
#include "RigWellPathIntersectionTools.h"
|
||||||
|
|
||||||
#include "RiuLineSegmentQwtPlotCurve.h"
|
#include "RiuLineSegmentQwtPlotCurve.h"
|
||||||
|
|
||||||
#include "RifReaderEclipseRft.h"
|
|
||||||
#include "RifEclipseRftAddress.h"
|
#include "RifEclipseRftAddress.h"
|
||||||
|
#include "RifReaderEclipseRft.h"
|
||||||
|
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafVecIjk.h"
|
||||||
|
|
||||||
#include "cvfAssert.h"
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
#include <qwt_plot.h>
|
#include <qwt_plot.h>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
#include <numeric>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
template<>
|
template<>
|
||||||
@ -249,14 +263,14 @@ void RimWellLogRftCurve::onLoadDataAndUpdate(bool updateParentPlot)
|
|||||||
CVF_ASSERT(wellLogPlot);
|
CVF_ASSERT(wellLogPlot);
|
||||||
|
|
||||||
std::vector<double> values = xValues();
|
std::vector<double> values = xValues();
|
||||||
std::vector<double> depthVector = depthValues();
|
std::vector<double> tvDepthVector = tvDepthValues();
|
||||||
|
std::vector<double> measuredDepthVector = measuredDepthValues();
|
||||||
|
|
||||||
if (values.empty() || depthVector.empty()) return;
|
if (values.empty()) return;
|
||||||
|
if (values.size() != tvDepthVector.size()) return;
|
||||||
if (values.size() == depthVector.size())
|
if (values.size() != measuredDepthVector.size()) return;
|
||||||
{
|
|
||||||
m_curveData->setValuesAndMD(values, depthVector, RiaEclipseUnitTools::depthUnit(m_eclipseResultCase->eclipseCaseData()->unitsType()), false);
|
m_curveData->setValuesWithTVD(values, measuredDepthVector, tvDepthVector, RiaEclipseUnitTools::depthUnit(m_eclipseResultCase->eclipseCaseData()->unitsType()), false);
|
||||||
}
|
|
||||||
|
|
||||||
RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_METER;
|
RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_METER;
|
||||||
if (wellLogPlot)
|
if (wellLogPlot)
|
||||||
@ -264,7 +278,15 @@ void RimWellLogRftCurve::onLoadDataAndUpdate(bool updateParentPlot)
|
|||||||
displayUnit = wellLogPlot->depthUnit();
|
displayUnit = wellLogPlot->depthUnit();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->measuredDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
|
if (wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH)
|
||||||
|
{
|
||||||
|
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->measuredDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->trueDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
|
||||||
|
}
|
||||||
|
|
||||||
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
|
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
|
||||||
|
|
||||||
updateZoomInParentPlot();
|
updateZoomInParentPlot();
|
||||||
@ -413,16 +435,76 @@ std::vector<double> RimWellLogRftCurve::xValues() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<double> RimWellLogRftCurve::depthValues() const
|
std::vector<double> RimWellLogRftCurve::tvDepthValues() const
|
||||||
{
|
{
|
||||||
RifReaderEclipseRft* reader = rftReader();
|
RifReaderEclipseRft* reader = rftReader();
|
||||||
std::vector<double> values;
|
std::vector<double> tvDepthValues;
|
||||||
|
|
||||||
if (!reader) return values;
|
if (!reader) return tvDepthValues;
|
||||||
|
|
||||||
RifEclipseRftAddress address(m_wellName(), m_timeStep, RifEclipseRftAddress::DEPTH);
|
RifEclipseRftAddress depthAddress(m_wellName(), m_timeStep, RifEclipseRftAddress::DEPTH);
|
||||||
|
|
||||||
reader->values(address, &values);
|
reader->values(depthAddress, &tvDepthValues);
|
||||||
|
return tvDepthValues;
|
||||||
|
}
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<double> RimWellLogRftCurve::measuredDepthValues() const
|
||||||
|
{
|
||||||
|
std::vector<double> measuredDepthForCells;
|
||||||
|
|
||||||
|
RifReaderEclipseRft* reader = rftReader();
|
||||||
|
if (!reader) return measuredDepthForCells;
|
||||||
|
|
||||||
return values;
|
|
||||||
}
|
RimMainPlotCollection* mainPlotCollection;
|
||||||
|
this->firstAncestorOrThisOfTypeAsserted(mainPlotCollection);
|
||||||
|
|
||||||
|
RimWellLogPlotCollection* wellLogCollection = mainPlotCollection->wellLogPlotCollection();
|
||||||
|
if (!wellLogCollection) return measuredDepthForCells;
|
||||||
|
|
||||||
|
RigEclipseWellLogExtractor* eclExtractor = nullptr;
|
||||||
|
|
||||||
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
|
RimWellPath* wellPath = proj->wellPathFromSimulationWell(m_wellName());
|
||||||
|
eclExtractor = wellLogCollection->findOrCreateExtractor(wellPath, m_eclipseResultCase);
|
||||||
|
|
||||||
|
if (!eclExtractor)
|
||||||
|
{
|
||||||
|
std::vector<const RigWellPath*> wellPaths = proj->simulationWellBranches(m_wellName());
|
||||||
|
if (wellPaths.size() == 0) return measuredDepthForCells;
|
||||||
|
|
||||||
|
eclExtractor = wellLogCollection->findOrCreateSimWellExtractor(m_wellName(), QString("Find or create sim well extractor"), wellPaths[0], m_eclipseResultCase->eclipseCaseData());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!eclExtractor) return measuredDepthForCells;
|
||||||
|
|
||||||
|
std::vector<double> measuredDepthForIntersections = eclExtractor->measuredDepth();
|
||||||
|
|
||||||
|
std::vector< size_t> globCellIndices = eclExtractor->intersectedCellsGlobIdx();
|
||||||
|
|
||||||
|
std::map<size_t, std::vector<double>> globCellIdToIntersectionDepthsMap;
|
||||||
|
|
||||||
|
for (size_t iIdx = 0; iIdx < measuredDepthForIntersections.size(); ++iIdx)
|
||||||
|
{
|
||||||
|
globCellIdToIntersectionDepthsMap[globCellIndices[iIdx]].push_back(measuredDepthForIntersections[iIdx]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const RigMainGrid* mainGrid = eclExtractor->caseData()->mainGrid();
|
||||||
|
|
||||||
|
RifEclipseRftAddress depthAddress(m_wellName(), m_timeStep, RifEclipseRftAddress::DEPTH);
|
||||||
|
std::vector<caf::VecIjk> indices;
|
||||||
|
rftReader()->cellIndices(depthAddress, &indices);
|
||||||
|
|
||||||
|
for (const caf::VecIjk& ijkIndex : indices)
|
||||||
|
{
|
||||||
|
size_t globalCellIndex = mainGrid->cellIndexFromIJK(ijkIndex.i(), ijkIndex.j(), ijkIndex.k());
|
||||||
|
|
||||||
|
double sum = std::accumulate(globCellIdToIntersectionDepthsMap[globalCellIndex].begin(), globCellIdToIntersectionDepthsMap[globalCellIndex].end(), 0);
|
||||||
|
|
||||||
|
measuredDepthForCells.push_back(sum / (double)globCellIdToIntersectionDepthsMap[globalCellIndex].size());
|
||||||
|
}
|
||||||
|
|
||||||
|
return measuredDepthForCells;
|
||||||
|
}
|
||||||
|
@ -23,13 +23,15 @@
|
|||||||
|
|
||||||
#include "RifEclipseRftAddress.h"
|
#include "RifEclipseRftAddress.h"
|
||||||
|
|
||||||
|
#include "cafAppEnum.h"
|
||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmPtrField.h"
|
#include "cafPdmPtrField.h"
|
||||||
|
|
||||||
#include "cvfObject.h"
|
#include "cvfObject.h"
|
||||||
#include "cafAppEnum.h"
|
|
||||||
|
|
||||||
class RifReaderEclipseRft;
|
class RifReaderEclipseRft;
|
||||||
class RimEclipseResultCase;
|
class RimEclipseResultCase;
|
||||||
|
class RimWellPath;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@ -43,22 +45,22 @@ public:
|
|||||||
RimWellLogRftCurve();
|
RimWellLogRftCurve();
|
||||||
virtual ~RimWellLogRftCurve();
|
virtual ~RimWellLogRftCurve();
|
||||||
|
|
||||||
virtual QString wellName() const override;
|
virtual QString wellName() const override;
|
||||||
virtual QString wellLogChannelName() const override;
|
virtual QString wellLogChannelName() const override;
|
||||||
|
|
||||||
void setEclipseResultCase(RimEclipseResultCase* eclipseResultCase);
|
void setEclipseResultCase(RimEclipseResultCase* eclipseResultCase);
|
||||||
RimEclipseResultCase* eclipseResultCase() const;
|
RimEclipseResultCase* eclipseResultCase() const;
|
||||||
|
|
||||||
void setRftAddress(RifEclipseRftAddress address);
|
void setRftAddress(RifEclipseRftAddress address);
|
||||||
RifEclipseRftAddress rftAddress() const;
|
RifEclipseRftAddress rftAddress() const;
|
||||||
|
|
||||||
void setDefaultAddress(QString wellName);
|
void setDefaultAddress(QString wellName);
|
||||||
void updateWellChannelNameAndTimeStep();
|
void updateWellChannelNameAndTimeStep();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overrides from RimWellLogPlotCurve
|
// Overrides from RimWellLogPlotCurve
|
||||||
virtual QString createCurveAutoName() override;
|
virtual QString createCurveAutoName() override;
|
||||||
virtual void onLoadDataAndUpdate(bool updateParentPlot) override;
|
virtual void onLoadDataAndUpdate(bool updateParentPlot) override;
|
||||||
|
|
||||||
// Pdm overrrides
|
// Pdm overrrides
|
||||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||||
@ -69,7 +71,8 @@ private:
|
|||||||
RifReaderEclipseRft* rftReader() const;
|
RifReaderEclipseRft* rftReader() const;
|
||||||
|
|
||||||
std::vector<double> xValues() const;
|
std::vector<double> xValues() const;
|
||||||
std::vector<double> depthValues() const;
|
std::vector<double> tvDepthValues() const;
|
||||||
|
std::vector<double> measuredDepthValues() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase;
|
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase;
|
||||||
|
@ -82,7 +82,6 @@ void RigWellLogCurveData::setValuesWithTVD(const std::vector<double>& xValues,
|
|||||||
m_tvDepths = tvDepths;
|
m_tvDepths = tvDepths;
|
||||||
m_depthUnit = depthUnit;
|
m_depthUnit = depthUnit;
|
||||||
|
|
||||||
// Always use value filtering when TVD is present
|
|
||||||
m_isExtractionCurve = isExtractionCurve;
|
m_isExtractionCurve = isExtractionCurve;
|
||||||
|
|
||||||
calculateIntervalsOfContinousValidValues();
|
calculateIntervalsOfContinousValidValues();
|
||||||
|
@ -45,7 +45,8 @@ public:
|
|||||||
void setValuesWithTVD(const std::vector<double>& xValues,
|
void setValuesWithTVD(const std::vector<double>& xValues,
|
||||||
const std::vector<double>& measuredDepths,
|
const std::vector<double>& measuredDepths,
|
||||||
const std::vector<double>& tvDepths,
|
const std::vector<double>& tvDepths,
|
||||||
RiaDefines::DepthUnitType depthUnit);
|
RiaDefines::DepthUnitType depthUnit,
|
||||||
|
bool isExtractionCurve);
|
||||||
|
|
||||||
const std::vector<double>& xValues() const;
|
const std::vector<double>& xValues() const;
|
||||||
const std::vector<double>& measuredDepths() const;
|
const std::vector<double>& measuredDepths() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user