mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1462 Add support for exporting WPIMULT
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimWellPath.h"
|
#include "RimWellPath.h"
|
||||||
#include "RimFishbonesMultipleSubs.h"
|
#include "RimFishbonesMultipleSubs.h"
|
||||||
#include "RimCaseAndFileExportSettings.h"
|
#include "RimExportCompletionDataSettings.h"
|
||||||
|
|
||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ void RicWellPathExportCompletionDataFeature::onActionTriggered(bool isChecked)
|
|||||||
QString projectFolder = app->currentProjectPath();
|
QString projectFolder = app->currentProjectPath();
|
||||||
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("COMPLETIONS", projectFolder);
|
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("COMPLETIONS", projectFolder);
|
||||||
|
|
||||||
RimCaseAndFileExportSettings exportSettings;
|
RimExportCompletionDataSettings exportSettings;
|
||||||
|
|
||||||
exportSettings.fileName = QDir(defaultDir).filePath("Completions");
|
exportSettings.fileName = QDir(defaultDir).filePath("Completions");
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ void RicWellPathExportCompletionDataFeature::onActionTriggered(bool isChecked)
|
|||||||
{
|
{
|
||||||
RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", QFileInfo(exportSettings.fileName).absolutePath());
|
RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", QFileInfo(exportSettings.fileName).absolutePath());
|
||||||
|
|
||||||
exportToFolder(objects[0], exportSettings.fileName, exportSettings.caseToApply);
|
exportToFolder(objects[0], exportSettings.fileName, exportSettings.caseToApply, exportSettings.includeWpimult());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,9 +106,15 @@ void RicWellPathExportCompletionDataFeature::setupActionLook(QAction* actionToSe
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicWellPathExportCompletionDataFeature::exportToFolder(RimWellPath* wellPath, const QString& fileName, const RimEclipseCase* caseToApply)
|
void RicWellPathExportCompletionDataFeature::exportToFolder(RimWellPath* wellPath, const QString& fileName, const RimEclipseCase* caseToApply, bool includeWpimult)
|
||||||
{
|
{
|
||||||
QFile exportFile(fileName);
|
QFile exportFile(fileName);
|
||||||
|
|
||||||
|
if (caseToApply == nullptr)
|
||||||
|
{
|
||||||
|
RiaLogging::error("Export Completions Data: Cannot export completions data without specified eclipse case");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!exportFile.open(QIODevice::WriteOnly))
|
if (!exportFile.open(QIODevice::WriteOnly))
|
||||||
{
|
{
|
||||||
@@ -120,55 +126,90 @@ void RicWellPathExportCompletionDataFeature::exportToFolder(RimWellPath* wellPat
|
|||||||
|
|
||||||
const RigEclipseCaseData* caseData = caseToApply->eclipseCaseData();
|
const RigEclipseCaseData* caseData = caseToApply->eclipseCaseData();
|
||||||
std::vector<size_t> wellPathCells = findIntersectingCells(caseData, wellPath->wellPathGeometry()->m_wellPathPoints);
|
std::vector<size_t> wellPathCells = findIntersectingCells(caseData, wellPath->wellPathGeometry()->m_wellPathPoints);
|
||||||
|
std::map<size_t, double> lateralsPerCell;
|
||||||
|
|
||||||
RifEclipseOutputTableFormatter formatter(stream);
|
RifEclipseOutputTableFormatter formatter(stream);
|
||||||
std::vector<RifEclipseOutputTableColumn> header = {
|
|
||||||
RifEclipseOutputTableColumn{"Well", LEFT},
|
|
||||||
RifEclipseOutputTableColumn{"I", LEFT},
|
|
||||||
RifEclipseOutputTableColumn{"J", LEFT},
|
|
||||||
RifEclipseOutputTableColumn{"K1", LEFT},
|
|
||||||
RifEclipseOutputTableColumn{"K2", LEFT},
|
|
||||||
RifEclipseOutputTableColumn{"Status", LEFT},
|
|
||||||
RifEclipseOutputTableColumn{"SAT", LEFT},
|
|
||||||
RifEclipseOutputTableColumn{"TR", LEFT},
|
|
||||||
RifEclipseOutputTableColumn{"DIAM", LEFT},
|
|
||||||
RifEclipseOutputTableColumn{"KH", LEFT},
|
|
||||||
RifEclipseOutputTableColumn{"S", LEFT},
|
|
||||||
RifEclipseOutputTableColumn{"Df", LEFT},
|
|
||||||
RifEclipseOutputTableColumn{"DIR", LEFT},
|
|
||||||
RifEclipseOutputTableColumn{"r0", LEFT}
|
|
||||||
};
|
|
||||||
|
|
||||||
formatter.keyword("COMPDAT");
|
// COMPDAT
|
||||||
formatter.header(header);
|
|
||||||
|
|
||||||
for (RimFishbonesMultipleSubs* subs : wellPath->fishbonesSubs)
|
|
||||||
{
|
{
|
||||||
for (size_t subIndex = 0; subIndex < subs->locationOfSubs().size(); ++subIndex)
|
std::vector<RifEclipseOutputTableColumn> header = {
|
||||||
|
RifEclipseOutputTableColumn{"Well", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"I", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"J", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"K1", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"K2", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"Status", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"SAT", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"TR", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"DIAM", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"KH", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"S", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"Df", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"DIR", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"r0", LEFT}
|
||||||
|
};
|
||||||
|
|
||||||
|
formatter.keyword("COMPDAT");
|
||||||
|
formatter.header(header);
|
||||||
|
|
||||||
|
for (RimFishbonesMultipleSubs* subs : wellPath->fishbonesSubs)
|
||||||
{
|
{
|
||||||
for (size_t lateralIndex = 0; lateralIndex < subs->lateralLengths().size(); ++lateralIndex)
|
for (size_t subIndex = 0; subIndex < subs->locationOfSubs().size(); ++subIndex)
|
||||||
{
|
{
|
||||||
std::vector<cvf::Vec3d> lateralCoords = subs->coordsForLateral(subIndex, lateralIndex);
|
for (size_t lateralIndex = 0; lateralIndex < subs->lateralLengths().size(); ++lateralIndex)
|
||||||
|
|
||||||
std::vector<size_t> lateralCells = findIntersectingCells(caseData, lateralCoords);
|
|
||||||
|
|
||||||
std::vector<size_t> cellsUniqueToLateral = filterWellPathCells(lateralCells, wellPathCells);
|
|
||||||
|
|
||||||
std::vector<EclipseCellIndexRange> cellRanges = getCellIndexRange(caseData->mainGrid(), cellsUniqueToLateral);
|
|
||||||
|
|
||||||
formatter.comment(QString("Fishbone %1 - Sub: %2 - Lateral: %3").arg(subs->name()).arg(subIndex).arg(lateralIndex));
|
|
||||||
for (auto cellRange : cellRanges)
|
|
||||||
{
|
{
|
||||||
// Add cell indices
|
std::vector<cvf::Vec3d> lateralCoords = subs->coordsForLateral(subIndex, lateralIndex);
|
||||||
formatter.add(wellPath->name()).addZeroBasedCellIndex(cellRange.i).addZeroBasedCellIndex(cellRange.j).addZeroBasedCellIndex(cellRange.k1).addZeroBasedCellIndex(cellRange.k2);
|
|
||||||
// Remaining data, to be computed
|
std::vector<size_t> lateralCells = findIntersectingCells(caseData, lateralCoords);
|
||||||
formatter.add("'OPEN'").add("1*").add("1*").add(0.0).add("1*").add("1*").add("1*").add("'Z'").add("1*");
|
|
||||||
formatter.rowCompleted();
|
if (includeWpimult)
|
||||||
|
{
|
||||||
|
// Only need this data if WPIMULT should be included in file
|
||||||
|
addLateralToCells(&lateralsPerCell, lateralCells);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<size_t> cellsUniqueToLateral = filterWellPathCells(lateralCells, wellPathCells);
|
||||||
|
|
||||||
|
std::vector<EclipseCellIndexRange> cellRanges = getCellIndexRange(caseData->mainGrid(), cellsUniqueToLateral);
|
||||||
|
|
||||||
|
formatter.comment(QString("Fishbone %1 - Sub: %2 - Lateral: %3").arg(subs->name()).arg(subIndex).arg(lateralIndex));
|
||||||
|
for (auto cellRange : cellRanges)
|
||||||
|
{
|
||||||
|
// Add cell indices
|
||||||
|
formatter.add(wellPath->name()).addZeroBasedCellIndex(cellRange.i).addZeroBasedCellIndex(cellRange.j).addZeroBasedCellIndex(cellRange.k1).addZeroBasedCellIndex(cellRange.k2);
|
||||||
|
// Remaining data, to be computed
|
||||||
|
formatter.add("'OPEN'").add("1*").add("1*").add(0.0).add("1*").add("1*").add("1*").add("'Z'").add("1*");
|
||||||
|
formatter.rowCompleted();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
formatter.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
// WPIMULT
|
||||||
|
if (includeWpimult)
|
||||||
|
{
|
||||||
|
std::vector<RifEclipseOutputTableColumn> header = {
|
||||||
|
RifEclipseOutputTableColumn{"Well", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"Mult", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"I", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"J", LEFT},
|
||||||
|
RifEclipseOutputTableColumn{"K", LEFT},
|
||||||
|
};
|
||||||
|
formatter.keyword("WPIMULT");
|
||||||
|
formatter.header(header);
|
||||||
|
|
||||||
|
for (auto lateralsInCell : lateralsPerCell)
|
||||||
|
{
|
||||||
|
size_t i, j, k;
|
||||||
|
caseData->mainGrid()->ijkFromCellIndex(lateralsInCell.first, &i, &j, &k);
|
||||||
|
formatter.add(wellPath->name()).add(lateralsInCell.second).addZeroBasedCellIndex(i).addZeroBasedCellIndex(j).addZeroBasedCellIndex(k);
|
||||||
|
formatter.rowCompleted();
|
||||||
|
}
|
||||||
|
|
||||||
|
formatter.flush();
|
||||||
}
|
}
|
||||||
formatter.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -351,4 +392,23 @@ std::vector<size_t> RicWellPathExportCompletionDataFeature::filterWellPathCells(
|
|||||||
return filteredCells;
|
return filteredCells;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicWellPathExportCompletionDataFeature::addLateralToCells(std::map<size_t, double>* lateralsPerCell, const std::vector<size_t>& lateralCells)
|
||||||
|
{
|
||||||
|
for (size_t cell : lateralCells)
|
||||||
|
{
|
||||||
|
std::map<size_t, double>::iterator it = lateralsPerCell->find(cell);
|
||||||
|
if (it == lateralsPerCell->end())
|
||||||
|
{
|
||||||
|
(*lateralsPerCell)[cell] = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(*lateralsPerCell)[cell] = it->second + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace caf
|
} // end namespace caf
|
||||||
|
|||||||
@@ -57,13 +57,14 @@ protected:
|
|||||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void exportToFolder(RimWellPath* wellPath, const QString& fileName, const RimEclipseCase* caseToApply);
|
static void exportToFolder(RimWellPath* wellPath, const QString& fileName, const RimEclipseCase* caseToApply, bool includeWpimult);
|
||||||
static std::vector<size_t> findCloseCells(const RigEclipseCaseData* caseData, const cvf::BoundingBox& bb);
|
static std::vector<size_t> findCloseCells(const RigEclipseCaseData* caseData, const cvf::BoundingBox& bb);
|
||||||
static std::vector<EclipseCellIndexRange> getCellIndexRange(const RigMainGrid* grid, const std::vector<size_t>& cellIndices);
|
static std::vector<EclipseCellIndexRange> getCellIndexRange(const RigMainGrid* grid, const std::vector<size_t>& cellIndices);
|
||||||
static bool cellOrdering(const EclipseCellIndex& cell1, const EclipseCellIndex& cell2);
|
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 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 setHexCorners(const RigCell& cell, const std::vector<cvf::Vec3d>& nodeCoords, cvf::Vec3d* hexCorners);
|
||||||
static std::vector<size_t> filterWellPathCells(const std::vector<size_t>& completionCells, const std::vector<size_t>& wellPathCells);
|
static std::vector<size_t> filterWellPathCells(const std::vector<size_t>& completionCells, const std::vector<size_t>& wellPathCells);
|
||||||
|
static void addLateralToCells(std::map<size_t, double>* lateralsPerCell, const std::vector<size_t>& lateralCells);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ void RifEclipseOutputTableFormatter::outputBuffer()
|
|||||||
m_out << " /" << "\n";
|
m_out << " /" << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If we finished a table, output an "empty" line after it
|
||||||
|
if (!m_columns.empty()) m_out << "/\n";
|
||||||
|
m_columns.clear();
|
||||||
m_buffer.clear();
|
m_buffer.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ set (SOURCE_GROUP_HEADER_FILES
|
|||||||
${CEE_CURRENT_LIST_DIR}RimEclipseCaseCollection.h
|
${CEE_CURRENT_LIST_DIR}RimEclipseCaseCollection.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimCaseCollection.h
|
${CEE_CURRENT_LIST_DIR}RimCaseCollection.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimCaseAndFileExportSettings.h
|
${CEE_CURRENT_LIST_DIR}RimCaseAndFileExportSettings.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimExportCompletionDataSettings.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimCellFilter.h
|
${CEE_CURRENT_LIST_DIR}RimCellFilter.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimEclipsePropertyFilter.h
|
${CEE_CURRENT_LIST_DIR}RimEclipsePropertyFilter.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimPropertyFilterCollection.h
|
${CEE_CURRENT_LIST_DIR}RimPropertyFilterCollection.h
|
||||||
@@ -101,6 +102,7 @@ set (SOURCE_GROUP_SOURCE_FILES
|
|||||||
${CEE_CURRENT_LIST_DIR}RimEclipseCaseCollection.cpp
|
${CEE_CURRENT_LIST_DIR}RimEclipseCaseCollection.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimCaseCollection.cpp
|
${CEE_CURRENT_LIST_DIR}RimCaseCollection.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimCaseAndFileExportSettings.cpp
|
${CEE_CURRENT_LIST_DIR}RimCaseAndFileExportSettings.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimExportCompletionDataSettings.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimCellFilter.cpp
|
${CEE_CURRENT_LIST_DIR}RimCellFilter.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimEclipsePropertyFilter.cpp
|
${CEE_CURRENT_LIST_DIR}RimEclipsePropertyFilter.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimPropertyFilterCollection.cpp
|
${CEE_CURRENT_LIST_DIR}RimPropertyFilterCollection.cpp
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017- Statoil ASA
|
||||||
|
// Copyright (C) 2017- Ceetron Solutions AS
|
||||||
|
//
|
||||||
|
// 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 "RimExportCompletionDataSettings.h"
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimExportCompletionDataSettings, "RimExportCompletionDataSettings");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimExportCompletionDataSettings::RimExportCompletionDataSettings()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("RimExportCompletionDataSettings", "", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&includeWpimult, "IncludeWPIMULT", "Include WPIMLUT", "", "", "");
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017- Statoil ASA
|
||||||
|
// Copyright (C) 2017- Ceetron Solutions AS
|
||||||
|
//
|
||||||
|
// 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 "cafPdmField.h"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimExportCompletionDataSettings : public RimCaseAndFileExportSettings
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
|
||||||
|
RimExportCompletionDataSettings();
|
||||||
|
|
||||||
|
caf::PdmField<bool> includeWpimult;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user