mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1519 Compdat export for fishbones and perforations
This commit is contained in:
parent
45f5b5a80a
commit
3dbc09b28d
@ -7,7 +7,6 @@ endif()
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathExportCompletionDataFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathExportPerforationCompdatFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathImportCompletionsFileFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h
|
||||
@ -17,7 +16,6 @@ ${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.h
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathExportCompletionDataFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathExportPerforationCompdatFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathImportCompletionsFileFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp
|
||||
|
@ -25,11 +25,14 @@
|
||||
#include "RimWellPath.h"
|
||||
#include "RimFishbonesMultipleSubs.h"
|
||||
#include "RimFishbonesCollection.h"
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimPerforationCollection.h"
|
||||
#include "RimExportCompletionDataSettings.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "RigWellLogExtractionTools.h"
|
||||
#include "RigWellPathIntersectionTools.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigWellPath.h"
|
||||
@ -95,7 +98,7 @@ void RicWellPathExportCompletionDataFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", QFileInfo(exportSettings.fileName).absolutePath());
|
||||
|
||||
exportToFolder(objects[0], exportSettings);
|
||||
exportCompletions(objects[0], exportSettings);
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +113,7 @@ void RicWellPathExportCompletionDataFeature::setupActionLook(QAction* actionToSe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportCompletionDataFeature::exportToFolder(RimWellPath* wellPath, const RimExportCompletionDataSettings& exportSettings)
|
||||
void RicWellPathExportCompletionDataFeature::exportCompletions(RimWellPath* wellPath, const RimExportCompletionDataSettings& exportSettings)
|
||||
{
|
||||
QFile exportFile(exportSettings.fileName());
|
||||
|
||||
@ -126,108 +129,126 @@ void RicWellPathExportCompletionDataFeature::exportToFolder(RimWellPath* wellPat
|
||||
return;
|
||||
}
|
||||
|
||||
RiaLogging::debug(QString("Exporting completion data for well path %1 to %2 [WPIMULT: %3, REM BORE CELLS: %4]").arg(wellPath->name).arg(exportSettings.fileName()).arg(exportSettings.includeWpimult()).arg(exportSettings.removeLateralsInMainBoreCells()));
|
||||
|
||||
// Generate completion data
|
||||
std::map<IJKCellIndex, RigCompletionData> completionData;
|
||||
|
||||
// Generate data
|
||||
const RigEclipseCaseData* caseData = exportSettings.caseToApply()->eclipseCaseData();
|
||||
std::vector<WellSegmentLocation> wellSegmentLocations = findWellSegmentLocations(exportSettings.caseToApply, wellPath);
|
||||
|
||||
// Filter out cells where main bore is present
|
||||
if (exportSettings.removeLateralsInMainBoreCells())
|
||||
if (exportSettings.includePerforations)
|
||||
{
|
||||
std::vector<size_t> wellPathCells = findIntersectingCells(caseData, wellPath->wellPathGeometry()->m_wellPathPoints);
|
||||
markWellPathCells(wellPathCells, &wellSegmentLocations);
|
||||
std::vector<RigCompletionData> perforationCompletionData = generatePerforationsCompdatValues(wellPath, exportSettings);
|
||||
appendCompletionData(&completionData, perforationCompletionData);
|
||||
}
|
||||
if (exportSettings.includeFishbones)
|
||||
{
|
||||
std::vector<RigCompletionData> fishbonesCompletionData = generateFishbonesCompdatValues(wellPath, exportSettings);
|
||||
appendCompletionData(&completionData, fishbonesCompletionData);
|
||||
}
|
||||
|
||||
// Print data
|
||||
// Merge map into a vector of values
|
||||
std::vector<RigCompletionData> completions;
|
||||
for (auto& data : completionData)
|
||||
{
|
||||
completions.push_back(data.second);
|
||||
}
|
||||
// Sort by well name / cell index
|
||||
std::sort(completions.begin(), completions.end());
|
||||
|
||||
// Print completion data
|
||||
QTextStream stream(&exportFile);
|
||||
RifEclipseOutputTableFormatter formatter(stream);
|
||||
|
||||
generateCompdatTable(formatter, wellPath, exportSettings, wellSegmentLocations);
|
||||
|
||||
if (exportSettings.includeWpimult())
|
||||
generateCompdatTable(formatter, completions);
|
||||
if (exportSettings.includeWpimult)
|
||||
{
|
||||
std::map<size_t, double> lateralsPerCell = computeLateralsPerCell(wellSegmentLocations, exportSettings.removeLateralsInMainBoreCells());
|
||||
generateWpimultTable(formatter, wellPath, exportSettings, lateralsPerCell);
|
||||
generateWpimultTable(formatter, completions);
|
||||
}
|
||||
|
||||
generateWelsegsTable(formatter, wellPath, exportSettings, wellSegmentLocations);
|
||||
generateCompsegsTable(formatter, wellPath, exportSettings, wellSegmentLocations);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportCompletionDataFeature::generateCompdatTable(RifEclipseOutputTableFormatter& formatter, const RimWellPath* wellPath, const RimExportCompletionDataSettings& settings, const std::vector<WellSegmentLocation>& locations)
|
||||
void RicWellPathExportCompletionDataFeature::generateCompdatTable(RifEclipseOutputTableFormatter& formatter, const std::vector<RigCompletionData>& completionData)
|
||||
{
|
||||
RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid();
|
||||
std::vector<RifEclipseOutputTableColumn> header = {
|
||||
RifEclipseOutputTableColumn("Well"),
|
||||
RifEclipseOutputTableColumn("I"),
|
||||
RifEclipseOutputTableColumn("J"),
|
||||
RifEclipseOutputTableColumn("K1"),
|
||||
RifEclipseOutputTableColumn("K2"),
|
||||
RifEclipseOutputTableColumn("Status"),
|
||||
RifEclipseOutputTableColumn("SAT"),
|
||||
RifEclipseOutputTableColumn("TR"),
|
||||
RifEclipseOutputTableColumn("DIAM"),
|
||||
RifEclipseOutputTableColumn("KH"),
|
||||
RifEclipseOutputTableColumn("S"),
|
||||
RifEclipseOutputTableColumn("Df"),
|
||||
RifEclipseOutputTableColumn("DIR"),
|
||||
RifEclipseOutputTableColumn("r0")
|
||||
RifEclipseOutputTableColumn("Well"),
|
||||
RifEclipseOutputTableColumn("I"),
|
||||
RifEclipseOutputTableColumn("J"),
|
||||
RifEclipseOutputTableColumn("K1"),
|
||||
RifEclipseOutputTableColumn("K2"),
|
||||
RifEclipseOutputTableColumn("Status"),
|
||||
RifEclipseOutputTableColumn("SAT"),
|
||||
RifEclipseOutputTableColumn("TR"),
|
||||
RifEclipseOutputTableColumn("DIAM"),
|
||||
RifEclipseOutputTableColumn("KH"),
|
||||
RifEclipseOutputTableColumn("S"),
|
||||
RifEclipseOutputTableColumn("Df"),
|
||||
RifEclipseOutputTableColumn("DIR"),
|
||||
RifEclipseOutputTableColumn("r0")
|
||||
};
|
||||
|
||||
formatter.keyword("COMPDAT");
|
||||
formatter.header(header);
|
||||
|
||||
for (const WellSegmentLocation& location : locations)
|
||||
for (const RigCompletionData& data : completionData)
|
||||
{
|
||||
for (const WellSegmentLateral& lateral : location.laterals)
|
||||
for (const RigCompletionMetaData& metadata : data.metadata())
|
||||
{
|
||||
formatter.comment(QString("Fishbone %1 - Sub: %2 - Lateral: %3").arg(location.fishbonesSubs->name()).arg(location.subIndex).arg(lateral.lateralIndex));
|
||||
for (const WellSegmentLateralIntersection& intersection : lateral.intersections)
|
||||
{
|
||||
if (settings.removeLateralsInMainBoreCells && intersection.mainBoreCell) continue;
|
||||
formatter.comment(QString("%1 : %2").arg(metadata.name).arg(metadata.comment));
|
||||
}
|
||||
formatter.add(data.wellName());
|
||||
formatter.addZeroBasedCellIndex(data.cellIndex().i).addZeroBasedCellIndex(data.cellIndex().j).addZeroBasedCellIndex(data.cellIndex().k).addZeroBasedCellIndex(data.cellIndex().k);
|
||||
switch (data.connectionState())
|
||||
{
|
||||
case OPEN:
|
||||
formatter.add("OPEN");
|
||||
break;
|
||||
case SHUT:
|
||||
formatter.add("SHUT");
|
||||
break;
|
||||
case AUTO:
|
||||
formatter.add("AUTO");
|
||||
break;
|
||||
}
|
||||
if (RigCompletionData::isDefaultValue(data.saturation())) formatter.add("1*"); else formatter.add(data.saturation());
|
||||
if (RigCompletionData::isDefaultValue(data.transmissibility()))
|
||||
{
|
||||
formatter.add("1*"); // Transmissibility
|
||||
|
||||
size_t i, j, k;
|
||||
grid->ijkFromCellIndex(intersection.cellIndex, &i, &j, &k);
|
||||
formatter.add(wellPath->name());
|
||||
formatter.addZeroBasedCellIndex(i).addZeroBasedCellIndex(j).addZeroBasedCellIndex(k).addZeroBasedCellIndex(k);
|
||||
formatter.add("'OPEN'").add("1*").add("1*");
|
||||
formatter.add(location.fishbonesSubs->holeRadius() / 1000);
|
||||
formatter.add("1*").add("1*").add("1*");
|
||||
switch (intersection.direction)
|
||||
{
|
||||
case POS_I:
|
||||
case NEG_I:
|
||||
formatter.add("'X'");
|
||||
break;
|
||||
case POS_J:
|
||||
case NEG_J:
|
||||
formatter.add("'Y'");
|
||||
break;
|
||||
case POS_K:
|
||||
case NEG_K:
|
||||
formatter.add("'Z'");
|
||||
break;
|
||||
}
|
||||
formatter.add("1*");
|
||||
formatter.rowCompleted();
|
||||
if (RigCompletionData::isDefaultValue(data.diameter())) formatter.add("1*"); else formatter.add(data.diameter());
|
||||
if (RigCompletionData::isDefaultValue(data.kh())) formatter.add("1*"); else formatter.add(data.kh());
|
||||
if (RigCompletionData::isDefaultValue(data.skinFactor())) formatter.add("1*"); else formatter.add(data.skinFactor());
|
||||
if (RigCompletionData::isDefaultValue(data.dFactor())) formatter.add("1*"); else formatter.add(data.dFactor());
|
||||
|
||||
switch (data.direction())
|
||||
{
|
||||
case DIR_I:
|
||||
formatter.add("'X'");
|
||||
break;
|
||||
case DIR_J:
|
||||
formatter.add("'Y'");
|
||||
break;
|
||||
case DIR_K:
|
||||
formatter.add("'Z'");
|
||||
break;
|
||||
default:
|
||||
formatter.add("'Z'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
formatter.add(data.transmissibility());
|
||||
}
|
||||
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
formatter.tableCompleted();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportCompletionDataFeature::generateWpimultTable(RifEclipseOutputTableFormatter& formatter, const RimWellPath* wellPath, const RimExportCompletionDataSettings& settings, const std::map<size_t, double>& lateralsPerCell)
|
||||
void RicWellPathExportCompletionDataFeature::generateWpimultTable(RifEclipseOutputTableFormatter& formatter, const std::vector<RigCompletionData>& completionData)
|
||||
{
|
||||
RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid();
|
||||
std::vector<RifEclipseOutputTableColumn> header = {
|
||||
RifEclipseOutputTableColumn("Well"),
|
||||
RifEclipseOutputTableColumn("Mult"),
|
||||
@ -238,19 +259,120 @@ void RicWellPathExportCompletionDataFeature::generateWpimultTable(RifEclipseOutp
|
||||
formatter.keyword("WPIMULT");
|
||||
formatter.header(header);
|
||||
|
||||
for (auto lateralsInCell : lateralsPerCell)
|
||||
for (auto& completion : completionData)
|
||||
{
|
||||
size_t i, j, k;
|
||||
grid->ijkFromCellIndex(lateralsInCell.first, &i, &j, &k);
|
||||
formatter.add(wellPath->name());
|
||||
formatter.add(lateralsInCell.second);
|
||||
formatter.addZeroBasedCellIndex(i).addZeroBasedCellIndex(j).addZeroBasedCellIndex(k);
|
||||
formatter.add(completion.wellName());
|
||||
formatter.add(completion.count());
|
||||
formatter.addZeroBasedCellIndex(completion.cellIndex().i).addZeroBasedCellIndex(completion.cellIndex().j).addZeroBasedCellIndex(completion.cellIndex().k);
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
|
||||
formatter.tableCompleted();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateFishbonesCompdatValues(const RimWellPath* wellPath, const RimExportCompletionDataSettings& settings)
|
||||
{
|
||||
// Generate data
|
||||
const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData();
|
||||
std::vector<WellSegmentLocation> locations = findWellSegmentLocations(settings.caseToApply, wellPath);
|
||||
|
||||
// Filter out cells where main bore is present
|
||||
if (settings.removeLateralsInMainBoreCells())
|
||||
{
|
||||
std::vector<size_t> wellPathCells = findIntersectingCells(caseData, wellPath->wellPathGeometry()->m_wellPathPoints);
|
||||
markWellPathCells(wellPathCells, &locations);
|
||||
}
|
||||
|
||||
RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid();
|
||||
|
||||
std::vector<RigCompletionData> completionData;
|
||||
|
||||
for (const WellSegmentLocation& location : locations)
|
||||
{
|
||||
for (const WellSegmentLateral& lateral : location.laterals)
|
||||
{
|
||||
for (const WellSegmentLateralIntersection& intersection : lateral.intersections)
|
||||
{
|
||||
if (intersection.mainBoreCell && settings.removeLateralsInMainBoreCells()) continue;
|
||||
|
||||
size_t i, j, k;
|
||||
grid->ijkFromCellIndex(intersection.cellIndex, &i, &j, &k);
|
||||
RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k));
|
||||
completion.addMetadata(location.fishbonesSubs->name(), QString("Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex));
|
||||
double diameter = location.fishbonesSubs->holeRadius() / 1000 * 2;
|
||||
switch (intersection.direction)
|
||||
{
|
||||
case POS_I:
|
||||
case NEG_I:
|
||||
completion.setFromFishbone(diameter, CellDirection::DIR_I);
|
||||
break;
|
||||
case POS_J:
|
||||
case NEG_J:
|
||||
completion.setFromFishbone(diameter, CellDirection::DIR_J);
|
||||
break;
|
||||
case POS_K:
|
||||
case NEG_K:
|
||||
completion.setFromFishbone(diameter, CellDirection::DIR_K);
|
||||
break;
|
||||
default:
|
||||
completion.setFromFishbone(diameter, CellDirection::DIR_UNDEF);
|
||||
break;
|
||||
}
|
||||
completionData.push_back(completion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return completionData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generatePerforationsCompdatValues(const RimWellPath* wellPath, const RimExportCompletionDataSettings& settings)
|
||||
{
|
||||
std::vector<RigCompletionData> completionData;
|
||||
|
||||
for (const RimPerforationInterval* interval : wellPath->perforationIntervalCollection()->perforations())
|
||||
{
|
||||
std::vector<cvf::Vec3d> perforationPoints = wellPath->wellPathGeometry()->clippedPointSubset(interval->startMD(), interval->endMD());
|
||||
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), perforationPoints);
|
||||
for (auto& cell : intersectedCells)
|
||||
{
|
||||
size_t i, j, k;
|
||||
settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.cellIndex, &i, &j, &k);
|
||||
RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k));
|
||||
completion.addMetadata("Perforation", QString("StartMD: %1 - EndMD: %2").arg(interval->startMD()).arg(interval->endMD()));
|
||||
double diameter = interval->radius() * 2;
|
||||
switch (cell.direction)
|
||||
{
|
||||
case POS_I:
|
||||
case NEG_I:
|
||||
completion.setFromPerforation(diameter, CellDirection::DIR_I);
|
||||
break;
|
||||
case POS_J:
|
||||
case NEG_J:
|
||||
completion.setFromPerforation(diameter, CellDirection::DIR_J);
|
||||
break;
|
||||
case POS_K:
|
||||
case NEG_K:
|
||||
completion.setFromPerforation(diameter, CellDirection::DIR_K);
|
||||
break;
|
||||
default:
|
||||
completion.setFromPerforation(diameter, CellDirection::DIR_UNDEF);
|
||||
break;
|
||||
}
|
||||
|
||||
completionData.push_back(completion);
|
||||
}
|
||||
}
|
||||
|
||||
return completionData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -446,122 +568,6 @@ void RicWellPathExportCompletionDataFeature::generateCompsegsTable(RifEclipseOut
|
||||
formatter.tableCompleted();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<size_t> RicWellPathExportCompletionDataFeature::findCloseCells(const RigEclipseCaseData* caseData, const cvf::BoundingBox& bb)
|
||||
{
|
||||
std::vector<size_t> closeCells;
|
||||
caseData->mainGrid()->findIntersectingCells(bb, &closeCells);
|
||||
return closeCells;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<EclipseCellIndexRange> RicWellPathExportCompletionDataFeature::getCellIndexRange(const RigMainGrid* grid, const std::vector<size_t>& cellIndices)
|
||||
{
|
||||
// Retrieve I, J, K indices
|
||||
std::vector<EclipseCellIndex> eclipseCellIndices;
|
||||
for (auto cellIndex : cellIndices)
|
||||
{
|
||||
size_t i, j, k;
|
||||
if (!grid->ijkFromCellIndex(cellIndex, &i, &j, &k)) continue;
|
||||
eclipseCellIndices.push_back(std::make_tuple(i, j, k));
|
||||
}
|
||||
|
||||
// Group cell indices in K-ranges
|
||||
std::sort(eclipseCellIndices.begin(), eclipseCellIndices.end(), RicWellPathExportCompletionDataFeature::cellOrdering);
|
||||
std::vector<EclipseCellIndexRange> eclipseCellRanges;
|
||||
size_t lastI = std::numeric_limits<size_t>::max();
|
||||
size_t lastJ = std::numeric_limits<size_t>::max();
|
||||
size_t lastK = std::numeric_limits<size_t>::max();
|
||||
size_t startK = std::numeric_limits<size_t>::max();
|
||||
for (EclipseCellIndex cell : eclipseCellIndices)
|
||||
{
|
||||
size_t i, j, k;
|
||||
std::tie(i, j, k) = cell;
|
||||
if (i != lastI || j != lastJ || k != lastK + 1)
|
||||
{
|
||||
if (startK != std::numeric_limits<size_t>::max())
|
||||
{
|
||||
EclipseCellIndexRange cellRange = {lastI, lastJ, startK, lastK};
|
||||
eclipseCellRanges.push_back(cellRange);
|
||||
}
|
||||
lastI = i;
|
||||
lastJ = j;
|
||||
lastK = k;
|
||||
startK = k;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastK = k;
|
||||
}
|
||||
}
|
||||
// Append last cell range
|
||||
if (startK != std::numeric_limits<size_t>::max())
|
||||
{
|
||||
EclipseCellIndexRange cellRange = {lastI, lastJ, startK, lastK};
|
||||
eclipseCellRanges.push_back(cellRange);
|
||||
}
|
||||
return eclipseCellRanges;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicWellPathExportCompletionDataFeature::cellOrdering(const EclipseCellIndex& cell1, const EclipseCellIndex& cell2)
|
||||
{
|
||||
size_t i1, i2, j1, j2, k1, k2;
|
||||
std::tie(i1, j1, k1) = cell1;
|
||||
std::tie(i2, j2, k2) = cell2;
|
||||
if (i1 == i2)
|
||||
{
|
||||
if (j1 == j2)
|
||||
{
|
||||
return k1 < k2;
|
||||
}
|
||||
else
|
||||
{
|
||||
return j1 < j2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return i1 < i2;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RicWellPathExportCompletionDataFeature::findCellFromCoords(const RigEclipseCaseData* caseData, const cvf::Vec3d& coords)
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& nodeCoords = caseData->mainGrid()->nodes();
|
||||
|
||||
cvf::BoundingBox bb;
|
||||
bb.add(coords);
|
||||
std::vector<size_t> closeCells = findCloseCells(caseData, bb);
|
||||
cvf::Vec3d hexCorners[8];
|
||||
|
||||
for (size_t closeCell : closeCells)
|
||||
{
|
||||
const RigCell& cell = caseData->mainGrid()->globalCellArray()[closeCell];
|
||||
if (cell.isInvalid()) continue;
|
||||
|
||||
setHexCorners(cell, nodeCoords, hexCorners);
|
||||
|
||||
if (RigHexIntersector::isPointInCell(coords, hexCorners, closeCell))
|
||||
{
|
||||
return closeCell;
|
||||
}
|
||||
}
|
||||
|
||||
// Coordinate is outside any cells?
|
||||
CVF_ASSERT(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -570,17 +576,7 @@ std::vector<size_t> RicWellPathExportCompletionDataFeature::findIntersectingCell
|
||||
const std::vector<cvf::Vec3d>& nodeCoords = caseData->mainGrid()->nodes();
|
||||
std::set<size_t> cells;
|
||||
|
||||
// Find starting cell
|
||||
if (coords.size() > 0)
|
||||
{
|
||||
size_t startCell = findCellFromCoords(caseData, coords[0]);
|
||||
if (startCell > 0)
|
||||
{
|
||||
cells.insert(startCell);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<HexIntersectionInfo> intersections = findIntersections(caseData, coords);
|
||||
std::vector<HexIntersectionInfo> intersections = RigWellPathIntersectionTools::getIntersectedCells(caseData->mainGrid(), coords);
|
||||
for (auto intersection : intersections)
|
||||
{
|
||||
cells.insert(intersection.m_hexIndex);
|
||||
@ -594,54 +590,6 @@ std::vector<size_t> RicWellPathExportCompletionDataFeature::findIntersectingCell
|
||||
return cellsVector;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<HexIntersectionInfo> RicWellPathExportCompletionDataFeature::findIntersections(const RigEclipseCaseData* caseData, const std::vector<cvf::Vec3d>& coords)
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& nodeCoords = caseData->mainGrid()->nodes();
|
||||
std::vector<HexIntersectionInfo> intersections;
|
||||
for (size_t i = 0; i < coords.size() - 1; ++i)
|
||||
{
|
||||
cvf::BoundingBox bb;
|
||||
bb.add(coords[i]);
|
||||
bb.add(coords[i + 1]);
|
||||
|
||||
std::vector<size_t> closeCells = findCloseCells(caseData, bb);
|
||||
|
||||
cvf::Vec3d hexCorners[8];
|
||||
|
||||
for (size_t closeCell : closeCells)
|
||||
{
|
||||
const RigCell& cell = caseData->mainGrid()->globalCellArray()[closeCell];
|
||||
if (cell.isInvalid()) continue;
|
||||
|
||||
setHexCorners(cell, nodeCoords, hexCorners);
|
||||
|
||||
RigHexIntersector::lineHexCellIntersection(coords[i], coords[i + 1], hexCorners, closeCell, &intersections);
|
||||
}
|
||||
}
|
||||
|
||||
return intersections;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportCompletionDataFeature::setHexCorners(const RigCell& cell, const std::vector<cvf::Vec3d>& nodeCoords, cvf::Vec3d* hexCorners)
|
||||
{
|
||||
const caf::SizeTArray8& cornerIndices = cell.cornerIndices();
|
||||
|
||||
hexCorners[0] = nodeCoords[cornerIndices[0]];
|
||||
hexCorners[1] = nodeCoords[cornerIndices[1]];
|
||||
hexCorners[2] = nodeCoords[cornerIndices[2]];
|
||||
hexCorners[3] = nodeCoords[cornerIndices[3]];
|
||||
hexCorners[4] = nodeCoords[cornerIndices[4]];
|
||||
hexCorners[5] = nodeCoords[cornerIndices[5]];
|
||||
hexCorners[6] = nodeCoords[cornerIndices[6]];
|
||||
hexCorners[7] = nodeCoords[cornerIndices[7]];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -713,26 +661,7 @@ bool RicWellPathExportCompletionDataFeature::isPointBetween(const cvf::Vec3d& po
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportCompletionDataFeature::filterIntersections(std::vector<HexIntersectionInfo>* intersections)
|
||||
{
|
||||
// Erase intersections that are marked as entering
|
||||
for (auto it = intersections->begin(); it != intersections->end();)
|
||||
{
|
||||
if (it->m_isIntersectionEntering)
|
||||
{
|
||||
it = intersections->erase(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<WellSegmentLocation> RicWellPathExportCompletionDataFeature::findWellSegmentLocations(const RimEclipseCase* caseToApply, RimWellPath* wellPath)
|
||||
std::vector<WellSegmentLocation> RicWellPathExportCompletionDataFeature::findWellSegmentLocations(const RimEclipseCase* caseToApply, const RimWellPath* wellPath)
|
||||
{
|
||||
std::vector<WellSegmentLocation> wellSegmentLocations;
|
||||
for (RimFishbonesMultipleSubs* subs : wellPath->fishbonesCollection()->fishbonesSubs())
|
||||
@ -765,61 +694,37 @@ void RicWellPathExportCompletionDataFeature::calculateLateralIntersections(const
|
||||
{
|
||||
lateral.branchNumber = ++(*branchNum);
|
||||
std::vector<cvf::Vec3d> coords = location->fishbonesSubs->coordsForLateral(location->subIndex, lateral.lateralIndex);
|
||||
std::vector<HexIntersectionInfo> intersections = findIntersections(caseToApply->eclipseCaseData(), coords);
|
||||
filterIntersections(&intersections);
|
||||
std::vector<WellPathCellIntersectionInfo> intersections = RigWellPathIntersectionTools::findCellsIntersectedByPath(caseToApply->eclipseCaseData(), coords);
|
||||
|
||||
const HexIntersectionInfo* prevIntersection = nullptr;
|
||||
auto intersection = intersections.cbegin();
|
||||
double length = 0;
|
||||
double depth = 0;
|
||||
cvf::Vec3d startPoint = coords[0];
|
||||
int attachedSegmentNumber = location->segmentNumber;
|
||||
|
||||
for (size_t i = 1; i < coords.size() && intersection != intersections.cend(); ++i)
|
||||
{
|
||||
double length = 0;
|
||||
double depth = 0;
|
||||
cvf::Vec3d startPoint = coords[0];
|
||||
auto intersection = intersections.cbegin();
|
||||
int attachedSegmentNumber = location->segmentNumber;
|
||||
|
||||
for (size_t i = 1; i < coords.size() && intersection != intersections.cend(); i++)
|
||||
if (isPointBetween(startPoint, coords[i], intersection->endPoint))
|
||||
{
|
||||
if (isPointBetween(startPoint, coords[i], intersection->m_intersectionPoint))
|
||||
{
|
||||
cvf::Vec3d between = intersection->m_intersectionPoint - startPoint;
|
||||
length += between.length();
|
||||
depth += intersection->m_intersectionPoint.z() - startPoint.z();
|
||||
length += (intersection->endPoint - startPoint).length();
|
||||
depth += intersection->endPoint.z() - startPoint.z();
|
||||
|
||||
// Find the direction of the previous cell
|
||||
if (prevIntersection != nullptr)
|
||||
{
|
||||
std::pair<WellSegmentCellDirection, double> direction = calculateDirectionAndDistanceInCell(caseToApply->eclipseCaseData()->mainGrid(), prevIntersection->m_hexIndex, prevIntersection->m_intersectionPoint, intersection->m_intersectionPoint);
|
||||
WellSegmentLateralIntersection& lateralIntersection = lateral.intersections[lateral.intersections.size() - 1];
|
||||
lateralIntersection.direction = direction.first;
|
||||
lateralIntersection.directionLength = direction.second;
|
||||
}
|
||||
WellSegmentLateralIntersection lateralIntersection(++(*segmentNum), attachedSegmentNumber, intersection->cellIndex, length, depth);
|
||||
lateralIntersection.direction = intersection->direction;
|
||||
lateral.intersections.push_back(lateralIntersection);
|
||||
|
||||
lateral.intersections.push_back(WellSegmentLateralIntersection(++(*segmentNum), attachedSegmentNumber, intersection->m_hexIndex, length, depth));
|
||||
|
||||
length = 0;
|
||||
depth = 0;
|
||||
startPoint = intersection->m_intersectionPoint;
|
||||
attachedSegmentNumber = *segmentNum;
|
||||
++intersection;
|
||||
prevIntersection = &*intersection;
|
||||
}
|
||||
else
|
||||
{
|
||||
const cvf::Vec3d between = coords[i] - startPoint;
|
||||
length += between.length();
|
||||
depth += coords[i].z() - startPoint.z();
|
||||
startPoint = coords[i];
|
||||
}
|
||||
length = 0;
|
||||
depth = 0;
|
||||
startPoint = intersection->startPoint;
|
||||
attachedSegmentNumber = *segmentNum;
|
||||
++intersection;
|
||||
}
|
||||
else
|
||||
{
|
||||
length += (coords[i] - startPoint).length();
|
||||
depth += coords[i].z() - startPoint.z();
|
||||
startPoint = coords[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Find the direction of the last cell
|
||||
if (prevIntersection != nullptr && !coords.empty())
|
||||
{
|
||||
std::pair<WellSegmentCellDirection, double> direction = calculateDirectionAndDistanceInCell(caseToApply->eclipseCaseData()->mainGrid(), prevIntersection->m_hexIndex, prevIntersection->m_intersectionPoint, coords[coords.size()-1]);
|
||||
WellSegmentLateralIntersection& lateralIntersection = lateral.intersections[lateral.intersections.size() - 1];
|
||||
lateralIntersection.direction = direction.first;
|
||||
lateralIntersection.directionLength = direction.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -846,81 +751,18 @@ void RicWellPathExportCompletionDataFeature::assignBranchAndSegmentNumbers(const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportCompletionDataFeature::calculateCellMainAxisDirections(const RigMainGrid* grid, size_t cellIndex, cvf::Vec3d* iAxisDirection, cvf::Vec3d* jAxisDirection, cvf::Vec3d* kAxisDirection)
|
||||
void RicWellPathExportCompletionDataFeature::appendCompletionData(std::map<IJKCellIndex, RigCompletionData>* completionData, const std::vector<RigCompletionData>& data)
|
||||
{
|
||||
const std::vector<cvf::Vec3d>& nodeCoords = grid->nodes();
|
||||
cvf::Vec3d hexCorners[8];
|
||||
const RigCell& cell = grid->globalCellArray()[cellIndex];
|
||||
setHexCorners(cell, nodeCoords, hexCorners);
|
||||
|
||||
*iAxisDirection = calculateCellMainAxisDirection(hexCorners, cvf::StructGridInterface::FaceType::NEG_I, cvf::StructGridInterface::POS_I);
|
||||
*jAxisDirection = calculateCellMainAxisDirection(hexCorners, cvf::StructGridInterface::FaceType::NEG_J, cvf::StructGridInterface::POS_J);
|
||||
*kAxisDirection = calculateCellMainAxisDirection(hexCorners, cvf::StructGridInterface::FaceType::NEG_K, cvf::StructGridInterface::POS_K);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RicWellPathExportCompletionDataFeature::calculateCellMainAxisDirection(const cvf::Vec3d* hexCorners, cvf::StructGridInterface::FaceType startFace, cvf::StructGridInterface::FaceType endFace)
|
||||
{
|
||||
cvf::ubyte faceVertexIndices[4];
|
||||
|
||||
cvf::StructGridInterface::cellFaceVertexIndices(startFace, faceVertexIndices);
|
||||
|
||||
cvf::Vec3d startFaceCenter = cvf::GeometryTools::computeFaceCenter(hexCorners[faceVertexIndices[0]], hexCorners[faceVertexIndices[1]], hexCorners[faceVertexIndices[2]], hexCorners[faceVertexIndices[3]]);
|
||||
|
||||
cvf::StructGridInterface::cellFaceVertexIndices(endFace, faceVertexIndices);
|
||||
|
||||
cvf::Vec3d endFaceCenter = cvf::GeometryTools::computeFaceCenter(hexCorners[faceVertexIndices[0]], hexCorners[faceVertexIndices[1]], hexCorners[faceVertexIndices[2]], hexCorners[faceVertexIndices[3]]);
|
||||
|
||||
return endFaceCenter - startFaceCenter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<WellSegmentCellDirection, double> RicWellPathExportCompletionDataFeature::calculateDirectionAndDistanceInCell(const RigMainGrid* grid, size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint)
|
||||
{
|
||||
cvf::Vec3d vec = endPoint - startPoint;
|
||||
|
||||
cvf::Vec3d iAxisDirection;
|
||||
cvf::Vec3d jAxisDirection;
|
||||
cvf::Vec3d kAxisDirection;
|
||||
calculateCellMainAxisDirections(grid, cellIndex, &iAxisDirection, &jAxisDirection, &kAxisDirection);
|
||||
|
||||
double iLength = iAxisDirection.dot(vec);
|
||||
double jLength = jAxisDirection.dot(vec);
|
||||
double kLength = kAxisDirection.dot(vec);
|
||||
|
||||
double iNormalizedLength = abs(iLength / iAxisDirection.length());
|
||||
double jNormalizedLength = abs(jLength / jAxisDirection.length());
|
||||
double kNormalizedLength = abs(kLength / kAxisDirection.length());
|
||||
|
||||
if (iNormalizedLength > jNormalizedLength && iNormalizedLength > kNormalizedLength)
|
||||
for (auto& completion : data)
|
||||
{
|
||||
WellSegmentCellDirection direction = POS_I;
|
||||
if (iLength < 0)
|
||||
auto it = completionData->find(completion.cellIndex());
|
||||
if (it != completionData->end())
|
||||
{
|
||||
direction = NEG_I;
|
||||
it->second = it->second.combine(completion);
|
||||
}
|
||||
return std::make_pair(direction, iLength);
|
||||
}
|
||||
else if (jNormalizedLength > iNormalizedLength && jNormalizedLength > kNormalizedLength)
|
||||
{
|
||||
WellSegmentCellDirection direction = POS_J;
|
||||
if (jLength < 0)
|
||||
else
|
||||
{
|
||||
direction = NEG_J;
|
||||
completionData->insert(std::pair<IJKCellIndex, RigCompletionData>(completion.cellIndex(), completion));
|
||||
}
|
||||
return std::make_pair(direction, jLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
WellSegmentCellDirection direction = POS_K;
|
||||
if (kLength < 0)
|
||||
{
|
||||
direction = NEG_K;
|
||||
}
|
||||
return std::make_pair(direction, kLength);
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include "RifEclipseOutputTableFormatter.h"
|
||||
|
||||
#include "RigWellLogExtractionTools.h"
|
||||
#include "RigWellPathIntersectionTools.h"
|
||||
#include "RigCompletionData.h"
|
||||
|
||||
#include "RimExportCompletionDataSettings.h"
|
||||
|
||||
@ -36,18 +38,6 @@ class RigMainGrid;
|
||||
class RigCell;
|
||||
class RimFishbonesMultipleSubs;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
enum WellSegmentCellDirection {
|
||||
POS_I,
|
||||
NEG_I,
|
||||
POS_J,
|
||||
NEG_J,
|
||||
POS_K,
|
||||
NEG_K
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@ -59,7 +49,6 @@ struct WellSegmentLateralIntersection {
|
||||
length(length),
|
||||
depth(depth),
|
||||
direction(POS_I),
|
||||
directionLength(-1.0),
|
||||
mainBoreCell(false)
|
||||
{}
|
||||
|
||||
@ -69,8 +58,7 @@ struct WellSegmentLateralIntersection {
|
||||
bool mainBoreCell;
|
||||
double length;
|
||||
double depth;
|
||||
WellSegmentCellDirection direction;
|
||||
double directionLength;
|
||||
WellPathCellDirection direction;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
@ -134,33 +122,25 @@ protected:
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
static void exportToFolder(RimWellPath* wellPath, const RimExportCompletionDataSettings& exportSettings);
|
||||
static void exportCompletions(RimWellPath* wellPath, const RimExportCompletionDataSettings& exportSettings);
|
||||
|
||||
static void generateCompdatTable(RifEclipseOutputTableFormatter& formatter, const std::vector<RigCompletionData>& completionData);
|
||||
static void generateWpimultTable(RifEclipseOutputTableFormatter& formatter, const std::vector<RigCompletionData>& completionData);
|
||||
|
||||
static std::vector<RigCompletionData> generateFishbonesCompdatValues(const RimWellPath* wellPath, const RimExportCompletionDataSettings& settings);
|
||||
static std::vector<RigCompletionData> generatePerforationsCompdatValues(const RimWellPath* wellPath, const RimExportCompletionDataSettings& settings);
|
||||
|
||||
static void generateCompdatTable(RifEclipseOutputTableFormatter& formatter, const RimWellPath* wellPath, const RimExportCompletionDataSettings& settings, const std::vector<WellSegmentLocation>& locations);
|
||||
static void generateWpimultTable(RifEclipseOutputTableFormatter& formatter, const RimWellPath* wellPath, const RimExportCompletionDataSettings& settings, const std::map<size_t, double>& lateralsPerCell);
|
||||
static void generateWelsegsTable(RifEclipseOutputTableFormatter& formatter, const RimWellPath* wellPath, const RimExportCompletionDataSettings& settings, const std::vector<WellSegmentLocation>& locations);
|
||||
static void generateCompsegsTable(RifEclipseOutputTableFormatter& formatter, const RimWellPath* wellPath, const RimExportCompletionDataSettings& settings, const std::vector<WellSegmentLocation>& locations);
|
||||
|
||||
static std::map<size_t, double> computeLateralsPerCell(const std::vector<WellSegmentLocation>& segmentLocations, bool removeMainBoreCells);
|
||||
|
||||
static std::vector<size_t> findCloseCells(const RigEclipseCaseData* caseData, const cvf::BoundingBox& bb);
|
||||
static size_t findCellFromCoords(const RigEclipseCaseData* caseData, const cvf::Vec3d& coords);
|
||||
|
||||
static std::vector<EclipseCellIndexRange> getCellIndexRange(const RigMainGrid* grid, const std::vector<size_t>& cellIndices);
|
||||
static bool cellOrdering(const EclipseCellIndex& cell1, const EclipseCellIndex& cell2);
|
||||
static std::vector<size_t> findIntersectingCells(const RigEclipseCaseData* grid, const std::vector<cvf::Vec3d>& coords);
|
||||
static void setHexCorners(const RigCell& cell, const std::vector<cvf::Vec3d>& nodeCoords, cvf::Vec3d* hexCorners);
|
||||
static void markWellPathCells(const std::vector<size_t>& wellPathCells, std::vector<WellSegmentLocation>* locations);
|
||||
static bool wellSegmentLocationOrdering(const WellSegmentLocation& first, const WellSegmentLocation& second);
|
||||
static std::vector<HexIntersectionInfo> findIntersections(const RigEclipseCaseData* caseData, const std::vector<cvf::Vec3d>& coords);
|
||||
static bool isPointBetween(const cvf::Vec3d& pointA, const cvf::Vec3d& pointB, const cvf::Vec3d& needle);
|
||||
static void filterIntersections(std::vector<HexIntersectionInfo>* intersections);
|
||||
static std::vector<WellSegmentLocation> findWellSegmentLocations(const RimEclipseCase* caseToApply, RimWellPath* wellPath);
|
||||
static std::vector<WellSegmentLocation> findWellSegmentLocations(const RimEclipseCase* caseToApply, const RimWellPath* wellPath);
|
||||
static void calculateLateralIntersections(const RimEclipseCase* caseToApply, WellSegmentLocation* location, int* branchNum, int* segmentNum);
|
||||
static void assignBranchAndSegmentNumbers(const RimEclipseCase* caseToApply, std::vector<WellSegmentLocation>* locations);
|
||||
|
||||
// Calculate direction
|
||||
static void calculateCellMainAxisDirections(const RigMainGrid* grid, size_t cellIndex, cvf::Vec3d* iAxisDirection, cvf::Vec3d* jAxisDirection, cvf::Vec3d* kAxisDirection);
|
||||
static cvf::Vec3d calculateCellMainAxisDirection(const cvf::Vec3d* hexCorners, cvf::StructGridInterface::FaceType startFace, cvf::StructGridInterface::FaceType endFace);
|
||||
static std::pair<WellSegmentCellDirection, double> calculateDirectionAndDistanceInCell(const RigMainGrid* grid, size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint);
|
||||
static void appendCompletionData(std::map<IJKCellIndex, RigCompletionData>* completionData, const std::vector<RigCompletionData>& data);
|
||||
};
|
||||
|
@ -1,201 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicWellPathExportPerforationCompdatFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimPerforationCollection.h"
|
||||
#include "RimPerforationInterval.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "RigWellLogExtractionTools.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigWellPath.h"
|
||||
#include "RigWellPathIntersectionTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
|
||||
#include "cvfPlane.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicWellPathExportPerforationCompdatFeature, "RicWellPathExportPerforationCompdatFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicWellPathExportPerforationCompdatFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimWellPath*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType(&objects);
|
||||
|
||||
if (objects.size() == 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportPerforationCompdatFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellPath*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType(&objects);
|
||||
|
||||
CVF_ASSERT(objects.size() == 1);
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
QString projectFolder = app->currentProjectPath();
|
||||
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("COMPLETIONS", projectFolder);
|
||||
|
||||
RimCaseAndFileExportSettings 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.fileName = QDir(defaultDir).filePath("Perforations");
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Completion Data", "");
|
||||
if (propertyDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", QFileInfo(exportSettings.fileName).absolutePath());
|
||||
|
||||
exportCompdat(objects[0], exportSettings);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportPerforationCompdatFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Export Perforation Completion Data");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportPerforationCompdatFeature::exportCompdat(RimWellPath* wellPath, const RimCaseAndFileExportSettings& exportSettings)
|
||||
{
|
||||
QFile exportFile(exportSettings.fileName());
|
||||
|
||||
if (exportSettings.caseToApply() == nullptr)
|
||||
{
|
||||
RiaLogging::error("Export Completions Data: Cannot export completions data without specified eclipse case");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!exportFile.open(QIODevice::WriteOnly))
|
||||
{
|
||||
RiaLogging::error(QString("Export Completions Data: Could not open the file: %1").arg(exportSettings.fileName()));
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate data
|
||||
const RigEclipseCaseData* caseData = exportSettings.caseToApply()->eclipseCaseData();
|
||||
const RigMainGrid* grid = caseData->mainGrid();
|
||||
|
||||
|
||||
QTextStream stream(&exportFile);
|
||||
RifEclipseOutputTableFormatter formatter(stream);
|
||||
|
||||
std::vector<RifEclipseOutputTableColumn> header = {
|
||||
RifEclipseOutputTableColumn("Well"),
|
||||
RifEclipseOutputTableColumn("I"),
|
||||
RifEclipseOutputTableColumn("J"),
|
||||
RifEclipseOutputTableColumn("K1"),
|
||||
RifEclipseOutputTableColumn("K2"),
|
||||
RifEclipseOutputTableColumn("Status"),
|
||||
RifEclipseOutputTableColumn("SAT"),
|
||||
RifEclipseOutputTableColumn("TR"),
|
||||
RifEclipseOutputTableColumn("DIAM"),
|
||||
RifEclipseOutputTableColumn("KH"),
|
||||
RifEclipseOutputTableColumn("S"),
|
||||
RifEclipseOutputTableColumn("Df"),
|
||||
RifEclipseOutputTableColumn("DIR"),
|
||||
RifEclipseOutputTableColumn("r0")
|
||||
};
|
||||
|
||||
formatter.keyword("COMPDAT");
|
||||
formatter.header(header);
|
||||
|
||||
for (const RimPerforationInterval* interval : wellPath->perforationIntervalCollection()->m_perforations())
|
||||
{
|
||||
generateCompdatForPerforation(formatter, caseData, wellPath, interval);
|
||||
}
|
||||
|
||||
formatter.tableCompleted();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellPathExportPerforationCompdatFeature::generateCompdatForPerforation(RifEclipseOutputTableFormatter& formatter, const RigEclipseCaseData* caseData, RimWellPath* wellPath, const RimPerforationInterval* interval)
|
||||
{
|
||||
std::vector<cvf::Vec3d> perforationPoints = wellPath->wellPathGeometry()->clippedPointSubset(interval->startMD(), interval->endMD());
|
||||
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(caseData, perforationPoints);
|
||||
|
||||
formatter.comment(QString("Perforation interval from %1 to %2").arg(interval->startMD()).arg(interval->endMD()));
|
||||
for (auto& cell : intersectedCells)
|
||||
{
|
||||
size_t i, j, k;
|
||||
caseData->mainGrid()->ijkFromCellIndex(cell.cellIndex, &i, &j, &k);
|
||||
formatter.add(wellPath->name());
|
||||
formatter.addZeroBasedCellIndex(i).addZeroBasedCellIndex(j).addZeroBasedCellIndex(k).addZeroBasedCellIndex(k);
|
||||
formatter.add("'OPEN'").add("1*").add("1*");
|
||||
formatter.add(interval->radius());
|
||||
formatter.add("1*").add("1*").add("1*");
|
||||
switch (cell.direction)
|
||||
{
|
||||
case POS_I:
|
||||
case NEG_I:
|
||||
formatter.add("'X'");
|
||||
break;
|
||||
case POS_J:
|
||||
case NEG_J:
|
||||
formatter.add("'Y'");
|
||||
break;
|
||||
case POS_K:
|
||||
case NEG_K:
|
||||
formatter.add("'Z'");
|
||||
break;
|
||||
}
|
||||
formatter.add("1*");
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimCaseAndFileExportSettings.h"
|
||||
|
||||
#include "RifEclipseOutputTableFormatter.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimPerforationInterval;
|
||||
class RimWellPath;
|
||||
|
||||
class RigEclipseCaseData;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicWellPathExportPerforationCompdatFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
static void exportCompdat(RimWellPath* wellPath, const RimCaseAndFileExportSettings& exportSettings);
|
||||
static void generateCompdatForPerforation(RifEclipseOutputTableFormatter& formatter, const RigEclipseCaseData* caseData, RimWellPath* wellPath, const RimPerforationInterval* interval);
|
||||
};
|
@ -401,7 +401,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
commandIds << "RicExportFishbonesLateralsFeature";
|
||||
commandIds << "RicWellPathExportCompletionDataFeature";
|
||||
commandIds << "RicWellPathImportCompletionsFileFeature";
|
||||
commandIds << "RicWellPathExportPerforationCompdatFeature";
|
||||
commandIds << "RicFlyToObjectFeature";
|
||||
|
||||
// Work in progress -- End
|
||||
|
@ -46,6 +46,9 @@ RimExportCompletionDataSettings::RimExportCompletionDataSettings()
|
||||
{
|
||||
CAF_PDM_InitObject("RimExportCompletionDataSettings", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&includePerforations, "IncludePerforations", true, "Include Perforations", "", "", "");
|
||||
CAF_PDM_InitField(&includeFishbones, "IncludeFishbones", true, "Include Fishbones", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&includeWpimult, "IncludeWPIMULT", true, "Include WPIMLUT", "", "", "");
|
||||
CAF_PDM_InitField(&removeLateralsInMainBoreCells, "RemoveLateralsInMainBoreCells", false, "Remove Laterals in Main Bore Cells", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&pressureDrop, "PressureDrop", "Pressure Drop", "", "", "");
|
||||
|
@ -48,6 +48,10 @@ public:
|
||||
|
||||
RimExportCompletionDataSettings();
|
||||
|
||||
|
||||
caf::PdmField<bool> includePerforations;
|
||||
caf::PdmField<bool> includeFishbones;
|
||||
|
||||
caf::PdmField<bool> includeWpimult;
|
||||
caf::PdmField<bool> removeLateralsInMainBoreCells;
|
||||
caf::PdmField<PressureDropEnum> pressureDrop;
|
||||
|
@ -83,3 +83,18 @@ void RimPerforationCollection::appendPerforation(RimPerforationInterval* perfora
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<const RimPerforationInterval*> RimPerforationCollection::perforations() const
|
||||
{
|
||||
std::vector<const RimPerforationInterval*> myPerforations;
|
||||
|
||||
for (auto perforation : m_perforations)
|
||||
{
|
||||
myPerforations.push_back(perforation);
|
||||
}
|
||||
|
||||
return myPerforations;
|
||||
}
|
||||
|
||||
|
@ -41,8 +41,12 @@ public:
|
||||
~RimPerforationCollection();
|
||||
|
||||
void appendPerforation(RimPerforationInterval* perforation);
|
||||
std::vector<const RimPerforationInterval*> perforations() const;
|
||||
|
||||
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
||||
friend class RiuEditPerforationCollectionWidget;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimPerforationInterval*> m_perforations;
|
||||
};
|
||||
|
@ -17,6 +17,7 @@ ${CEE_CURRENT_LIST_DIR}RigActiveCellsResultAccessor.h
|
||||
${CEE_CURRENT_LIST_DIR}RigCellEdgeResultAccessor.h
|
||||
${CEE_CURRENT_LIST_DIR}RigCombTransResultAccessor.h
|
||||
${CEE_CURRENT_LIST_DIR}RigCombMultResultAccessor.h
|
||||
${CEE_CURRENT_LIST_DIR}RigCompletionData.h
|
||||
${CEE_CURRENT_LIST_DIR}RigResultModifier.h
|
||||
${CEE_CURRENT_LIST_DIR}RigResultModifierFactory.h
|
||||
${CEE_CURRENT_LIST_DIR}RigFormationNames.h
|
||||
@ -69,6 +70,7 @@ ${CEE_CURRENT_LIST_DIR}RigActiveCellsResultAccessor.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigCellEdgeResultAccessor.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigCombTransResultAccessor.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigCombMultResultAccessor.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigCompletionData.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigResultModifierFactory.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigFormationNames.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigFlowDiagResultAddress.cpp
|
||||
|
196
ApplicationCode/ReservoirDataModel/RigCompletionData.cpp
Normal file
196
ApplicationCode/ReservoirDataModel/RigCompletionData.cpp
Normal file
@ -0,0 +1,196 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RigCompletionData.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
RigCompletionData::RigCompletionData(const QString wellName, const IJKCellIndex cellIndex)
|
||||
: m_wellName(wellName),
|
||||
m_cellIndex(cellIndex),
|
||||
m_saturation(HUGE_VAL),
|
||||
m_transmissibility(HUGE_VAL),
|
||||
m_diameter(HUGE_VAL),
|
||||
m_kh(HUGE_VAL),
|
||||
m_skinFactor(HUGE_VAL),
|
||||
m_dFactor(HUGE_VAL),
|
||||
m_direction(DIR_UNDEF),
|
||||
m_connectionState(OPEN),
|
||||
m_count(1)
|
||||
{
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
RigCompletionData::~RigCompletionData()
|
||||
{
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
RigCompletionData::RigCompletionData(const RigCompletionData& other)
|
||||
{
|
||||
copy(*this, other);
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
RigCompletionData RigCompletionData::combine(const RigCompletionData& other) const
|
||||
{
|
||||
RigCompletionData result(*this);
|
||||
CVF_ASSERT(result.m_wellName == other.m_wellName);
|
||||
CVF_ASSERT(result.m_cellIndex == other.m_cellIndex);
|
||||
|
||||
if (onlyOneIsDefaulted(result.m_transmissibility, other.m_transmissibility))
|
||||
{
|
||||
RiaLogging::error("Transmissibility defaulted in one but not both, will produce erroneous result");
|
||||
}
|
||||
else
|
||||
{
|
||||
result.m_transmissibility += other.m_transmissibility;
|
||||
}
|
||||
|
||||
result.m_metadata.reserve(result.m_metadata.size() + other.m_metadata.size());
|
||||
result.m_metadata.insert(result.m_metadata.end(), other.m_metadata.begin(), other.m_metadata.end());
|
||||
|
||||
result.m_count += other.m_count;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
bool RigCompletionData::operator<(const RigCompletionData& other) const
|
||||
{
|
||||
if (m_wellName < other.m_wellName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return m_cellIndex < other.m_cellIndex;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
RigCompletionData& RigCompletionData::operator=(const RigCompletionData& other)
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
copy(*this, other);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
void RigCompletionData::setFromFracture(double transmissibility, double skinFactor)
|
||||
{
|
||||
m_transmissibility = transmissibility;
|
||||
m_skinFactor = skinFactor;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
void RigCompletionData::setFromFishbone(double diameter, CellDirection direction)
|
||||
{
|
||||
m_diameter = diameter;
|
||||
m_direction = direction;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
void RigCompletionData::setFromPerforation(double diameter, CellDirection direction)
|
||||
{
|
||||
m_diameter = diameter;
|
||||
m_direction = direction;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
void RigCompletionData::addMetadata(const QString& name, const QString& comment)
|
||||
{
|
||||
m_metadata.push_back(RigCompletionMetaData(name, comment));
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
bool RigCompletionData::isDefaultValue(double val)
|
||||
{
|
||||
return val == HUGE_VAL;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
bool RigCompletionData::onlyOneIsDefaulted(double first, double second)
|
||||
{
|
||||
if (first == HUGE_VAL)
|
||||
{
|
||||
if (second == HUGE_VAL)
|
||||
{
|
||||
// Both have default values
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// First has default value, second does not
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (second == HUGE_VAL)
|
||||
{
|
||||
// Second has default value, first does not
|
||||
return true;
|
||||
}
|
||||
|
||||
// Neither has default values
|
||||
return false;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
void RigCompletionData::copy(RigCompletionData& target, const RigCompletionData& from)
|
||||
{
|
||||
target.m_metadata = from.m_metadata;
|
||||
target.m_wellName = from.m_wellName;
|
||||
target.m_cellIndex = from.m_cellIndex;
|
||||
target.m_connectionState = from.m_connectionState;
|
||||
target.m_saturation = from.m_saturation;
|
||||
target.m_transmissibility = from.m_transmissibility;
|
||||
target.m_diameter = from.m_diameter;
|
||||
target.m_kh = from.m_kh;
|
||||
target.m_skinFactor = from.m_skinFactor;
|
||||
target.m_dFactor = from.m_dFactor;
|
||||
target.m_direction = from.m_direction;
|
||||
target.m_count = from.m_count;
|
||||
}
|
140
ApplicationCode/ReservoirDataModel/RigCompletionData.h
Normal file
140
ApplicationCode/ReservoirDataModel/RigCompletionData.h
Normal file
@ -0,0 +1,140 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "cvfObject.h"
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
enum WellConnectionState {
|
||||
OPEN,
|
||||
SHUT,
|
||||
AUTO,
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
enum CellDirection {
|
||||
DIR_I,
|
||||
DIR_J,
|
||||
DIR_K,
|
||||
DIR_UNDEF,
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class IJKCellIndex {
|
||||
public:
|
||||
IJKCellIndex() {};
|
||||
IJKCellIndex(size_t i, size_t j, size_t k) : i(i), j(j), k(k) {};
|
||||
IJKCellIndex(const IJKCellIndex& other)
|
||||
{
|
||||
i = other.i;
|
||||
j = other.j;
|
||||
k = other.k;
|
||||
}
|
||||
|
||||
bool operator==(const IJKCellIndex& other) const
|
||||
{
|
||||
return i == other.i && j == other.j && k == other.k;
|
||||
}
|
||||
|
||||
bool operator<(const IJKCellIndex& other) const
|
||||
{
|
||||
if (i != other.i) return i < other.i;
|
||||
if (j != other.j) return j < other.j;
|
||||
if (k != other.k) return k < other.k;
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t i;
|
||||
size_t j;
|
||||
size_t k;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
struct RigCompletionMetaData {
|
||||
RigCompletionMetaData(const QString& name, const QString& comment) : name(name), comment(comment) {}
|
||||
|
||||
QString name;
|
||||
QString comment;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigCompletionData : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RigCompletionData(const QString wellName, const IJKCellIndex cellIndex);
|
||||
~RigCompletionData();
|
||||
RigCompletionData(const RigCompletionData& other);
|
||||
|
||||
RigCompletionData combine(const RigCompletionData& other) const;
|
||||
|
||||
bool operator<(const RigCompletionData& other) const;
|
||||
RigCompletionData& operator=(const RigCompletionData& other);
|
||||
|
||||
void setFromFracture(double transmissibility, double skinFactor);
|
||||
void setFromFishbone(double diameter, CellDirection direction);
|
||||
void setFromPerforation(double diameter, CellDirection direction);
|
||||
void addMetadata(const QString& name, const QString& comment);
|
||||
static bool isDefaultValue(double val);
|
||||
|
||||
const std::vector<RigCompletionMetaData>& metadata() const { return m_metadata; }
|
||||
const QString& wellName() const { return m_wellName; }
|
||||
const IJKCellIndex& cellIndex() const { return m_cellIndex; }
|
||||
WellConnectionState connectionState() const { return m_connectionState; }
|
||||
double saturation() const { return m_saturation; }
|
||||
double transmissibility() const { return m_transmissibility; }
|
||||
double diameter() const { return m_diameter; }
|
||||
double kh() const { return m_kh; }
|
||||
double skinFactor() const { return m_skinFactor; }
|
||||
double dFactor() const { return m_dFactor; }
|
||||
CellDirection direction() const { return m_direction; }
|
||||
size_t count() const { return m_count; }
|
||||
|
||||
private:
|
||||
std::vector<RigCompletionMetaData> m_metadata;
|
||||
QString m_wellName;
|
||||
IJKCellIndex m_cellIndex;
|
||||
WellConnectionState m_connectionState;
|
||||
double m_saturation;
|
||||
double m_transmissibility;
|
||||
double m_diameter;
|
||||
double m_kh;
|
||||
double m_skinFactor;
|
||||
double m_dFactor;
|
||||
CellDirection m_direction;
|
||||
|
||||
// Number of parts that have contributed to this completion
|
||||
size_t m_count;
|
||||
|
||||
private:
|
||||
static bool onlyOneIsDefaulted(double first, double second);
|
||||
static void copy(RigCompletionData& target, const RigCompletionData& from);
|
||||
};
|
@ -18,8 +18,6 @@
|
||||
|
||||
#include "RigWellPathIntersectionTools.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RigWellPath.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
@ -121,10 +119,6 @@ std::vector<HexIntersectionInfo> RigWellPathIntersectionTools::getIntersectedCel
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigWellPathIntersectionTools::calculateCellMainAxisVectors(const std::array<cvf::Vec3d, 8>& hexCorners, cvf::Vec3d* iAxisDirection, cvf::Vec3d* jAxisDirection, cvf::Vec3d* kAxisDirection)
|
||||
{
|
||||
for (auto vec : hexCorners)
|
||||
{
|
||||
RiaLogging::debug(QString("%1, %2, %3").arg(vec.x()).arg(vec.y()).arg(vec.z()));
|
||||
}
|
||||
*iAxisDirection = calculateCellMainAxisVector(hexCorners, cvf::StructGridInterface::NEG_I, cvf::StructGridInterface::POS_I);
|
||||
*jAxisDirection = calculateCellMainAxisVector(hexCorners, cvf::StructGridInterface::NEG_J, cvf::StructGridInterface::POS_J);
|
||||
*kAxisDirection = calculateCellMainAxisVector(hexCorners, cvf::StructGridInterface::NEG_K, cvf::StructGridInterface::POS_K);
|
||||
|
Loading…
Reference in New Issue
Block a user