#2553 Well CF Visualization: Add recompute of virtual conn factors

This commit is contained in:
Magne Sjaastad 2018-04-05 13:50:14 +02:00
parent 50212fff0d
commit c0054cff91
9 changed files with 144 additions and 24 deletions

View File

@ -394,31 +394,39 @@ const RigVirtualPerforationTransmissibilities* RimEclipseCase::computeAndGetVirt
}
}
rigEclipseCase->setVirtualPerforationTransmissibilities(perfTrans.p());
;
for (const auto& wellRes : rigEclipseCase->wellResults())
{
double minValue = HUGE_VAL;
double maxValue = -HUGE_VAL;
double posClosestToZero = HUGE_VAL;
double negClosestToZero = -HUGE_VAL;
perfTrans->computeMinMax(&minValue, &maxValue, &posClosestToZero, &negClosestToZero);
if (minValue != HUGE_VAL)
std::vector<std::vector<RigCompletionData>> completionsPerTimeStep;
for (size_t i = 0; i < timeStepDates().size(); i++)
{
for (const auto& v : views())
{
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(v);
if (eclView)
{
RimLegendConfig* legendConfig = eclView->virtualPerforationResult()->legendConfig();
std::vector<RigCompletionData> completionData;
legendConfig->setAutomaticRanges(minValue, maxValue, minValue, maxValue);
legendConfig->setClosestToZeroValues(posClosestToZero, negClosestToZero, posClosestToZero, negClosestToZero);
if (wellRes->hasWellResult(i))
{
for (const auto& wellResultBranch : wellRes->wellResultFrame(i).m_wellResultBranches)
{
for (const auto& r : wellResultBranch.m_branchResultPoints)
{
if (r.isValid() && r.m_isOpen)
{
RigCompletionData compData(wellRes->m_wellName, RigCompletionDataGridCell(r.m_gridCellIndex, rigEclipseCase->mainGrid()), 0);
compData.setTransmissibility(r.connectionFactor());
completionData.push_back(compData);
}
}
}
}
completionsPerTimeStep.push_back(completionData);
perfTrans->setCompletionDataForSimWell(wellRes.p(), completionsPerTimeStep);
}
}
rigEclipseCase->setVirtualPerforationTransmissibilities(perfTrans.p());
}
return rigEclipseCase->virtualPerforationTransmissibilities();

View File

@ -33,6 +33,7 @@
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"
#include "RigSimWellData.h"
#include "RigVirtualPerforationTransmissibilities.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimCellEdgeColors.h"
@ -310,8 +311,6 @@ void RimEclipseView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
scheduleCreateDisplayModelAndRedraw();
}
}
//--------------------------------------------------------------------------------------------------
@ -843,6 +842,11 @@ void RimEclipseView::onLoadDataAndUpdate()
}
}
if (this->isVirtualConnectionFactorGeometryVisible())
{
m_virtualPerforationResult->loadData();
}
this->scheduleCreateDisplayModelAndRedraw();
}
@ -1103,6 +1107,8 @@ void RimEclipseView::updateLegends()
if (m_virtualPerforationResult->isActive())
{
updateVirtualConnectionLegendRanges();
RimLegendConfig* virtLegend = m_virtualPerforationResult->legendConfig();
m_viewer->addColorLegendToBottomLeftCorner(virtLegend->legend());
@ -1593,6 +1599,33 @@ void RimEclipseView::resetLegendsInViewer()
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseView::updateVirtualConnectionLegendRanges()
{
if (!eclipseCase()) return;
const RigVirtualPerforationTransmissibilities* virtualTransmissibilities = eclipseCase()->computeAndGetVirtualPerforationTransmissibilities();
if (virtualTransmissibilities)
{
double minValue = HUGE_VAL;
double maxValue = -HUGE_VAL;
double posClosestToZero = HUGE_VAL;
double negClosestToZero = -HUGE_VAL;
virtualTransmissibilities->computeMinMax(&minValue, &maxValue, &posClosestToZero, &negClosestToZero);
if (minValue != HUGE_VAL)
{
RimLegendConfig* legendConfig = virtualPerforationResult()->legendConfig();
legendConfig->setAutomaticRanges(minValue, maxValue, minValue, maxValue);
legendConfig->setClosestToZeroValues(posClosestToZero, negClosestToZero, posClosestToZero, negClosestToZero);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -162,6 +162,7 @@ private:
void updateLegends();
void updateMinMaxValuesAndAddLegendToView(QString legendLabel, RimEclipseCellColors* resultColors, RigCaseCellResultsData* cellResultsData);
virtual void resetLegendsInViewer() override;
void updateVirtualConnectionLegendRanges();
std::set<RivCellSetEnum> allVisibleFaultGeometryTypes() const;
void updateFaultColors();

View File

@ -18,6 +18,7 @@
#include "RimVirtualPerforationResults.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimLegendConfig.h"
@ -35,7 +36,7 @@ RimVirtualPerforationResults::RimVirtualPerforationResults()
CAF_PDM_InitObject(connectionFactorUiName, ":/CellResult.png", "", "");
CAF_PDM_InitField(&m_isActive, "ShowConnectionFactors", false, "", "", "", "");
CAF_PDM_InitField(&m_geometryScaleFactor, "GeometryScaleFactor", 0.2, "Geometry Scale Factor", "", "", "");
CAF_PDM_InitField(&m_geometryScaleFactor, "GeometryScaleFactor", 1.0, "Geometry Scale Factor", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_legendConfig, "LegendDefinition", "Legend Definition", "", "", "");
m_legendConfig.uiCapability()->setUiHidden(true);
@ -75,6 +76,19 @@ RimLegendConfig* RimVirtualPerforationResults::legendConfig() const
return m_legendConfig();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimVirtualPerforationResults::loadData()
{
RimEclipseCase* eclipseCase = nullptr;
this->firstAncestorOrThisOfType(eclipseCase);
if (eclipseCase)
{
eclipseCase->computeAndGetVirtualPerforationTransmissibilities();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -85,6 +99,8 @@ void RimVirtualPerforationResults::fieldChangedByUi(const caf::PdmFieldHandle* c
if (changedField == &m_isActive)
{
updateUiIconFromToggleField();
loadData();
}
RimEclipseView* eclView = nullptr;
@ -124,7 +140,7 @@ void RimVirtualPerforationResults::defineUiOrdering(QString uiConfigName, caf::P
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RimVirtualPerforationResults::initAfterRead()
{

View File

@ -39,10 +39,11 @@ public:
RimVirtualPerforationResults();
virtual ~RimVirtualPerforationResults();
bool isActive() const;
double geometryScaleFactor() const;
bool isActive() const;
double geometryScaleFactor() const;
RimLegendConfig* legendConfig() const;
void loadData();
private:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;

View File

@ -129,6 +129,14 @@ void RigCompletionData::setDiameter(double diameter)
m_diameter = diameter;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCompletionData::setTransmissibility(double transmissibility)
{
m_transmissibility = transmissibility;
}
//==================================================================================================
///
//==================================================================================================

View File

@ -70,6 +70,7 @@ public:
RigCompletionData(const QString wellName, const RigCompletionDataGridCell& cellIndex, double orderingValue);
~RigCompletionData();
RigCompletionData(const RigCompletionData& other);
bool operator<(const RigCompletionData& other) const;
@ -78,6 +79,7 @@ public:
void setFromFracture(double transmissibility, double skinFactor, double diameter);
void setSecondOrderingValue(double orderingValue);
void setDiameter(double diameter);
void setTransmissibility(double transmissibility);
void setTransAndWPImultBackgroundDataFromFishbone(double transmissibility,
double skinFactor,

View File

@ -17,6 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RigVirtualPerforationTransmissibilities.h"
#include "RigStatisticsMath.h"
//--------------------------------------------------------------------------------------------------
@ -113,6 +114,33 @@ const std::map<RigCompletionDataGridCell, std::vector<RigCompletionData>>&
return dummy;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigVirtualPerforationTransmissibilities::setCompletionDataForSimWell(
const RigSimWellData* simWellData,
std::vector<std::vector<RigCompletionData>>& completionsPerTimeStep)
{
m_mapFromSimWellToCompletionData[simWellData] = completionsPerTimeStep;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<RigCompletionData>&
RigVirtualPerforationTransmissibilities::completionsForSimWell(const RigSimWellData* simWellData, size_t timeStepIndex) const
{
static std::vector<RigCompletionData> dummayVector;
auto item = m_mapFromSimWellToCompletionData.find(simWellData);
if (item != m_mapFromSimWellToCompletionData.end())
{
return item->second[timeStepIndex];
}
return dummayVector;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -143,6 +171,22 @@ void RigVirtualPerforationTransmissibilities::computeMinMax(double* minValue,
}
}
for (const auto& item : m_mapFromSimWellToCompletionData)
{
auto dataForSimWell = item.second;
for (const auto& timeStepFrame : dataForSimWell)
{
for (const auto& completionData : timeStepFrame)
{
double transmissibility = completionData.transmissibility();
minMaxAccumulator.addValue(transmissibility);
posNegAccumulator.addValue(transmissibility);
}
}
}
if (*minValue) *minValue = minMaxAccumulator.min;
if (*maxValue) *maxValue = minMaxAccumulator.max;
if (*posClosestToZero) *posClosestToZero = posNegAccumulator.pos;

View File

@ -28,6 +28,7 @@
class RigCompletionData;
class RigCompletionDataGridCell;
class RigSimWellData;
class RimWellPath;
//--------------------------------------------------------------------------------------------------
@ -60,7 +61,13 @@ public:
const std::map<RigCompletionDataGridCell, std::vector<RigCompletionData>>&
multipleCompletionsPerEclipseCell(RimWellPath* wellPath, size_t timeStepIndex) const;
void setCompletionDataForSimWell(const RigSimWellData* simWellData, std::vector<std::vector<RigCompletionData>>& completionsPerTimeStep);
const std::vector<RigCompletionData>&
completionsForSimWell(const RigSimWellData* simWellData, size_t timeStepIndex) const;
void computeMinMax(double* minValue, double* maxValue, double* posClosestToZero, double* negClosestToZero) const;
private:
std::map<RimWellPath*, std::vector<CompletionDataFrame>> m_mapFromWellToCompletionData;
std::map<const RigSimWellData*, std::vector<std::vector<RigCompletionData>>> m_mapFromSimWellToCompletionData;
};