mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Scale length threshold based on average DZ
This commit is contained in:
parent
1a9fb26153
commit
30c3fe3a5c
@ -21,6 +21,7 @@
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigResultAccessor.h"
|
||||
@ -57,6 +58,8 @@ void RigEclipseWellLogExtractor::calculateIntersection()
|
||||
|
||||
if ( m_wellPathGeometry->wellPathPoints().empty() ) return;
|
||||
|
||||
double tolerance = computeLengthThreshold();
|
||||
|
||||
for ( size_t wpp = 0; wpp < m_wellPathGeometry->wellPathPoints().size() - 1; ++wpp )
|
||||
{
|
||||
std::vector<HexIntersectionInfo> intersections;
|
||||
@ -99,7 +102,7 @@ void RigEclipseWellLogExtractor::calculateIntersection()
|
||||
double md1 = m_wellPathGeometry->measuredDepths()[wpp];
|
||||
double md2 = m_wellPathGeometry->measuredDepths()[wpp + 1];
|
||||
|
||||
insertIntersectionsInMap( intersections, p1, md1, p2, md2, &uniqueIntersections );
|
||||
insertIntersectionsInMap( intersections, p1, md1, p2, md2, tolerance, &uniqueIntersections );
|
||||
}
|
||||
|
||||
if ( uniqueIntersections.empty() && m_wellPathGeometry->wellPathPoints().size() > 1 )
|
||||
@ -139,7 +142,8 @@ void RigEclipseWellLogExtractor::calculateIntersection()
|
||||
globalCellIndex );
|
||||
RigMDCellIdxEnterLeaveKey enterLeaveKey( m_wellPathGeometry->measuredDepths().front(),
|
||||
globalCellIndex,
|
||||
isEntering );
|
||||
isEntering,
|
||||
tolerance );
|
||||
|
||||
uniqueIntersections.insert( std::make_pair( enterLeaveKey, info ) );
|
||||
}
|
||||
@ -151,7 +155,8 @@ void RigEclipseWellLogExtractor::calculateIntersection()
|
||||
HexIntersectionInfo info( lastPoint, isEntering, cvf::StructGridInterface::NO_FACE, globalCellIndex );
|
||||
RigMDCellIdxEnterLeaveKey enterLeaveKey( m_wellPathGeometry->measuredDepths().back(),
|
||||
globalCellIndex,
|
||||
isEntering );
|
||||
isEntering,
|
||||
tolerance );
|
||||
|
||||
uniqueIntersections.insert( std::make_pair( enterLeaveKey, info ) );
|
||||
}
|
||||
@ -208,3 +213,31 @@ cvf::Vec3d RigEclipseWellLogExtractor::calculateLengthInCell( size_t
|
||||
|
||||
return RigWellPathIntersectionTools::calculateLengthInCell( hexCorners, startPoint, endPoint );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigEclipseWellLogExtractor::computeLengthThreshold() const
|
||||
{
|
||||
// Default length tolerance for most common grid sizes
|
||||
double tolerance = 0.1;
|
||||
|
||||
// For grids with very thin z-layers, reduce the tolerance to be able to find the intersections
|
||||
// If not, the intersection will be considered as non-valid cell edge intersection and discarded
|
||||
// https://github.com/OPM/ResInsight/issues/9244
|
||||
|
||||
auto gridCellResult =
|
||||
const_cast<RigCaseCellResultsData*>( m_caseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL ) );
|
||||
|
||||
auto resultAdr = RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "DZ" );
|
||||
if ( gridCellResult && gridCellResult->hasResultEntry( resultAdr ) )
|
||||
{
|
||||
double averageDZ = 0.1;
|
||||
gridCellResult->meanCellScalarValues( resultAdr, averageDZ );
|
||||
|
||||
const double scaleFactor = 0.05;
|
||||
tolerance = std::min( tolerance, averageDZ * scaleFactor );
|
||||
}
|
||||
|
||||
return tolerance;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class RigEclipseWellLogExtractor : public RigWellLogExtractor
|
||||
public:
|
||||
RigEclipseWellLogExtractor( gsl::not_null<const RigEclipseCaseData*> aCase,
|
||||
gsl::not_null<const RigWellPath*> wellpath,
|
||||
const std::string& wellCaseErrorMsgName );
|
||||
const std::string& wellCaseErrorMsgName );
|
||||
|
||||
void curveData( const RigResultAccessor* resultAccessor, std::vector<double>* values );
|
||||
const RigEclipseCaseData* caseData() { return m_caseData.p(); }
|
||||
@ -49,5 +49,8 @@ private:
|
||||
cvf::Vec3d
|
||||
calculateLengthInCell( size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint ) const override;
|
||||
|
||||
double computeLengthThreshold() const;
|
||||
|
||||
private:
|
||||
cvf::cref<RigEclipseCaseData> m_caseData;
|
||||
};
|
||||
|
@ -1025,7 +1025,8 @@ void RigGeoMechWellLogExtractor::calculateIntersection()
|
||||
double md1 = m_wellPathGeometry->measuredDepths()[wpp];
|
||||
double md2 = m_wellPathGeometry->measuredDepths()[wpp + 1];
|
||||
|
||||
insertIntersectionsInMap( intersections, p1, md1, p2, md2, &uniqueIntersections );
|
||||
const double tolerance = 0.1;
|
||||
insertIntersectionsInMap( intersections, p1, md1, p2, md2, tolerance, &uniqueIntersections );
|
||||
}
|
||||
|
||||
this->populateReturnArrays( uniqueIntersections );
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
struct RigWellLogExtractionTools
|
||||
{
|
||||
static bool isEqualDepth( double d1, double d2, const double tolerance = 0.1 )
|
||||
static bool isEqualDepth( double d1, double d2, const double tolerance )
|
||||
{
|
||||
double depthDiff = d1 - d2;
|
||||
|
||||
@ -46,10 +46,11 @@ struct RigWellLogExtractionTools
|
||||
|
||||
struct RigMDCellIdxEnterLeaveKey
|
||||
{
|
||||
RigMDCellIdxEnterLeaveKey( double md, size_t cellIdx, bool entering )
|
||||
RigMDCellIdxEnterLeaveKey( double md, size_t cellIdx, bool entering, double tolerance )
|
||||
: measuredDepth( md )
|
||||
, hexIndex( cellIdx )
|
||||
, isEnteringCell( entering )
|
||||
, tolerance( tolerance )
|
||||
{
|
||||
}
|
||||
|
||||
@ -57,10 +58,11 @@ struct RigMDCellIdxEnterLeaveKey
|
||||
size_t hexIndex;
|
||||
bool isEnteringCell; // As opposed to leaving.
|
||||
bool isLeavingCell() const { return !isEnteringCell; }
|
||||
double tolerance;
|
||||
|
||||
bool operator<( const RigMDCellIdxEnterLeaveKey& other ) const
|
||||
{
|
||||
if ( RigWellLogExtractionTools::isEqualDepth( measuredDepth, other.measuredDepth ) )
|
||||
if ( RigWellLogExtractionTools::isEqualDepth( measuredDepth, other.measuredDepth, tolerance ) )
|
||||
{
|
||||
if ( hexIndex == other.hexIndex )
|
||||
{
|
||||
@ -90,10 +92,11 @@ struct RigMDCellIdxEnterLeaveKey
|
||||
|
||||
struct RigMDEnterLeaveCellIdxKey
|
||||
{
|
||||
RigMDEnterLeaveCellIdxKey( double md, bool entering, size_t cellIdx )
|
||||
RigMDEnterLeaveCellIdxKey( double md, bool entering, size_t cellIdx, double tolerance )
|
||||
: measuredDepth( md )
|
||||
, isEnteringCell( entering )
|
||||
, hexIndex( cellIdx )
|
||||
, tolerance( tolerance )
|
||||
{
|
||||
}
|
||||
|
||||
@ -101,10 +104,11 @@ struct RigMDEnterLeaveCellIdxKey
|
||||
bool isEnteringCell; // As opposed to leaving.
|
||||
bool isLeavingCell() const { return !isEnteringCell; }
|
||||
size_t hexIndex;
|
||||
double tolerance;
|
||||
|
||||
bool operator<( const RigMDEnterLeaveCellIdxKey& other ) const
|
||||
{
|
||||
if ( RigWellLogExtractionTools::isEqualDepth( measuredDepth, other.measuredDepth ) )
|
||||
if ( RigWellLogExtractionTools::isEqualDepth( measuredDepth, other.measuredDepth, tolerance ) )
|
||||
{
|
||||
if ( isEnteringCell == other.isEnteringCell )
|
||||
{
|
||||
@ -128,6 +132,6 @@ struct RigMDEnterLeaveCellIdxKey
|
||||
static bool isProperCellEnterLeavePair( const RigMDEnterLeaveCellIdxKey& key1, const RigMDEnterLeaveCellIdxKey& key2 )
|
||||
{
|
||||
return ( key1.hexIndex == key2.hexIndex && key1.isEnteringCell && key2.isLeavingCell() &&
|
||||
!RigWellLogExtractionTools::isEqualDepth( key1.measuredDepth, key2.measuredDepth ) );
|
||||
!RigWellLogExtractionTools::isEqualDepth( key1.measuredDepth, key2.measuredDepth, key1.tolerance ) );
|
||||
}
|
||||
};
|
||||
|
@ -111,6 +111,7 @@ void RigWellLogExtractor::insertIntersectionsInMap( const std::vector<HexInterse
|
||||
double md1,
|
||||
cvf::Vec3d p2,
|
||||
double md2,
|
||||
double tolerance,
|
||||
std::map<RigMDCellIdxEnterLeaveKey, HexIntersectionInfo>* uniqueIntersections )
|
||||
{
|
||||
for ( size_t intIdx = 0; intIdx < intersections.size(); ++intIdx )
|
||||
@ -130,11 +131,11 @@ void RigWellLogExtractor::insertIntersectionsInMap( const std::vector<HexInterse
|
||||
measuredDepthOfPoint = md1;
|
||||
}
|
||||
|
||||
uniqueIntersections->insert(
|
||||
std::make_pair( RigMDCellIdxEnterLeaveKey( measuredDepthOfPoint,
|
||||
intersections[intIdx].m_hexIndex,
|
||||
intersections[intIdx].m_isIntersectionEntering ),
|
||||
intersections[intIdx] ) );
|
||||
uniqueIntersections->insert( std::make_pair( RigMDCellIdxEnterLeaveKey( measuredDepthOfPoint,
|
||||
intersections[intIdx].m_hexIndex,
|
||||
intersections[intIdx].m_isIntersectionEntering,
|
||||
tolerance ),
|
||||
intersections[intIdx] ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,7 +157,9 @@ void RigWellLogExtractor::populateReturnArrays( std::map<RigMDCellIdxEnterLeaveK
|
||||
++it2;
|
||||
if ( it2 != uniqueIntersections.end() )
|
||||
{
|
||||
if ( RigWellLogExtractionTools::isEqualDepth( it1->first.measuredDepth, it2->first.measuredDepth ) )
|
||||
if ( RigWellLogExtractionTools::isEqualDepth( it1->first.measuredDepth,
|
||||
it2->first.measuredDepth,
|
||||
it1->first.tolerance ) )
|
||||
{
|
||||
if ( it1->first.hexIndex == it2->first.hexIndex )
|
||||
{
|
||||
@ -187,7 +190,8 @@ void RigWellLogExtractor::populateReturnArrays( std::map<RigMDCellIdxEnterLeaveK
|
||||
{
|
||||
sortedUniqueIntersections.insert( std::make_pair( RigMDEnterLeaveCellIdxKey( it->first.measuredDepth,
|
||||
it->first.isEnteringCell,
|
||||
it->first.hexIndex ),
|
||||
it->first.hexIndex,
|
||||
it->first.tolerance ),
|
||||
it->second ) );
|
||||
++it;
|
||||
}
|
||||
@ -210,7 +214,8 @@ void RigWellLogExtractor::populateReturnArrays( std::map<RigMDCellIdxEnterLeaveK
|
||||
sortedUniqueIntersections.insert(
|
||||
std::make_pair( RigMDEnterLeaveCellIdxKey( m_wellPathGeometry->measuredDepths()[0],
|
||||
true,
|
||||
firstLeavingPoint.m_hexIndex ),
|
||||
firstLeavingPoint.m_hexIndex,
|
||||
it->first.tolerance ),
|
||||
firstLeavingPoint ) );
|
||||
}
|
||||
|
||||
@ -230,7 +235,8 @@ void RigWellLogExtractor::populateReturnArrays( std::map<RigMDCellIdxEnterLeaveK
|
||||
sortedUniqueIntersections.insert(
|
||||
std::make_pair( RigMDEnterLeaveCellIdxKey( m_wellPathGeometry->measuredDepths().back(),
|
||||
false,
|
||||
lastEnterPoint.m_hexIndex ),
|
||||
lastEnterPoint.m_hexIndex,
|
||||
rit->first.tolerance ),
|
||||
lastEnterPoint ) );
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ protected:
|
||||
double md1,
|
||||
cvf::Vec3d p2,
|
||||
double md2,
|
||||
double tolerance,
|
||||
std::map<RigMDCellIdxEnterLeaveKey, HexIntersectionInfo>* uniqueIntersections );
|
||||
|
||||
void populateReturnArrays( std::map<RigMDCellIdxEnterLeaveKey, HexIntersectionInfo>& uniqueIntersections );
|
||||
|
Loading…
Reference in New Issue
Block a user