Fix invalid MD interpolation for wells starting at zero depth.

The interpolation procedure adds a point at zero depth. If the well already
had a starting point there the interpolation would set all MD values to zero.
Fixed by adding the zero point only when necessary.
This commit is contained in:
Kristian Bendiksen 2020-09-07 14:04:43 +02:00 committed by Magne Sjaastad
parent 85ba3a3bc9
commit b0448043f3
2 changed files with 17 additions and 1 deletions

View File

@ -322,9 +322,10 @@ QwtSpline RigWellPathGeometryTools::createSpline( const std::vector<double>& ori
QwtSplineCurveFitter curveFitter;
QPolygonF splinePoints = curveFitter.fitCurve( polygon );
// Extend spline from 0.0 to a large value for MD
// Extend spline from 0.0 (if it does not already exist) to a large value for MD
// This is to force a specific and known extrapolation.
// Otherwise we get an undefined and unknown extrapolation.
if ( !( splinePoints[0].x() == 0.0 && splinePoints[0].y() == 0.0 ) )
{
double x1 = splinePoints[0].x();
double x2 = splinePoints[1].x();

View File

@ -59,6 +59,21 @@ TEST( RigWellPathGeometryTools, LinearPath )
}
}
TEST( RigWellPathGeometryTools, LinearPathStartingAtZero )
{
std::vector<double> mdValues = {0, 100, 500, 1000};
std::vector<double> tvdValues = {0, 50, 250, 500};
std::vector<double> fullTVDValues = {0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500};
std::vector<double> fullMDValues = RigWellPathGeometryTools::interpolateMdFromTvd( mdValues, tvdValues, fullTVDValues );
EXPECT_EQ( fullTVDValues.size(), fullMDValues.size() );
for ( size_t i = 0; i < fullTVDValues.size(); ++i )
{
EXPECT_NEAR( 2.0 * fullTVDValues[i], fullMDValues[i], TOLERANCE );
}
}
double quadraticFunction( double x )
{
return 0.0015 * std::pow( x, 2 ) - 0.25 * x + 100;