#11109 Improve visualization of MSW with valve branches

Increase default segment threshold to 4
Add an optional setting to override the default value
Use this threshold to merge short branches into parent branch
This commit is contained in:
Magne Sjaastad
2024-01-25 18:17:10 +01:00
parent 85672f5ef5
commit 7d601ac067
11 changed files with 87 additions and 39 deletions

View File

@@ -28,6 +28,7 @@
#include "RigWellResultFrame.h"
#include "RimEclipseCase.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimSimWellInView.h"
#include "RimSimWellInViewCollection.h"
@@ -37,7 +38,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<SimulationWellCellBranch> RigMswCenterLineCalculator::calculateMswWellPipeGeometry( RimSimWellInView* rimWell )
std::vector<SimulationWellCellBranch> RigMswCenterLineCalculator::calculateMswWellPipeGeometry( const RimSimWellInView* rimWell )
{
CVF_ASSERT( rimWell );
@@ -50,7 +51,13 @@ std::vector<SimulationWellCellBranch> RigMswCenterLineCalculator::calculateMswWe
auto eclipseCaseData = eclipseView->eclipseCase()->eclipseCaseData();
int timeStepIndex = eclipseView->currentTimeStep();
return calculateMswWellPipeGeometryForTimeStep( eclipseCaseData, simWellData, timeStepIndex );
int shortBranchMergeThreshold = 4;
if ( auto eclipseResultCase = dynamic_cast<RimEclipseResultCase*>( eclipseView->eclipseCase() ) )
{
shortBranchMergeThreshold = eclipseResultCase->mswMergeThreshold();
}
return calculateMswWellPipeGeometryForTimeStep( eclipseCaseData, simWellData, timeStepIndex, shortBranchMergeThreshold );
}
return {};
@@ -62,10 +69,9 @@ std::vector<SimulationWellCellBranch> RigMswCenterLineCalculator::calculateMswWe
std::vector<SimulationWellCellBranch>
RigMswCenterLineCalculator::calculateMswWellPipeGeometryForTimeStep( const RigEclipseCaseData* eclipseCaseData,
const RigSimWellData* wellResults,
int timeStepIndex )
int timeStepIndex,
int shortBranchMergeThreshold )
{
if ( timeStepIndex >= 0 && !wellResults->hasAnyValidCells( timeStepIndex ) ) return {};
const RigWellResultFrame* wellFramePtr = nullptr;
if ( timeStepIndex < 0 )
@@ -80,7 +86,7 @@ std::vector<SimulationWellCellBranch>
const RigWellResultFrame& wellFrame = *wellFramePtr;
const std::vector<RigWellResultBranch> resultBranches = wellFrame.wellResultBranches();
std::vector<WellBranch> wellBranches = mergeShortBranchesIntoLongBranches( resultBranches );
std::vector<WellBranch> wellBranches = mergeShortBranchesIntoLongBranches( resultBranches, shortBranchMergeThreshold );
// Connect outlet segment of branches to parent branch
@@ -290,7 +296,8 @@ SimulationWellCellBranch
///
//--------------------------------------------------------------------------------------------------
std::vector<RigMswCenterLineCalculator::WellBranch>
RigMswCenterLineCalculator::mergeShortBranchesIntoLongBranches( const std::vector<RigWellResultBranch>& resBranches )
RigMswCenterLineCalculator::mergeShortBranchesIntoLongBranches( const std::vector<RigWellResultBranch>& resBranches,
int shortBranchMergeThreshold )
{
std::vector<WellBranch> longWellBranches;
std::vector<WellBranch> shortWellBranches;
@@ -314,8 +321,7 @@ std::vector<RigMswCenterLineCalculator::WellBranch>
}
}
const int resultPointThreshold = 3;
if ( resultBranch.branchResultPoints().size() > resultPointThreshold )
if ( static_cast<int>( resultBranch.branchResultPoints().size() ) > shortBranchMergeThreshold )
{
longWellBranches.push_back( branch );
}

View File

@@ -35,7 +35,7 @@ class RigSimWellData;
class RigMswCenterLineCalculator
{
public:
static std::vector<SimulationWellCellBranch> calculateMswWellPipeGeometry( RimSimWellInView* rimWell );
static std::vector<SimulationWellCellBranch> calculateMswWellPipeGeometry( const RimSimWellInView* rimWell );
private:
struct OutputSegment
@@ -69,11 +69,13 @@ private:
private:
static std::vector<SimulationWellCellBranch> calculateMswWellPipeGeometryForTimeStep( const RigEclipseCaseData* eclipseCaseData,
const RigSimWellData* simWellData,
int timeStepIndex );
int timeStepIndex,
int shortBranchMergeThreshold );
static SimulationWellCellBranch addCoordsAtCellFaceIntersectionsAndCreateBranch( const std::vector<cvf::Vec3d> branchCoords,
const std::vector<RigWellResultPoint>& resultPoints,
const RigEclipseCaseData* eclipseCaseData );
static std::vector<WellBranch> mergeShortBranchesIntoLongBranches( const std::vector<RigWellResultBranch>& resBranches );
static std::vector<WellBranch> mergeShortBranchesIntoLongBranches( const std::vector<RigWellResultBranch>& resBranches,
int shortBranchMergeThreshold );
};

View File

@@ -43,7 +43,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<SimulationWellCellBranch> RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline( RimSimWellInView* rimWell )
std::vector<SimulationWellCellBranch> RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline( const RimSimWellInView* rimWell )
{
std::vector<std::vector<cvf::Vec3d>> pipeBranchesCLCoords;
std::vector<std::vector<RigWellResultPoint>> pipeBranchesCellIds;
@@ -118,7 +118,7 @@ std::pair<std::vector<std::vector<cvf::Vec3d>>, std::vector<std::vector<RigWellR
/// 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::calculateWellPipeStaticCenterline( RimSimWellInView* rimWell,
void RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline( const RimSimWellInView* rimWell,
std::vector<std::vector<cvf::Vec3d>>& pipeBranchesCLCoords,
std::vector<std::vector<RigWellResultPoint>>& pipeBranchesCellIds )
{

View File

@@ -37,7 +37,7 @@ class RigWellResultFrame;
class RigSimulationWellCenterLineCalculator
{
public:
static std::vector<SimulationWellCellBranch> calculateWellPipeStaticCenterline( RimSimWellInView* rimWell );
static std::vector<SimulationWellCellBranch> calculateWellPipeStaticCenterline( const RimSimWellInView* rimWell );
static std::vector<SimulationWellCellBranch> calculateWellPipeCenterlineForTimeStep( const RigEclipseCaseData* eclipseCaseData,
const RigSimWellData* simWellData,
@@ -49,7 +49,7 @@ public:
extractBranchData( const std::vector<SimulationWellCellBranch> simulationBranch );
private:
static void calculateWellPipeStaticCenterline( RimSimWellInView* rimWell,
static void calculateWellPipeStaticCenterline( const RimSimWellInView* rimWell,
std::vector<std::vector<cvf::Vec3d>>& pipeBranchesCLCoords,
std::vector<std::vector<RigWellResultPoint>>& pipeBranchesCellIds );