Work in progress

This commit is contained in:
jonjenssen committed 2025-08-15 12:54:41 +02:00
1 parent b414e27176
commit d764917daa
8 files changed
+140 -8

No files matched your search

@@ -53,6 +53,7 @@
#include "Well/RigWellPath.h"
#include "Well/RigWellPathIntersectionTools.h"
#include "RimEclipseCase.h"
#include "RimFileWellPath.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
@@ -1682,7 +1683,99 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCarfinForTemporaryLgrs( c
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> RicWellPathExportCompletionDataFeatureImpl::completionDataForWellPath( RimWellPath* wellPath )
std::vector<RigCompletionData> RicWellPathExportCompletionDataFeatureImpl::completionDataForWellPath( RimWellPath* wellPath,
RimEclipseCase* eCase )
{
return {};
if ( eCase == nullptr ) return {};
// Ensure that the case is open. This will enable export without any open views.
// https://github.com/OPM/ResInsight/issues/11134
eCase->ensureReservoirCaseIsOpen();
if ( eCase->eclipseCaseData() == nullptr )
{
RiaLogging::error( "Export Completions Data: No data available for Eclipse Case" );
return {};
}
RicExportCompletionDataSettingsUi exportSettings;
exportSettings.caseToApply = eCase;
exportSettings.includeMsw = false;
exportSettings.setExportDataSourceAsComment( true );
exportSettings.includePerforations = true;
exportSettings.includeFishbones = false;
exportSettings.includeFractures = false;
std::vector<RigCompletionData> completions;
std::vector<RimWellPath*> allWellPathLaterals;
if ( wellPath->unitSystem() == eCase->eclipseCaseData()->unitsType() )
{
allWellPathLaterals = wellPath->allWellPathLaterals();
}
else
{
return {};
}
std::map<size_t, std::vector<RigCompletionData>> completionsPerEclipseCellAllCompletionTypes;
for ( auto wellPathLateral : allWellPathLaterals )
{
// Skip well paths that are not enabled, no export of WELSEGS or COMPDAT
// https://github.com/OPM/ResInsight/issues/10754
//
if ( !wellPathLateral->isEnabled() ) continue;
// Generate completion data
if ( exportSettings.includePerforations )
{
std::vector<RigCompletionData> perforationCompletionData =
generatePerforationsCompdatValues( wellPathLateral,
wellPathLateral->perforationIntervalCollection()->perforations(),
exportSettings );
appendCompletionData( &completionsPerEclipseCellAllCompletionTypes, perforationCompletionData );
}
if ( exportSettings.includeFishbones )
{
// Make sure the start and end location is computed if needed
wellPathLateral->fishbonesCollection()->computeStartAndEndLocation();
std::vector<RigCompletionData> fishbonesCompletionData =
RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneCompdatValuesUsingAdjustedCellVolume( wellPathLateral,
exportSettings );
appendCompletionData( &completionsPerEclipseCellAllCompletionTypes, fishbonesCompletionData );
}
if ( exportSettings.includeFractures() )
{
// If no report is wanted, set reportItems = nullptr
std::vector<RicWellPathFractureReportItem>* reportItems = nullptr;
std::vector<RigCompletionData> fractureCompletionData = RicExportFractureCompletionsImpl::
generateCompdatValuesForWellPath( wellPathLateral,
exportSettings.caseToApply(),
reportItems,
nullptr,
RicExportFractureCompletionsImpl::
PressureDepletionParameters( exportSettings.performTransScaling(),
exportSettings.transScalingTimeStep(),
exportSettings.transScalingWBHPSource(),
exportSettings.transScalingWBHP() ) );
appendCompletionData( &completionsPerEclipseCellAllCompletionTypes, fractureCompletionData );
}
}
for ( auto& data : completionsPerEclipseCellAllCompletionTypes )
{
completions.push_back( combineEclipseCellCompletions( data.second, exportSettings ) );
}
return completions;
}
@@ -123,7 +123,7 @@ public:
static std::vector<RigCompletionData>
computeDynamicCompletionsForWellPath( RimWellPath* wellPath, RimEclipseCase* eclipseCase, size_t timeStepIndex );
static std::vector<RigCompletionData> completionDataForWellPath( RimWellPath* wellPath );
static std::vector<RigCompletionData> completionDataForWellPath( RimWellPath* wellPath, RimEclipseCase* eCase );
private:
static std::vector<RigCompletionData> generatePerforationsCompdatValues( gsl::not_null<const RimWellPath*> wellPath,
@@ -44,6 +44,7 @@ RimCompdatData::RimCompdatData()
CAF_PDM_InitScriptableFieldNoDefault( &m_direction, "Direction", "Direction" );
CAF_PDM_InitScriptableFieldNoDefault( &m_startMD, "StartMd", "Start MD" );
CAF_PDM_InitScriptableFieldNoDefault( &m_endMD, "EndMd", "End MD" );
CAF_PDM_InitScriptableFieldNoDefault( &m_comment, "Comment", "Comment" );
}
//--------------------------------------------------------------------------------------------------
@@ -293,11 +293,11 @@ void RimModeledWellPath::updateReferencePoint()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCompletionData* RimModeledWellPath::completionData()
RimCompletionData* RimModeledWellPath::completionData( RimEclipseCase* eCase )
{
auto retData = new RimCompletionData();
auto compdata = RicWellPathExportCompletionDataFeatureImpl::completionDataForWellPath( this );
auto compdata = RicWellPathExportCompletionDataFeatureImpl::completionDataForWellPath( this, eCase );
for ( auto& cd : compdata )
{
@@ -26,6 +26,7 @@ class RimWellPathTarget;
class RimWellPath;
class RimWellPathGeometryDef;
class RimCompletionData;
class RimeclipseCase;
class RimModeledWellPath : public RimWellPath
{
@@ -43,7 +44,7 @@ public:
void updateTieInLocationFromParentWell();
void updateReferencePoint();
RimCompletionData* completionData();
RimCompletionData* completionData( RimEclipseCase* eCase );
private:
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
@@ -19,7 +19,9 @@
#include "RimcWellPathCollection.h"
#include "CompletionData/RimCompletionData.h"
#include "RimEclipseCase.h"
#include "RimModeledWellPath.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
@@ -90,6 +92,8 @@ RimcWellPathCollection_wellCompletions::RimcWellPathCollection_wellCompletions(
{
CAF_PDM_InitObject( "Well Completions" );
CAF_PDM_InitScriptableFieldNoDefault( &m_wellName, "WellName", "Name of Well" );
// CAF_PDM_InitScriptableFieldNoDefault( &m_case, "eclipseCase", "Eclipse Case to extract data from" );
CAF_PDM_InitScriptableField( &m_caseId, "eclipseCaseId", -1, "Eclipse Case to extract data from" );
}
//--------------------------------------------------------------------------------------------------
@@ -108,11 +112,27 @@ std::expected<caf::PdmObjectHandle*, QString> RimcWellPathCollection_wellComplet
return std::unexpected( QString( "Well name is empty. Nothing to do." ) );
}
if ( m_caseId() < 0 )
{
return std::unexpected( QString( "Eclipse case is not set. Cannot get completion data." ) );
}
RimEclipseCase* eCase = RimProject::current()->eclipseCaseFromCaseId( m_caseId() );
if ( eCase == nullptr )
{
return std::unexpected( QString( "Eclipse case is not set. Cannot get completion data." ) );
}
// if ( m_case() == nullptr )
//{
// return std::unexpected( QString( "Eclipse case is not set. Cannot get completion data." ) );
// }
if ( auto wellPath = wellPathCollection->wellPathByName( m_wellName ) )
{
if ( auto modWellPath = dynamic_cast<RimModeledWellPath*>( wellPath ) )
{
if ( auto completionData = modWellPath->completionData() )
if ( auto completionData = modWellPath->completionData( eCase ) )
{
return completionData;
}
@@ -24,6 +24,8 @@
#include <QString>
class RimEclipseCase;
//==================================================================================================
///
//==================================================================================================
@@ -56,4 +58,6 @@ public:
private:
caf::PdmField<QString> m_wellName;
// caf::PdmPtrField<RimEclipseCase*> m_case;
caf::PdmField<int> m_caseId;
};