WBS-plot: Add optional support for maximum curve interval for UCS parameter curve (#10118)

* WBS-plot: Add optional support for maximum curve interval for UCS parameter curve
* GeoMech: Guard out-of-bound access to Pore pressure data
This commit is contained in:
Magne Sjaastad 2023-04-19 07:16:13 +02:00 committed by GitHub
parent b7f8d0e0f1
commit d4f11e0f8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 7 deletions

View File

@ -105,14 +105,17 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorNormalST::calculate( int par
{ {
for ( int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx ) for ( int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx )
{ {
size_t elmNodResIdx = femPart->elementNodeResultIdx( elmIdx, elmNodIdx ); const size_t elmNodResIdx = femPart->elementNodeResultIdx( elmIdx, elmNodIdx );
const int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodResIdx );
float por = 0.0f;
if ( nodeIdx < srcPORFrameData.size() )
{
por = srcPORFrameData[nodeIdx];
if ( por == inf ) por = 0.0f;
}
if ( elmNodResIdx < srcSFrameData.size() ) if ( elmNodResIdx < srcSFrameData.size() )
{ {
int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodResIdx );
float por = srcPORFrameData[nodeIdx];
if ( por == inf ) por = 0.0f;
// ST = SE_abacus + porePressure // ST = SE_abacus + porePressure
// porePressure is POR-Bar. // porePressure is POR-Bar.
double SE_abacus = -srcSFrameData[elmNodResIdx]; double SE_abacus = -srcSFrameData[elmNodResIdx];

View File

@ -833,6 +833,14 @@ QString RimWellLogCurveCommonDataSource::smoothingUiOrderinglabel()
return "ApplySmoothing"; return "ApplySmoothing";
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<bool, double> RimWellLogCurveCommonDataSource::maximumCurvePointInterval() const
{
return m_maximumCurvePointInterval();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -103,6 +103,8 @@ public:
static QString smoothingUiOrderinglabel(); static QString smoothingUiOrderinglabel();
std::pair<bool, double> maximumCurvePointInterval() const;
private: private:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;

View File

@ -50,6 +50,7 @@
#include "RimTools.h" #include "RimTools.h"
#include "RimWellBoreStabilityPlot.h" #include "RimWellBoreStabilityPlot.h"
#include "RimWellLogCurve.h" #include "RimWellLogCurve.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogFile.h" #include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h" #include "RimWellLogFileChannel.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
@ -421,6 +422,29 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::performDataExtraction( bool* isUsingPseudoLength ) void RimWellLogExtractionCurve::performDataExtraction( bool* isUsingPseudoLength )
{ {
if ( dynamic_cast<RimGeoMechCase*>( m_case.value() ) && ( m_geomResultDefinition->resultPositionType() == RIG_WELLPATH_DERIVED ) &&
( m_geomResultDefinition->resultFieldName() == "UCS" ) )
{
RimWellBoreStabilityPlot* wbsPlot = nullptr;
this->firstAncestorOrThisOfType( wbsPlot );
if ( wbsPlot )
{
auto maxCurvePointInterval = wbsPlot->commonDataSource()->maximumCurvePointInterval();
if ( maxCurvePointInterval.first )
{
double maxIntervalLength = maxCurvePointInterval.second;
// Special handling for a UCS parameter curve as this curve also depends on UCS that can be defined in a LAS file with
// high resolution. The maximum curve interval was designed to only be used by RimWellLogWbsCurve. To be able to use
// this functionality for a wellpath UCS curve, we get the maximumCurvePointInterval directly. It is not possible to
// control this setting locally on the curve object, the value is always taken directly from the WBS plot settings.
extractData( isUsingPseudoLength, {}, maxIntervalLength );
return;
}
}
}
extractData( isUsingPseudoLength, {}, {} ); extractData( isUsingPseudoLength, {}, {} );
} }

View File

@ -27,7 +27,7 @@ std::optional<T> createOptional( bool enable, const T& value )
{ {
if ( !enable ) return {}; if ( !enable ) return {};
return std::optional<T>( value ); return value;
} }
template <typename T> template <typename T>