#1112 Made conveninece methods to calculate well pipe centerline, and added possibility to do it pr timestep.

This commit is contained in:
Jacob Støren 2017-01-20 17:20:09 +01:00
parent cebe5428be
commit 0d7da9788a
6 changed files with 83 additions and 11 deletions

View File

@ -82,7 +82,7 @@ void RivSimWellPipesPartMgr::buildWellPipeParts()
m_pipeBranchesCLCoords.clear();
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterline(m_rimWell.p(), m_pipeBranchesCLCoords, pipeBranchesCellIds);
m_rimWell->calculateWellPipeStaticCenterLine(m_pipeBranchesCLCoords, pipeBranchesCellIds);
double characteristicCellSize = m_rimReservoirView->mainGrid()->characteristicIJCellSize();
double pipeRadius = m_rimReservoirView->wellCollection()->pipeRadiusScaleFactor() *m_rimWell->pipeRadiusScaleFactor() * characteristicCellSize;

View File

@ -27,6 +27,7 @@
#include "RimIntersectionCollection.h"
#include "cvfMath.h"
#include "RigSimulationWellCenterLineCalculator.h"
CAF_PDM_SOURCE_INIT(RimEclipseWell, "Well");
@ -114,6 +115,25 @@ caf::PdmFieldHandle* RimEclipseWell::objectToggleField()
return &showWell;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseWell::calculateWellPipeStaticCenterLine(std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds)
{
RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline(this, pipeBranchesCLCoords, pipeBranchesCellIds);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseWell::calculateWellPipeDynamicCenterLine(size_t timeStepIdx,
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds)
{
RigSimulationWellCenterLineCalculator::calculateWellPipeDynamicCenterline(this, timeStepIdx, pipeBranchesCLCoords, pipeBranchesCellIds);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@
// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"
class RigSingleWellResultsData;
#include "RigSingleWellResultsData.h"
//==================================================================================================
///
@ -57,8 +57,12 @@ public:
virtual caf::PdmFieldHandle* userDescriptionField();
virtual caf::PdmFieldHandle* objectToggleField();
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
void calculateWellPipeStaticCenterLine( std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds);
void calculateWellPipeDynamicCenterLine(size_t timeStepIdx,
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds);
caf::PdmField<bool> showWell;
@ -73,6 +77,10 @@ public:
caf::PdmField<cvf::Color3f> wellPipeColor;
caf::PdmField<double> pipeRadiusScaleFactor;
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
private:
cvf::ref<RigSingleWellResultsData> m_wellResults;
size_t m_resultWellIndex;

View File

@ -393,7 +393,7 @@ void RimIntersection::updateWellCenterline() const
{
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterline(simulationWell(), m_wellBranchCenterlines, pipeBranchesCellIds);
simulationWell->calculateWellPipeStaticCenterLine(m_wellBranchCenterlines, pipeBranchesCellIds);
}
}
else

View File

@ -34,7 +34,7 @@
/// The returned CellIds is one less than the number of centerline points,
/// and are describing the lines between the points, starting with the first line
//--------------------------------------------------------------------------------------------------
void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterline(RimEclipseWell* rimWell,
void RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline(RimEclipseWell* rimWell,
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds)
{
@ -74,6 +74,45 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterline(RimEclip
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigSimulationWellCenterLineCalculator::calculateWellPipeDynamicCenterline(RimEclipseWell* rimWell,
size_t timeStepIndex,
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds)
{
bool isAutoDetectBranches = false;
RigEclipseCaseData* eclipseCaseData = NULL;
RigSingleWellResultsData* wellResults = NULL;
{
CVF_ASSERT(rimWell);
RimEclipseView* eclipseView;
rimWell->firstAncestorOrThisOfType(eclipseView);
CVF_ASSERT(eclipseView);
isAutoDetectBranches = eclipseView->wellCollection()->isAutoDetectingBranches();
eclipseCaseData = eclipseView->eclipseCase()->reservoirData();
wellResults = rimWell->wellResults();
if ( !wellResults || !wellResults->hasWellResult(timeStepIndex) ) return;
}
const RigWellResultFrame& wellFrame = wellResults->wellResultFrame(timeStepIndex);
bool isMultiSegmentWell = wellResults->isMultiSegmentWell();
bool useAllCellCenters = rimWell->isUsingCellCenterForPipe();
calculateWellPipeCenterlineFromWellFrame(wellFrame,
eclipseCaseData,
isMultiSegmentWell,
isAutoDetectBranches,
useAllCellCenters,
pipeBranchesCLCoords,
pipeBranchesCellIds);
}
//--------------------------------------------------------------------------------------------------
/// Based on the points and cells, calculate a pipe centerline
/// The returned CellIds is one less than the number of centerline points,

View File

@ -28,10 +28,17 @@ class RigEclipseCaseData;
class RigSimulationWellCenterLineCalculator
{
public:
static void calculateWellPipeCenterline(RimEclipseWell* m_rimWell,
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds) ;
static void calculateWellPipeStaticCenterline(RimEclipseWell* rimWell,
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds) ;
static void calculateWellPipeDynamicCenterline(RimEclipseWell* rimWell,
size_t timeStepIndex,
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds) ;
private:
static void calculateWellPipeCenterlineFromWellFrame(const RigWellResultFrame& wellFrame,
const RigEclipseCaseData* eclipseCaseData,
bool isMultiSegmentWell,
@ -40,8 +47,6 @@ public:
std::vector<std::vector<cvf::Vec3d>> & pipeBranchesCLCoords,
std::vector<std::vector<RigWellResultPoint>> & pipeBranchesCellIds);
private:
static bool hasAnyResultCells(const std::vector<RigWellResultBranch> &resBranches);
static bool hasAnyValidDataCells(const RigWellResultBranch& branch);
static void finishPipeCenterLine( std::vector< std::vector<cvf::Vec3d> > &pipeBranchesCLCoords, const cvf::Vec3d& lastCellCenter ) ;