mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7400 StimPlanModel: Bin pressure by depth and use mean value.
This commit is contained in:
parent
023bb062b5
commit
9373326281
@ -27,6 +27,7 @@
|
|||||||
#include "RigEclipseCaseData.h"
|
#include "RigEclipseCaseData.h"
|
||||||
#include "RigGridBase.h"
|
#include "RigGridBase.h"
|
||||||
#include "RigMainGrid.h"
|
#include "RigMainGrid.h"
|
||||||
|
#include "RigStatisticsMath.h"
|
||||||
#include "RigWellPath.h"
|
#include "RigWellPath.h"
|
||||||
#include "RigWellPathGeometryTools.h"
|
#include "RigWellPathGeometryTools.h"
|
||||||
|
|
||||||
@ -359,6 +360,68 @@ void RimStimPlanModelPressureCalculator::sortAndRemoveDuplicates( DepthValuePair
|
|||||||
depthValuePairs.erase( unique( depthValuePairs.begin(), depthValuePairs.end() ), depthValuePairs.end() );
|
depthValuePairs.erase( unique( depthValuePairs.begin(), depthValuePairs.end() ), depthValuePairs.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimStimPlanModelPressureCalculator::binByDepthAndAverage( DepthValuePairVector& depthValuePairs )
|
||||||
|
{
|
||||||
|
if ( depthValuePairs.size() < 2 ) return;
|
||||||
|
|
||||||
|
double minDepth = std::floor( depthValuePairs.front().first );
|
||||||
|
double maxDepth = std::ceil( depthValuePairs.back().first );
|
||||||
|
|
||||||
|
RiaLogging::debug( QString( "Binning: min depth=%1 max depth=%2. Vec size=%3." )
|
||||||
|
.arg( minDepth )
|
||||||
|
.arg( maxDepth )
|
||||||
|
.arg( depthValuePairs.size() ) );
|
||||||
|
|
||||||
|
double binSize = 1.0;
|
||||||
|
|
||||||
|
double diff = maxDepth - minDepth;
|
||||||
|
int nBins = diff / binSize;
|
||||||
|
|
||||||
|
std::vector<std::vector<double>> histogramBins;
|
||||||
|
histogramBins.resize( nBins );
|
||||||
|
for ( auto [depth, value] : depthValuePairs )
|
||||||
|
{
|
||||||
|
int bin = static_cast<int>( std::floor( ( depth - minDepth ) / binSize ) );
|
||||||
|
histogramBins[bin].push_back( value );
|
||||||
|
}
|
||||||
|
|
||||||
|
DepthValuePairVector newDepthValuePairs;
|
||||||
|
for ( size_t i = 0; i < histogramBins.size(); i++ )
|
||||||
|
{
|
||||||
|
double startDepth = minDepth + i * binSize;
|
||||||
|
double endDepth = minDepth + ( i + 1 ) * binSize;
|
||||||
|
|
||||||
|
double min;
|
||||||
|
double max;
|
||||||
|
double sum;
|
||||||
|
double range;
|
||||||
|
double mean;
|
||||||
|
double dev;
|
||||||
|
RigStatisticsMath::calculateBasicStatistics( histogramBins[i], &min, &max, &sum, &range, &mean, &dev );
|
||||||
|
|
||||||
|
RiaLogging::debug( QString( "Bin[%1]. TVD: [%2 - %3]. Samples: %4. Pressure: [%5 - %6]. Mean: %7 Dev: %8" )
|
||||||
|
.arg( i )
|
||||||
|
.arg( startDepth )
|
||||||
|
.arg( endDepth )
|
||||||
|
.arg( histogramBins[i].size() )
|
||||||
|
.arg( min )
|
||||||
|
.arg( max )
|
||||||
|
.arg( mean )
|
||||||
|
.arg( dev ) );
|
||||||
|
|
||||||
|
if ( !std::isinf( mean ) )
|
||||||
|
{
|
||||||
|
double binCenterDepth = startDepth + binSize / 2.0;
|
||||||
|
newDepthValuePairs.push_back( std::make_pair( binCenterDepth, mean ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
depthValuePairs = newDepthValuePairs;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -419,6 +482,10 @@ bool RimStimPlanModelPressureCalculator::buildPressureTablesPerEqlNum( const Rim
|
|||||||
sortAndRemoveDuplicates( valuesPerEqlNum[eqlNum] );
|
sortAndRemoveDuplicates( valuesPerEqlNum[eqlNum] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for ( int eqlNum : presentEqlNums )
|
||||||
|
{
|
||||||
|
binByDepthAndAverage( valuesPerEqlNum[eqlNum] );
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,4 +76,6 @@ protected:
|
|||||||
static std::set<int> findUniqueValues( const std::vector<double>& values );
|
static std::set<int> findUniqueValues( const std::vector<double>& values );
|
||||||
|
|
||||||
static double interpolatePressure( const DepthValuePairVector& depthValuePairs, double depth, int eqlNum );
|
static double interpolatePressure( const DepthValuePairVector& depthValuePairs, double depth, int eqlNum );
|
||||||
|
|
||||||
|
static void binByDepthAndAverage( DepthValuePairVector& depthValuePairs );
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user