Fix problem in RigWellPathGeometry::interpolateMdFromTvd starting at 0.0 MD.

The spline has to be extended to 0.0 regardless of the value of TVD.
This commit is contained in:
Kristian Bendiksen 2021-02-15 15:44:01 +01:00
parent 3e43ca2b65
commit e7d7a40251
2 changed files with 17 additions and 1 deletions

View File

@ -325,7 +325,7 @@ QwtSpline RigWellPathGeometryTools::createSpline( const std::vector<double>& ori
// 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 ) )
if ( !( splinePoints[0].x() == 0.0 ) )
{
double x1 = splinePoints[0].x();
double x2 = splinePoints[1].x();

View File

@ -74,6 +74,22 @@ TEST( RigWellPathGeometryTools, LinearPathStartingAtZero )
}
}
TEST( RigWellPathGeometryTools, ShortLinearPathStartingAtZero )
{
std::vector<double> mdValues = { 0, 1000.0 };
std::vector<double> tvdValues = { 2000.0, 4000 };
std::vector<double> fullTVDValues = { 0, 2000.0, 3000, 4000.0 };
std::vector<double> expectedMDValues = { 0.0, 0.0, 500, 1000.0 };
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( expectedMDValues[i], fullMDValues[i], TOLERANCE );
}
}
double quadraticFunction( double x )
{
return 0.0015 * std::pow( x, 2 ) - 0.25 * x + 100;