Improve MSW export including multi lateral wells

Based on branch https://github.com/OPM/ResInsight/tree/system-msw-refactor

- Move completion settings to property of well path
- Rename to RimFishbones
- Export implicit COMPSEGS for fishbones main bore
- Add valve for each branch
- Increase version number to be able to handle import of legacy project files
This commit is contained in:
Magne Sjaastad
2021-02-26 14:27:59 +01:00
parent 5415a8c42d
commit 8bab748fa6
104 changed files with 3250 additions and 3203 deletions

View File

@@ -25,8 +25,8 @@
#include "RigWellPath.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimWellPath.h"
#include "cafSelectionManager.h"
@@ -67,38 +67,35 @@ void RicExportFishbonesLateralsFeature::onActionTriggered( bool isChecked )
auto exportFile = EXP::openFileForExport( folder, fileName );
auto stream = EXP::createOutputFileStream( *exportFile );
for ( RimFishbonesMultipleSubs* fishbone : wellPath->fishbonesCollection()->activeFishbonesSubs() )
for ( RimFishbones* fishbone : wellPath->fishbonesCollection()->activeFishbonesSubs() )
{
const QString fishboneName = fishbone->generatedName();
for ( auto& sub : fishbone->installedLateralIndices() )
for ( const auto& [subIndex, lateralIndex] : fishbone->installedLateralIndices() )
{
for ( size_t lateralIndex : sub.lateralIndices )
std::vector<std::pair<cvf::Vec3d, double>> coordsAndMD =
fishbone->coordsAndMDForLateral( subIndex, lateralIndex );
std::vector<cvf::Vec3d> lateralCoords;
std::vector<double> lateralMDs;
lateralCoords.reserve( coordsAndMD.size() );
lateralMDs.reserve( coordsAndMD.size() );
for ( auto& coordMD : coordsAndMD )
{
std::vector<std::pair<cvf::Vec3d, double>> coordsAndMD =
fishbone->coordsAndMDForLateral( sub.subIndex, lateralIndex );
std::vector<cvf::Vec3d> lateralCoords;
std::vector<double> lateralMDs;
lateralCoords.reserve( coordsAndMD.size() );
lateralMDs.reserve( coordsAndMD.size() );
for ( auto& coordMD : coordsAndMD )
{
lateralCoords.push_back( coordMD.first );
lateralMDs.push_back( coordMD.second );
}
RigWellPath geometry( lateralCoords, lateralMDs );
// Pad with "0" to get a total of two characters defining the sub index text
QString subIndexText = QString( "%1" ).arg( sub.subIndex, 2, 10, QChar( '0' ) );
QString lateralName =
QString( "%1_%2_Sub%3_Lat%4" ).arg( wellPath->name() ).arg( fishboneName ).arg( subIndexText ).arg( lateralIndex );
EXP::writeWellPathGeometryToStream( *stream, geometry, lateralName, mdStepSize, false, 0.0, false );
lateralCoords.push_back( coordMD.first );
lateralMDs.push_back( coordMD.second );
}
RigWellPath geometry( lateralCoords, lateralMDs );
// Pad with "0" to get a total of two characters defining the sub index text
QString subIndexText = QString( "%1" ).arg( subIndex, 2, 10, QChar( '0' ) );
QString lateralName =
QString( "%1_%2_Sub%3_Lat%4" ).arg( wellPath->name() ).arg( fishboneName ).arg( subIndexText ).arg( lateralIndex );
EXP::writeWellPathGeometryToStream( *stream, geometry, lateralName, mdStepSize, false, 0.0, false );
}
}

View File

