#6072 Well Completions : Make sure valves are included if they are located outside grid cells

This commit is contained in:
Magne Sjaastad 2020-06-15 15:36:27 +02:00
parent 49d74a4bbb
commit 9d0ec6727c
3 changed files with 99 additions and 6 deletions

View File

@ -1110,9 +1110,13 @@ std::vector<SubSegmentIntersectionInfo>
const std::vector<double>& mds = wellPathGeometry->measureDepths();
CVF_ASSERT( !coords.empty() && !mds.empty() );
std::vector<WellPathCellIntersectionInfo> intersections =
std::vector<WellPathCellIntersectionInfo> intersectionsA =
RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath( eclipseCase->eclipseCaseData(), coords, mds );
const RigMainGrid* mainGrid = eclipseCase->mainGrid();
std::vector<WellPathCellIntersectionInfo> intersections =
RigWellPathIntersectionTools::buildContinuousIntersections( intersectionsA, mainGrid );
if ( wellPath->perforationIntervalCollection()->mswParameters()->referenceMDType() ==
RimMswCompletionParameters::MANUAL_REFERENCE_MD )
{
@ -1221,11 +1225,19 @@ std::vector<WellPathCellIntersectionInfo>
const RigMainGrid* grid = eclipseCase->mainGrid();
extraIntersection.intersectionLengthsInCellCS =
RigWellPathIntersectionTools::calculateLengthInCell( grid,
intersection.globCellIndex,
intersectionPoint,
intersection.endPoint );
if ( intersection.globCellIndex < grid->cellCount() )
{
extraIntersection.intersectionLengthsInCellCS =
RigWellPathIntersectionTools::calculateLengthInCell( grid,
intersection.globCellIndex,
intersectionPoint,
intersection.endPoint );
}
else
{
extraIntersection.intersectionLengthsInCellCS = cvf::Vec3d::ZERO;
}
filteredIntersections.push_back( extraIntersection );
}
}

View File

@ -150,3 +150,74 @@ cvf::Vec3d RigWellPathIntersectionTools::calculateLengthInCell( const RigMainGri
return calculateLengthInCell( hexCorners, startPoint, endPoint );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::buildContinuousIntersections(
const std::vector<WellPathCellIntersectionInfo>& originalIntersections,
const cvf::StructGridInterface* grid )
{
std::vector<WellPathCellIntersectionInfo> intersectionsNoGap;
for ( size_t i = 0; i < originalIntersections.size() - 1; i++ )
{
const WellPathCellIntersectionInfo& current = originalIntersections[i];
const WellPathCellIntersectionInfo& next = originalIntersections[i + 1];
double distance = std::fabs( current.endMD - next.startMD );
double gapInGridThreshold = 0.1;
if ( distance > gapInGridThreshold )
{
WellPathCellIntersectionInfo extraIntersection;
QString ijkTextCurrent;
{
size_t i = 0, j = 0, k = 0;
if ( grid )
{
grid->ijkFromCellIndex( current.globCellIndex, &i, &j, &k );
}
ijkTextCurrent = QString( "(%1 %2 %3)" ).arg( i + 1 ).arg( j + 1 ).arg( k + 1 );
}
QString ijkTextNext;
{
size_t i = 0, j = 0, k = 0;
if ( grid )
{
grid->ijkFromCellIndex( next.globCellIndex, &i, &j, &k );
}
ijkTextNext = QString( "(%1 %2 %3)" ).arg( i + 1 ).arg( j + 1 ).arg( k + 1 );
}
QString text = QString( "Gap detected : Distance diff : %1, epsilon = %2\n Global Cell Index 1 : %3, "
"IJK=%4, endMD : %5\n Global Cell Index 2 : %6, IJK=%7, startMD : %8" )
.arg( distance )
.arg( gapInGridThreshold )
.arg( current.globCellIndex )
.arg( ijkTextCurrent )
.arg( current.endMD )
.arg( next.globCellIndex )
.arg( ijkTextNext )
.arg( next.startMD );
RiaLogging::info( text );
extraIntersection.globCellIndex = std::numeric_limits<size_t>::max();
extraIntersection.startPoint = current.endPoint;
extraIntersection.endPoint = next.startPoint;
extraIntersection.startMD = current.endMD;
extraIntersection.endMD = next.startMD;
extraIntersection.intersectedCellFaceIn =
cvf::StructGridInterface::oppositeFace( current.intersectedCellFaceOut );
extraIntersection.intersectedCellFaceOut = cvf::StructGridInterface::oppositeFace( next.intersectedCellFaceIn );
extraIntersection.intersectionLengthsInCellCS = cvf::Vec3d::ZERO;
intersectionsNoGap.push_back( extraIntersection );
}
intersectionsNoGap.push_back( current );
}
return intersectionsNoGap;
}

View File

@ -29,6 +29,11 @@ class RigEclipseCaseData;
struct HexIntersectionInfo;
struct WellPathCellIntersectionInfo;
namespace cvf
{
class StructGridInterface;
};
//==================================================================================================
///
//==================================================================================================
@ -55,4 +60,9 @@ public:
size_t cellIndex,
const cvf::Vec3d& startPoint,
const cvf::Vec3d& endPoint );
// Insert dummy intersections used to represent gap in grid
static std::vector<WellPathCellIntersectionInfo>
buildContinuousIntersections( const std::vector<WellPathCellIntersectionInfo>& originalIntersections,
const cvf::StructGridInterface* grid );
};