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 "RiaApplication.h"
|
||||
#include "RiaEclipseUnitTools.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEclipseWellLogExtractor.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigWellLogCurveData.h"
|
||||
#include "RigWellPath.h"
|
||||
#include "RigWellPathIntersectionTools.h"
|
||||
|
||||
#include "RiuLineSegmentQwtPlotCurve.h"
|
||||
|
||||
#include "RifReaderEclipseRft.h"
|
||||
#include "RifEclipseRftAddress.h"
|
||||
#include "RifReaderEclipseRft.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafVecIjk.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <qwt_plot.h>
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
@ -249,14 +263,14 @@ void RimWellLogRftCurve::onLoadDataAndUpdate(bool updateParentPlot)
|
||||
CVF_ASSERT(wellLogPlot);
|
||||
|
||||
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() != measuredDepthVector.size()) return;
|
||||
|
||||
if (values.size() == depthVector.size())
|
||||
{
|
||||
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;
|
||||
if (wellLogPlot)
|
||||
@ -264,7 +278,15 @@ void RimWellLogRftCurve::onLoadDataAndUpdate(bool updateParentPlot)
|
||||
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());
|
||||
|
||||
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();
|
||||
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);
|
||||
|
||||
return values;
|
||||
reader->values(depthAddress, &tvDepthValues);
|
||||
return tvDepthValues;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RimWellLogRftCurve::measuredDepthValues() const
|
||||
{
|
||||
std::vector<double> measuredDepthForCells;
|
||||
|
||||
RifReaderEclipseRft* reader = rftReader();
|
||||
if (!reader) return measuredDepthForCells;
|
||||
|
||||
|
||||
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 "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "cvfObject.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
class RifReaderEclipseRft;
|
||||
class RimEclipseResultCase;
|
||||
class RimWellPath;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -43,22 +45,22 @@ public:
|
||||
RimWellLogRftCurve();
|
||||
virtual ~RimWellLogRftCurve();
|
||||
|
||||
virtual QString wellName() const override;
|
||||
virtual QString wellLogChannelName() const override;
|
||||
virtual QString wellName() const override;
|
||||
virtual QString wellLogChannelName() const override;
|
||||
|
||||
void setEclipseResultCase(RimEclipseResultCase* eclipseResultCase);
|
||||
RimEclipseResultCase* eclipseResultCase() const;
|
||||
void setEclipseResultCase(RimEclipseResultCase* eclipseResultCase);
|
||||
RimEclipseResultCase* eclipseResultCase() const;
|
||||
|
||||
void setRftAddress(RifEclipseRftAddress address);
|
||||
RifEclipseRftAddress rftAddress() const;
|
||||
void setRftAddress(RifEclipseRftAddress address);
|
||||
RifEclipseRftAddress rftAddress() const;
|
||||
|
||||
void setDefaultAddress(QString wellName);
|
||||
void updateWellChannelNameAndTimeStep();
|
||||
void setDefaultAddress(QString wellName);
|
||||
void updateWellChannelNameAndTimeStep();
|
||||
|
||||
protected:
|
||||
// Overrides from RimWellLogPlotCurve
|
||||
virtual QString createCurveAutoName() override;
|
||||
virtual void onLoadDataAndUpdate(bool updateParentPlot) override;
|
||||
virtual QString createCurveAutoName() override;
|
||||
virtual void onLoadDataAndUpdate(bool updateParentPlot) override;
|
||||
|
||||
// Pdm overrrides
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
@ -69,7 +71,8 @@ private:
|
||||
RifReaderEclipseRft* rftReader() const;
|
||||
|
||||
std::vector<double> xValues() const;
|
||||
std::vector<double> depthValues() const;
|
||||
std::vector<double> tvDepthValues() const;
|
||||
std::vector<double> measuredDepthValues() const;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase;
|
||||
|
@ -82,7 +82,6 @@ void RigWellLogCurveData::setValuesWithTVD(const std::vector<double>& xValues,
|
||||
m_tvDepths = tvDepths;
|
||||
m_depthUnit = depthUnit;
|
||||
|
||||
// Always use value filtering when TVD is present
|
||||
m_isExtractionCurve = isExtractionCurve;
|
||||
|
||||
calculateIntervalsOfContinousValidValues();
|
||||
|
@ -45,7 +45,8 @@ public:
|
||||
void setValuesWithTVD(const std::vector<double>& xValues,
|
||||
const std::vector<double>& measuredDepths,
|
||||
const std::vector<double>& tvDepths,
|
||||
RiaDefines::DepthUnitType depthUnit);
|
||||
RiaDefines::DepthUnitType depthUnit,
|
||||
bool isExtractionCurve);
|
||||
|
||||
const std::vector<double>& xValues() const;
|
||||
const std::vector<double>& measuredDepths() const;
|
||||
|
Loading…
Reference in New Issue
Block a user