mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2608 Guard input and and validate output of SolveSpace SCurve calculator.
Now fallback is used in most cases where needed
This commit is contained in:
parent
752510fab2
commit
840f011346
@ -59,13 +59,20 @@ RiaSCurveCalculator::RiaSCurveCalculator(cvf::Vec3d p1, double azi1, double inc1
|
|||||||
|
|
||||||
if (true)
|
if (true)
|
||||||
{
|
{
|
||||||
double p1p2Length = (p2-p1).length();
|
cvf::Vec3d p1p2 = p2 - p1;
|
||||||
|
|
||||||
|
double p1p2Length = (p1p2).length();
|
||||||
RiaSCurveCalculator estimatedCurveCalc = RiaSCurveCalculator::fromTangentsAndLength(p1, azi1, inc1, 0.2 * p1p2Length,
|
RiaSCurveCalculator estimatedCurveCalc = RiaSCurveCalculator::fromTangentsAndLength(p1, azi1, inc1, 0.2 * p1p2Length,
|
||||||
p2, azi2, inc2, 0.2 * p1p2Length);
|
p2, azi2, inc2, 0.2 * p1p2Length);
|
||||||
|
|
||||||
est_rad1 = estimatedCurveCalc.firstRadius() ;
|
est_rad1 = estimatedCurveCalc.firstRadius() ;
|
||||||
est_rad2 = estimatedCurveCalc.secondRadius();
|
est_rad2 = estimatedCurveCalc.secondRadius();
|
||||||
|
|
||||||
|
if (est_rad1 >= 1e10 || est_rad2 >= 1e10)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
std::cout << "Estimate:" << std::endl;
|
std::cout << "Estimate:" << std::endl;
|
||||||
estimatedCurveCalc.dump();
|
estimatedCurveCalc.dump();
|
||||||
@ -542,6 +549,22 @@ RiaSCurveCalculator::RiaSCurveCalculator(cvf::Vec3d p1, double azi1, double inc1
|
|||||||
|
|
||||||
m_r1 = (m_c1 - m_p1).length();
|
m_r1 = (m_c1 - m_p1).length();
|
||||||
m_r2 = (m_c2 - m_p2).length();
|
m_r2 = (m_c2 - m_p2).length();
|
||||||
|
|
||||||
|
// Validate solution
|
||||||
|
// Normal1 x C1P11 == tP11P22
|
||||||
|
// Normal2 x C2P22 == tP11P22
|
||||||
|
|
||||||
|
cvf::Vec3d tP11P22 = (m_secondArcStartpoint - m_firstArcEndpoint).getNormalized();
|
||||||
|
|
||||||
|
double error1 = ((m_n1 ^ (m_firstArcEndpoint - m_c1).getNormalized() ) - tP11P22).lengthSquared();
|
||||||
|
double error2 = ((m_n2 ^ (m_secondArcStartpoint - m_c2).getNormalized() ) - tP11P22).lengthSquared();
|
||||||
|
|
||||||
|
if ( error1 > 1e-9 && error2 > 1e-9 )
|
||||||
|
{
|
||||||
|
// Solution is invalid. The line is not continuing the arcs in the right direction
|
||||||
|
m_isCalculationOK = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -258,7 +258,6 @@ std::vector<cvf::Vec3d> RimWellPathGeometryDef::lineArcEndpoints() const
|
|||||||
|
|
||||||
if (!sCurveCalc.isOk())
|
if (!sCurveCalc.isOk())
|
||||||
{
|
{
|
||||||
RiaLogging::warning("SCurve Calculation failed between target " + QString::number(tIdx+1) + " and " + QString::number(tIdx+2));
|
|
||||||
double p1p2Length = (target2->targetPointXYZ() - target1->targetPointXYZ()).length();
|
double p1p2Length = (target2->targetPointXYZ() - target1->targetPointXYZ()).length();
|
||||||
sCurveCalc = RiaSCurveCalculator::fromTangentsAndLength(target1->targetPointXYZ(),
|
sCurveCalc = RiaSCurveCalculator::fromTangentsAndLength(target1->targetPointXYZ(),
|
||||||
target1->azimuth(),
|
target1->azimuth(),
|
||||||
@ -268,6 +267,8 @@ std::vector<cvf::Vec3d> RimWellPathGeometryDef::lineArcEndpoints() const
|
|||||||
target2->azimuth(),
|
target2->azimuth(),
|
||||||
target2->inclination(),
|
target2->inclination(),
|
||||||
0.2*p1p2Length);
|
0.2*p1p2Length);
|
||||||
|
|
||||||
|
RiaLogging::warning("Using fall-back calculation of well path geometry between active target number: " + QString::number(tIdx+1) + " and " + QString::number(tIdx+2));
|
||||||
}
|
}
|
||||||
endPoints.push_back( sCurveCalc.firstArcEndpoint() + m_referencePoint() );
|
endPoints.push_back( sCurveCalc.firstArcEndpoint() + m_referencePoint() );
|
||||||
endPoints.push_back( sCurveCalc.secondArcStartpoint() + m_referencePoint() );
|
endPoints.push_back( sCurveCalc.secondArcStartpoint() + m_referencePoint() );
|
||||||
|
Loading…
Reference in New Issue
Block a user