Compute TVD when MD is extracted from well path

This commit is contained in:
Magne Sjaastad 2023-09-08 08:11:29 +02:00
parent 1edac5762d
commit 453fca7ba4
2 changed files with 17 additions and 18 deletions

View File

@ -20,7 +20,9 @@
#include "RiaExtractionTools.h" #include "RiaExtractionTools.h"
#include "RigEclipseWellLogExtractor.h"
#include "RigStatisticsMath.h" #include "RigStatisticsMath.h"
#include "RigWellPath.h"
#include "RimSummaryCase.h" #include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h" #include "RimSummaryCaseCollection.h"
@ -221,7 +223,6 @@ void RifReaderEnsembleStatisticsRft::calculateStatistics( const QString& wellNam
RifEclipseRftAddress mdAddress = RifEclipseRftAddress::createAddress( wellName, timeStep, ChannelType::MD ); RifEclipseRftAddress mdAddress = RifEclipseRftAddress::createAddress( wellName, timeStep, ChannelType::MD );
RiaCurveMerger<double> curveMerger; RiaCurveMerger<double> curveMerger;
RiaWeightedMeanCalculator<size_t> dataSetSizeCalc; RiaWeightedMeanCalculator<size_t> dataSetSizeCalc;
std::vector<double> tvdDepthsForFirstRftCase;
for ( RimSummaryCase* summaryCase : m_summaryCaseCollection->allSummaryCases() ) for ( RimSummaryCase* summaryCase : m_summaryCaseCollection->allSummaryCases() )
{ {
@ -231,11 +232,6 @@ void RifReaderEnsembleStatisticsRft::calculateStatistics( const QString& wellNam
std::vector<double> pressures; std::vector<double> pressures;
reader->values( pressAddress, &pressures ); reader->values( pressAddress, &pressures );
if ( tvdDepthsForFirstRftCase.empty() )
{
reader->values( tvdAddress, &tvdDepthsForFirstRftCase );
}
std::vector<double> measuredDepths = reader->computeMeasuredDepth( wellName, timeStep, extractor ); std::vector<double> measuredDepths = reader->computeMeasuredDepth( wellName, timeStep, extractor );
if ( !measuredDepths.empty() && !pressures.empty() ) if ( !measuredDepths.empty() && !pressures.empty() )
@ -245,15 +241,7 @@ void RifReaderEnsembleStatisticsRft::calculateStatistics( const QString& wellNam
} }
} }
extractStatisticsFromCurveMerger( wellName, timeStep, mdAddress, curveMerger, dataSetSizeCalc ); extractStatisticsFromCurveMerger( wellName, timeStep, mdAddress, curveMerger, dataSetSizeCalc, extractor->wellPathGeometry() );
if ( m_cachedValues[mdAddress].size() == tvdDepthsForFirstRftCase.size() )
{
// The number of RFT cells can vary between realizations in some cases. TVD depth is only given if the number of RFT cells is
// identical between realizations.
m_cachedValues[tvdAddress] = tvdDepthsForFirstRftCase;
}
} }
else else
{ {
@ -282,7 +270,7 @@ void RifReaderEnsembleStatisticsRft::calculateStatistics( const QString& wellNam
} }
} }
extractStatisticsFromCurveMerger( wellName, timeStep, tvdAddress, curveMerger, dataSetSizeCalc ); extractStatisticsFromCurveMerger( wellName, timeStep, tvdAddress, curveMerger, dataSetSizeCalc, nullptr );
} }
} }
@ -293,7 +281,8 @@ void RifReaderEnsembleStatisticsRft::extractStatisticsFromCurveMerger( const QSt
const QDateTime& timeStep, const QDateTime& timeStep,
RifEclipseRftAddress depthAddress, RifEclipseRftAddress depthAddress,
RiaCurveMerger<double>& curveMerger, RiaCurveMerger<double>& curveMerger,
RiaWeightedMeanCalculator<size_t>& dataSetSizeCalc ) RiaWeightedMeanCalculator<size_t>& dataSetSizeCalc,
const RigWellPath* wellPathGeometry )
{ {
using ChannelType = RifEclipseRftAddress::RftWellLogChannelType; using ChannelType = RifEclipseRftAddress::RftWellLogChannelType;
@ -329,6 +318,14 @@ void RifReaderEnsembleStatisticsRft::extractStatisticsFromCurveMerger( const QSt
m_cachedValues[depthAddress].push_back( allDepths[depthIdx] ); m_cachedValues[depthAddress].push_back( allDepths[depthIdx] );
if ( wellPathGeometry && ( depthAddress.wellLogChannel() == ChannelType::MD ) )
{
// Compute corresponding TVD for given MD
auto tvdAddress = RifEclipseRftAddress::createAddress( wellName, timeStep, ChannelType::TVD );
auto tvdDepth = wellPathGeometry->interpolatedPointAlongWellPath( allDepths[depthIdx] );
m_cachedValues[tvdAddress].push_back( -tvdDepth.z() );
}
if ( p10 != HUGE_VAL ) m_cachedValues[p10Address].push_back( p10 ); if ( p10 != HUGE_VAL ) m_cachedValues[p10Address].push_back( p10 );
if ( p50 != HUGE_VAL ) m_cachedValues[p50Address].push_back( p50 ); if ( p50 != HUGE_VAL ) m_cachedValues[p50Address].push_back( p50 );
if ( p90 != HUGE_VAL ) m_cachedValues[p90Address].push_back( p90 ); if ( p90 != HUGE_VAL ) m_cachedValues[p90Address].push_back( p90 );

View File

@ -27,6 +27,7 @@
class RimSummaryCaseCollection; class RimSummaryCaseCollection;
class RimEclipseCase; class RimEclipseCase;
class RigWellPath;
class RifReaderEnsembleStatisticsRft : public RifReaderRftInterface, public cvf::Object class RifReaderEnsembleStatisticsRft : public RifReaderRftInterface, public cvf::Object
{ {
@ -51,7 +52,8 @@ private:
const QDateTime& timeStep, const QDateTime& timeStep,
RifEclipseRftAddress depthAddress, RifEclipseRftAddress depthAddress,
RiaCurveMerger<double>& curveMerger, RiaCurveMerger<double>& curveMerger,
RiaWeightedMeanCalculator<size_t>& dataSetSizeCalc ); RiaWeightedMeanCalculator<size_t>& dataSetSizeCalc,
const RigWellPath* wellPathGeometry );
void clearCache( const QString& wellName, const QDateTime& timeStep ); void clearCache( const QString& wellName, const QDateTime& timeStep );