#3183 Export Fractures as Multi Segment Wells.

This commit is contained in:
Gaute Lindkvist 2018-08-15 15:46:32 +02:00
parent 90ce1126a9
commit 16560a7d81
13 changed files with 818 additions and 310 deletions

View File

@ -5,6 +5,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicWellPathExportCompletionDataFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathExportCompletionDataFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicFishbonesTransmissibilityCalculationFeatureImp.h
${CMAKE_CURRENT_LIST_DIR}/RicExportFishbonesWellSegmentsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportFracturesWellSegmentsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCaseAndFileExportSettingsUi.h
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureCompletionsImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleWellPathsFeature.h
@ -21,6 +22,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicWellPathExportCompletionDataFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathExportCompletionDataFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicFishbonesTransmissibilityCalculationFeatureImp.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportFishbonesWellSegmentsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportFracturesWellSegmentsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCaseAndFileExportSettingsUi.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureCompletionsImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleWellPathsFeature.cpp

View File

@ -21,7 +21,11 @@
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RifEclipseDataTableFormatter.h"
#include "RicExportFeatureImpl.h"
#include "RicMultiSegmentWellExportInfo.h"
#include "RicWellPathExportCompletionDataFeatureImpl.h"
#include "RimProject.h"
#include "RimFishboneWellPathCollection.h"

View File

@ -18,11 +18,7 @@
#pragma once
#include "RifEclipseDataTableFormatter.h"
#include "RicCaseAndFileExportSettingsUi.h"
#include "RicMultiSegmentWellExportInfo.h"
#include "RicWellPathExportCompletionDataFeatureImpl.h"
#include "cafCmdFeature.h"

View File

