mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1112 Well centerline with cell centers improved, and moved to centerline calculator
This commit is contained in:
@@ -84,39 +84,6 @@ void RivSimWellPipesPartMgr::buildWellPipeParts()
|
||||
|
||||
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterline(m_rimWell.p(), m_pipeBranchesCLCoords, pipeBranchesCellIds);
|
||||
|
||||
RimEclipseWellCollection* wellColl = nullptr;
|
||||
m_rimWell->firstAncestorOrThisOfType(wellColl);
|
||||
if (wellColl && wellColl->wellPipeCoordType() == RimEclipseWellCollection::WELLPIPE_CELLCENTER)
|
||||
{
|
||||
// Compute coords based on connection centers
|
||||
// Loop over all well cells, and overwrite with cell center instead of interpolated coordinates
|
||||
|
||||
RigMainGrid* mainGrid = m_rimReservoirView->mainGrid();
|
||||
|
||||
for (size_t i = 0; i < pipeBranchesCellIds.size(); i++)
|
||||
{
|
||||
const std::vector<RigWellResultPoint>& resPoints = pipeBranchesCellIds[i];
|
||||
for (size_t j = 0; j < resPoints.size(); j++)
|
||||
{
|
||||
if (resPoints[j].isCell())
|
||||
{
|
||||
size_t gridIndex = resPoints[j].m_gridIndex;
|
||||
size_t gridCellIndex = resPoints[j].m_gridCellIndex;
|
||||
|
||||
if (gridIndex < mainGrid->gridCount())
|
||||
{
|
||||
RigGridBase* rigGrid = mainGrid->gridByIndex(gridIndex);
|
||||
if (gridCellIndex < rigGrid->cellCount())
|
||||
{
|
||||
cvf::Vec3d center = rigGrid->cell(gridCellIndex).center();
|
||||
m_pipeBranchesCLCoords[i][j] = center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double characteristicCellSize = m_rimReservoirView->mainGrid()->characteristicIJCellSize();
|
||||
double pipeRadius = m_rimReservoirView->wellCollection()->pipeRadiusScaleFactor() *m_rimWell->pipeRadiusScaleFactor() * characteristicCellSize;
|
||||
|
||||
|
@@ -296,6 +296,17 @@ bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseWell::isUsingCellCenterForPipe()
|
||||
{
|
||||
RimEclipseWellCollection* wellColl = nullptr;
|
||||
this->firstAncestorOrThisOfType(wellColl);
|
||||
|
||||
return (wellColl && wellColl->wellPipeCoordType() == RimEclipseWellCollection::WELLPIPE_CELLCENTER);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -50,6 +50,7 @@ public:
|
||||
|
||||
bool isWellPipeVisible(size_t frameIndex);
|
||||
bool isWellSpheresVisible(size_t frameIndex);
|
||||
bool isUsingCellCenterForPipe();
|
||||
|
||||
bool visibleCellsInstersectsWell(size_t frameIndex);
|
||||
|
||||
|
@@ -61,11 +61,13 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterline(RimEclip
|
||||
|
||||
const RigWellResultFrame& staticWellFrame = wellResults->m_staticWellCells;
|
||||
bool isMultiSegmentWell = wellResults->isMultiSegmentWell();
|
||||
bool useAllCellCenters = rimWell->isUsingCellCenterForPipe();
|
||||
|
||||
calculateWellPipeCenterlineFromWellFrame(staticWellFrame,
|
||||
eclipseCaseData,
|
||||
isMultiSegmentWell,
|
||||
isAutoDetectBranches,
|
||||
isAutoDetectBranches,
|
||||
useAllCellCenters,
|
||||
pipeBranchesCLCoords,
|
||||
pipeBranchesCellIds);
|
||||
return;
|
||||
@@ -73,12 +75,15 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterline(RimEclip
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
/// Based on the points and cells, calculate a pipe centerline
|
||||
/// 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::calculateWellPipeCenterlineFromWellFrame(const RigWellResultFrame &wellFrame,
|
||||
const RigEclipseCaseData* eclipseCaseData,
|
||||
bool isMultiSegmentWell,
|
||||
bool isAutoDetectBranches,
|
||||
bool useAllCellCenters,
|
||||
std::vector<std::vector<cvf::Vec3d>> &pipeBranchesCLCoords,
|
||||
std::vector<std::vector<RigWellResultPoint>> &pipeBranchesCellIds)
|
||||
{
|
||||
@@ -360,6 +365,7 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellF
|
||||
}
|
||||
}
|
||||
|
||||
if (useAllCellCenters) addCellCenterPoints(eclipseCaseData, pipeBranchesCLCoords, pipeBranchesCellIds);
|
||||
|
||||
CVF_ASSERT(pipeBranchesCellIds.size() == pipeBranchesCLCoords.size());
|
||||
for (size_t i = 0 ; i < pipeBranchesCellIds.size() ; ++i)
|
||||
@@ -368,6 +374,41 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellF
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigSimulationWellCenterLineCalculator::addCellCenterPoints(const RigEclipseCaseData* eclipseCaseData,
|
||||
std::vector<std::vector<cvf::Vec3d>> &pipeBranchesCLCoords,
|
||||
std::vector<std::vector<RigWellResultPoint>> &pipeBranchesCellIds)
|
||||
{
|
||||
for ( size_t brIdx = 0; brIdx < pipeBranchesCellIds.size(); brIdx++ )
|
||||
{
|
||||
const std::vector<RigWellResultPoint>& branchResPoints = pipeBranchesCellIds[brIdx];
|
||||
const std::vector<cvf::Vec3d>& branchClPoints = pipeBranchesCLCoords[brIdx];
|
||||
|
||||
std::vector<RigWellResultPoint> branchResPointsWithCellCenters;
|
||||
std::vector<cvf::Vec3d> branchClPointsWithCellCenters;
|
||||
|
||||
for ( size_t cIdx = 0; cIdx < branchResPoints.size(); cIdx++ )
|
||||
{
|
||||
branchResPointsWithCellCenters.push_back(branchResPoints[cIdx]);
|
||||
branchClPointsWithCellCenters.push_back(branchClPoints[cIdx]);
|
||||
|
||||
if ( branchResPoints[cIdx].isCell() )
|
||||
{
|
||||
const RigCell& cell = eclipseCaseData->cellFromWellResultCell(branchResPoints[cIdx]);
|
||||
cvf::Vec3d center = cell.center();
|
||||
branchClPointsWithCellCenters.push_back(center);
|
||||
branchResPointsWithCellCenters.push_back(branchResPoints[cIdx]);
|
||||
}
|
||||
}
|
||||
|
||||
branchClPointsWithCellCenters.push_back(branchClPoints[branchResPoints.size()]);
|
||||
|
||||
pipeBranchesCellIds[brIdx] = branchResPointsWithCellCenters;
|
||||
pipeBranchesCLCoords[brIdx] = branchClPointsWithCellCenters;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@@ -36,6 +36,7 @@ public:
|
||||
const RigEclipseCaseData* eclipseCaseData,
|
||||
bool isMultiSegmentWell,
|
||||
bool isAutoDetectBranches,
|
||||
bool useAllCellCenters,
|
||||
std::vector<std::vector<cvf::Vec3d>> & pipeBranchesCLCoords,
|
||||
std::vector<std::vector<RigWellResultPoint>> & pipeBranchesCellIds);
|
||||
|
||||
@@ -44,5 +45,7 @@ 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 ) ;
|
||||
|
||||
static void addCellCenterPoints(const RigEclipseCaseData* eclipseCaseData, std::vector<std::vector<cvf::Vec3d>> &pipeBranchesCLCoords, std::vector<std::vector<RigWellResultPoint>> &pipeBranchesCellIds);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user