#3604 Export completions. New feature 'Export Completion Data for Temporary LGRs'

This commit is contained in:
Bjørn Erik Jensen 2018-11-08 11:24:40 +01:00
parent 963c403869
commit cfb45f674a
13 changed files with 239 additions and 24 deletions

View File

@ -13,6 +13,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleSimWellsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicMultiSegmentWellExportInfo.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureTextReportFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureReportItem.h
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForTemporaryLgrsFeature.h
)
@ -30,6 +31,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleSimWellsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMultiSegmentWellExportInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureTextReportFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureReportItem.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForTemporaryLgrsFeature.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,104 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicExportCompletionsForTemporaryLgrsFeature.h"
#include "RiaApplication.h"
#include "RicWellPathExportCompletionDataFeature.h"
#include "RigMainGrid.h"
#include "RiuPlotMainWindow.h"
#include "RimGridCollection.h"
#include "RimWellPath.h"
#include "RimProject.h"
#include "RimWellPathCollection.h"
#include "RimEclipseCase.h"
#include "cafSelectionManagerTools.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicExportCompletionsForTemporaryLgrsFeature, "RicExportCompletionsForTemporaryLgrsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicExportCompletionsForTemporaryLgrsFeature::isCommandEnabled()
{
std::vector<RimGridInfoCollection*> selGridInfos = caf::selectedObjectsByTypeStrict<RimGridInfoCollection*>();
return selGridInfos.size() == 1 && selGridInfos.front()->uiName() == RimGridCollection::temporaryGridUiName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionsForTemporaryLgrsFeature::onActionTriggered(bool isChecked)
{
std::vector<RimWellPath*> wellPaths = wellPathsAssociatedWithLgrs();
CVF_ASSERT(wellPaths.size() > 0);
std::vector<RimSimWellInView*> simWells;
QString dialogTitle = "Export Completion Data for Temporary LGRs";
RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompletions(dialogTitle, wellPaths, simWells);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionsForTemporaryLgrsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Export Completion Data");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPath*> RicExportCompletionsForTemporaryLgrsFeature::wellPathsAssociatedWithLgrs()
{
std::vector<RimWellPath*> wellPaths;
auto selectedEclipseCase = caf::firstAncestorOfTypeFromSelectedObject<RimEclipseCase*>();
auto mainGrid = selectedEclipseCase->mainGrid();
std::set<QString> wellPathNames;
for (size_t i = 0; i < mainGrid->gridCount(); i++)
{
const RigGridBase* grid = mainGrid->gridByIndex(i);
if (!grid->associatedWellPathName().empty())
{
wellPathNames.insert(QString::fromStdString(grid->associatedWellPathName()));
}
}
auto project = RiaApplication::instance()->project();
for (const auto& wellPathName : wellPathNames)
{
auto wellPath = project->wellPathByName(wellPathName);
if (wellPath)
{
wellPaths.push_back(wellPath);
}
}
return wellPaths;
}

View File

@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafCmdFeature.h"
class RimSimWellInView;
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
class RicExportCompletionsForTemporaryLgrsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
public:
static std::vector<RimWellPath*> wellPathsAssociatedWithLgrs();
};

View File

@ -124,7 +124,7 @@ std::vector<RigCompletionData> filterCompletionsOnType(const std::vector<RigComp
const std::set<RigCompletionData::CompletionType>& includedCompletionTypes)
{
std::vector<RigCompletionData> filtered;
for (auto completion : completions)
for (const auto& completion : completions)
{
if (includedCompletionTypes.count(completion.completionType()) > 0) filtered.push_back(completion);
}
@ -344,12 +344,12 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPath(RimWellPath*
if (splitType == Lgr::LGR_PER_CELL)
{
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep, completionTypes, intersectingOtherLgrs);
lgrs = buildLgrsPerMainCell(eclipseCase, intersectingCells, lgrCellCounts);
lgrs = buildLgrsPerMainCell(eclipseCase, wellPath, intersectingCells, lgrCellCounts);
}
else if (splitType == Lgr::LGR_PER_COMPLETION)
{
auto intersectingCells = cellsIntersectingCompletions_PerCompletion(eclipseCase, wellPath, timeStep, completionTypes, intersectingOtherLgrs);
lgrs = buildLgrsPerCompletion(eclipseCase, intersectingCells, lgrCellCounts);
lgrs = buildLgrsPerCompletion(eclipseCase, wellPath, intersectingCells, lgrCellCounts);
}
else if (splitType == Lgr::LGR_PER_WELL)
{
@ -357,7 +357,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPath(RimWellPath*
int lgrId = firstAvailableLgrId(eclipseCase->mainGrid());
auto lgrName = createLgrName("", lgrId);
lgrs.push_back(buildLgr(lgrId, lgrName, lgrName, eclipseCase, intersectingCells, lgrCellCounts));
lgrs.push_back(buildLgr(lgrId, lgrName, lgrName, eclipseCase, wellPath, intersectingCells, lgrCellCounts));
}
return lgrs;
}
@ -366,16 +366,17 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPath(RimWellPath*
///
//--------------------------------------------------------------------------------------------------
std::vector<LgrInfo> RicExportLgrFeature::buildLgrsPerMainCell(RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
const std::vector<RigCompletionDataGridCell>& intersectingCells,
const caf::VecIjk& lgrSizes)
{
std::vector<LgrInfo> lgrs;
int lgrId = firstAvailableLgrId(eclipseCase->mainGrid());
for (auto intersectionCell : intersectingCells)
for (const auto& intersectionCell : intersectingCells)
{
auto lgrName = createLgrName("", lgrId);
lgrs.push_back(buildLgr(lgrId++, lgrName, lgrName, eclipseCase, {intersectionCell}, lgrSizes));
lgrs.push_back(buildLgr(lgrId++, lgrName, lgrName, eclipseCase, wellPath, {intersectionCell}, lgrSizes));
}
return lgrs;
}
@ -385,6 +386,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsPerMainCell(RimEclipseCase*
//--------------------------------------------------------------------------------------------------
std::vector<LgrInfo> RicExportLgrFeature::buildLgrsPerCompletion(
RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
const std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>& completionInfo,
const caf::VecIjk& lgrSizesPerMainGridCell)
{
@ -401,7 +403,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsPerCompletion(
auto& typeName = namesAndCounters[complInfo.first.type].first;
auto& typeCounter = namesAndCounters[complInfo.first.type].second;
auto lgrShortName = createShortLgrName(typeName, typeCounter++);
lgrs.push_back(buildLgr(lgrId++, lgrName, lgrShortName, eclipseCase, complInfo.second, lgrSizesPerMainGridCell));
lgrs.push_back(buildLgr(lgrId++, lgrName, lgrShortName, eclipseCase, wellPath, complInfo.second, lgrSizesPerMainGridCell));
}
return lgrs;
}
@ -413,6 +415,7 @@ LgrInfo RicExportLgrFeature::buildLgr(int
const QString& lgrName,
const QString& shortLgrName,
RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
const std::vector<RigCompletionDataGridCell>& intersectingCells,
const caf::VecIjk& lgrSizesPerMainGridCell)
{
@ -423,7 +426,7 @@ LgrInfo RicExportLgrFeature::buildLgr(int
auto jRange = initRange();
auto kRange = initRange();
for (auto cell : intersectingCells)
for (const auto& cell : intersectingCells)
{
iRange.first = std::min(cell.localCellIndexI(), iRange.first);
iRange.second = std::max(cell.localCellIndexI(), iRange.second);
@ -439,7 +442,7 @@ LgrInfo RicExportLgrFeature::buildLgr(int
caf::VecIjk mainGridStartCell(iRange.first, jRange.first, kRange.first);
caf::VecIjk mainGridEndCell(iRange.second, jRange.second, kRange.second);
return LgrInfo(lgrId, lgrName, shortLgrName, lgrSizes, mainGridStartCell, mainGridEndCell);
return LgrInfo(lgrId, lgrName, shortLgrName, wellPath->name(), lgrSizes, mainGridStartCell, mainGridEndCell);
}
//--------------------------------------------------------------------------------------------------
@ -526,7 +529,7 @@ std::vector<std::pair<RigCompletionDataGridCell, std::vector<RigCompletionData>>
if (!cellFoundOnWellPath)
{
cellsNotOnWellPath.push_back({ true, CellInfo(complCell.first.globalCellIndex()) });
cellsNotOnWellPath.emplace_back( true, CellInfo(complCell.first.globalCellIndex()) );
}
}
}
@ -540,7 +543,7 @@ std::vector<std::pair<RigCompletionDataGridCell, std::vector<RigCompletionData>>
// Add cell on well path first
auto complDataGridCell = complCellLookup.at(cellOnWellPath.globCellIndex);
auto complDataList = completionCells.at(complDataGridCell);
result.push_back({complDataGridCell, complDataList});
result.emplace_back(complDataGridCell, complDataList);
// Check intersected completions in current cell
RigCompletionData::CompletionType complTypes[] = { RigCompletionData::FRACTURE, RigCompletionData::FISHBONES, RigCompletionData::PERFORATION };
@ -570,7 +573,7 @@ std::vector<std::pair<RigCompletionDataGridCell, std::vector<RigCompletionData>>
if (itr != complDataList2.end())
{
result.push_back({ complCellLookup.at(cellNotOnWellPath.second.globCellIndex), complDataList2});
result.emplace_back( complCellLookup.at(cellNotOnWellPath.second.globCellIndex), complDataList2);
cellNotOnWellPath.first = false;
}
}
@ -599,7 +602,7 @@ std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
auto completions = eclipseCase->computeAndGetVirtualPerforationTransmissibilities();
if (wellPathGeometry && completions)
{
auto intCells = completions->multipleCompletionsPerEclipseCell(wellPath, timeStep);
const auto& intCells = completions->multipleCompletionsPerEclipseCell(wellPath, timeStep);
CompletionInfo lastCompletionInfo;
auto wpIntCells = RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath(eclipseCase->eclipseCaseData(),
@ -655,7 +658,7 @@ bool RicExportLgrFeature::isCommandEnabled()
void RicExportLgrFeature::onActionTriggered(bool isChecked)
{
std::vector<RimWellPath*> wellPaths = selectedWellPaths();
if(wellPaths.size() == 0) return;
if(wellPaths.empty()) return;
QString dialogTitle = "Export LGR for Completions";

View File

@ -45,10 +45,12 @@ public:
LgrInfo(int id,
const QString& name,
const QString& shortName,
const QString& associatedWellPathName,
const caf::VecIjk& sizes,
const caf::VecIjk& mainGridStartCell,
const caf::VecIjk& mainGridEndCell)
: id(id), name(name), shortName(shortName), sizes(sizes), mainGridStartCell(mainGridStartCell), mainGridEndCell(mainGridEndCell)
: id(id), name(name), shortName(shortName), associatedWellPathName(associatedWellPathName),
sizes(sizes), mainGridStartCell(mainGridStartCell), mainGridEndCell(mainGridEndCell)
{
}
@ -67,6 +69,7 @@ public:
int id;
QString name;
QString shortName;
QString associatedWellPathName;
caf::VecIjk sizes;
caf::VecIjk mainGridStartCell;
@ -162,16 +165,19 @@ private:
static void exportLgrs(QTextStream& stream, const std::vector<LgrInfo>& lgrInfos);
static std::vector<LgrInfo> buildLgrsPerMainCell(RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
const std::vector<RigCompletionDataGridCell>& intersectingCells,
const caf::VecIjk& lgrSizes);
static std::vector<LgrInfo>
buildLgrsPerCompletion(RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
const std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>& completionInfo,
const caf::VecIjk& lgrSizesPerMainGridCell);
static LgrInfo buildLgr(int lgrId,
const QString& lgrName,
const QString& shortLgrName,
RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
const std::vector<RigCompletionDataGridCell>& intersectingCells,
const caf::VecIjk& lgrSizesPerMainGridCell);

View File

@ -220,6 +220,7 @@ void RicCreateTemporaryLgrFeature::createLgr(const LgrInfo& lgrInfo, RigMainGrid
// Create local grid and set properties
RigLocalGrid* localGrid = new RigLocalGrid(mainGrid);
localGrid->setAsTempGrid(true);
localGrid->setAssociatedWellPathName(lgrInfo.associatedWellPathName.toStdString());
localGrid->setGridId(lgrId);
localGrid->setIndexToStartOfCells(totalCellCount);
localGrid->setGridName(lgrInfo.name.toStdString());

View File

@ -193,6 +193,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
}
else if (dynamic_cast<RimGridInfoCollection*>(uiItem))
{
menuBuilder << "RicExportCompletionsForTemporaryLgrsFeature";
menuBuilder << "RicDeleteTemporaryLgrsFeature";
}
else if (dynamic_cast<RimGeoMechCase*>(uiItem))

View File

@ -30,8 +30,7 @@
RigGridBase::RigGridBase(RigMainGrid* mainGrid):
m_gridPointDimensions(0,0,0),
m_indexToStartOfCells(0),
m_mainGrid(mainGrid),
m_isTempGrid(false)
m_mainGrid(mainGrid)
{
if (mainGrid == nullptr)
{

View File

@ -75,6 +75,9 @@ public:
cvf::BoundingBox boundingBox();
virtual bool isTempGrid() const = 0;
virtual const std::string& associatedWellPathName() const = 0;
protected:
friend class RigMainGrid;//::initAllSubGridsParentGridPointer();
void initSubGridParentPointer();
@ -105,10 +108,6 @@ public:
bool isCellValid( size_t i, size_t j, size_t k ) const override;
bool cellIJKNeighbor(size_t i, size_t j, size_t k, FaceType face, size_t* neighborCellIndex ) const override;
void setAsTempGrid(bool isTemp) { m_isTempGrid = isTemp; }
bool isTempGrid() const { return m_isTempGrid; }
private:
std::string m_gridName;
cvf::Vec3st m_gridPointDimensions;
@ -119,8 +118,6 @@ private:
cvf::BoundingBox m_boundingBox;
std::vector<std::array<size_t, 6>> m_coarseningBoxInfo;
bool m_isTempGrid;
};

View File

@ -23,7 +23,9 @@
RigLocalGrid::RigLocalGrid(RigMainGrid* mainGrid):
RigGridBase(mainGrid),
m_parentGrid(nullptr),
m_positionInParentGrid(cvf::UNDEFINED_SIZE_T)
m_positionInParentGrid(cvf::UNDEFINED_SIZE_T),
m_isTempGrid(false),
m_associatedWellPathName("")
{
}
@ -64,3 +66,35 @@ void RigLocalGrid::setPositionInParentGrid(size_t positionInParentGrid)
{
m_positionInParentGrid = positionInParentGrid;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigLocalGrid::setAsTempGrid(bool isTemp)
{
m_isTempGrid = isTemp;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigLocalGrid::isTempGrid() const
{
return m_isTempGrid;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigLocalGrid::setAssociatedWellPathName(const std::string& wellPathName)
{
m_associatedWellPathName = wellPathName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::string& RigLocalGrid::associatedWellPathName() const
{
return m_associatedWellPathName;
}

View File

@ -31,8 +31,16 @@ public:
size_t positionInParentGrid() const;
void setPositionInParentGrid(size_t positionInParentGrid);
void setAsTempGrid(bool isTemp);
bool isTempGrid() const override;
void setAssociatedWellPathName(const std::string& wellPathName);
const std::string& associatedWellPathName() const override;
private:
RigGridBase * m_parentGrid;
size_t m_positionInParentGrid;
bool m_isTempGrid;
std::string m_associatedWellPathName;
};

View File

@ -754,3 +754,20 @@ cvf::BoundingBox RigMainGrid::boundingBox() const
return m_boundingBox;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigMainGrid::isTempGrid() const
{
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::string& RigMainGrid::associatedWellPathName() const
{
static const std::string EMPTY_STRING;
return EMPTY_STRING;
}

View File

@ -90,6 +90,9 @@ public:
cvf::BoundingBox boundingBox() const;
bool isTempGrid() const override;
const std::string& associatedWellPathName() const override;
private:
void initAllSubCellsMainGridCellIndex();
void buildCellSearchTree();