#1114 WIP: Moved pipe radius, and well head position calculations to RimEclipseWell as preparation for well pair lines.

This commit is contained in:
Jacob Støren 2017-03-14 19:17:14 +01:00
parent ef32c8bdc5
commit d4c14d0f53
4 changed files with 103 additions and 60 deletions

View File

@ -84,9 +84,7 @@ void RivSimWellPipesPartMgr::buildWellPipeParts()
m_rimWell->calculateWellPipeStaticCenterLine(m_pipeBranchesCLCoords, pipeBranchesCellIds);
double characteristicCellSize = m_rimReservoirView->mainGrid()->characteristicIJCellSize();
double pipeRadius = m_rimReservoirView->wellCollection()->pipeScaleFactor() * m_rimWell->pipeScaleFactor() * characteristicCellSize;
double pipeRadius = m_rimWell->pipeRadius();
for (size_t brIdx = 0; brIdx < pipeBranchesCellIds.size(); ++brIdx)
{

View File

@ -49,6 +49,7 @@
#include "cvfPart.h"
#include "cvfTransform.h"
#include "cvfqtUtils.h"
#include "cafDisplayCoordTransform.h"
@ -77,71 +78,32 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
clearAllGeometry();
if (m_rimReservoirView.isNull()) return;
RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->reservoirData();
RimEclipseWell* well = m_rimWell;
RigSingleWellResultsData* wellResults = well->wellResults();
if (wellResults->staticWellCells().m_wellResultBranches.size() == 0) return;
if (!wellResults->hasWellResult(frameIndex)) return;
const RigWellResultFrame& wellResultFrame = wellResults->wellResultFrame(frameIndex);
const RigCell& whCell = rigReservoir->cellFromWellResultCell(wellResultFrame.m_wellHead);
double characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize();
// Match this position with pipe start position in RivWellPipesPartMgr::calculateWellPipeCenterline()
cvf::Vec3d whStartPos = whCell.faceCenter(cvf::StructGridInterface::NEG_K);
whStartPos -= rigReservoir->mainGrid()->displayModelOffset();
whStartPos.transformPoint(m_scaleTransform->worldTransform());
// Compute well head based on the z position of the top of the K column the well head is part of
cvf::Vec3d whEndPos = whStartPos;
if (m_rimReservoirView->wellCollection()->wellHeadPosition() == RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN)
cvf::Vec3d whEndPos;
cvf::Vec3d whStartPos;
{
// Position well head at top active cell of IJ-column
well->wellHeadTopBottomPosition(frameIndex, &whEndPos, &whStartPos);
size_t i, j, k;
rigReservoir->mainGrid()->ijkFromCellIndex(whCell.mainGridCellIndex(), &i, &j, &k);
size_t kIndexWellHeadCell = k;
k = 0;
size_t topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
while(k < kIndexWellHeadCell && !m_rimReservoirView->currentActiveCellInfo()->isActive(topActiveCellIndex))
{
k++;
topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
}
const RigCell& topActiveCell = rigReservoir->mainGrid()->cell(topActiveCellIndex);
cvf::Vec3d topCellPos = topActiveCell.faceCenter(cvf::StructGridInterface::NEG_K);
topCellPos -= rigReservoir->mainGrid()->displayModelOffset();
topCellPos.transformPoint(m_scaleTransform->worldTransform());
// Modify position if top active cell is closer to sea than well head
if (kIndexWellHeadCell > k)
{
whEndPos.z() = topCellPos.z() + characteristicCellSize;
}
}
else
{
// Position well head at top of active cells bounding box
cvf::Vec3d activeCellsBoundingBoxMax = m_rimReservoirView->currentActiveCellInfo()->geometryBoundingBox().max();
activeCellsBoundingBoxMax -= rigReservoir->mainGrid()->displayModelOffset();
activeCellsBoundingBoxMax.transformPoint(m_scaleTransform->worldTransform());
whEndPos.z() = activeCellsBoundingBoxMax.z();
cvf::ref<caf::DisplayCoordTransform> transForm = m_rimReservoirView->displayCoordTransform();
whEndPos = transForm->transformToDisplayCoord(whEndPos);
whStartPos = transForm->transformToDisplayCoord(whStartPos);
whEndPos.z() += characteristicCellSize;
}
double pipeRadius = m_rimReservoirView->wellCollection()->pipeScaleFactor() * m_rimWell->pipeScaleFactor() * characteristicCellSize;
if (!well->wellResults()->hasWellResult(frameIndex)) return;
const RigWellResultFrame& wellResultFrame = well->wellResults()->wellResultFrame(frameIndex);
double pipeRadius = m_rimWell->pipeRadius();
if (wellResultFrame.m_isOpen)
{
// Use slightly larger well head arrow when well is open
@ -331,7 +293,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
drawableText->setVerticalAlignment(cvf::TextDrawer::CENTER);
drawableText->setTextColor(m_rimReservoirView->wellCollection()->wellLabelColor());
cvf::String cvfString = cvfqt::Utils::toString(well->name());
cvf::String cvfString = cvfqt::Utils::toString(m_rimWell->name());
cvf::Vec3f textCoord(textPosition);
drawableText->addText(cvfString, textCoord);

View File

@ -33,6 +33,11 @@
#include "RivReservoirViewPartMgr.h"
#include "cvfMath.h"
#include "RigCell.h"
#include "RimEclipseCase.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigActiveCellInfo.h"
CAF_PDM_SOURCE_INIT(RimEclipseWell, "Well");
@ -155,6 +160,82 @@ void RimEclipseWell::calculateWellPipeDynamicCenterLine(size_t timeStepIdx,
RigSimulationWellCenterLineCalculator::calculateWellPipeDynamicCenterline(this, timeStepIdx, pipeBranchesCLCoords, pipeBranchesCellIds);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseWell::wellHeadTopBottomPosition(size_t frameIndex, cvf::Vec3d* top, cvf::Vec3d* bottom)
{
RimEclipseView* m_rimReservoirView;
firstAncestorOrThisOfTypeAsserted(m_rimReservoirView);
RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->reservoirData();
if (!this->wellResults()->hasWellResult(frameIndex)) return;
const RigWellResultFrame& wellResultFrame = this->wellResults()->wellResultFrame(frameIndex);
const RigCell& whCell = rigReservoir->cellFromWellResultCell(wellResultFrame.m_wellHead);
double characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize();
// Match this position with pipe start position in RivWellPipesPartMgr::calculateWellPipeCenterline()
(*bottom) = whCell.faceCenter(cvf::StructGridInterface::NEG_K);
// Compute well head based on the z position of the top of the K column the well head is part of
(*top) = (*bottom);
if ( m_rimReservoirView->wellCollection()->wellHeadPosition() == RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN )
{
// Position well head at top active cell of IJ-column
size_t i, j, k;
rigReservoir->mainGrid()->ijkFromCellIndex(whCell.mainGridCellIndex(), &i, &j, &k);
size_t kIndexWellHeadCell = k;
k = 0;
size_t topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
while ( k < kIndexWellHeadCell && !m_rimReservoirView->currentActiveCellInfo()->isActive(topActiveCellIndex) )
{
k++;
topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
}
const RigCell& topActiveCell = rigReservoir->mainGrid()->cell(topActiveCellIndex);
cvf::Vec3d topCellPos = topActiveCell.faceCenter(cvf::StructGridInterface::NEG_K);
// Modify position if top active cell is closer to sea than well head
if ( kIndexWellHeadCell > k )
{
top->z() = topCellPos.z();
}
}
else
{
// Position well head at top of active cells bounding box
cvf::Vec3d activeCellsBoundingBoxMax = m_rimReservoirView->currentActiveCellInfo()->geometryBoundingBox().max();
top->z() = activeCellsBoundingBoxMax.z();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimEclipseWell::pipeRadius()
{
RimEclipseView* reservoirView;
firstAncestorOrThisOfTypeAsserted(reservoirView);
RigEclipseCaseData* rigReservoir = reservoirView->eclipseCase()->reservoirData();
double characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize();
double pipeRadius = reservoirView->wellCollection()->pipeScaleFactor() * this->pipeScaleFactor() * characteristicCellSize;
return pipeRadius;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -69,6 +69,8 @@ public:
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds);
void wellHeadTopBottomPosition(size_t frameIndex, cvf::Vec3d* top, cvf::Vec3d* bottom);
double pipeRadius();
caf::PdmField<bool> showWell;
caf::PdmField<QString> name;