From ec6a13e1da7d8b3671236cefca236aef7600c5c2 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 20 Sep 2023 12:52:17 +0200 Subject: [PATCH] StimPlanModel: Extrapolate pressure table to cover extraction range. --- .../RimStimPlanModelPressureCalculator.cpp | 30 +++++++++++++++++-- .../RimStimPlanModelPressureCalculator.h | 4 ++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.cpp index 1692c35ac0..e3503e32b4 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.cpp @@ -153,7 +153,10 @@ bool RimStimPlanModelPressureCalculator::extractValuesForProperty( RiaDefines::C if ( stimPlanModel->stimPlanModelTemplate()->usePressureTableForProperty( pressureCurveProperty ) ) { - if ( !extractPressureDataFromTable( pressureCurveProperty, stimPlanModel, values, measuredDepthValues, tvDepthValues ) ) + CAF_ASSERT( !targetTvds.empty() ); + double minTvd = targetTvds[0]; + double maxTvd = targetTvds[targetTvds.size() - 1]; + if ( !extractPressureDataFromTable( pressureCurveProperty, stimPlanModel, values, measuredDepthValues, tvDepthValues, minTvd, maxTvd ) ) { RiaLogging::error( "Unable to extract pressure data from table" ); return false; @@ -321,7 +324,9 @@ bool RimStimPlanModelPressureCalculator::extractPressureDataFromTable( RiaDefine const RimStimPlanModel* stimPlanModel, std::vector& values, std::vector& measuredDepthValues, - std::vector& tvDepthValues ) const + std::vector& tvDepthValues, + double minimumTvd, + double maximumTvd ) const { RimStimPlanModelTemplate* stimPlanModelTemplate = stimPlanModel->stimPlanModelTemplate(); if ( !stimPlanModelTemplate ) return false; @@ -357,6 +362,27 @@ bool RimStimPlanModelPressureCalculator::extractPressureDataFromTable( RiaDefine tvDepthValues.push_back( item->depth() ); } + // Make sure the full range of the extraction is covered by the table + bool needsExtrapolation = false; + if ( minimumTvd < tvDepthValues.front() ) + { + tvDepthValues.insert( tvDepthValues.begin(), minimumTvd ); + values.insert( values.begin(), std::numeric_limits::infinity() ); + needsExtrapolation = true; + } + + if ( maximumTvd > tvDepthValues.back() ) + { + tvDepthValues.push_back( maximumTvd ); + values.push_back( std::numeric_limits::infinity() ); + needsExtrapolation = true; + } + + if ( needsExtrapolation ) + { + RiaInterpolationTools::interpolateMissingValues( tvDepthValues, values ); + } + // Interpolate MDs from the tvd data from the table and well path geometry const std::vector& mdValuesOfWellPath = wellPathGeometry->measuredDepths(); const std::vector& tvdValuesOfWellPath = wellPathGeometry->trueVerticalDepths(); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.h b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.h index 21636a07fd..5ef276478d 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.h +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPressureCalculator.h @@ -64,7 +64,9 @@ protected: const RimStimPlanModel* stimPlanModel, std::vector& values, std::vector& measuredDepthValues, - std::vector& tvDepthValues ) const; + std::vector& tvDepthValues, + double minimumTvd, + double maximumTvd ) const; bool interpolateInitialPressureByEquilibrationRegion( RiaDefines::CurveProperty curveProperty, const RimStimPlanModel* stimPlanModel,