@@ -21,8 +21,8 @@
#include "RicNewFishbonesSubsFeature.h"
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimProject.h"
#include "RimWellPath.h"
@@ -48,7 +48,7 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered( bool isChecke
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
RimFishbones* obj = new RimFishbones;
wellPath->fishbonesCollection()->appendFishbonesSubs( obj );
obj->setMeasuredDepthAndCount( wellPathSelItem->m_measuredDepth, 12.5, 13 );

View File

@@ -25,9 +25,9 @@
#include "RigWellPath.h"
#include "Rim3dView.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimImportedFishboneLateralsCollection.h"
#include "RimProject.h"
#include "RimWellPathCollection.h"
#include "RimWellPathCompletions.h"
@@ -55,10 +55,10 @@ void RicNewFishbonesSubsFeature::onActionTriggered( bool isChecked )
fishbonesCollection->firstAncestorOrThisOfTypeAsserted( wellPath );
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
RimFishbones* obj = new RimFishbones;
fishbonesCollection->appendFishbonesSubs( obj );
double wellPathTipMd = wellPath->endMD();
double wellPathTipMd = wellPath->uniqueEndMD();
if ( wellPathTipMd != HUGE_VAL )
{
double startMd = wellPathTipMd - 150 - 100;

View File

@@ -20,7 +20,7 @@
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"

View File

@@ -55,6 +55,7 @@ void RicNewPerforationIntervalFeature::onActionTriggered( bool isChecked )
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
RimPerforationInterval* perforationInterval = new RimPerforationInterval;
perforationInterval->setStartAndEndMD( wellPath->uniqueStartMD(), wellPath->uniqueEndMD() );
perforationCollection->appendPerforation( perforationInterval );

View File

@@ -19,7 +19,7 @@
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"

View File

@@ -20,8 +20,8 @@
#include "RiaApplication.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbonesCollection.h"
#include "RimImportedFishboneLateralsCollection.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
@@ -55,7 +55,7 @@ bool RicWellPathImportCompletionsFileFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicWellPathImportCompletionsFileFeature::onActionTriggered( bool isChecked )
{
RimFishboneWellPathCollection* fishbonesWellPathCollection =
RimImportedFishboneLateralsCollection* fishbonesWellPathCollection =
RicWellPathImportCompletionsFileFeature::selectedWellPathCollection();
CVF_ASSERT( fishbonesWellPathCollection );
@@ -100,7 +100,7 @@ void RicWellPathImportCompletionsFileFeature::setupActionLook( QAction* actionTo
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFishboneWellPathCollection* RicWellPathImportCompletionsFileFeature::selectedWellPathCollection()
RimImportedFishboneLateralsCollection* RicWellPathImportCompletionsFileFeature::selectedWellPathCollection()
{
RimFishbonesCollection* objToFind = nullptr;
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();

View File

@@ -20,7 +20,7 @@
#include "cafCmdFeature.h"
class RimFishboneWellPathCollection;
class RimImportedFishboneLateralsCollection;
//==================================================================================================
///
@@ -36,5 +36,5 @@ protected:
void setupActionLook( QAction* actionToSetup ) override;
private:
static RimFishboneWellPathCollection* selectedWellPathCollection();
static RimImportedFishboneLateralsCollection* selectedWellPathCollection();
};

View File

@@ -11,10 +11,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCaseAndFileExportSettingsUi.h
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureCompletionsImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleWellPathsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleSimWellsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicMswBranch.h
${CMAKE_CURRENT_LIST_DIR}/RicMswCompletions.h
${CMAKE_CURRENT_LIST_DIR}/RicMswExportInfo.h
${CMAKE_CURRENT_LIST_DIR}/RicMswItem.h
${CMAKE_CURRENT_LIST_DIR}/RicMswSegment.h
${CMAKE_CURRENT_LIST_DIR}/RicMswSubSegment.h
${CMAKE_CURRENT_LIST_DIR}/RicMswSegmentCellIntersection.h
${CMAKE_CURRENT_LIST_DIR}/RicMswValveAccumulators.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureTextReportFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureReportItem.h
@@ -34,10 +36,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCaseAndFileExportSettingsUi.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureCompletionsImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleWellPathsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleSimWellsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswBranch.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswCompletions.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswExportInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswItem.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswSegment.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswSubSegment.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswSegmentCellIntersection.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswValveAccumulators.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureTextReportFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureReportItem.cpp

View File

@@ -406,7 +406,7 @@ std::map<int, std::vector<std::pair<QString, QString>>>
double currentWellPressure = 0.0;
RicExportFractureCompletionsImpl::
getWellPressuresAndInitialProductionTimeStepFromSummaryData( caseToApply,
wellPath->completions()->wellNameForExport(),
wellPath->completionSettings()->wellNameForExport(),
0,
&initialWellProductionTimeStep,
&initialWellPressure,

View File

@@ -155,5 +155,10 @@ std::vector<RimWellPath*> RicExportCompletionsForVisibleWellPathsFeature::visibl
std::set<RimWellPath*> uniqueWellPaths( wellPaths.begin(), wellPaths.end() );
wellPaths.assign( uniqueWellPaths.begin(), uniqueWellPaths.end() );
wellPaths.erase( std::remove_if( wellPaths.begin(),
wellPaths.end(),
[]( auto wellPath ) { return !wellPath->isTopLevelWellPath(); } ),
wellPaths.end() );
return wellPaths;
}

View File

@@ -30,9 +30,9 @@
#include "RicWellPathExportMswCompletionsImpl.h"
#include "RimEclipseCase.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimImportedFishboneLateralsCollection.h"
#include "RimPerforationCollection.h"
#include "RimProject.h"
#include "RimWellPath.h"

View File

@@ -23,7 +23,7 @@
#include "cafCmdFeature.h"
class RimFishbonesCollection;
class RimFishbonesMultipleSubs;
class RimFishbones;
class RimWellPath;
//==================================================================================================

View File

@@ -84,7 +84,7 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
}
return generateCompdatValues( caseToApply,
wellPath->completions()->wellNameForExport(),
wellPath->completionSettings()->wellNameForExport(),
wellPath->wellPathGeometry(),
fracturesAlongWellPath,
fractureDataForReport,

View File

@@ -19,7 +19,10 @@
#include "RicFishbonesTransmissibilityCalculationFeatureImp.h"
#include "RicExportCompletionDataSettingsUi.h"
#include "RicMswBranch.h"
#include "RicMswCompletions.h"
#include "RicMswExportInfo.h"
#include "RicMswSegment.h"
#include "RicWellPathExportCompletionDataFeatureImpl.h"
#include "RicWellPathExportMswCompletionsImpl.h"
@@ -31,10 +34,10 @@
#include "RigWellPathIntersectionTools.h"
#include "RigWellLogExtractor.h"
#include "RimFishboneWellPath.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimImportedFishboneLaterals.h"
#include "RimImportedFishboneLateralsCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCompletions.h"
@@ -134,7 +137,7 @@ std::vector<RigCompletionData>
continue;
}
RigCompletionData completion( wellPath->completions()->wellNameForExport(),
RigCompletionData completion( wellPath->completionSettings()->wellNameForExport(),
RigCompletionDataGridCell( globalCellIndex, settings.caseToApply->mainGrid() ),
wellBorePart.intersectionWithWellMeasuredDepth );
completion.setSecondOrderingValue( wellBorePart.lateralIndex );
@@ -206,34 +209,50 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
// Generate data
const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData();
RicMswExportInfo exportInfo =
RicWellPathExportMswCompletionsImpl::generateFishbonesMswExportInfo( settings.caseToApply(), wellPath, false );
RiaDefines::EclipseUnitSystem unitSystem = caseData->unitsType();
bool isMainBore = false;
auto mswParameters = wellPath->completionSettings()->mswParameters();
RiaDefines::EclipseUnitSystem unitSystem = caseData->unitsType();
for ( std::shared_ptr<RicMswSegment> location : exportInfo.segments() )
RicMswExportInfo exportInfo( wellPath,
unitSystem,
wellPath->fishbonesCollection()->startMD(),
mswParameters->lengthAndDepth().text(),
mswParameters->pressureDrop().text() );
exportInfo.setLinerDiameter( mswParameters->linerDiameter( unitSystem ) );
exportInfo.setRoughnessFactor( mswParameters->roughnessFactor( unitSystem ) );
RicWellPathExportMswCompletionsImpl::generateFishbonesMswExportInfo( settings.caseToApply(),
wellPath,
0.0,
{},
false,
&exportInfo,
exportInfo.mainBoreBranch() );
bool isMainBore = false;
for ( auto segment : exportInfo.mainBoreBranch()->segments() )
{
for ( std::shared_ptr<RicMswCompletion> completion : location->completions() )
for ( auto completion : segment->completions() )
{
for ( std::shared_ptr<RicMswSubSegment> segment : completion->subSegments() )
for ( auto completionSegment : completion->segments() )
{
for ( std::shared_ptr<RicMswSubSegmentCellIntersection> intersection : segment->intersections() )
for ( std::shared_ptr<RicMswSegmentCellIntersection> intersection : completionSegment->intersections() )
{
double diameter = location->holeDiameter();
double diameter = segment->holeDiameter();
QString completionMetaData =
( location->label() +
QString( ": Sub: %1 Lateral: %2" ).arg( location->subIndex() ).arg( completion->index() ) );
( segment->label() +
QString( ": Sub: %1 Lateral: %2" ).arg( segment->subIndex() ).arg( completion->index() ) );
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc( intersection->lengthsInCell(),
diameter / 2.0,
location->skinFactor(),
segment->skinFactor(),
isMainBore,
completionMetaData );
wellBorePart.intersectionWithWellMeasuredDepth = location->endMD();
wellBorePart.intersectionWithWellMeasuredDepth = segment->endMD();
wellBorePart.lateralIndex = completion->index();
wellBorePart.setSourcePdmObject( location->sourcePdmObject() );
wellBorePart.setSourcePdmObject( segment->sourcePdmObject() );
wellBorePartsInCells[intersection->globalCellIndex()].push_back( wellBorePart );
}
@@ -293,7 +312,8 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate
double holeRadius = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter( unitSystem ) / 2.0;
double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor();
for ( const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths() )
for ( const RimImportedFishboneLaterals* fishbonesPath :
wellPath->fishbonesCollection()->wellPathCollection()->wellPaths() )
{
if ( !fishbonesPath->isChecked() )
{
@@ -336,7 +356,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::appendMainWellBoreParts(
double holeRadius,
double startMeasuredDepth,
double endMeasuredDepth,
const RimFishbonesMultipleSubs* fishbonesDefinitions )
const RimFishbones* fishbonesDefinitions )
{
if ( !wellPath ) return;
if ( !wellPath->wellPathGeometry() ) return;
@@ -355,7 +375,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::appendMainWellBoreParts(
for ( const auto& cellIntersectionInfo : intersectedCellsIntersectionInfo )
{
QString completionMetaData = wellPath->completions()->wellNameForExport() + " main bore";
QString completionMetaData = wellPath->completionSettings()->wellNameForExport() + " main bore";
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc( cellIntersectionInfo.intersectionLengthsInCellCS,
holeRadius,
skinFactor,

View File

@@ -26,7 +26,7 @@
class RigCompletionData;
class RimWellPath;
class RimFishbonesMultipleSubs;
class RimFishbones;
class RicExportCompletionDataSettingsUi;
class RigEclipseCaseData;
@@ -60,5 +60,5 @@ private:
double holeRadius,
double startMeasuredDepth,
double endMeasuredDepth,
const RimFishbonesMultipleSubs* fishbonesDefinitions );
const RimFishbones* fishbonesDefinitions );
};

View File

@@ -1,164 +1,182 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicMswBranch.h"
#include "RicMswSubSegment.h"
#include "RicMswCompletions.h"
#include "RicMswSegment.h"
#include "RimWellPath.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswSubSegmentCellIntersection::RicMswSubSegmentCellIntersection( const QString& gridName,
size_t globalCellIndex,
const cvf::Vec3st& gridLocalCellIJK,
const cvf::Vec3d& lengthsInCell )
: m_gridName( gridName )
, m_globalCellIndex( globalCellIndex )
, m_gridLocalCellIJK( gridLocalCellIJK )
, m_lengthsInCell( lengthsInCell )
RicMswBranch::RicMswBranch( const QString& label, const RimWellPath* wellPath, double initialMD, double initialTVD )
: RicMswItem( label )
, m_initialMD( initialMD )
, m_initialTVD( initialTVD )
, m_branchNumber( -1 )
, m_wellPath( wellPath )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString& RicMswSubSegmentCellIntersection::gridName() const
void RicMswBranch::addSegment( std::unique_ptr<RicMswSegment> segment )
{
return m_gridName;
m_segments.push_back( std::move( segment ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RicMswSubSegmentCellIntersection::globalCellIndex() const
void RicMswBranch::insertAfterSegment( const RicMswSegment* insertAfter, std::unique_ptr<RicMswSegment> insertItem )
{
return m_globalCellIndex;
auto it = std::find_if( m_segments.begin(), m_segments.end(), [insertAfter]( auto& item ) {
return item.get() == insertAfter;
} );
m_segments.insert( it, std::move( insertItem ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3st RicMswSubSegmentCellIntersection::gridLocalCellIJK() const
void RicMswBranch::sortSegments()
{
return m_gridLocalCellIJK;
std::stable_sort( m_segments.begin(),
m_segments.end(),
[]( const std::unique_ptr<RicMswSegment>& lhs, const std::unique_ptr<RicMswSegment>& rhs ) {
return *lhs < *rhs;
} );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const cvf::Vec3d& RicMswSubSegmentCellIntersection::lengthsInCell() const
const RimWellPath* RicMswBranch::wellPath() const
{
return m_lengthsInCell;
return m_wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswSubSegment::RicMswSubSegment( double startMD, double endMD, double startTVD, double endTVD )
: m_startMD( startMD )
, m_endMD( endMD )
, m_startTVD( startTVD )
, m_endTVD( endTVD )
, m_segmentNumber( -1 )
double RicMswBranch::startMD() const
{
return m_initialMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSubSegment::startMD() const
double RicMswBranch::startTVD() const
{
return m_startMD;
return m_initialTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSubSegment::endMD() const
double RicMswBranch::endMD() const
{
return m_endMD;
if ( !m_segments.empty() )
{
return m_segments.back()->endMD();
}
return m_initialMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSubSegment::deltaMD() const
double RicMswBranch::endTVD() const
{
return m_endMD - m_startMD;
if ( !m_segments.empty() )
{
return m_segments.back()->endTVD();
}
return m_initialTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSubSegment::startTVD() const
int RicMswBranch::branchNumber() const
{
return m_startTVD;
return m_branchNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSubSegment::endTVD() const
void RicMswBranch::setBranchNumber( int branchNumber )
{
return m_endTVD;
m_branchNumber = branchNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSubSegment::deltaTVD() const
std::vector<const RicMswSegment*> RicMswBranch::segments() const
{
return m_endTVD - m_startTVD;
std::vector<const RicMswSegment*> allSegments;
for ( const auto& segment : m_segments )
{
allSegments.push_back( segment.get() );
}
return allSegments;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RicMswSubSegment::segmentNumber() const
std::vector<RicMswSegment*> RicMswBranch::segments()
{
return m_segmentNumber;
std::vector<RicMswSegment*> allSegments;
for ( auto& segment : m_segments )
{
allSegments.push_back( segment.get() );
}
return allSegments;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSubSegment::setSegmentNumber( int segmentNumber )
size_t RicMswBranch::segmentCount() const
{
m_segmentNumber = segmentNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSubSegment::addIntersection( std::shared_ptr<RicMswSubSegmentCellIntersection> intersection )
{
m_intersections.push_back( intersection );
return m_segments.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<std::shared_ptr<RicMswSubSegmentCellIntersection>>& RicMswSubSegment::intersections() const
std::vector<const RicMswBranch*> RicMswBranch::branches() const
{
return m_intersections;
std::vector<const RicMswBranch*> branches;
for ( const auto& branch : m_branches )
{
branches.push_back( branch.get() );
}
return branches;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::shared_ptr<RicMswSubSegmentCellIntersection>>& RicMswSubSegment::intersections()
std::vector<RicMswBranch*> RicMswBranch::branches()
{
return m_intersections;
std::vector<RicMswBranch*> branches;
for ( auto& branch : m_branches )
{
branches.push_back( branch.get() );
}
return branches;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswBranch::addChildBranch( std::unique_ptr<RicMswBranch> branch )
{
m_branches.push_back( std::move( branch ) );
}

View File

@@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicMswItem.h"
#include "RicMswSegment.h"
#include "cafPdmPointer.h"
#include <memory>
#include <vector>
class RimWellPath;
class RicMswCompletion;
class RicMswSegment;
class RicMswBranch : public RicMswItem
{
public:
RicMswBranch( const QString& label, const RimWellPath* wellPath, double initialMD = 0.0, double initialTVD = 0.0 );
virtual ~RicMswBranch() = default;
void addSegment( std::unique_ptr<RicMswSegment> segment );
void insertAfterSegment( const RicMswSegment* insertAfter, std::unique_ptr<RicMswSegment> segment );
void sortSegments();
const RimWellPath* wellPath() const;
double startMD() const override;
double startTVD() const override;
double endMD() const override;
double endTVD() const override;
int branchNumber() const;
void setBranchNumber( int branchNumber );
std::vector<const RicMswSegment*> segments() const;
std::vector<RicMswSegment*> segments();
size_t segmentCount() const;
std::vector<const RicMswBranch*> branches() const;
std::vector<RicMswBranch*> branches();
void addChildBranch( std::unique_ptr<RicMswBranch> branch );
private:
double m_initialMD;
double m_initialTVD;
int m_branchNumber;
std::vector<std::unique_ptr<RicMswSegment>> m_segments;
std::vector<std::unique_ptr<RicMswBranch>> m_branches;
const RimWellPath* m_wellPath;
};

View File

@@ -18,27 +18,22 @@
#include "RicMswCompletions.h"
#include "RicMswSubSegment.h"
#include "RicMswSegmentCellIntersection.h"
#include "RimWellPathValve.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswCompletion::RicMswCompletion( const QString& label, size_t index /* = cvf::UNDEFINED_SIZE_T */, int branchNumber /*= 0*/ )
: m_label( label )
RicMswCompletion::RicMswCompletion( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index /* = cvf::UNDEFINED_SIZE_T */ )
: RicMswBranch( label, wellPath, startMD, startTVD )
, m_index( index )
, m_branchNumber( branchNumber )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString& RicMswCompletion::label() const
{
return m_label;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -50,58 +45,12 @@ size_t RicMswCompletion::index() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RicMswCompletion::branchNumber() const
{
return m_branchNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswCompletion::setBranchNumber( int branchNumber )
{
m_branchNumber = branchNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswCompletion::addSubSegment( std::shared_ptr<RicMswSubSegment> subSegment )
{
m_subSegments.push_back( subSegment );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::shared_ptr<RicMswSubSegment>>& RicMswCompletion::subSegments()
{
return m_subSegments;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<std::shared_ptr<RicMswSubSegment>>& RicMswCompletion::subSegments() const
{
return m_subSegments;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswCompletion::setLabel( const QString& label )
{
m_label = label;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswFracture::RicMswFracture( const QString& label,
size_t index /*= cvf::UNDEFINED_SIZE_T*/,
int branchNumber /*= cvf::UNDEFINED_INT*/ )
: RicMswCompletion( label, index, branchNumber )
RicMswFracture::RicMswFracture( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index /*= cvf::UNDEFINED_SIZE_T*/ )
: RicMswCompletion( label, wellPath, startMD, startTVD, index )
{
}
@@ -116,10 +65,12 @@ RigCompletionData::CompletionType RicMswFracture::completionType() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswPerforation::RicMswPerforation( const QString& label,
size_t index /*= cvf::UNDEFINED_SIZE_T*/,
int branchNumber /*= cvf::UNDEFINED_INT*/ )
: RicMswCompletion( label, index, branchNumber )
RicMswPerforation::RicMswPerforation( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index /*= cvf::UNDEFINED_SIZE_T*/ )
: RicMswCompletion( label, wellPath, startMD, startTVD, index )
{
}
@@ -134,8 +85,12 @@ RigCompletionData::CompletionType RicMswPerforation::completionType() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswValve::RicMswValve( const QString& label, const RimWellPathValve* wellPathValve )
: RicMswCompletion( label )
RicMswValve::RicMswValve( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
: RicMswCompletion( label, wellPath, startMD, startTVD )
, m_wellPathValve( wellPathValve )
, m_valid( false )
{
@@ -168,8 +123,41 @@ void RicMswValve::setIsValid( bool valid )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswWsegValve::RicMswWsegValve( const QString& label, const RimWellPathValve* wellPathValve )
: RicMswValve( label, wellPathValve )
std::unique_ptr<RicMswValve> RicMswValve::createExportValve( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
{
std::unique_ptr<RicMswValve> outletValve;
if ( wellPathValve->componentType() == RiaDefines::WellPathComponentType::ICD )
{
outletValve = std::make_unique<RicMswPerforationICD>( label, wellPath, startMD, startTVD, wellPathValve );
}
else if ( wellPathValve->componentType() == RiaDefines::WellPathComponentType::ICV )
{
outletValve = std::make_unique<RicMswPerforationICV>( label, wellPath, startMD, startTVD, wellPathValve );
}
else if ( wellPathValve->componentType() == RiaDefines::WellPathComponentType::AICD )
{
outletValve = std::make_unique<RicMswPerforationAICD>( label, wellPath, startMD, startTVD, wellPathValve );
}
else
{
CAF_ASSERT( false && "Valve needs to be either an ICD, ICVF or AICD" );
}
return outletValve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswWsegValve::RicMswWsegValve( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
: RicMswValve( label, wellPath, startMD, startTVD, wellPathValve )
, m_flowCoefficient( 0.0 )
, m_area( 0.0 )
{
@@ -210,8 +198,12 @@ void RicMswWsegValve::setArea( double icdArea )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswFishbonesICD::RicMswFishbonesICD( const QString& label, const RimWellPathValve* wellPathValve )
: RicMswWsegValve( label, wellPathValve )
RicMswFishbonesICD::RicMswFishbonesICD( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
: RicMswWsegValve( label, wellPath, startMD, startTVD, wellPathValve )
{
setIsValid( true );
}
@@ -227,8 +219,12 @@ RigCompletionData::CompletionType RicMswFishbonesICD::completionType() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswPerforationICD::RicMswPerforationICD( const QString& label, const RimWellPathValve* wellPathValve )
: RicMswWsegValve( label, wellPathValve )
RicMswPerforationICD::RicMswPerforationICD( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
: RicMswWsegValve( label, wellPath, startMD, startTVD, wellPathValve )
{
}
@@ -243,8 +239,12 @@ RigCompletionData::CompletionType RicMswPerforationICD::completionType() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswPerforationICV::RicMswPerforationICV( const QString& label, const RimWellPathValve* wellPathValve )
: RicMswWsegValve( label, wellPathValve )
RicMswPerforationICV::RicMswPerforationICV( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
: RicMswWsegValve( label, wellPath, startMD, startTVD, wellPathValve )
{
setIsValid( true );
}
@@ -260,8 +260,12 @@ RigCompletionData::CompletionType RicMswPerforationICV::completionType() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswPerforationAICD::RicMswPerforationAICD( const QString& label, const RimWellPathValve* wellPathValve )
: RicMswValve( label, wellPathValve )
RicMswPerforationAICD::RicMswPerforationAICD( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
: RicMswValve( label, wellPath, startMD, startTVD, wellPathValve )
, m_deviceOpen( false )
, m_length( 0.0 )
, m_flowScalingFactor( 0.0 )

View File

@@ -17,7 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicMswSubSegment.h"
#include "RicMswBranch.h"
#include "RigCompletionData.h"
@@ -33,38 +33,31 @@ class RimWellPathValve;
//==================================================================================================
///
//==================================================================================================
class RicMswCompletion
class RicMswCompletion : public RicMswBranch
{
public:
RicMswCompletion( const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT );
RicMswCompletion( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index = cvf::UNDEFINED_SIZE_T );
virtual RigCompletionData::CompletionType completionType() const = 0;
const QString& label() const;
size_t index() const;
int branchNumber() const;
void setBranchNumber( int branchNumber );
void addSubSegment( std::shared_ptr<RicMswSubSegment> subSegment );
std::vector<std::shared_ptr<RicMswSubSegment>>& subSegments();
const std::vector<std::shared_ptr<RicMswSubSegment>>& subSegments() const;
void setLabel( const QString& label );
size_t index() const;
private:
QString m_label;
size_t m_index;
int m_branchNumber;
std::vector<std::shared_ptr<RicMswSubSegment>> m_subSegments;
size_t m_index;
};
class RicMswFishbones : public RicMswCompletion
{
public:
RicMswFishbones( const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT )
: RicMswCompletion( label, index, branchNumber )
RicMswFishbones( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index = cvf::UNDEFINED_SIZE_T )
: RicMswCompletion( label, wellPath, startMD, startTVD, index )
{
}
@@ -77,7 +70,11 @@ public:
class RicMswFracture : public RicMswCompletion
{
public:
RicMswFracture( const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT );
RicMswFracture( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index = cvf::UNDEFINED_SIZE_T );
RigCompletionData::CompletionType completionType() const override;
};
@@ -87,7 +84,11 @@ public:
class RicMswPerforation : public RicMswCompletion
{
public:
RicMswPerforation( const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT );
RicMswPerforation( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index = cvf::UNDEFINED_SIZE_T );
RigCompletionData::CompletionType completionType() const override;
};
@@ -97,7 +98,11 @@ public:
class RicMswValve : public RicMswCompletion
{
public:
RicMswValve( const QString& label, const RimWellPathValve* wellPathValve );
RicMswValve( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
virtual ~RicMswValve() {}
@@ -106,6 +111,12 @@ public:
bool isValid() const;
void setIsValid( bool valid );
static std::unique_ptr<RicMswValve> createExportValve( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
private:
bool m_valid;
const RimWellPathValve* m_wellPathValve;
@@ -117,7 +128,11 @@ private:
class RicMswWsegValve : public RicMswValve
{
public:
RicMswWsegValve( const QString& label, const RimWellPathValve* wellPathValve );
RicMswWsegValve( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
double flowCoefficient() const;
double area() const;
@@ -135,7 +150,11 @@ private:
class RicMswFishbonesICD : public RicMswWsegValve
{
public:
RicMswFishbonesICD( const QString& label, const RimWellPathValve* wellPathValve );
RicMswFishbonesICD( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
RigCompletionData::CompletionType completionType() const override;
};
@@ -145,7 +164,11 @@ public:
class RicMswPerforationICD : public RicMswWsegValve
{
public:
RicMswPerforationICD( const QString& label, const RimWellPathValve* wellPathValve );
RicMswPerforationICD( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
RigCompletionData::CompletionType completionType() const override;
};
@@ -155,7 +178,11 @@ public:
class RicMswPerforationICV : public RicMswWsegValve
{
public:
RicMswPerforationICV( const QString& label, const RimWellPathValve* wellPathValve );
RicMswPerforationICV( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
RigCompletionData::CompletionType completionType() const override;
};
@@ -165,7 +192,11 @@ public:
class RicMswPerforationAICD : public RicMswValve
{
public:
RicMswPerforationAICD( const QString& label, const RimWellPathValve* wellPathValve );
RicMswPerforationAICD( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
RigCompletionData::CompletionType completionType() const override;
bool isOpen() const;

View File

@@ -36,15 +36,18 @@ RicMswExportInfo::RicMswExportInfo( const RimWellPath* wellPath,
double initialMD,
const QString& lengthAndDepthText,
const QString& pressureDropText )
: m_wellPath( wellPath )
, m_initialMD( initialMD )
, m_unitSystem( unitSystem )
: m_unitSystem( unitSystem )
, m_topWellBoreVolume( RicMswExportInfo::defaultDoubleValue() )
, m_linerDiameter( RimMswCompletionParameters::defaultLinerDiameter( unitSystem ) )
, m_roughnessFactor( RimMswCompletionParameters::defaultRoughnessFactor( unitSystem ) )
, m_lengthAndDepthText( lengthAndDepthText )
, m_pressureDropText( pressureDropText )
, m_hasSubGridIntersections( false )
, m_mainBoreBranch(
std::make_unique<RicMswBranch>( "Main Stem",
wellPath,
initialMD,
-wellPath->wellPathGeometry()->interpolatedPointAlongWellPath( initialMD ).z() ) )
{
}
@@ -72,48 +75,6 @@ void RicMswExportInfo::setHasSubGridIntersections( bool subGridIntersections )
m_hasSubGridIntersections = subGridIntersections;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswExportInfo::addSegment( std::shared_ptr<RicMswSegment> location )
{
m_segments.push_back( location );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswExportInfo::sortSegments()
{
std::sort( m_segments.begin(),
m_segments.end(),
[]( std::shared_ptr<RicMswSegment> lhs, std::shared_ptr<RicMswSegment> rhs ) { return *lhs < *rhs; } );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimWellPath* RicMswExportInfo::wellPath() const
{
return m_wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswExportInfo::initialMD() const
{
return m_initialMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswExportInfo::initialTVD() const
{
return -m_wellPath->wellPathGeometry()->interpolatedPointAlongWellPath( m_initialMD ).z();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -181,15 +142,15 @@ double RicMswExportInfo::defaultDoubleValue()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<std::shared_ptr<RicMswSegment>>& RicMswExportInfo::segments() const
const RicMswBranch* RicMswExportInfo::mainBoreBranch() const
{
return m_segments;
return m_mainBoreBranch.get();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::shared_ptr<RicMswSegment>>& RicMswExportInfo::segments()
RicMswBranch* RicMswExportInfo::mainBoreBranch()
{
return m_segments;
return m_mainBoreBranch.get();
}

View File

@@ -20,6 +20,7 @@
#include "RiaDefines.h"
#include "RicMswBranch.h"
#include "RicMswSegment.h"
#include <QString>
@@ -27,7 +28,7 @@
#include <memory>
class RimWellPath;
class RimFishbonesMultipleSubs;
class RimFishbones;
//==================================================================================================
///
@@ -45,13 +46,7 @@ public:
void setRoughnessFactor( double roughnessFactor );
void setHasSubGridIntersections( bool subGridIntersections );
void addSegment( std::shared_ptr<RicMswSegment> location );
void sortSegments();
const RimWellPath* wellPath() const;
RiaDefines::EclipseUnitSystem unitSystem() const;
double initialMD() const;
double initialTVD() const;
double topWellBoreVolume() const;
double linerDiameter() const;
double roughnessFactor() const;
@@ -60,13 +55,11 @@ public:
bool hasSubGridIntersections() const;
static double defaultDoubleValue();
const std::vector<std::shared_ptr<RicMswSegment>>& segments() const;
std::vector<std::shared_ptr<RicMswSegment>>& segments();
const RicMswBranch* mainBoreBranch() const;
RicMswBranch* mainBoreBranch();
private:
const RimWellPath* m_wellPath;
RiaDefines::EclipseUnitSystem m_unitSystem;
double m_initialMD;
double m_topWellBoreVolume;
double m_linerDiameter;
double m_roughnessFactor;
@@ -74,5 +67,5 @@ private:
QString m_pressureDropText;
bool m_hasSubGridIntersections;
std::vector<std::shared_ptr<RicMswSegment>> m_segments;
std::unique_ptr<RicMswBranch> m_mainBoreBranch;
};

View File

@@ -0,0 +1,49 @@
#include "RicMswItem.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswItem::RicMswItem( const QString& label )
: m_label( label )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicMswItem::label() const
{
return m_label;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswItem::setLabel( const QString& label )
{
m_label = label;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswItem::deltaMD() const
{
return endMD() - startMD();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswItem::deltaTVD() const
{
return endTVD() - startTVD();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicMswItem::operator<( const RicMswItem& rhs ) const
{
return startMD() < rhs.startMD();
}

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QString>
class RicMswItem
{
public:
RicMswItem( const QString& label );
virtual ~RicMswItem() = default;
QString label() const;
void setLabel( const QString& label );
virtual double startMD() const = 0;
virtual double endMD() const = 0;
double deltaMD() const;
virtual double startTVD() const = 0;
virtual double endTVD() const = 0;
double deltaTVD() const;
bool operator<( const RicMswItem& rhs ) const;
protected:
QString m_label;
};

View File

@@ -15,9 +15,9 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicMswSegment.h"
#include "RicMswCompletions.h"
#include "RicMswExportInfo.h"
#include <cafPdmBase.h>
@@ -33,7 +33,7 @@ RicMswSegment::RicMswSegment( const QString& label,
double endTVD,
size_t subIndex,
int segmentNumber /*= -1*/ )
: m_label( label )
: RicMswItem( label )
, m_startMD( startMD )
, m_endMD( endMD )
, m_startTVD( startTVD )
@@ -49,14 +49,6 @@ RicMswSegment::RicMswSegment( const QString& label,
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicMswSegment::label() const
{
return m_label;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -73,38 +65,6 @@ double RicMswSegment::endMD() const
return m_endMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSegment::setOutputMD( double outputMD )
{
m_outputMD = outputMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSegment::outputMD() const
{
return m_outputMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSegment::length() const
{
return m_endMD - m_startMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSegment::deltaMD() const
{
return m_endMD - m_startMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -121,6 +81,22 @@ double RicMswSegment::endTVD() const
return m_endTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSegment::setOutputMD( double outputMD )
{
m_outputMD = outputMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSegment::outputMD() const
{
return m_outputMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -137,14 +113,6 @@ double RicMswSegment::outputTVD() const
return m_outputTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSegment::deltaTVD() const
{
return m_endTVD - m_startTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -196,17 +164,27 @@ int RicMswSegment::segmentNumber() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<std::shared_ptr<RicMswCompletion>>& RicMswSegment::completions() const
std::vector<const RicMswCompletion*> RicMswSegment::completions() const
{
return m_completions;
std::vector<const RicMswCompletion*> allCompletions;
for ( const auto& completion : m_completions )
{
allCompletions.push_back( completion.get() );
}
return allCompletions;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::shared_ptr<RicMswCompletion>>& RicMswSegment::completions()
std::vector<RicMswCompletion*> RicMswSegment::completions()
{
return m_completions;
std::vector<RicMswCompletion*> allCompletions;
for ( auto& completion : m_completions )
{
allCompletions.push_back( completion.get() );
}
return allCompletions;
}
//--------------------------------------------------------------------------------------------------
@@ -260,24 +238,51 @@ void RicMswSegment::setSegmentNumber( int segmentNumber )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSegment::addCompletion( std::shared_ptr<RicMswCompletion> completion )
void RicMswSegment::addCompletion( std::unique_ptr<RicMswCompletion> completion )
{
m_completions.push_back( completion );
m_completions.push_back( std::move( completion ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSegment::removeCompletion( std::shared_ptr<RicMswCompletion> completion )
std::unique_ptr<RicMswCompletion> RicMswSegment::removeCompletion( RicMswCompletion* completion )
{
std::unique_ptr<RicMswCompletion> removedCompletion;
for ( auto it = m_completions.begin(); it != m_completions.end(); ++it )
{
if ( ( *it ) == completion )
if ( it->get() == completion )
{
removedCompletion = std::move( *it );
m_completions.erase( it );
break;
}
}
return removedCompletion;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSegment::addIntersection( std::shared_ptr<RicMswSegmentCellIntersection> intersection )
{
m_intersections.push_back( intersection );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<std::shared_ptr<RicMswSegmentCellIntersection>>& RicMswSegment::intersections() const
{
return m_intersections;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::shared_ptr<RicMswSegmentCellIntersection>>& RicMswSegment::intersections()
{
return m_intersections;
}
//--------------------------------------------------------------------------------------------------
@@ -295,11 +300,3 @@ const caf::PdmObject* RicMswSegment::sourcePdmObject() const
{
return m_sourcePdmObject;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicMswSegment::operator<( const RicMswSegment& rhs ) const
{
return startMD() < rhs.startMD();
}

View File

@@ -17,16 +17,21 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicMswCompletions.h"
#include "RicMswItem.h"
#include "RicMswSegmentCellIntersection.h"
#include <cafPdmPointer.h>
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cvfMath.h"
#include <memory>
class RicMswCompletion;
//==================================================================================================
///
//==================================================================================================
class RicMswSegment
class RicMswSegment : public RicMswItem
{
public:
RicMswSegment( const QString& label,
@@ -37,20 +42,16 @@ public:
size_t subIndex = cvf::UNDEFINED_SIZE_T,
int segmentNumber = -1 );
QString label() const;
double startMD() const override;
double endMD() const override;
double startTVD() const override;
double endTVD() const override;
double startMD() const;
double endMD() const;
void setOutputMD( double outputMD );
double outputMD() const;
double length() const;
double deltaMD() const;
double startTVD() const;
double endTVD() const;
void setOutputTVD( double outputTVD );
double outputTVD() const;
double deltaTVD() const;
double effectiveDiameter() const;
double holeDiameter() const;
@@ -60,8 +61,8 @@ public:
size_t subIndex() const;
int segmentNumber() const;
const std::vector<std::shared_ptr<RicMswCompletion>>& completions() const;
std::vector<std::shared_ptr<RicMswCompletion>>& completions();
std::vector<const RicMswCompletion*> completions() const;
std::vector<RicMswCompletion*> completions();
void setLabel( const QString& label );
void setEffectiveDiameter( double effectiveDiameter );
@@ -69,31 +70,38 @@ public:
void setOpenHoleRoughnessFactor( double roughnessFactor );
void setSkinFactor( double skinFactor );
void setSegmentNumber( int segmentNumber );
void addCompletion( std::shared_ptr<RicMswCompletion> completion );
void removeCompletion( std::shared_ptr<RicMswCompletion> completion );
void addCompletion( std::unique_ptr<RicMswCompletion> completion );
std::unique_ptr<RicMswCompletion> removeCompletion( RicMswCompletion* completion );
void addIntersection( std::shared_ptr<RicMswSegmentCellIntersection> intersection );
const std::vector<std::shared_ptr<RicMswSegmentCellIntersection>>& intersections() const;
std::vector<std::shared_ptr<RicMswSegmentCellIntersection>>& intersections();
void setSourcePdmObject( const caf::PdmObject* object );
const caf::PdmObject* sourcePdmObject() const;
bool operator<( const RicMswSegment& rhs ) const;
private:
QString m_label;
double m_startMD;
double m_endMD;
double m_startTVD;
double m_endTVD;
double m_startMD;
double m_endMD;
double m_startTVD;
double m_endTVD;
double m_outputMD;
double m_outputTVD;
double m_effectiveDiameter;
double m_holeDiameter;
double m_openHoleRoughnessFactor;
double m_skinFactor;
double m_effectiveDiameter;
double m_holeDiameter;
double m_openHoleRoughnessFactor;
double m_skinFactor;
size_t m_subIndex;
int m_segmentNumber;
std::vector<std::shared_ptr<RicMswCompletion>> m_completions;
std::vector<std::unique_ptr<RicMswCompletion>> m_completions;
std::vector<std::shared_ptr<RicMswSegmentCellIntersection>> m_intersections;
caf::PdmPointer<caf::PdmObject> m_sourcePdmObject;
};

View File

@@ -0,0 +1,65 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicMswSegmentCellIntersection.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswSegmentCellIntersection::RicMswSegmentCellIntersection( const QString& gridName,
size_t globalCellIndex,
const cvf::Vec3st& gridLocalCellIJK,
const cvf::Vec3d& lengthsInCell )
: m_gridName( gridName )
, m_globalCellIndex( globalCellIndex )
, m_gridLocalCellIJK( gridLocalCellIJK )
, m_lengthsInCell( lengthsInCell )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString& RicMswSegmentCellIntersection::gridName() const
{
return m_gridName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RicMswSegmentCellIntersection::globalCellIndex() const
{
return m_globalCellIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3st RicMswSegmentCellIntersection::gridLocalCellIJK() const
{
return m_gridLocalCellIJK;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const cvf::Vec3d& RicMswSegmentCellIntersection::lengthsInCell() const
{
return m_lengthsInCell;
}

View File

@@ -26,10 +26,10 @@
//==================================================================================================
///
//==================================================================================================
class RicMswSubSegmentCellIntersection
class RicMswSegmentCellIntersection
{
public:
RicMswSubSegmentCellIntersection( const QString& gridName, // Pass in empty string for main grid
RicMswSegmentCellIntersection( const QString& gridName, // Pass in empty string for main grid
size_t globalCellIndex,
const cvf::Vec3st& gridLocalCellIJK,
const cvf::Vec3d& lengthsInCell );
@@ -44,35 +44,3 @@ private:
cvf::Vec3st m_gridLocalCellIJK;
cvf::Vec3d m_lengthsInCell;
};
//==================================================================================================
///
//==================================================================================================
class RicMswSubSegment
{
public:
RicMswSubSegment( double startMD, double endMD, double startTVD, double endTVD );
double startMD() const;
double endMD() const;
double deltaMD() const;
double startTVD() const;
double endTVD() const;
double deltaTVD() const;
int segmentNumber() const;
void setSegmentNumber( int segmentNumber );
void addIntersection( std::shared_ptr<RicMswSubSegmentCellIntersection> intersection );
const std::vector<std::shared_ptr<RicMswSubSegmentCellIntersection>>& intersections() const;
std::vector<std::shared_ptr<RicMswSubSegmentCellIntersection>>& intersections();
private:
double m_startMD;
double m_endMD;
double m_startTVD;
double m_endTVD;
int m_segmentNumber;
std::vector<std::shared_ptr<RicMswSubSegmentCellIntersection>> m_intersections;
};

View File

@@ -27,7 +27,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswICDAccumulator::RicMswICDAccumulator( std::shared_ptr<RicMswValve> valve, RiaDefines::EclipseUnitSystem unitSystem )
RicMswICDAccumulator::RicMswICDAccumulator( RicMswValve* valve, RiaDefines::EclipseUnitSystem unitSystem )
: RicMswValveAccumulator( valve, unitSystem )
, m_areaSum( 0.0 )
{
@@ -70,7 +70,7 @@ bool RicMswICDAccumulator::accumulateValveParameters( const RimWellPathValve* we
//--------------------------------------------------------------------------------------------------
void RicMswICDAccumulator::applyToSuperValve()
{
std::shared_ptr<RicMswWsegValve> icd = std::dynamic_pointer_cast<RicMswWsegValve>( m_valve );
auto icd = dynamic_cast<RicMswWsegValve*>( m_valve );
CVF_ASSERT( icd );
if ( m_coefficientCalculator.validAggregatedWeight() && m_valid )
@@ -84,7 +84,7 @@ void RicMswICDAccumulator::applyToSuperValve()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswAICDAccumulator::RicMswAICDAccumulator( std::shared_ptr<RicMswValve> valve, RiaDefines::EclipseUnitSystem unitSystem )
RicMswAICDAccumulator::RicMswAICDAccumulator( RicMswValve* valve, RiaDefines::EclipseUnitSystem unitSystem )
: RicMswValveAccumulator( valve, unitSystem )
, m_deviceOpen( false )
, m_accumulatedLength( 0.0 )
@@ -145,8 +145,8 @@ bool RicMswAICDAccumulator::accumulateValveParameters( const RimWellPathValve* w
//--------------------------------------------------------------------------------------------------
void RicMswAICDAccumulator::applyToSuperValve()
{
const double eps = 1.0e-8;
std::shared_ptr<RicMswPerforationAICD> aicd = std::dynamic_pointer_cast<RicMswPerforationAICD>( m_valve );
const double eps = 1.0e-8;
auto aicd = dynamic_cast<RicMswPerforationAICD*>( m_valve );
if ( aicd && m_valid && m_accumulatedLength > eps )
{

View File

@@ -22,7 +22,6 @@
#include "RimWellPathAicdParameters.h"
#include <array>
#include <memory>
class RimWellPathValve;
class RicMswValve;
@@ -33,7 +32,7 @@ class RicMswValve;
class RicMswValveAccumulator
{
public:
RicMswValveAccumulator( std::shared_ptr<RicMswValve> valve, RiaDefines::EclipseUnitSystem unitSystem )
RicMswValveAccumulator( RicMswValve* valve, RiaDefines::EclipseUnitSystem unitSystem )
: m_valve( valve )
, m_unitSystem( unitSystem )
, m_valid( false )
@@ -44,10 +43,10 @@ public:
double perforationCompsegsLength ) = 0;
virtual void applyToSuperValve() = 0;
std::shared_ptr<RicMswValve> superValve() const { return m_valve; }
RicMswValve* superValve() const { return m_valve; }
protected:
std::shared_ptr<RicMswValve> m_valve;
RicMswValve* m_valve;
RiaDefines::EclipseUnitSystem m_unitSystem;
bool m_valid;
};
@@ -58,7 +57,7 @@ protected:
class RicMswICDAccumulator : public RicMswValveAccumulator
{
public:
RicMswICDAccumulator( std::shared_ptr<RicMswValve> valve, RiaDefines::EclipseUnitSystem unitSystem );
RicMswICDAccumulator( RicMswValve* valve, RiaDefines::EclipseUnitSystem unitSystem );
bool accumulateValveParameters( const RimWellPathValve* wellPathValve,
double overlapLength,
double perforationCompsegsLength ) override;
@@ -75,7 +74,7 @@ private:
class RicMswAICDAccumulator : public RicMswValveAccumulator
{
public:
RicMswAICDAccumulator( std::shared_ptr<RicMswValve> valve, RiaDefines::EclipseUnitSystem unitSystem );
RicMswAICDAccumulator( RicMswValve* valve, RiaDefines::EclipseUnitSystem unitSystem );
bool accumulateValveParameters( const RimWellPathValve* wellPathValve,
double overlapLength,
double perforationCompsegsLength ) override;

View File

@@ -25,7 +25,7 @@
#include "RicExportFeatureImpl.h"
#include "RimDialogData.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"
#include "RimSimWellFracture.h"
@@ -87,10 +87,10 @@ void RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompl
if ( exportSettings->folder().isEmpty() ) exportSettings->folder = defaultDir;
std::vector<RimSimWellFracture*> simWellFractures;
std::vector<RimWellPathFracture*> wellPathFractures;
std::vector<RimFishbonesMultipleSubs*> wellPathFishbones;
std::vector<RimPerforationInterval*> wellPathPerforations;
std::vector<RimSimWellFracture*> simWellFractures;
std::vector<RimWellPathFracture*> wellPathFractures;
std::vector<RimFishbones*> wellPathFishbones;
std::vector<RimPerforationInterval*> wellPathPerforations;
for ( auto s : simWells )
{
@@ -222,5 +222,10 @@ std::vector<RimWellPath*> RicWellPathExportCompletionDataFeature::selectedWellPa
}
}
wellPaths.erase( std::remove_if( wellPaths.begin(),
wellPaths.end(),
[]( auto wellPath ) { return !wellPath->isTopLevelWellPath(); } ),
wellPaths.end() );
return wellPaths;
}

View File

@@ -51,8 +51,8 @@
#include "RigWellPathIntersectionTools.h"
#include "RimFileWellPath.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFractureTemplate.h"
#include "RimNonDarcyPerforationParameters.h"
#include "RimPerforationCollection.h"
@@ -298,7 +298,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
std::vector<RicWellPathFractureReportItem> reportItemsForWell;
for ( const auto& fracItem : fractureDataReportItems )
{
if ( fracItem.wellPathNameForExport() == wellPath->completions()->wellNameForExport() )
if ( fracItem.wellPathNameForExport() == wellPath->completionSettings()->wellNameForExport() )
{
reportItemsForWell.push_back( fracItem );
}
@@ -353,7 +353,8 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
std::vector<RicWellPathFractureReportItem> reportItemsForWell;
for ( const auto& fracItem : fractureDataReportItems )
{
if ( fracItem.wellPathNameForExport() == wellPath->completions()->wellNameForExport() )
if ( fracItem.wellPathNameForExport() ==
wellPath->completionSettings()->wellNameForExport() )
{
reportItemsForWell.push_back( fracItem );
}
@@ -688,7 +689,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWellPathFractureReport(
{
for ( const auto& reportItem : sortedReportItems )
{
if ( reportItem.wellPathNameForExport() == wellPath->completions()->wellNameForExport() )
if ( reportItem.wellPathNameForExport() == wellPath->completionSettings()->wellNameForExport() )
{
wellPathsSet.insert( wellPath );
}
@@ -749,22 +750,22 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspecsToFile( RimEclips
// Export
for ( const auto wellPath : wellPathSet )
{
auto rimCompletions = wellPath->completions();
auto ijIntersection = wellPathUpperGridIntersectionIJ( gridCase, wellPath );
auto completionSettings = wellPath->completionSettings();
auto ijIntersection = wellPathUpperGridIntersectionIJ( gridCase, wellPath );
formatter.add( rimCompletions->wellNameForExport() )
.add( rimCompletions->wellGroupNameForExport() )
formatter.add( completionSettings->wellNameForExport() )
.add( completionSettings->wellGroupNameForExport() )
.addOneBasedCellIndex( ijIntersection.second.x() )
.addOneBasedCellIndex( ijIntersection.second.y() )
.add( rimCompletions->referenceDepthForExport() )
.add( rimCompletions->wellTypeNameForExport() )
.add( rimCompletions->drainageRadiusForExport() )
.add( rimCompletions->gasInflowEquationForExport() )
.add( rimCompletions->automaticWellShutInForExport() )
.add( rimCompletions->allowWellCrossFlowForExport() )
.add( rimCompletions->wellBoreFluidPVTForExport() )
.add( rimCompletions->hydrostaticDensityForExport() )
.add( rimCompletions->fluidInPlaceRegionForExport() )
.add( completionSettings->referenceDepthForExport() )
.add( completionSettings->wellTypeNameForExport() )
.add( completionSettings->drainageRadiusForExport() )
.add( completionSettings->gasInflowEquationForExport() )
.add( completionSettings->automaticWellShutInForExport() )
.add( completionSettings->allowWellCrossFlowForExport() )
.add( completionSettings->wellBoreFluidPVTForExport() )
.add( completionSettings->hydrostaticDensityForExport() )
.add( completionSettings->fluidInPlaceRegionForExport() )
.rowCompleted();
}
@@ -839,22 +840,22 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile(
std::tie( measuredDepth, ijIntersection, lgrName ) = itemWithLowestMD;
auto rimCompletions = wellPath->completions();
auto completionSettings = wellPath->completionSettings();
formatter.add( rimCompletions->wellNameForExport() )
.add( rimCompletions->wellGroupNameForExport() )
formatter.add( completionSettings->wellNameForExport() )
.add( completionSettings->wellGroupNameForExport() )
.add( lgrName )
.addOneBasedCellIndex( ijIntersection.x() )
.addOneBasedCellIndex( ijIntersection.y() )
.add( rimCompletions->referenceDepthForExport() )
.add( rimCompletions->wellTypeNameForExport() )
.add( rimCompletions->drainageRadiusForExport() )
.add( rimCompletions->gasInflowEquationForExport() )
.add( rimCompletions->automaticWellShutInForExport() )
.add( rimCompletions->allowWellCrossFlowForExport() )
.add( rimCompletions->wellBoreFluidPVTForExport() )
.add( rimCompletions->hydrostaticDensityForExport() )
.add( rimCompletions->fluidInPlaceRegionForExport() )
.add( completionSettings->referenceDepthForExport() )
.add( completionSettings->wellTypeNameForExport() )
.add( completionSettings->drainageRadiusForExport() )
.add( completionSettings->gasInflowEquationForExport() )
.add( completionSettings->automaticWellShutInForExport() )
.add( completionSettings->allowWellCrossFlowForExport() )
.add( completionSettings->wellBoreFluidPVTForExport() )
.add( completionSettings->hydrostaticDensityForExport() )
.add( completionSettings->fluidInPlaceRegionForExport() )
.rowCompleted();
}
}
@@ -1190,7 +1191,7 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeatureImpl::gener
bool cellIsActive = activeCellInfo->isActive( cell.globCellIndex );
if ( !cellIsActive ) continue;
RigCompletionData completion( wellPath->completions()->wellNameForExport(),
RigCompletionData completion( wellPath->completionSettings()->wellNameForExport(),
RigCompletionDataGridCell( cell.globCellIndex,
settings.caseToApply->mainGrid() ),
cell.startMD );

View File

@@ -38,7 +38,7 @@ class RigCell;
class RigEclipseCaseData;
class RigMainGrid;
class RimEclipseCase;
class RimFishbonesMultipleSubs;
class RimFishbones;
class RimSimWellInView;
class RimPerforationInterval;
class RimWellPath;

View File

@@ -88,7 +88,7 @@ const RimWellPath* RicWellPathExportCompletionsFileTools::findWellPathFromExport
for ( const auto wellPath : allWellPaths )
{
if ( wellPath->completions()->wellNameForExport() == wellNameForExport ) return wellPath;
if ( wellPath->completionSettings()->wellNameForExport() == wellNameForExport ) return wellPath;
}
return nullptr;
}

View File

@@ -17,16 +17,21 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicMswBranch.h"
#include "RicMswCompletions.h"
#include "RicMswExportInfo.h"
#include "RicMswSegment.h"
#include "RigCompletionData.h"
#include <gsl/gsl>
#include <set>
class RicExportCompletionDataSettingsUi;
class RifTextDataTableFormatter;
class RigActiveCellInfo;
class RimEclipseCase;
class RimFishbonesMultipleSubs;
class RimFishbones;
class RimPerforationInterval;
class RimWellPath;
class RimWellPathValve;
@@ -40,6 +45,24 @@ class QFile;
class RicWellPathExportMswCompletionsImpl
{
private:
class CvfVec3stComparator
{
public:
bool operator()( const cvf::Vec3st& lhs, const cvf::Vec3st& rhs ) const
{
if ( lhs.z() == rhs.z() )
{
if ( lhs.y() == rhs.y() )
{
return lhs.x() < rhs.x();
}
return lhs.y() < rhs.y();
}
return lhs.z() < rhs.z();
}
};
public:
static void exportWellSegmentsForAllCompletions( const RicExportCompletionDataSettingsUi& exportSettings,
const std::vector<RimWellPath*>& wellPaths );
@@ -57,15 +80,23 @@ public:
const RimWellPath* wellPath,
int timeStep );
static RicMswExportInfo generateFishbonesMswExportInfo( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
bool enableSegmentSplitting );
static void generateFishbonesMswExportInfo( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
bool enableSegmentSplitting,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
private:
static RicMswExportInfo generateFishbonesMswExportInfo( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs,
bool enableSegmentSplitting );
static void generateFishbonesMswExportInfo( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
const std::vector<RimFishbones*>& fishbonesSubs,
bool enableSegmentSplitting,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static RicMswExportInfo generateFracturesMswExportInfo( RimEclipseCase* caseToApply, const RimWellPath* wellPath );
@@ -73,14 +104,17 @@ private:
const RimWellPath* wellPath,
const std::vector<RimWellPathFracture*>& fractures );
static RicMswExportInfo
generatePerforationsMswExportInfo( RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
int timeStep,
const std::vector<const RimPerforationInterval*>& perforationIntervals );
static bool generatePerforationsMswExportInfo( RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
int timeStep,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static std::vector<WellPathCellIntersectionInfo>
generateCellSegments( const RimEclipseCase* eclipseCase, const RimWellPath* wellPath, double& initialMD );
static std::vector<WellPathCellIntersectionInfo> generateCellSegments( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
gsl::not_null<double*> initialMD );
static std::vector<WellPathCellIntersectionInfo>
filterIntersections( const std::vector<WellPathCellIntersectionInfo>& intersections,
@@ -89,46 +123,52 @@ private:
gsl::not_null<const RimEclipseCase*> eclipseCase );
static void generateWelsegsTable( RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
RicMswExportInfo& exportInfo,
double maxSegmentLength );
static void writeMainBoreWelsegsSegment( std::shared_ptr<RicMswSegment> segment,
std::shared_ptr<RicMswSegment> previousSegment,
RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
double maxSegmentLength,
int* segmentNumber );
static void writeValveWelsegsSegment( std::shared_ptr<RicMswSegment> segment,
std::shared_ptr<RicMswValve> valve,
RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
double maxSegmentLength,
int* segmentNumber );
static void writeCompletionWelsegsSegment( std::shared_ptr<RicMswSegment> segment,
std::shared_ptr<RicMswCompletion> completion,
RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
double maxSegmentLength,
int* segmentNumber );
static void writeWelsegsSegmentsRecursively( RifTextDataTableFormatter& formatter,
RicMswExportInfo& exportInfo,
gsl::not_null<RicMswBranch*> branch,
gsl::not_null<int*> segmentNumber,
double maxSegmentLength,
RicMswSegment* connectedToSegment = nullptr );
static void generateWelsegsSegments( RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
const std::set<RigCompletionData::CompletionType>& exportCompletionTypes,
double maxSegmentLength,
int* segmentNumber );
static void generateWelsegsCompletionCommentHeader( RifTextDataTableFormatter& formatter,
RigCompletionData::CompletionType completionType );
static void generateCompsegTables( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo );
static void writeWelsegsSegment( RicMswSegment* segment,
const RicMswSegment* previousSegment,
RifTextDataTableFormatter& formatter,
RicMswExportInfo& exportInfo,
double maxSegmentLength,
gsl::not_null<RicMswBranch*> branch,
int* segmentNumber );
static void writeValveWelsegsSegment( const RicMswSegment* outletSegment,
RicMswValve* valve,
RifTextDataTableFormatter& formatter,
RicMswExportInfo& exportInfo,
double maxSegmentLength,
int* segmentNumber );
static void writeCompletionWelsegsSegments( gsl::not_null<const RicMswSegment*> outletSegment,
gsl::not_null<const RicMswCompletion*> completion,
RifTextDataTableFormatter& formatter,
RicMswExportInfo& exportInfo,
double maxSegmentLength,
int* segmentNumber );
static void writeWelsegsCompletionCommentHeader( RifTextDataTableFormatter& formatter,
RigCompletionData::CompletionType completionType );
static void generateCompsegTables( RifTextDataTableFormatter& formatter, RicMswExportInfo& exportInfo );
static void generateCompsegTable( RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
RicMswExportInfo& exportInfo,
gsl::not_null<const RicMswBranch*> branch,
bool exportSubGridIntersections,
const std::set<RigCompletionData::CompletionType>& exportCompletionTypes );
const std::set<RigCompletionData::CompletionType>& exportCompletionTypes,
gsl::not_null<bool*> headerGenerated,
gsl::not_null<std::set<cvf::Vec3st, CvfVec3stComparator>*> intersectedCells );
static void generateCompsegHeader( RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
RicMswExportInfo& exportInfo,
RigCompletionData::CompletionType completionType,
bool exportSubGridIntersections );
static void generateWsegvalvTable( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo );
static void generateWsegAicdTable( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo );
static void generateWsegvalvTable( RifTextDataTableFormatter& formatter, RicMswExportInfo& exportInfo );
static void generateWsegAicdTable( RifTextDataTableFormatter& formatter, RicMswExportInfo& exportInfo );
static std::pair<double, double>
calculateOverlapWithActiveCells( double startMD,
@@ -137,67 +177,73 @@ private:
const RigActiveCellInfo* activeCellInfo );
private:
typedef std::vector<std::shared_ptr<RicMswSegment>> MainBoreSegments;
typedef std::map<std::shared_ptr<RicMswCompletion>, std::vector<const RimWellPathValve*>> ValveContributionMap;
static std::vector<std::pair<double, double>>
createSubSegmentMDPairs( double startMD, double endMD, double maxSegmentLength );
static MainBoreSegments
createMainBoreSegmentsForPerforations( const std::vector<WellPathCellIntersectionInfo>& cellSegmentIntersections,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
const RimWellPath* wellPath,
int timeStep,
RimEclipseCase* eclipseCase,
bool* foundSubGridIntersections );
static void createWellPathSegments( gsl::not_null<RicMswBranch*> branch,
const std::vector<WellPathCellIntersectionInfo>& cellSegmentIntersections,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
const RimWellPath* wellPath,
int timeStep,
const RimEclipseCase* eclipseCase,
bool* foundSubGridIntersections );
static void createValveCompletions( std::vector<std::shared_ptr<RicMswSegment>>& mainBoreSegments,
static void createValveCompletions( gsl::not_null<RicMswBranch*> branch,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
const RimWellPath* wellPath,
RiaDefines::EclipseUnitSystem unitSystem );
static void
assignValveContributionsToSuperICDsOrAICDs( const std::vector<std::shared_ptr<RicMswSegment>>& mainBoreSegments,
assignValveContributionsToSuperICDsOrAICDs( gsl::not_null<RicMswBranch*> branch,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
const std::vector<WellPathCellIntersectionInfo>& wellPathIntersections,
const RigActiveCellInfo* activeCellInfo,
RiaDefines::EclipseUnitSystem unitSystem );
static void moveIntersectionsToICVs( const std::vector<std::shared_ptr<RicMswSegment>>& mainBoreSegments,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
RiaDefines::EclipseUnitSystem unitSystem );
static void moveIntersectionsToICVs( gsl::not_null<RicMswBranch*> branch,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
RiaDefines::EclipseUnitSystem unitSystem );
static void moveIntersectionsToSuperICDsOrAICDs( MainBoreSegments mainBoreSegments );
static void moveIntersectionsToSuperICDsOrAICDs( gsl::not_null<RicMswBranch*> branch );
static void assignFishbonesLateralIntersections( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
const RimFishbonesMultipleSubs* fishbonesSubs,
std::shared_ptr<RicMswSegment> segment,
bool* foundSubGridIntersections,
double maxSegmentLength );
static void assignFishbonesLateralIntersections( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
const RimFishbones* fishbonesSubs,
gsl::not_null<RicMswSegment*> segment,
bool* foundSubGridIntersections,
double maxSegmentLength );
static void assignFractureCompletionsToCellSegment( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
const RimWellPathFracture* fracture,
const std::vector<RigCompletionData>& completionData,
std::shared_ptr<RicMswSegment> segment,
gsl::not_null<RicMswSegment*> segment,
bool* foundSubGridIntersections );
static std::vector<RigCompletionData>
generatePerforationIntersections( gsl::not_null<const RimWellPath*> wellPath,
gsl::not_null<const RimPerforationInterval*> perforationInterval,
int timeStep,
gsl::not_null<RimEclipseCase*> eclipseCase );
gsl::not_null<const RimEclipseCase*> eclipseCase );
static void assignPerforationIntersections( const std::vector<RigCompletionData>& completionData,
std::shared_ptr<RicMswCompletion> perforationCompletion,
gsl::not_null<RicMswCompletion*> perforationCompletion,
const WellPathCellIntersectionInfo& cellIntInfo,
double overlapStart,
double overlapEnd,
bool* foundSubGridIntersections );
static void
assignBranchNumbers( const RimEclipseCase* caseToApply, std::shared_ptr<RicMswSegment> segment, int* branchNum );
static void assignBranchNumbers( const RimEclipseCase* caseToApply, RicMswExportInfo* exportInfo );
static void assignBranchNumbersToPerforations( const RimEclipseCase* caseToApply,
gsl::not_null<RicMswSegment*> segment,
gsl::not_null<int*> branchNumber );
static void assignBranchNumbersToOtherCompletions( const RimEclipseCase* caseToApply,
gsl::not_null<RicMswSegment*> segment,
gsl::not_null<int*> branchNumber );
static void assignBranchNumbersToBranch( const RimEclipseCase* caseToApply,
RicMswExportInfo* exportInfo,
gsl::not_null<RicMswBranch*> branch,
gsl::not_null<int*> branchNumber );
static double tvdFromMeasuredDepth( gsl::not_null<const RimWellPath*> wellPath, double measuredDepth );
};

View File

@@ -253,7 +253,7 @@ QString RicWellPathFractureTextReportFeatureImpl::createWellFileLocationText( co
auto fileWellPath = dynamic_cast<RimFileWellPath*>( wellPath );
if ( fileWellPath )
{
formatter.add( wellPath->completions()->wellNameForExport() );
formatter.add( wellPath->completionSettings()->wellNameForExport() );
formatter.add( fileWellPath->filePath() );
formatter.rowCompleted();
}
@@ -564,7 +564,7 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureInstancesText(
fracture->firstAncestorOrThisOfType( wellPath );
if ( wellPath )
{
wellName = wellPath->completions()->wellNameForExport();
wellName = wellPath->completionSettings()->wellNameForExport();
}
formatter.add( wellName );

View File

@@ -48,7 +48,7 @@
#include "RiuPlotMainWindow.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RimPerforationInterval.h"
#include "RimWellPathFracture.h"
@@ -236,7 +236,7 @@ QString completionName( const caf::PdmObject* object )
{
auto perf = dynamic_cast<const RimPerforationInterval*>( object );
auto frac = dynamic_cast<const RimFracture*>( object );
auto fish = dynamic_cast<const RimFishbonesMultipleSubs*>( object );
auto fish = dynamic_cast<const RimFishbones*>( object );
QString name;
if ( perf )

View File

@@ -118,7 +118,7 @@ void RicNewWellPathFractureFeature::onActionTriggered( bool isChecked )
RimWellPath* wellPath = nullptr;
fractureColl->firstAncestorOrThisOfTypeAsserted( wellPath );
double defaultMeasuredDepth = 0.0f;
double defaultMeasuredDepth = wellPath->uniqueStartMD();
RicNewWellPathFractureFeature::addFracture( wellPath, defaultMeasuredDepth );
}

View File

@@ -22,7 +22,6 @@
#include "RicWellTarget3dEditor.h"
#include "RimWellPathGeometryDef.h"
#include "RimWellPathLateralGeometryDef.h"
#include "RimWellPathTarget.h"
#include "cafPickEventHandler.h"
@@ -56,7 +55,7 @@ RicWellPathGeometry3dEditor::~RicWellPathGeometry3dEditor()
//--------------------------------------------------------------------------------------------------
void RicWellPathGeometry3dEditor::configureAndUpdateUi( const QString& uiConfigName )
{
RimWellPathGeometryDefInterface* geomDef = dynamic_cast<RimWellPathGeometryDefInterface*>( this->pdmObject() );
RimWellPathGeometryDef* geomDef = dynamic_cast<RimWellPathGeometryDef*>( this->pdmObject() );
for ( auto targetEditor : m_targetEditors )
{

View File

@@ -24,7 +24,6 @@
#include "RimCase.h"
#include "RimModeledWellPath.h"
#include "RimWellPathGeometryDef.h"
#include "RimWellPathLateralGeometryDef.h"
#include "RimWellPathTarget.h"
#include "RiuViewer.h"
@@ -86,7 +85,7 @@ void RicWellTarget3dEditor::configureAndUpdateUi( const QString& uiConfigName )
return;
}
RimWellPathGeometryDefInterface* geomDef;
RimWellPathGeometryDef* geomDef;
target->firstAncestorOrThisOfTypeAsserted( geomDef );
target->m_targetType.uiCapability()->addFieldEditor( this );
@@ -153,7 +152,7 @@ void RicWellTarget3dEditor::slotUpdated( const cvf::Vec3d& origin, const cvf::Ve
cvf::ref<caf::DisplayCoordTransform> dispXf = view->displayCoordTransform();
RimWellPathGeometryDefInterface* geomDef;
RimWellPathGeometryDef* geomDef;
target->firstAncestorOrThisOfTypeAsserted( geomDef );
cvf::Vec3d domainOrigin = dispXf->transformToDomainCoord( origin ) - geomDef->anchorPointXyz();

View File

@@ -34,7 +34,6 @@
#include "RimModeledWellPath.h"
#include "RimWellPath.h"
#include "RimWellPathGeometryDef.h"
#include "RimWellPathLateralGeometryDef.h"
#include "RimWellPathTarget.h"
#include "RiuViewerCommands.h"
@@ -56,8 +55,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicCreateWellTargetsPickEventHandler::RicCreateWellTargetsPickEventHandler(
gsl::not_null<RimWellPathGeometryDefInterface*> wellGeometryDef )
RicCreateWellTargetsPickEventHandler::RicCreateWellTargetsPickEventHandler( gsl::not_null<RimWellPathGeometryDef*> wellGeometryDef )
: m_geometryToAddTargetsTo( wellGeometryDef )
{
}
@@ -97,55 +95,94 @@ bool RicCreateWellTargetsPickEventHandler::handle3dPickEvent( const Ric3dPickEve
cvf::Vec3d targetPointInDomain = cvf::Vec3d::ZERO;
// If clicked on an other well path, snap target point to well path center line
auto firstPickItem = eventObject.m_pickItemInfos.front();
auto firstPickItem = eventObject.m_pickItemInfos.front();
auto wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>( firstPickItem.sourceInfo() );
auto intersectionPointInDomain =
rimView->displayCoordTransform()->transformToDomainCoord( firstPickItem.globalPickedPoint() );
bool doSetAzimuthAndInclination = false;
double azimuth = 0.0;
double inclination = 0.0;
double azimuth = std::numeric_limits<double>::infinity();
double inclination = std::numeric_limits<double>::infinity();
auto wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>( firstPickItem.sourceInfo() );
if ( isValidWellPathSourceObject( wellPathSourceInfo ) )
if ( wellPathSourceInfo && wellPathSourceInfo->wellPath() && wellPathSourceInfo->wellPath()->wellPathGeometry() )
{
calculateWellPathGeometryAtPickPoint( firstPickItem,
wellPathSourceInfo,
intersectionPointInDomain,
&targetPointInDomain,
&azimuth,
&inclination );
auto wellPathGeometry = wellPathSourceInfo->wellPath()->wellPathGeometry();
targetPointInDomain =
wellPathSourceInfo->closestPointOnCenterLine( firstPickItem.faceIdx(), intersectionPointInDomain );
double md = wellPathSourceInfo->measuredDepth( firstPickItem.faceIdx(), intersectionPointInDomain );
doSetAzimuthAndInclination = calculateAzimuthAndInclinationAtMd( md, wellPathGeometry, &azimuth, &inclination );
double rkbDiff = wellPathGeometry->rkbDiff();
if ( m_geometryToAddTargetsTo->airGap() == 0.0 && rkbDiff != std::numeric_limits<double>::infinity() )
{
m_geometryToAddTargetsTo->setAirGap( rkbDiff );
}
}
else if ( isGridSourceObject( firstPickItem.sourceInfo() ) )
{
targetPointInDomain = calculateGridPickPoint( rimView, firstPickItem, intersectionPointInDomain );
targetPointInDomain = intersectionPointInDomain;
doSetAzimuthAndInclination = false;
cvf::Vec3d domainRayOrigin =
rimView->displayCoordTransform()->transformToDomainCoord( firstPickItem.globalRayOrigin() );
cvf::Vec3d domainRayEnd = targetPointInDomain + ( targetPointInDomain - domainRayOrigin );
cvf::Vec3d hexElementIntersection =
findHexElementIntersection( rimView, firstPickItem, domainRayOrigin, domainRayEnd );
CVF_TIGHT_ASSERT( !hexElementIntersection.isUndefined() );
if ( !hexElementIntersection.isUndefined() )
{
targetPointInDomain = hexElementIntersection;
}
}
else
{
targetPointInDomain = intersectionPointInDomain;
targetPointInDomain = intersectionPointInDomain;
doSetAzimuthAndInclination = false;
}
if ( auto wellPathGeometryDef = dynamic_cast<RimWellPathGeometryDef*>( m_geometryToAddTargetsTo.p() );
wellPathGeometryDef )
if ( !m_geometryToAddTargetsTo->firstActiveTarget() )
{
addNewTargetToModeledWellPath( firstPickItem,
wellPathGeometryDef,
intersectionPointInDomain,
targetPointInDomain,
azimuth,
inclination );
m_geometryToAddTargetsTo->setReferencePointXyz( targetPointInDomain );
if ( wellPathSourceInfo )
{
double mdAtFirstTarget =
wellPathSourceInfo->measuredDepth( firstPickItem.faceIdx(), intersectionPointInDomain );
RimModeledWellPath* modeledWellPath = dynamic_cast<RimModeledWellPath*>( wellPathSourceInfo->wellPath() );
if ( modeledWellPath )
{
mdAtFirstTarget += modeledWellPath->geometryDefinition()->mdAtFirstTarget();
}
m_geometryToAddTargetsTo->setMdAtFirstTarget( mdAtFirstTarget );
}
}
else if ( auto wellPathLateralGeometryDef =
dynamic_cast<RimWellPathLateralGeometryDef*>( m_geometryToAddTargetsTo.p() );
wellPathLateralGeometryDef )
cvf::Vec3d referencePoint = m_geometryToAddTargetsTo->anchorPointXyz();
cvf::Vec3d relativeTagetPoint = targetPointInDomain - referencePoint;
RimWellPathTarget* newTarget = new RimWellPathTarget;
if ( doSetAzimuthAndInclination )
{
addNewTargetToModeledWellPathLateral( firstPickItem,
wellPathLateralGeometryDef,
intersectionPointInDomain,
targetPointInDomain,
azimuth,
inclination );
newTarget->setAsPointXYZAndTangentTarget( cvf::Vec3d( relativeTagetPoint.x(),
relativeTagetPoint.y(),
relativeTagetPoint.z() ),
azimuth,
inclination );
}
else
{
newTarget->setAsPointTargetXYD(
cvf::Vec3d( relativeTagetPoint.x(), relativeTagetPoint.y(), -relativeTagetPoint.z() ) );
}
m_geometryToAddTargetsTo->insertTarget( nullptr, newTarget );
m_geometryToAddTargetsTo->updateConnectedEditors();
m_geometryToAddTargetsTo->updateWellPathVisualization( true );
return true; // Todo: See if we really should eat the event instead
}
@@ -206,155 +243,6 @@ bool RicCreateWellTargetsPickEventHandler::calculateAzimuthAndInclinationAtMd( d
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateWellTargetsPickEventHandler::calculateWellPathGeometryAtPickPoint(
const RiuPickItemInfo& pickItem,
gsl::not_null<const RivWellPathSourceInfo*> wellPathSourceInfo,
const cvf::Vec3d& intersectionPointInDomain,
gsl::not_null<cvf::Vec3d*> targetPointInDomain,
gsl::not_null<double*> azimuth,
gsl::not_null<double*> inclination ) const
{
*targetPointInDomain = wellPathSourceInfo->closestPointOnCenterLine( pickItem.faceIdx(), intersectionPointInDomain );
bool doSetAzimuthAndInclination = false;
auto wellPathGeometry = wellPathSourceInfo->wellPath()->wellPathGeometry();
if ( wellPathGeometry )
{
double md = wellPathSourceInfo->measuredDepth( pickItem.faceIdx(), intersectionPointInDomain );
doSetAzimuthAndInclination = calculateAzimuthAndInclinationAtMd( md, wellPathGeometry, azimuth, inclination );
double rkbDiff = wellPathGeometry->rkbDiff();
auto wellPathGeometryDef = dynamic_cast<RimWellPathGeometryDef*>( m_geometryToAddTargetsTo.p() );
if ( wellPathGeometryDef && wellPathGeometryDef->airGap() == 0.0 &&
rkbDiff != std::numeric_limits<double>::infinity() )
{
wellPathGeometryDef->setAirGap( rkbDiff );
}
}
return doSetAzimuthAndInclination;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RicCreateWellTargetsPickEventHandler::calculateGridPickPoint( gsl::not_null<const Rim3dView*> rimView,
const RiuPickItemInfo& pickItem,
const cvf::Vec3d& intersectionPointInDomain ) const
{
auto targetPointInDomain = intersectionPointInDomain;
cvf::Vec3d domainRayOrigin = rimView->displayCoordTransform()->transformToDomainCoord( pickItem.globalRayOrigin() );
cvf::Vec3d domainRayEnd = targetPointInDomain + ( targetPointInDomain - domainRayOrigin );
cvf::Vec3d hexElementIntersection = findHexElementIntersection( rimView, pickItem, domainRayOrigin, domainRayEnd );
CVF_TIGHT_ASSERT( !hexElementIntersection.isUndefined() );
if ( !hexElementIntersection.isUndefined() )
{
targetPointInDomain = hexElementIntersection;
}
return targetPointInDomain;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateWellTargetsPickEventHandler::addNewTargetToModeledWellPath( const RiuPickItemInfo& pickItem,
gsl::not_null<RimWellPathGeometryDef*> wellPathGeometryDef,
const cvf::Vec3d& intersectionPointInDomain,
const cvf::Vec3d& targetPointInDomain,
double azimuth,
double inclination )
{
if ( !m_geometryToAddTargetsTo->firstActiveTarget() )
{
wellPathGeometryDef->setReferencePointXyz( targetPointInDomain );
auto wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>( pickItem.sourceInfo() );
if ( wellPathSourceInfo )
{
double mdAtFirstTarget = wellPathSourceInfo->measuredDepth( pickItem.faceIdx(), intersectionPointInDomain );
RimModeledWellPath* modeledWellPath = dynamic_cast<RimModeledWellPath*>( wellPathSourceInfo->wellPath() );
if ( modeledWellPath )
{
mdAtFirstTarget += modeledWellPath->geometryDefinition()->mdAtFirstTarget();
}
wellPathGeometryDef->setMdAtFirstTarget( mdAtFirstTarget );
}
}
cvf::Vec3d referencePoint = wellPathGeometryDef->anchorPointXyz();
cvf::Vec3d relativeTargetPoint = targetPointInDomain - referencePoint;
RimWellPathTarget* newTarget = new RimWellPathTarget;
bool doSetAzimuthAndInclination = azimuth != std::numeric_limits<double>::infinity() &&
inclination != std::numeric_limits<double>::infinity();
if ( doSetAzimuthAndInclination )
{
newTarget->setAsPointXYZAndTangentTarget( relativeTargetPoint, azimuth, inclination );
}
else
{
newTarget->setAsPointTargetXYD(
cvf::Vec3d( relativeTargetPoint.x(), relativeTargetPoint.y(), -relativeTargetPoint.z() ) );
}
m_geometryToAddTargetsTo->insertTarget( nullptr, newTarget );
m_geometryToAddTargetsTo->updateConnectedEditors();
m_geometryToAddTargetsTo->updateWellPathVisualization( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateWellTargetsPickEventHandler::addNewTargetToModeledWellPathLateral(
const RiuPickItemInfo& pickItem,
gsl::not_null<RimWellPathLateralGeometryDef*> wellPathLateralGeometryDef,
const cvf::Vec3d& intersectionPointInDomain,
const cvf::Vec3d& targetPointInDomain,
double azimuth,
double inclination )
{
auto wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>( pickItem.sourceInfo() );
if ( wellPathSourceInfo )
{
double mdAtConnection = wellPathSourceInfo->measuredDepth( pickItem.faceIdx(), intersectionPointInDomain );
wellPathLateralGeometryDef->setParentGeometry( wellPathSourceInfo->wellPath()->wellPathGeometry() );
wellPathLateralGeometryDef->setMdAtConnection( mdAtConnection );
}
cvf::Vec3d referencePoint = wellPathLateralGeometryDef->anchorPointXyz();
cvf::Vec3d relativeTargetPoint = targetPointInDomain - referencePoint;
RimWellPathTarget* newTarget = new RimWellPathTarget;
bool doSetAzimuthAndInclination = azimuth != std::numeric_limits<double>::infinity() &&
inclination != std::numeric_limits<double>::infinity();
if ( doSetAzimuthAndInclination )
{
newTarget->setAsPointXYZAndTangentTarget( cvf::Vec3d( relativeTargetPoint.x(),
relativeTargetPoint.y(),
relativeTargetPoint.z() ),
azimuth,
inclination );
}
else
{
newTarget->setAsPointTargetXYD(
cvf::Vec3d( relativeTargetPoint.x(), relativeTargetPoint.y(), -relativeTargetPoint.z() ) );
}
m_geometryToAddTargetsTo->insertTarget( nullptr, newTarget );
m_geometryToAddTargetsTo->updateConnectedEditors();
m_geometryToAddTargetsTo->updateWellPathVisualization( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -368,18 +256,10 @@ bool RicCreateWellTargetsPickEventHandler::isGridSourceObject( const cvf::Object
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateWellTargetsPickEventHandler::isValidWellPathSourceObject( const RivWellPathSourceInfo* wellPathSourceInfo )
{
return wellPathSourceInfo && wellPathSourceInfo->wellPath() && wellPathSourceInfo->wellPath()->wellPathGeometry();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection( gsl::not_null<const Rim3dView*> view,
const RiuPickItemInfo& pickItem,
const cvf::Vec3d& domainRayOrigin,
const cvf::Vec3d& domainRayEnd )
cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection( gsl::not_null<Rim3dView*> view,
const RiuPickItemInfo& pickItem,
const cvf::Vec3d& domainRayOrigin,
const cvf::Vec3d& domainRayEnd )
{
auto sourceInfo = dynamic_cast<const RivSourceInfo*>( pickItem.sourceInfo() );
auto femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>( pickItem.sourceInfo() );
@@ -393,7 +273,7 @@ cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection( gsl
{
cellIndex = sourceInfo->m_cellFaceFromTriangleMapper->cellIndex( pickItem.faceIdx() );
const RimEclipseView* eclipseView = dynamic_cast<const RimEclipseView*>( view.get() );
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( view.get() );
if ( eclipseView && eclipseView->mainGrid() )
{
RigGridBase* hitGrid = eclipseView->mainGrid()->gridByIndex( gridIndex );
@@ -408,11 +288,11 @@ cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection( gsl
{
size_t elementIndex = femSourceInfo->triangleToElmMapper()->elementIndex( pickItem.faceIdx() );
const RimGeoMechView* geoMechView = dynamic_cast<const RimGeoMechView*>( view.get() );
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view.get() );
if ( geoMechView && geoMechView->femParts() )
{
const RigFemPart* femPart = geoMechView->femParts()->part( femPartIndex );
RigElementType elType = femPart->elementType( elementIndex );
RigFemPart* femPart = geoMechView->femParts()->part( femPartIndex );
RigElementType elType = femPart->elementType( elementIndex );
if ( elType == HEX8 || elType == HEX8P )
{

View File

@@ -24,12 +24,8 @@
#include <gsl/gsl>
class RimWellPathGeometryDefInterface;
class RigWellPath;
class RiuPickItemInfo;
class RivWellPathSourceInfo;
class RimWellPathGeometryDef;
class RimWellPathLateralGeometryDef;
class RigWellPath;
//==================================================================================================
///
@@ -37,7 +33,7 @@ class RimWellPathLateralGeometryDef;
class RicCreateWellTargetsPickEventHandler : public Ric3dViewPickEventHandler
{
public:
RicCreateWellTargetsPickEventHandler( gsl::not_null<RimWellPathGeometryDefInterface*> wellGeometryDef );
RicCreateWellTargetsPickEventHandler( gsl::not_null<RimWellPathGeometryDef*> wellGeometryDef );
~RicCreateWellTargetsPickEventHandler();
void registerAsPickEventHandler() override;
@@ -51,38 +47,13 @@ private:
gsl::not_null<const RigWellPath*> wellPathGeometry,
double* azimuth,
double* inclination ) const;
bool calculateWellPathGeometryAtPickPoint( const RiuPickItemInfo& pickItem,
gsl::not_null<const RivWellPathSourceInfo*> sourceInfo,
const cvf::Vec3d& intersectionPointInDomain,
gsl::not_null<cvf::Vec3d*> targetPointInDomain,
gsl::not_null<double*> azimuth,
gsl::not_null<double*> inclination ) const;
cvf::Vec3d calculateGridPickPoint( gsl::not_null<const Rim3dView*> rimView,
const RiuPickItemInfo& pickItem,
const cvf::Vec3d& intersectionPointInDomain ) const;
void addNewTargetToModeledWellPath( const RiuPickItemInfo& pickItem,
gsl::not_null<RimWellPathGeometryDef*> wellPathGeometryDef,
const cvf::Vec3d& intersectionPointInDomain,
const cvf::Vec3d& targetPointInDomain,
double azimuth,
double inclination );
void addNewTargetToModeledWellPathLateral( const RiuPickItemInfo& pickItem,
gsl::not_null<RimWellPathLateralGeometryDef*> wellPathLateralGeometryDef,
const cvf::Vec3d& intersectionPointInDomain,
const cvf::Vec3d& targetPointInDomain,
double azimuth,
double inclination );
static bool isGridSourceObject( const cvf::Object* object );
static bool isValidWellPathSourceObject( const RivWellPathSourceInfo* sourceInfo );
static cvf::Vec3d findHexElementIntersection( gsl::not_null<const Rim3dView*> view,
const RiuPickItemInfo& pickItem,
const cvf::Vec3d& domainRayOrigin,
const cvf::Vec3d& domainRayEnd );
static cvf::Vec3d findHexElementIntersection( gsl::not_null<Rim3dView*> view,
const RiuPickItemInfo& pickItem,
const cvf::Vec3d& domainRayOrigin,
const cvf::Vec3d& domainRayEnd );
private:
caf::PdmPointer<RimWellPathGeometryDefInterface> m_geometryToAddTargetsTo;
caf::PdmPointer<RimWellPathGeometryDef> m_geometryToAddTargetsTo;
};

View File

@@ -20,15 +20,16 @@
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RigWellPath.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimModeledWellPathLateral.h"
#include "RimModeledWellPath.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPathGeometryDef.h"
#include "RimWellPathGroup.h"
#include "RimWellPathLateralGeometryDef.h"
#include "RimWellPathTarget.h"
#include "Riu3DMainWindowTools.h"
#include "Riu3dSelectionManager.h"
@@ -74,18 +75,17 @@ void RicNewWellPathLateralAtDepthFeature::onActionTriggered( bool isChecked )
if ( wellPathCollection )
{
auto newModeledWellPath = new RimModeledWellPathLateral();
auto newModeledWellPath = new RimModeledWellPath();
auto [pointVector, measuredDepths] =
wellPath->wellPathGeometry()->clippedPointSubset( wellPath->wellPathGeometry()->measuredDepths().front(),
wellPathSelItem->m_measuredDepth );
if ( pointVector.size() < 2u ) return;
newModeledWellPath->geometryDefinition()->setParentGeometry( wellPath->wellPathGeometry() );
newModeledWellPath->geometryDefinition()->setMdAtConnection( wellPathSelItem->m_measuredDepth );
newModeledWellPath->geometryDefinition()->createTargetAtConnectionPoint(
pointVector[pointVector.size() - 1u] - pointVector[pointVector.size() - 2u] );
newModeledWellPath->geometryDefinition()->setMdAtFirstTarget( measuredDepths.back() );
newModeledWellPath->geometryDefinition()->setUseAutoGeneratedTargetAtSeaLevel( false );
newModeledWellPath->geometryDefinition()->setFixedWellPathPoints( pointVector );
newModeledWellPath->geometryDefinition()->setFixedMeasuredDepths( measuredDepths );
newModeledWellPath->setName( wellPath->name() + QString( " md=%1" ).arg( wellPathSelItem->m_measuredDepth ) );
newModeledWellPath->geometryDefinition()->enableTargetPointPicking( true );
newModeledWellPath->createWellPathGeometry();
if ( wellPathGroup )