Minor adjustments related to well target workflow

* For a case with only static geometry, make sure it is possible to create a contour map
* Make sure the grid model is open before accessing data
* Make sure the picked polygon points are located above the grid model
This commit is contained in:
Magne Sjaastad 2025-01-08 10:27:13 +01:00 committed by GitHub
parent dffa24fa81
commit 90a1642326
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 5 deletions

View File

@ -23,7 +23,10 @@
#include "Well/RigWellPath.h"
#include "Rim3dView.h"
#include "RimEclipseContourMapView.h"
#include "RimGeoMechContourMapView.h"
#include "RimModeledWellPath.h"
#include "RimPolylinePickerInterface.h"
#include "RimPolylineTarget.h"
#include "RimUserDefinedPolylinesAnnotation.h"
@ -32,11 +35,11 @@
#include "RivPolylinesAnnotationSourceInfo.h"
#include "RimPolylinePickerInterface.h"
#include "cafDisplayCoordTransform.h"
#include "cafSelectionManager.h"
#include "cvfBoundingBox.h"
#include <vector>
//--------------------------------------------------------------------------------------------------
@ -84,6 +87,13 @@ bool RicPolylineTargetsPickEventHandler::handle3dPickEvent( const Ric3dPickEvent
const auto& firstPickItem = eventObject.m_pickItemInfos.front();
auto targetPointInDomain = rimView->displayCoordTransform()->transformToDomainCoord( firstPickItem.globalPickedPoint() );
if ( dynamic_cast<RimEclipseContourMapView*>( rimView ) || dynamic_cast<RimGeoMechContourMapView*>( rimView ) )
{
// In a contour map view, the contour map is located below the domain. This means that the picked z-value is below the domain.
// Use the z-value of the domain bounding box instead.
targetPointInDomain.z() = rimView->domainBoundingBox().max().z();
}
auto* newTarget = new RimPolylineTarget();
newTarget->setAsPointTargetXYD( cvf::Vec3d( targetPointInDomain.x(), targetPointInDomain.y(), -targetPointInDomain.z() ) );

View File

@ -35,6 +35,8 @@
#include "RimEclipseView.h"
#include "RimRegularLegendConfig.h"
#include <algorithm>
CAF_PDM_SOURCE_INIT( RimEclipseContourMapProjection, "RimEclipseContourMapProjection" );
//--------------------------------------------------------------------------------------------------
@ -365,7 +367,7 @@ std::pair<double, double> RimEclipseContourMapProjection::minmaxValuesAllTimeSte
{
clearTimeStepRange();
int timeStepCount = static_cast<int>( eclipseCase()->timeStepStrings().size() );
int timeStepCount = std::max( static_cast<int>( eclipseCase()->timeStepStrings().size() ), 1 );
for ( int i = 0; i < (int)timeStepCount; ++i )
{
std::vector<double> aggregatedResults = generateResults( i );

View File

@ -186,8 +186,12 @@ void RimWellTargetCandidatesGenerator::updateAllBoundaries()
if ( ensemble->cases().empty() ) return;
RimEclipseCase* eclipseCase = ensemble->cases().front();
eclipseCase->ensureReservoirCaseIsOpen();
int timeStepIdx = m_timeStep();
auto resultsData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
if ( !resultsData ) return;
const int timeStepIdx = m_timeStep();
auto updateBoundaryValues =
[]( auto resultsData, const std::vector<RigEclipseResultAddress>& addresses, size_t timeStepIdx ) -> std::pair<double, double>
@ -206,7 +210,6 @@ void RimWellTargetCandidatesGenerator::updateAllBoundaries()
return { globalMin, globalMax };
};
auto resultsData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
std::tie( m_minimumPressure, m_maximumPressure ) =
updateBoundaryValues( resultsData, { RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "PRESSURE" ) }, timeStepIdx );