mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
RFT ensemble refactoring
* Compute average MD for intersections with a cell * Create extractor for simulation well * Remove rftReader from RifDataSourceForRftPlt * Add function compute measured depth for RFT cells based on well path geometry * Move statistics reader to well ensemble curve set * Make sure both TVD and MD are cached if possible * Add selection of grid case to use for estimation of measured depth (MD) Add "Grid Model For MD" where the user can select a grid model. This grid model is propagated to a hidden field in EnsembleCurveSet. The grid model is then applied to RifReaderEnsembleStatisticsRft owned by EnsembleCurveSet
This commit is contained in:
@@ -15,8 +15,17 @@
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RifReaderRftInterface.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEclipseWellLogExtractor.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigWellPath.h"
|
||||
#include "RigWellPathGeometryTools.h"
|
||||
|
||||
#include "cafVecIjk.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -34,9 +43,104 @@ std::set<RifEclipseRftAddress> RifReaderRftInterface::eclipseRftAddresses( const
|
||||
return matchingAddresses;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Compute average measured depth for cell based on grid intersections for cells. If the well path geometry do not contain measured depth
|
||||
// for a grid cell, the measured depth is estimated based on existing geometry for the well path.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double>
|
||||
RifReaderRftInterface::computeMeasuredDepth( const QString& wellName, const QDateTime& timeStep, RigEclipseWellLogExtractor* eclExtractor )
|
||||
{
|
||||
if ( !eclExtractor ) return {};
|
||||
if ( !eclExtractor->caseData() ) return {};
|
||||
|
||||
if ( eclExtractor->cellIntersectionMDs().empty() ) return {};
|
||||
|
||||
auto mainGrid = eclExtractor->caseData()->mainGrid();
|
||||
if ( !mainGrid ) return {};
|
||||
|
||||
std::vector<double> avgMeasuredDepthForCells;
|
||||
std::vector<double> tvdValuesToEstimate;
|
||||
|
||||
auto cellIjk = cellIndices( wellName, timeStep );
|
||||
for ( const caf::VecIjk& ijk : cellIjk )
|
||||
{
|
||||
auto globalCellIndex = mainGrid->cellIndexFromIJK( ijk.i(), ijk.j(), ijk.k() );
|
||||
|
||||
auto avgMd = eclExtractor->averageMdForCell( globalCellIndex );
|
||||
if ( avgMd.has_value() )
|
||||
{
|
||||
avgMeasuredDepthForCells.push_back( avgMd.value() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// The RFT cell is not part of cells intersected by well path
|
||||
// Use the TVD of cell center to estimate measured depth
|
||||
|
||||
avgMeasuredDepthForCells.push_back( std::numeric_limits<double>::infinity() );
|
||||
auto center = mainGrid->cell( globalCellIndex ).center();
|
||||
tvdValuesToEstimate.push_back( -center.z() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !tvdValuesToEstimate.empty() )
|
||||
{
|
||||
auto wellPathMd = eclExtractor->wellPathGeometry()->measuredDepths();
|
||||
auto wellPathTvd = eclExtractor->wellPathGeometry()->trueVerticalDepths();
|
||||
|
||||
// Estimate measured depth for cells that do not have measured depth
|
||||
auto estimatedMeasuredDepth = RigWellPathGeometryTools::interpolateMdFromTvd( wellPathMd, wellPathTvd, tvdValuesToEstimate );
|
||||
|
||||
double previousMd = std::numeric_limits<double>::infinity();
|
||||
|
||||
// Replace infinity MD values with estimated MD values based on well path geometry
|
||||
// previousMd contains the last known measured depth value as we move along the well path
|
||||
|
||||
size_t estimatedIndex = 0;
|
||||
for ( auto& measuredDepth : avgMeasuredDepthForCells )
|
||||
{
|
||||
if ( measuredDepth == std::numeric_limits<double>::infinity() )
|
||||
{
|
||||
// No measured depth for cell is found, try to estimate MD based on MD for previous cell
|
||||
if ( estimatedIndex < estimatedMeasuredDepth.size() )
|
||||
{
|
||||
double estimatedMd = estimatedMeasuredDepth[estimatedIndex++];
|
||||
if ( previousMd != std::numeric_limits<double>::infinity() )
|
||||
{
|
||||
if ( previousMd < estimatedMd )
|
||||
{
|
||||
// The estimated MD is larger than previous MD, use the estimated MD
|
||||
measuredDepth = estimatedMd;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The estimated MD is smaller than previous MD, use the previous MD + 1.0
|
||||
measuredDepth = previousMd + 1.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We do not have a valid previous MD, use the estimated MD
|
||||
measuredDepth = estimatedMd;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
measuredDepth = previousMd + 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
// Assign the current MD as previous MD to be used for next estimated MD
|
||||
previousMd = measuredDepth;
|
||||
}
|
||||
}
|
||||
|
||||
return avgMeasuredDepthForCells;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderRftInterface::cellIndices( const RifEclipseRftAddress& rftAddress, std::vector<caf::VecIjk>* indices )
|
||||
std::vector<caf::VecIjk> RifReaderRftInterface::cellIndices( const QString& wellName, const QDateTime& timeStep )
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user