@ -47,7 +47,6 @@ public:
const RimSimWellInView* well,
QTextStream* outputStreamForIntermediateResultsText);
private:
static std::vector<RigCompletionData> generateCompdatValues(RimEclipseCase* caseToApply,
const QString& wellPathName,
const RigWellPath* wellPathGeometry,

View File

@ -0,0 +1,227 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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 "RicExportFracturesWellSegmentsFeature.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RicCaseAndFileExportSettingsUi.h"
#include "RicExportFeatureImpl.h"
#include "RicMultiSegmentWellExportInfo.h"
#include "RicWellPathExportCompletionDataFeatureImpl.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathFracture.h"
#include "RimWellPathFractureCollection.h"
#include "RifEclipseDataTableFormatter.h"
#include "Riu3DMainWindowTools.h"
#include "cafSelectionManager.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafUtils.h"
#include <QAction>
#include <QDir>
CAF_CMD_SOURCE_INIT(RicExportFracturesWellSegmentsFeature, "RicExportFracturesWellSegmentsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportFracturesWellSegmentsFeature::exportWellSegments(const RimWellPath* wellPath, const std::vector<RimWellPathFracture*>& fractures, const RicCaseAndFileExportSettingsUi& settings)
{
if (settings.caseToApply() == nullptr)
{
RiaLogging::error("Export Fracture Well Segments: Cannot export completions data without specified eclipse case");
return;
}
QString fileName = QString("%1-Fracture-Welsegs").arg(settings.caseToApply()->caseUserDescription());
fileName = caf::Utils::makeValidFileBasename(fileName);
QDir exportFolder(settings.folder());
if (!exportFolder.exists())
{
bool createdPath = exportFolder.mkpath(".");
if (createdPath)
RiaLogging::info("Export Fracture Well Segments: Created export folder " + settings.folder());
else
RiaLogging::error("Export Fracture Well Segments: Selected output folder does not exist, and could not be created.");
}
QString filePath = exportFolder.filePath(fileName);
QFile exportFile(filePath);
if (!exportFile.open(QIODevice::WriteOnly))
{
RiaLogging::error(QString("Export Fracture Well Segments: Could not open the file: %1").arg(filePath));
return;
}
RicMultiSegmentWellExportInfo exportInfo = RicWellPathExportCompletionDataFeatureImpl::generateFracturesMswExportInfo(settings.caseToApply, wellPath, fractures);
QTextStream stream(&exportFile);
RifEclipseDataTableFormatter formatter(stream);
RicWellPathExportCompletionDataFeatureImpl::generateWelsegsTable(formatter, exportInfo);
RicWellPathExportCompletionDataFeatureImpl::generateCompsegTables(formatter, exportInfo);
RicWellPathExportCompletionDataFeatureImpl::generateWsegvalvTable(formatter, exportInfo);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportFracturesWellSegmentsFeature::onActionTriggered(bool isChecked)
{
RimWellPath* wellPath = selectedWellPath();
RimWellPathFracture* fracture = selectedWellPathFracture();
RimWellPathFractureCollection* fractureCollection = selectedWellPathFractureCollection();
CVF_ASSERT(wellPath);
CVF_ASSERT(fractureCollection);
RiaApplication* app = RiaApplication::instance();
QString projectFolder = app->currentProjectPath();
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("COMPLETIONS", projectFolder);
RicCaseAndFileExportSettingsUi exportSettings;
std::vector<RimCase*> cases;
app->project()->allCases(cases);
for (auto c : cases)
{
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(c);
if (eclipseCase != nullptr)
{
exportSettings.caseToApply = eclipseCase;
break;
}
}
exportSettings.folder = defaultDir;
caf::PdmUiPropertyViewDialog propertyDialog(Riu3DMainWindowTools::mainWindowWidget(), &exportSettings, "Export Fractures as Multi Segment Wells", "");
RicExportFeatureImpl::configureForExport(&propertyDialog);
if (propertyDialog.exec() == QDialog::Accepted)
{
RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", QFileInfo(exportSettings.folder).absolutePath());
std::vector<RimWellPathFracture*> fractures;
if (fracture)
{
fractures.push_back(fracture);
}
else
{
for (RimWellPathFracture* fracture : fractureCollection->fractures())
{
if (fracture->isChecked())
{
fractures.push_back(fracture);
}
}
}
exportWellSegments(wellPath, fractures, exportSettings);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicExportFracturesWellSegmentsFeature::selectedWellPath()
{
RimWellPath* objToFind = nullptr;
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
if (objHandle)
{
objHandle->firstAncestorOrThisOfType(objToFind);
}
return objToFind;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathFracture* RicExportFracturesWellSegmentsFeature::selectedWellPathFracture()
{
RimWellPathFracture* objToFind = nullptr;
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
if (objHandle)
{
objHandle->firstAncestorOrThisOfType(objToFind);
}
return objToFind;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathFractureCollection* RicExportFracturesWellSegmentsFeature::selectedWellPathFractureCollection()
{
RimWellPathFractureCollection* objToFind = nullptr;
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
if (objHandle)
{
objHandle->firstAncestorOrThisOfType(objToFind);
}
return objToFind;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportFracturesWellSegmentsFeature::setupActionLook(QAction* actionToSetup)
{
if (selectedWellPathFracture())
{
actionToSetup->setText("Export Fracture as Multi Segment Well");
}
else
{
actionToSetup->setText("Export Fractures as Multi Segment Well");
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicExportFracturesWellSegmentsFeature::isCommandEnabled()
{
if (selectedWellPathFractureCollection())
{
return true;
}
return false;
}

View File

@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil 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 "RicCaseAndFileExportSettingsUi.h"
#include "cafCmdFeature.h"
class RimWellPath;
class RimWellPathFracture;
class RimWellPathFractureCollection;
//==================================================================================================
///
//==================================================================================================
class RicExportFracturesWellSegmentsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static void exportWellSegments(const RimWellPath* wellPath, const std::vector<RimWellPathFracture*>& fractures, const RicCaseAndFileExportSettingsUi& settings);
protected:
virtual void onActionTriggered(bool isChecked) override;
virtual void setupActionLook(QAction* actionToSetup) override;
virtual bool isCommandEnabled() override;
static RimWellPath* selectedWellPath();
static RimWellPathFracture* selectedWellPathFracture();
static RimWellPathFractureCollection* selectedWellPathFractureCollection();
};

View File

@ -76,23 +76,25 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
for (const RicWellSegmentLocation& location : exportInfo.wellSegmentLocations())
{
for (const RicWellSegmentLateral& lateral : location.laterals())
for (const RicWellSegmentCompletion& lateral : location.completions())
{
for (const RicWellSegmentLateralIntersection& intersection : lateral.intersections())
for (const RicWellSegmentSubSegment& segment : lateral.subSegments())
{
double diameter = location.holeDiameter();
QString completionMetaData = (location.label() + QString(": Sub: %1 Lateral: %2").arg(location.subIndex()).arg(lateral.lateralIndex()));
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(intersection.lengthsInCell(),
diameter / 2,
location.skinFactor(),
isMainBore,
completionMetaData);
for (const RicWellSegmentSubSegmentIntersection& intersection : segment.intersections())
{
double diameter = location.holeDiameter();
QString completionMetaData = (location.label() + QString(": Sub: %1 Lateral: %2").arg(location.subIndex()).arg(lateral.index()));
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(intersection.lengthsInCell(),
diameter / 2,
location.skinFactor(),
isMainBore,
completionMetaData);
wellBorePart.intersectionWithWellMeasuredDepth = location.measuredDepth();
wellBorePart.lateralIndex = lateral.lateralIndex();
wellBorePartsInCells[intersection.globalCellIndex()].push_back(wellBorePart);
wellBorePart.intersectionWithWellMeasuredDepth = location.measuredDepth();
wellBorePart.lateralIndex = lateral.index();
wellBorePartsInCells[intersection.globalCellIndex()].push_back(wellBorePart);
}
}
}
}

View File

@ -6,35 +6,26 @@
#include <algorithm>
#include <limits>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicWellSegmentLateralIntersection::RicWellSegmentLateralIntersection(const QString& gridName,
size_t globalCellIndex,
const cvf::Vec3st& gridLocalCellIJK,
double startMD,
double deltaMD,
double startTVD,
double deltaTVD,
const cvf::Vec3d& lengthsInCell)
RicWellSegmentSubSegmentIntersection::RicWellSegmentSubSegmentIntersection(const QString& gridName,
size_t globalCellIndex,
const cvf::Vec3st& gridLocalCellIJK,
const cvf::Vec3d& lengthsInCell)
: m_gridName(gridName)
, m_globalCellIndex(globalCellIndex)
, m_gridLocalCellIJK(gridLocalCellIJK)
, m_startMD(startMD)
, m_deltaMD(deltaMD)
, m_startTVD(startTVD)
, m_deltaTVD(deltaTVD)
, m_lengthsInCell(lengthsInCell)
, m_segmentNumber(std::numeric_limits<int>::infinity())
, m_attachedSegmentNumber(std::numeric_limits<int>::infinity())
, m_mainBoreCell(false)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString& RicWellSegmentLateralIntersection::gridName() const
const QString& RicWellSegmentSubSegmentIntersection::gridName() const
{
return m_gridName;
}
@ -42,7 +33,7 @@ const QString& RicWellSegmentLateralIntersection::gridName() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RicWellSegmentLateralIntersection::globalCellIndex() const
size_t RicWellSegmentSubSegmentIntersection::globalCellIndex() const
{
return m_globalCellIndex;
}
@ -50,7 +41,7 @@ size_t RicWellSegmentLateralIntersection::globalCellIndex() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3st RicWellSegmentLateralIntersection::gridLocalCellIJK() const
cvf::Vec3st RicWellSegmentSubSegmentIntersection::gridLocalCellIJK() const
{
return m_gridLocalCellIJK;
}
@ -58,39 +49,7 @@ cvf::Vec3st RicWellSegmentLateralIntersection::gridLocalCellIJK() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicWellSegmentLateralIntersection::startMD() const
{
return m_startMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicWellSegmentLateralIntersection::deltaMD() const
{
return m_deltaMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicWellSegmentLateralIntersection::startTVD() const
{
return m_startTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicWellSegmentLateralIntersection::deltaTVD() const
{
return m_deltaTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const cvf::Vec3d& RicWellSegmentLateralIntersection::lengthsInCell() const
const cvf::Vec3d& RicWellSegmentSubSegmentIntersection::lengthsInCell() const
{
return m_lengthsInCell;
}
@ -98,7 +57,55 @@ const cvf::Vec3d& RicWellSegmentLateralIntersection::lengthsInCell() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RicWellSegmentLateralIntersection::segmentNumber() const
RicWellSegmentSubSegment::RicWellSegmentSubSegment(double startMD,
double deltaMD,
double startTVD,
double deltaTVD)
: m_startMD(startMD)
, m_deltaMD(deltaMD)
, m_startTVD(startTVD)
, m_deltaTVD(deltaTVD)
, m_segmentNumber(-1)
, m_attachedSegmentNumber(-1)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicWellSegmentSubSegment::startMD() const
{
return m_startMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicWellSegmentSubSegment::deltaMD() const
{
return m_deltaMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicWellSegmentSubSegment::startTVD() const
{
return m_startTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicWellSegmentSubSegment::deltaTVD() const
{
return m_deltaTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RicWellSegmentSubSegment::segmentNumber() const
{
return m_segmentNumber;
}
@ -106,7 +113,7 @@ int RicWellSegmentLateralIntersection::segmentNumber() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RicWellSegmentLateralIntersection::attachedSegmentNumber() const
int RicWellSegmentSubSegment::attachedSegmentNumber() const
{
return m_attachedSegmentNumber;
}
@ -114,15 +121,7 @@ int RicWellSegmentLateralIntersection::attachedSegmentNumber() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicWellSegmentLateralIntersection::isMainBoreCell() const
{
return m_mainBoreCell;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellSegmentLateralIntersection::setSegmentNumber(int segmentNumber)
void RicWellSegmentSubSegment::setSegmentNumber(int segmentNumber)
{
m_segmentNumber = segmentNumber;
}
@ -130,7 +129,7 @@ void RicWellSegmentLateralIntersection::setSegmentNumber(int segmentNumber)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellSegmentLateralIntersection::setAttachedSegmentNumber(int attachedSegmentNumber)
void RicWellSegmentSubSegment::setAttachedSegmentNumber(int attachedSegmentNumber)
{
m_attachedSegmentNumber = attachedSegmentNumber;
}
@ -138,48 +137,7 @@ void RicWellSegmentLateralIntersection::setAttachedSegmentNumber(int attachedSeg
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellSegmentLateralIntersection::setIsMainBoreCell(bool isMainBoreCell)
{
m_mainBoreCell = isMainBoreCell;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicWellSegmentLateral::RicWellSegmentLateral(size_t lateralIndex, int branchNumber /*= 0*/)
: m_lateralIndex(lateralIndex)
, m_branchNumber(branchNumber)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RicWellSegmentLateral::lateralIndex() const
{
return m_lateralIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RicWellSegmentLateral::branchNumber() const
{
return m_branchNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellSegmentLateral::setBranchNumber(int branchNumber)
{
m_branchNumber = branchNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellSegmentLateral::addIntersection(const RicWellSegmentLateralIntersection& intersection)
void RicWellSegmentSubSegment::addIntersection(const RicWellSegmentSubSegmentIntersection& intersection)
{
m_intersections.push_back(intersection);
}
@ -187,7 +145,7 @@ void RicWellSegmentLateral::addIntersection(const RicWellSegmentLateralIntersect
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RicWellSegmentLateralIntersection>& RicWellSegmentLateral::intersections()
const std::vector<RicWellSegmentSubSegmentIntersection>& RicWellSegmentSubSegment::intersections() const
{
return m_intersections;
}
@ -195,11 +153,79 @@ std::vector<RicWellSegmentLateralIntersection>& RicWellSegmentLateral::intersect
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<RicWellSegmentLateralIntersection>& RicWellSegmentLateral::intersections() const
std::vector<RicWellSegmentSubSegmentIntersection>& RicWellSegmentSubSegment::intersections()
{
return m_intersections;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicWellSegmentCompletion::RicWellSegmentCompletion(RigCompletionData::CompletionType completionType,
size_t index /* = cvf::UNDEFINED_SIZE_T */,
int branchNumber /*= 0*/)
: m_completionType(completionType)
, m_index(index)
, m_branchNumber(branchNumber)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigCompletionData::CompletionType RicWellSegmentCompletion::completionType() const
{
return m_completionType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RicWellSegmentCompletion::index() const
{
return m_index;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RicWellSegmentCompletion::branchNumber() const
{
return m_branchNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellSegmentCompletion::setBranchNumber(int branchNumber)
{
m_branchNumber = branchNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellSegmentCompletion::addSubSegment(const RicWellSegmentSubSegment& subSegment)
{
m_subSegments.push_back(subSegment);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RicWellSegmentSubSegment>& RicWellSegmentCompletion::subSegments()
{
return m_subSegments;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<RicWellSegmentSubSegment>& RicWellSegmentCompletion::subSegments() const
{
return m_subSegments;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -219,8 +245,6 @@ RicWellSegmentLocation::RicWellSegmentLocation(const QString& label,
, m_icdArea(RicMultiSegmentWellExportInfo::defaultDoubleValue())
, m_subIndex(subIndex)
, m_segmentNumber(segmentNumber)
, m_icdBranchNumber(-1)
, m_icdSegmentNumber(-1)
{
}
@ -315,33 +339,17 @@ int RicWellSegmentLocation::segmentNumber() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RicWellSegmentLocation::icdBranchNumber() const
const std::vector<RicWellSegmentCompletion>& RicWellSegmentLocation::completions() const
{
return m_icdBranchNumber;
return m_completions;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RicWellSegmentLocation::icdSegmentNumber() const
std::vector<RicWellSegmentCompletion>& RicWellSegmentLocation::completions()
{
return m_icdSegmentNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<RicWellSegmentLateral>& RicWellSegmentLocation::laterals() const
{
return m_laterals;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RicWellSegmentLateral>& RicWellSegmentLocation::laterals()
{
return m_laterals;
return m_completions;
}
//--------------------------------------------------------------------------------------------------
@ -403,25 +411,9 @@ void RicWellSegmentLocation::setSegmentNumber(int segmentNumber)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellSegmentLocation::setIcdBranchNumber(int icdBranchNumber)
void RicWellSegmentLocation::addCompletion(const RicWellSegmentCompletion& completion)
{
m_icdBranchNumber = icdBranchNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellSegmentLocation::setIcdSegmentNumber(int icdSegmentNumber)
{
m_icdSegmentNumber = icdSegmentNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellSegmentLocation::addLateral(const RicWellSegmentLateral& lateral)
{
m_laterals.push_back(lateral);
m_completions.push_back(completion);
}
//--------------------------------------------------------------------------------------------------

View File

@ -19,8 +19,10 @@
#pragma once
#include "RiaEclipseUnitTools.h"
#include "RigCompletionData.h"
#include "cvfBase.h"
#include "cvfMath.h"
#include "cvfVector3.h"
#include <QString>
@ -31,69 +33,84 @@ class RimFishbonesMultipleSubs;
//==================================================================================================
///
//==================================================================================================
class RicWellSegmentLateralIntersection
class RicWellSegmentSubSegmentIntersection
{
public:
RicWellSegmentLateralIntersection(const QString& gridName, // Pass in empty string for main grid
size_t globalCellIndex,
const cvf::Vec3st& gridLocalCellIJK,
double startMD,
double deltaMD,
double startTVD,
double deltaTVD,
const cvf::Vec3d& lengthsInCell);
RicWellSegmentSubSegmentIntersection(const QString& gridName, // Pass in empty string for main grid
size_t globalCellIndex,
const cvf::Vec3st& gridLocalCellIJK,
const cvf::Vec3d& lengthsInCell);
const QString& gridName() const;
size_t globalCellIndex() const;
cvf::Vec3st gridLocalCellIJK() const;
double startMD() const;
double deltaMD() const;
double startTVD() const;
double deltaTVD() const;
const cvf::Vec3d& lengthsInCell() const;
int segmentNumber() const;
int attachedSegmentNumber() const;
bool isMainBoreCell() const;
void setSegmentNumber(int segmentNumber);
void setAttachedSegmentNumber(int attachedSegmentNumber);
void setIsMainBoreCell(bool isMainBoreCell);
private:
QString m_gridName;
size_t m_globalCellIndex;
cvf::Vec3st m_gridLocalCellIJK;
double m_startMD;
double m_deltaMD;
double m_startTVD;
double m_deltaTVD;
cvf::Vec3d m_lengthsInCell;
int m_segmentNumber;
int m_attachedSegmentNumber;
bool m_mainBoreCell;
};
//==================================================================================================
///
//==================================================================================================
class RicWellSegmentLateral
class RicWellSegmentSubSegment
{
public:
RicWellSegmentLateral(size_t lateralIndex, int branchNumber = 0);
RicWellSegmentSubSegment(double startMD,
double deltaMD,
double startTVD,
double deltaTVD);
size_t lateralIndex() const;
int branchNumber() const;
void setBranchNumber(int branchNumber);
double startMD() const;
double deltaMD() const;
double startTVD() const;
double deltaTVD() const;
void addIntersection(const RicWellSegmentLateralIntersection& intersection);
std::vector<RicWellSegmentLateralIntersection>& intersections();
const std::vector<RicWellSegmentLateralIntersection>& intersections() const;
int segmentNumber() const;
int attachedSegmentNumber() const;
void setSegmentNumber(int segmentNumber);
void setAttachedSegmentNumber(int attachedSegmentNumber);
void addIntersection(const RicWellSegmentSubSegmentIntersection& intersection);
const std::vector<RicWellSegmentSubSegmentIntersection>& intersections() const;
std::vector<RicWellSegmentSubSegmentIntersection>& intersections();
private:
double m_startMD;
double m_deltaMD;
double m_startTVD;
double m_deltaTVD;
int m_segmentNumber;
int m_attachedSegmentNumber;
std::vector<RicWellSegmentSubSegmentIntersection> m_intersections;
};
//==================================================================================================
///
//==================================================================================================
class RicWellSegmentCompletion
{
public:
RicWellSegmentCompletion(RigCompletionData::CompletionType completionType, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT);
RigCompletionData::CompletionType completionType() const;
size_t index() const;
int branchNumber() const;
void setBranchNumber(int branchNumber);
void addSubSegment(const RicWellSegmentSubSegment& subSegment);
std::vector<RicWellSegmentSubSegment>& subSegments();
const std::vector<RicWellSegmentSubSegment>& subSegments() const;
private:
size_t m_lateralIndex;
int m_branchNumber;
std::vector<RicWellSegmentLateralIntersection> m_intersections;
RigCompletionData::CompletionType m_completionType;
size_t m_index;
int m_branchNumber;
std::vector<RicWellSegmentSubSegment> m_subSegments;
};
//==================================================================================================
@ -105,7 +122,7 @@ public:
RicWellSegmentLocation(const QString& label,
double measuredDepth,
double trueVerticalDepth,
size_t subIndex,
size_t subIndex = cvf::UNDEFINED_SIZE_T,
int segmentNumber = -1);
QString label() const;
@ -120,11 +137,9 @@ public:
size_t subIndex() const;
int segmentNumber() const;
int icdBranchNumber() const;
int icdSegmentNumber() const;
const std::vector<RicWellSegmentLateral>& laterals() const;
std::vector<RicWellSegmentLateral>& laterals();
const std::vector<RicWellSegmentCompletion>& completions() const;
std::vector<RicWellSegmentCompletion>& completions();
void setEffectiveDiameter(double effectiveDiameter);
void setHoleDiameter(double holeDiameter);
@ -133,9 +148,7 @@ public:
void setIcdFlowCoefficient(double icdFlowCoefficient);
void setIcdArea(double icdArea);
void setSegmentNumber(int segmentNumber);
void setIcdBranchNumber(int icdBranchNumber);
void setIcdSegmentNumber(int icdSegmentNumber);
void addLateral(const RicWellSegmentLateral& lateral);
void addCompletion(const RicWellSegmentCompletion& completion);
bool operator<(const RicWellSegmentLocation& rhs) const;
@ -153,10 +166,8 @@ private:
size_t m_subIndex;
int m_segmentNumber;
int m_icdBranchNumber;
int m_icdSegmentNumber;
std::vector<RicWellSegmentLateral> m_laterals;
std::vector<RicWellSegmentCompletion> m_completions;
};
class RicMultiSegmentWellExportInfo

View File

@ -43,12 +43,15 @@
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFractureTemplate.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimSimWellInView.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPathCompletions.h"
#include "RimWellPathFracture.h"
#include "RimWellPathFractureCollection.h"
#include "RiuMainWindow.h"
@ -463,8 +466,12 @@ void RicWellPathExportCompletionDataFeatureImpl::generateWelsegsTable(RifEclipse
depth += location.trueVerticalDepth() - previousTVD;
length += location.measuredDepth() - previousMD;
}
formatter.comment(QString("Segment for sub %1").arg(location.subIndex()));
QString comment = QString("Segment for %1").arg(location.label());
if (location.subIndex() != cvf::UNDEFINED_SIZE_T)
{
comment += QString(", sub %1").arg(location.subIndex());
}
formatter.comment(comment);
formatter.add(location.segmentNumber()).add(location.segmentNumber());
formatter.add(1); // All segments on main stem are branch 1
formatter.add(location.segmentNumber() - 1); // All main stem segments are connected to the segment below them
@ -485,49 +492,65 @@ void RicWellPathExportCompletionDataFeatureImpl::generateWelsegsTable(RifEclipse
formatter.comment("Rough: MSW - Open Hole Roughness Factor");
for (const RicWellSegmentLocation& location : exportInfo.wellSegmentLocations())
{
formatter.comment("ICD");
formatter.add(location.icdSegmentNumber()).add(location.icdSegmentNumber());
formatter.add(location.icdBranchNumber());
formatter.add(location.segmentNumber());
formatter.add(0.1); // ICDs have 0.1 length
formatter.add(0); // Depth change
formatter.add(exportInfo.linerDiameter());
formatter.add(exportInfo.roughnessFactor());
formatter.rowCompleted();
for (const RicWellSegmentLateral& lateral : location.laterals())
if (location.completions().empty())
{
formatter.comment(QString("%1 : Sub index %2 - Lateral %3")
.arg(location.label())
.arg(location.subIndex())
.arg(lateral.lateralIndex()));
continue;
}
for (const RicWellSegmentLateralIntersection& intersection : lateral.intersections())
for (const RicWellSegmentCompletion& lateral : location.completions())
{
if (lateral.completionType() == RigCompletionData::ICD) // Found ICD
{
double depth = 0;
double length = 0;
if (exportInfo.lengthAndDepthText() == QString("INC"))
{
depth = intersection.deltaTVD();
length = intersection.deltaMD();
}
else
{
depth = intersection.startTVD() + intersection.deltaTVD();
length = intersection.startMD() + intersection.deltaMD();
}
double diameter = location.effectiveDiameter();
formatter.add(intersection.segmentNumber());
formatter.add(intersection.segmentNumber());
formatter.comment("ICD");
formatter.add(lateral.subSegments().front().segmentNumber());
formatter.add(lateral.subSegments().front().segmentNumber());
formatter.add(lateral.branchNumber());
formatter.add(intersection.attachedSegmentNumber());
formatter.add(length);
formatter.add(depth);
formatter.add(diameter);
formatter.add(location.openHoleRoughnessFactor());
formatter.add(location.segmentNumber());
formatter.add(0.1); // ICDs have 0.1 length
formatter.add(0); // Depth change
formatter.add(exportInfo.linerDiameter());
formatter.add(exportInfo.roughnessFactor());
formatter.rowCompleted();
}
else {
if (lateral.completionType() == RigCompletionData::FISHBONES)
{
formatter.comment(QString("%1 : Sub index %2 - Lateral %3")
.arg(location.label())
.arg(location.subIndex())
.arg(lateral.index()));
}
else if (lateral.completionType() == RigCompletionData::FRACTURE)
{
formatter.comment(QString("%1").arg(location.label()));
}
for (const RicWellSegmentSubSegment& subSegment : lateral.subSegments())
{
double depth = 0;
double length = 0;
if (exportInfo.lengthAndDepthText() == QString("INC"))
{
depth = subSegment.deltaTVD();
length = subSegment.deltaMD();
}
else
{
depth = subSegment.startTVD() + subSegment.deltaTVD();
length = subSegment.startMD() + subSegment.deltaMD();
}
double diameter = location.effectiveDiameter();
formatter.add(subSegment.segmentNumber());
formatter.add(subSegment.segmentNumber());
formatter.add(lateral.branchNumber());
formatter.add(subSegment.attachedSegmentNumber());
formatter.add(length);
formatter.add(depth);
formatter.add(diameter);
formatter.add(location.openHoleRoughnessFactor());
formatter.rowCompleted();
}
}
}
}
}
@ -592,26 +615,36 @@ void RicWellPathExportCompletionDataFeatureImpl::generateCompsegTable(RifEclipse
for (const RicWellSegmentLocation& location : exportInfo.wellSegmentLocations())
{
for (const RicWellSegmentLateral& lateral : location.laterals())
for (const RicWellSegmentCompletion& completion : location.completions())
{
double aggregatedLength = 0;
for (const RicWellSegmentLateralIntersection& intersection : lateral.intersections())
if (completion.completionType() == RigCompletionData::FRACTURE)
{
bool isSubGridIntersection = !intersection.gridName().isEmpty();
if (isSubGridIntersection == exportSubGridIntersections)
aggregatedLength = location.measuredDepth();
}
for (const RicWellSegmentSubSegment& segment : completion.subSegments())
{
for (const RicWellSegmentSubSegmentIntersection& intersection : segment.intersections())
{
if (exportSubGridIntersections)
bool isSubGridIntersection = !intersection.gridName().isEmpty();
if (isSubGridIntersection == exportSubGridIntersections)
{
formatter.add(intersection.gridName());
if (exportSubGridIntersections)
{
formatter.add(intersection.gridName());
}
cvf::Vec3st ijk = intersection.gridLocalCellIJK();
formatter.addZeroBasedCellIndex(ijk.x()).addZeroBasedCellIndex(ijk.y()).addZeroBasedCellIndex(ijk.z());
formatter.add(completion.branchNumber());
formatter.add(aggregatedLength);
formatter.add(aggregatedLength + segment.deltaMD());
formatter.rowCompleted();
}
if (completion.completionType() == RigCompletionData::FISHBONES)
{
aggregatedLength += segment.deltaMD();
}
cvf::Vec3st ijk = intersection.gridLocalCellIJK();
formatter.addZeroBasedCellIndex(ijk.x()).addZeroBasedCellIndex(ijk.y()).addZeroBasedCellIndex(ijk.z());
formatter.add(lateral.branchNumber());
formatter.add(aggregatedLength);
formatter.add(aggregatedLength + intersection.deltaMD());
formatter.rowCompleted();
}
aggregatedLength += intersection.deltaMD();
}
}
}
@ -637,11 +670,18 @@ void RicWellPathExportCompletionDataFeatureImpl::generateWsegvalvTable(RifEclips
}
for (const RicWellSegmentLocation& location : exportInfo.wellSegmentLocations())
{
formatter.add(exportInfo.wellPath()->name());
formatter.add(location.icdSegmentNumber());
formatter.add(location.icdFlowCoefficient());
formatter.add(location.icdArea());
formatter.rowCompleted();
for (const RicWellSegmentCompletion& lateral : location.completions())
{
if (lateral.completionType() == RigCompletionData::ICD)
{
CVF_ASSERT(lateral.subSegments().size() == 1u);
formatter.add(exportInfo.wellPath()->name());
formatter.add(lateral.subSegments().front().segmentNumber());
formatter.add(location.icdFlowCoefficient());
formatter.add(location.icdArea());
formatter.rowCompleted();
}
}
}
formatter.tableCompleted();
}
@ -1236,11 +1276,17 @@ RicMultiSegmentWellExportInfo RicWellPathExportCompletionDataFeatureImpl::genera
double icdOrificeRadius = subs->icdOrificeDiameter(unitSystem) / 2;
location.setIcdArea(icdOrificeRadius * icdOrificeRadius * cvf::PI_D * subs->icdCount());
// Add lateral for ICD
RicWellSegmentCompletion icdLateral(RigCompletionData::ICD);
RicWellSegmentSubSegment icdSegment(measuredDepth, 0.1, -position.z(), 0.0);
icdLateral.addSubSegment(icdSegment);
location.addCompletion(icdLateral);
for (size_t lateralIndex : sub.lateralIndices)
{
location.addLateral(RicWellSegmentLateral(lateralIndex));
location.addCompletion(RicWellSegmentCompletion(RigCompletionData::FISHBONES, lateralIndex));
}
assignLateralIntersections(caseToApply, subs, &location, &foundSubGridIntersections);
assignFishbonesLateralIntersections(caseToApply, subs, &location, &foundSubGridIntersections);
exportInfo.addWellSegmentLocation(location);
}
@ -1253,22 +1299,130 @@ RicMultiSegmentWellExportInfo RicWellPathExportCompletionDataFeatureImpl::genera
return exportInfo;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeatureImpl::assignLateralIntersections(const RimEclipseCase* caseToApply,
const RimFishbonesMultipleSubs* fishbonesSubs,
RicWellSegmentLocation* location,
bool* foundSubGridIntersections)
RicMultiSegmentWellExportInfo RicWellPathExportCompletionDataFeatureImpl::generateFracturesMswExportInfo(RimEclipseCase* caseToApply, const RimWellPath* wellPath)
{
std::vector<RimWellPathFracture*> fractures;
if (wellPath->fractureCollection()->isChecked())
{
for (RimWellPathFracture* fracture : wellPath->fractureCollection()->fractures())
{
if (fracture->isChecked())
{
fractures.push_back(fracture);
}
}
}
return generateFracturesMswExportInfo(caseToApply, wellPath, fractures);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMultiSegmentWellExportInfo RicWellPathExportCompletionDataFeatureImpl::generateFracturesMswExportInfo(RimEclipseCase* caseToApply, const RimWellPath* wellPath, const std::vector<RimWellPathFracture*>& fractures)
{
const RigMainGrid* grid = caseToApply->eclipseCaseData()->mainGrid();
RiaEclipseUnitTools::UnitSystem unitSystem = caseToApply->eclipseCaseData()->unitsType();
RicMultiSegmentWellExportInfo exportInfo(wellPath,
unitSystem,
0.0,
QString("INC"),
QString("HF-"));
const RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
const std::vector<cvf::Vec3d>& coords = wellPathGeometry->wellPathPoints();
const std::vector<double>& mds = wellPathGeometry->measureDepths();
CVF_ASSERT(!coords.empty() && !mds.empty());
std::vector<WellPathCellIntersectionInfo> intersections =
RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath(
caseToApply->eclipseCaseData(), coords, mds);
double previousExitMD = mds.front();
double previousExitTVD = -coords.front().z();
bool foundSubGridIntersections = false;
// Main bore
int mainBoreSegment = 0;
for (const auto& cellIntInfo : intersections)
{
size_t localGridIdx = 0u;
const RigGridBase* localGrid = grid->gridAndGridLocalIdxFromGlobalCellIdx(cellIntInfo.globCellIndex, &localGridIdx);
QString gridName;
if (localGrid != grid)
{
gridName = QString::fromStdString(localGrid->gridName());
foundSubGridIntersections = true;
}
size_t i = 0u, j = 0u, k = 0u;
localGrid->ijkFromCellIndex(localGridIdx, &i, &j, &k);
QString label = QString("Main stem segment %1").arg(++mainBoreSegment);
RicWellSegmentLocation location(label, cellIntInfo.endMD, -cellIntInfo.endPoint.z());
exportInfo.addWellSegmentLocation(location);
previousExitMD = cellIntInfo.endMD;
previousExitTVD = -cellIntInfo.endPoint.z();
}
// Fractures
for (RimWellPathFracture* fracture : fractures)
{
double measuredDepth = fracture->fractureMD();
cvf::Vec3d position = wellPath->wellPathGeometry()->interpolatedPointAlongWellPath(measuredDepth);
RicWellSegmentLocation location(fracture->name(), measuredDepth, -position.z(), 0);
std::vector<RimFracture*> fractureVector(1, fracture);
std::vector<RigCompletionData> completionData =
RicExportFractureCompletionsImpl::generateCompdatValues(caseToApply,
wellPath->completions()->wellNameForExport(),
wellPath->wellPathGeometry(),
fractureVector,
nullptr,
nullptr);
assignFractureIntersections(caseToApply, fracture, completionData, &location, &foundSubGridIntersections);
exportInfo.addWellSegmentLocation(location);
}
exportInfo.setHasSubGridIntersections(foundSubGridIntersections);
exportInfo.sortLocations();
assignBranchAndSegmentNumbers(caseToApply, &exportInfo);
return exportInfo;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeatureImpl::assignFishbonesLateralIntersections(const RimEclipseCase* caseToApply,
const RimFishbonesMultipleSubs* fishbonesSubs,
RicWellSegmentLocation* location,
bool* foundSubGridIntersections)
{
CVF_ASSERT(foundSubGridIntersections != nullptr);
const RigMainGrid* grid = caseToApply->eclipseCaseData()->mainGrid();
for (RicWellSegmentLateral& lateral : location->laterals())
for (RicWellSegmentCompletion& lateral : location->completions())
{
if (lateral.index() == cvf::UNDEFINED_SIZE_T)
{
continue;
}
std::vector<std::pair<cvf::Vec3d, double>> lateralCoordMDPairs =
fishbonesSubs->coordsAndMDForLateral(location->subIndex(), lateral.lateralIndex());
fishbonesSubs->coordsAndMDForLateral(location->subIndex(), lateral.index());
if (lateralCoordMDPairs.empty())
{
@ -1306,24 +1460,58 @@ void RicWellPathExportCompletionDataFeatureImpl::assignLateralIntersections(cons
size_t i = 0u, j = 0u, k = 0u;
localGrid->ijkFromCellIndex(localGridIdx, &i, &j, &k);
RicWellSegmentSubSegment subSegment (previousExitMD,
cellIntInfo.endMD - previousExitMD,
previousExitTVD,
cellIntInfo.endPoint.z() - previousExitTVD);
RicWellSegmentLateralIntersection lateralIntersection(gridName,
cellIntInfo.globCellIndex,
cvf::Vec3st(i, j, k),
previousExitMD,
cellIntInfo.endMD - previousExitMD,
previousExitTVD,
cellIntInfo.endPoint.z() - previousExitTVD,
cellIntInfo.intersectionLengthsInCellCS);
RicWellSegmentSubSegmentIntersection intersection(gridName,
cellIntInfo.globCellIndex,
cvf::Vec3st(i, j, k),
cellIntInfo.intersectionLengthsInCellCS);
subSegment.addIntersection(intersection);
lateral.addSubSegment(subSegment);
lateral.addIntersection(lateralIntersection);
previousExitMD = cellIntInfo.endMD;
previousExitMD = cellIntInfo.endMD;
previousExitTVD = cellIntInfo.endPoint.z();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeatureImpl::assignFractureIntersections(const RimEclipseCase* caseToApply,
const RimWellPathFracture* fracture,
const std::vector<RigCompletionData>& completionData,
RicWellSegmentLocation* location,
bool* foundSubGridIntersections)
{
CVF_ASSERT(foundSubGridIntersections != nullptr);
const RigMainGrid* grid = caseToApply->eclipseCaseData()->mainGrid();
double fractureMD = fracture->fractureMD();
RicWellSegmentCompletion lateral(RigCompletionData::FRACTURE);
RicWellSegmentSubSegment subSegment(fracture->fractureMD(),
fracture->fractureTemplate()->computeFractureWidth(fracture),
0.0,
0.0);
for (const RigCompletionData& compIntersection : completionData)
{
const RigCompletionDataGridCell& cell = compIntersection.completionDataGridCell();
cvf::Vec3st localIJK(cell.localCellIndexI(), cell.localCellIndexJ(), cell.localCellIndexK());
RicWellSegmentSubSegmentIntersection intersection(cell.lgrName(),
cell.globalCellIndex(),
localIJK,
cvf::Vec3d::ZERO);
subSegment.addIntersection(intersection);
}
lateral.addSubSegment(subSegment);
location->addCompletion(lateral);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1332,18 +1520,35 @@ void RicWellPathExportCompletionDataFeatureImpl::assignBranchAndSegmentNumbers(c
int* branchNum,
int* segmentNum)
{
for (RicWellSegmentLateral& lateral : location->laterals())
int icdSegmentNumber = cvf::UNDEFINED_INT;
for (RicWellSegmentCompletion& completion : location->completions())
{
++(*branchNum);
lateral.setBranchNumber(*branchNum);
int attachedSegmentNumber = location->icdSegmentNumber();
for (auto& intersection : lateral.intersections())
if (completion.completionType() != RigCompletionData::ICD)
{
++(*segmentNum);
intersection.setSegmentNumber(*segmentNum);
intersection.setAttachedSegmentNumber(attachedSegmentNumber);
attachedSegmentNumber = *segmentNum;
++(*branchNum);
completion.setBranchNumber(*branchNum);
}
int attachedSegmentNumber = location->segmentNumber();
if (icdSegmentNumber != cvf::UNDEFINED_INT)
{
attachedSegmentNumber = icdSegmentNumber;
}
for (auto& subSegment : completion.subSegments())
{
if (completion.completionType() == RigCompletionData::ICD)
{
subSegment.setSegmentNumber(location->segmentNumber() + 1);
icdSegmentNumber = subSegment.segmentNumber();
}
else
{
++(*segmentNum);
subSegment.setSegmentNumber(*segmentNum);
}
subSegment.setAttachedSegmentNumber(attachedSegmentNumber);
attachedSegmentNumber = *segmentNum;
}
}
}
@ -1361,8 +1566,14 @@ void RicWellPathExportCompletionDataFeatureImpl::assignBranchAndSegmentNumbers(c
for (RicWellSegmentLocation& location : exportInfo->wellSegmentLocations())
{
location.setSegmentNumber(++segmentNumber);
location.setIcdBranchNumber(++branchNumber);
location.setIcdSegmentNumber(++segmentNumber);
for (RicWellSegmentCompletion& completion : location.completions())
{
if (completion.completionType() == RigCompletionData::ICD)
{
++segmentNumber; // Skip a segment number because we need one for the ICD
completion.setBranchNumber(++branchNumber);
}
}
}
// Then assign branch and segment numbers to each lateral parts

View File

@ -36,6 +36,7 @@ class RimEclipseCase;
class RimFishbonesMultipleSubs;
class RimSimWellInView;
class RimWellPath;
class RimWellPathFracture;
class RifEclipseDataTableFormatter;
class RigVirtualPerforationTransmissibilities;
@ -53,6 +54,13 @@ public:
const RimWellPath* wellPath,
const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs);
static RicMultiSegmentWellExportInfo generateFracturesMswExportInfo(RimEclipseCase* caseToApply,
const RimWellPath* wellPath);
static RicMultiSegmentWellExportInfo generateFracturesMswExportInfo(RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
const std::vector<RimWellPathFracture*>& fractures);
static CellDirection calculateDirectionInCell(RimEclipseCase* eclipseCase,
size_t globalCellIndex,
const cvf::Vec3d& lengthsInCell);
@ -124,10 +132,17 @@ private:
static std::vector<RigCompletionData> generatePerforationsCompdatValues(const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
static void assignLateralIntersections(const RimEclipseCase* caseToApply,
const RimFishbonesMultipleSubs* fishbonesSubs,
RicWellSegmentLocation* location,
bool* foundSubGridIntersections);
static void assignFishbonesLateralIntersections(const RimEclipseCase* caseToApply,
const RimFishbonesMultipleSubs* fishbonesSubs,
RicWellSegmentLocation* location,
bool* foundSubGridIntersections);
static void assignFractureIntersections(const RimEclipseCase* caseToApply,
const RimWellPathFracture* fracture,
const std::vector<RigCompletionData>& completionData,
RicWellSegmentLocation* location,
bool* foundSubGridIntersections);
static void assignBranchAndSegmentNumbers(const RimEclipseCase* caseToApply,
RicWellSegmentLocation* location,
int* branchNum,

View File

@ -702,7 +702,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicEditPerforationCollectionFeature";
menuBuilder << "RicExportFishbonesLateralsFeature";
menuBuilder << "RicExportFishbonesWellSegmentsFeature";
menuBuilder << "RicExportFracturesWellSegmentsFeature";
{
QStringList candidates;

View File

@ -63,6 +63,7 @@ public:
FISHBONES,
FRACTURE,
PERFORATION,
ICD,
CT_UNDEFINED
};