Skip to content

Commit

Permalink
Minor adjustments related to well target workflow
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
magnesj authored Jan 8, 2025
1 parent dffa24f commit 90a1642
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -32,11 +35,11 @@

#include "RivPolylinesAnnotationSourceInfo.h"

#include "RimPolylinePickerInterface.h"

#include "cafDisplayCoordTransform.h"
#include "cafSelectionManager.h"

#include "cvfBoundingBox.h"

#include <vector>

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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() ) );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include "RimEclipseView.h"
#include "RimRegularLegendConfig.h"

#include <algorithm>

CAF_PDM_SOURCE_INIT( RimEclipseContourMapProjection, "RimEclipseContourMapProjection" );

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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 );

Expand Down

0 comments on commit 90a1642

Please sign in to comment.