#6526 Fracture Model: Make TVD/MD values consistent in Deviation.FRK

The change in measured depth (MD) must be greater or equal to change in
true vertical depth (TVD), and this was not always the case due to
interpolation imprecision.
This commit is contained in:
Kristian Bendiksen 2020-09-18 12:08:58 +02:00
parent 752f0f5100
commit f496e62123
4 changed files with 77 additions and 4 deletions

View File

@ -61,11 +61,15 @@ bool RifFractureModelDeviationFrkExporter::writeToFile( RimFractureModelPlot* pl
std::vector<double> mdValues; std::vector<double> mdValues;
RigWellPathGeometryExporter::exportWellPathGeometry( wellPath, mdStepSize, xValues, yValues, tvdValues, mdValues, useMdRkb ); RigWellPathGeometryExporter::exportWellPathGeometry( wellPath, mdStepSize, xValues, yValues, tvdValues, mdValues, useMdRkb );
convertFromMeterToFeet( mdValues ); std::vector<double> exportTvdValues;
convertFromMeterToFeet( tvdValues ); std::vector<double> exportMdValues;
fixupDepthValuesForExport( tvdValues, mdValues, exportTvdValues, exportMdValues );
appendToStream( stream, "mdArray", mdValues ); convertFromMeterToFeet( exportMdValues );
appendToStream( stream, "tvdArray", tvdValues ); convertFromMeterToFeet( exportTvdValues );
appendToStream( stream, "mdArray", exportMdValues );
appendToStream( stream, "tvdArray", exportTvdValues );
appendFooterToStream( stream ); appendFooterToStream( stream );
@ -124,3 +128,37 @@ void RifFractureModelDeviationFrkExporter::convertFromMeterToFeet( std::vector<d
data[i] = RiaEclipseUnitTools::meterToFeet( data[i] ); data[i] = RiaEclipseUnitTools::meterToFeet( data[i] );
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifFractureModelDeviationFrkExporter::fixupDepthValuesForExport( const std::vector<double>& tvdValues,
const std::vector<double>& mdValues,
std::vector<double>& exportTvdValues,
std::vector<double>& exportMdValues )
{
if ( tvdValues.empty() || mdValues.empty() ) return;
exportMdValues.push_back( mdValues[0] );
exportTvdValues.push_back( tvdValues[0] );
for ( size_t i = 1; i < tvdValues.size(); i++ )
{
double changeMd = mdValues[i] - exportMdValues[i - 1];
double changeTvd = tvdValues[i] - exportTvdValues[i - 1];
// Stimplan checks that the change in MD is larger than or equal to change in TVD.
// This condition is not always satisfied due to the interpolation of TVDs.
// Move the MD value to produce a file which can be imported.
if ( changeMd < changeTvd )
{
exportMdValues.push_back( exportMdValues[i - 1] + changeTvd );
}
else
{
exportMdValues.push_back( mdValues[i] );
}
exportTvdValues.push_back( tvdValues[i] );
}
}

View File

@ -32,6 +32,11 @@ class RifFractureModelDeviationFrkExporter
public: public:
static bool writeToFile( RimFractureModelPlot* plot, const QString& filepath ); static bool writeToFile( RimFractureModelPlot* plot, const QString& filepath );
static void fixupDepthValuesForExport( const std::vector<double>& tvdValues,
const std::vector<double>& mdValues,
std::vector<double>& exportTvdValues,
std::vector<double>& exportMdValues );
private: private:
static void appendHeaderToStream( QTextStream& stream ); static void appendHeaderToStream( QTextStream& stream );
static void appendToStream( QTextStream& stream, const QString& label, const std::vector<double>& values ); static void appendToStream( QTextStream& stream, const QString& label, const std::vector<double>& values );

View File

@ -73,6 +73,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RifElasticPropertiesReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStatisticsTools-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaStatisticsTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanXmlReader-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RifStimPlanXmlReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryExporter-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryExporter-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifFractureModelDeviationFrkExporter-Test.cpp
) )
if (RESINSIGHT_ENABLE_GRPC) if (RESINSIGHT_ENABLE_GRPC)

View File

@ -0,0 +1,29 @@
#include "gtest/gtest.h"
#include "RifFractureModelDeviationFrkExporter.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifFractureModelDeviationFrkExporterTest, TvdFixup )
{
std::vector<double> tvd =
{475.722, 492.126, 508.53, 524.934, 541.338, 557.743, 574.147, 590.551, 606.955, 623.359, 639.764, 656.168, 672.572};
std::vector<double> md =
{475.722, 492.126, 508.53, 524.934, 541.339, 557.743, 574.147, 590.551, 606.955, 623.36, 639.764, 656.168, 672.572};
std::vector<double> exportTvd;
std::vector<double> exportMd;
RifFractureModelDeviationFrkExporter::fixupDepthValuesForExport( tvd, md, exportTvd, exportMd );
EXPECT_EQ( tvd.size(), exportTvd.size() );
EXPECT_EQ( md.size(), exportMd.size() );
for ( size_t i = 1; i < exportMd.size(); i++ )
{
double changeMd = exportMd[i] - exportMd[i - 1];
double changeTvd = exportTvd[i] - exportTvd[i - 1];
ASSERT_GE( changeMd, changeTvd );
}
}