#1092 - pre-proto - Adding feature for exporting COMPDAT file for well path fractures.

This commit is contained in:
astridkbjorke
2017-01-11 09:30:34 +01:00
parent dc1e29c419
commit 9f82319a86
6 changed files with 238 additions and 0 deletions

View File

@@ -47,6 +47,7 @@ ${CEE_CURRENT_LIST_DIR}RicFracturesDeleteAllFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathFracturesDeleteAllFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathFracturesDeleteAllFeature.h
${CEE_CURRENT_LIST_DIR}RicSimWellFracturesDeleteAllFeature.h ${CEE_CURRENT_LIST_DIR}RicSimWellFracturesDeleteAllFeature.h
${CEE_CURRENT_LIST_DIR}RicExportFractureWellCompletionFeature.h ${CEE_CURRENT_LIST_DIR}RicExportFractureWellCompletionFeature.h
${CEE_CURRENT_LIST_DIR}RicExportWellPathFractureWellCompletionFeature.h
# General delete of any object in a child array field # General delete of any object in a child array field
@@ -97,6 +98,8 @@ ${CEE_CURRENT_LIST_DIR}RicFractureDefinitionsDeleteAllFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathFracturesDeleteAllFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathFracturesDeleteAllFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSimWellFracturesDeleteAllFeature.cpp ${CEE_CURRENT_LIST_DIR}RicSimWellFracturesDeleteAllFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportFractureWellCompletionFeature.cpp ${CEE_CURRENT_LIST_DIR}RicExportFractureWellCompletionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportWellPathFractureWellCompletionFeature.cpp

View File

@@ -0,0 +1,110 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicExportWellPathFractureWellCompletionFeature.h"
#include "RiaApplication.h"
#include "RifEclipseExportTools.h"
#include "RifEclipseExportTools.h"
#include "RimBinaryExportSettings.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimEclipseWellCollection.h"
#include "RimFractureExportSettings.h"
#include "RiuMainWindow.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
#include <QMessageBox>
#include <QString>
#include "RimWellPathCollection.h"
#include "RimView.h"
CAF_CMD_SOURCE_INIT(RicExportWellPathFractureWellCompletionFeature, "RicExportWellPathFractureWellCompletionFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportWellPathFractureWellCompletionFeature::onActionTriggered(bool isChecked)
{
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
if (!pdmUiItem) return;
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
if (!objHandle) return;
RimWellPathCollection* wellpathColl = nullptr;
objHandle->firstAncestorOrThisOfType(wellpathColl);
RimFractureExportSettings exportSettings;
RiaApplication* app = RiaApplication::instance();
QString projectFolder = app->currentProjectPath();
if (projectFolder.isEmpty())
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return;
RimEclipseView * activeRiv = dynamic_cast<RimEclipseView*>(activeView);
if (!activeRiv) return;
projectFolder = activeRiv->eclipseCase()->locationOnDisc();
}
QString outputFileName = projectFolder + "/Fractures";
exportSettings.fileName = outputFileName;
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Fracture Well Completion Data", "");
if (propertyDialog.exec() == QDialog::Accepted)
{
bool isOk = RifEclipseExportTools::writeWellPathFracturesToTextFile(exportSettings.fileName, wellpathColl);
if (!isOk)
{
QMessageBox::critical(NULL, "File export", "Failed to exported current result to " + exportSettings.fileName);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportWellPathFractureWellCompletionFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/FractureTemplate16x16.png"));
actionToSetup->setText("Export Fracture Well Completion Data");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicExportWellPathFractureWellCompletionFeature::isCommandEnabled()
{
return true;
}

View File

@@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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"
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RicExportWellPathFractureWellCompletionFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
virtual void onActionTriggered(bool isChecked) override;
virtual void setupActionLook(QAction* actionToSetup) override;
virtual bool isCommandEnabled() override;
};

View File

@@ -29,6 +29,9 @@
#include <QFile> #include <QFile>
#include "RimSimWellFracture.h" #include "RimSimWellFracture.h"
#include "RimEclipseWell.h" #include "RimEclipseWell.h"
#include "RimWellPathCollection.h"
#include "RimWellPathFracture.h"
#include "RimWellPath.h"
@@ -72,6 +75,27 @@ bool RifEclipseExportTools::writeSimWellFracturesToTextFile(const QString& fileN
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifEclipseExportTools::writeWellPathFracturesToTextFile(const QString& fileName, RimWellPathCollection* wellColl)
{
std::vector<RimWellPathFracture*> fractures;
wellColl->descendantsIncludingThisOfType(fractures);
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
return false;
}
writeWellPathFractureDataToTextFile(&file, fractures);
return true;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -129,3 +153,59 @@ void RifEclipseExportTools::writeSimWellFractureDataToTextFile(QFile* file, cons
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseExportTools::writeWellPathFractureDataToTextFile(QFile* file, const std::vector<RimWellPathFracture*>& fractures)
{
QTextStream out(file);
out << "\n";
out << "-- Exported from ResInsight" << "\n\n";
out << "COMPDAT" << "\n" << right << qSetFieldWidth(8);
caf::ProgressInfo pi(fractures.size(), QString("Writing data to file %1").arg(file->fileName()));
RimWellPathFracture* fracture;
RimWellPath* wellPath = nullptr;
size_t i;
std::vector<size_t> ijk;
for (i = 0; i < fractures.size(); i++)
{
fracture = fractures.at(i);
out << qSetFieldWidth(8);
fracture->firstAncestorOrThisOfType(wellPath);
out << wellPath->name; // 1. Well name
out << qSetFieldWidth(5);
//ijk = fracture->getIJK();
out << "0"; // 2. I location grid block
out << "0"; // 3. J location grid block
out << "0"; // 4. K location of upper connecting grid block
out << "0"; // 5. K location of lower connecting grid block
out << "OPEN"; // 6. Open / Shut flag of connection
out << "1* "; // 7. Saturation table number for connection rel perm. Default value
out << qSetFieldWidth(8);
out << 123456789; // 8. Transmissitivity //TODO: Calculate value
out << qSetFieldWidth(4);
out << "1* "; // 9. Well bore diameter. Set to default
out << qSetFieldWidth(8);
out << fracture->fractureDefinition->effectiveKh(); // 10. Effective Kh (perm times width)
out << qSetFieldWidth(4);
out << fracture->fractureDefinition->skinFactor; // 11. Skin factor
out << "1*"; // 12. D-factor for handling non-Darcy flow of free gas. Default value.
out << "Z"; // 13. Direction well is penetrating the grid block. Z is default.
out << "1*"; // 14. Pressure equivalent radius, Default
out << "/" << "\n";
pi.setProgress(i);
}
}

View File

@@ -30,6 +30,8 @@
class RimEclipseWellCollection; class RimEclipseWellCollection;
class RimSimWellFracture; class RimSimWellFracture;
class RimWellPathCollection;
class RimWellPathFracture;
class QFile; class QFile;
@@ -48,10 +50,12 @@ public:
static bool writeSimWellFracturesToTextFile(const QString& fileName, RimEclipseWellCollection* wellColl); static bool writeSimWellFracturesToTextFile(const QString& fileName, RimEclipseWellCollection* wellColl);
static bool writeWellPathFracturesToTextFile(const QString& fileName, RimWellPathCollection* wellColl);
private: private:
static void writeSimWellFractureDataToTextFile(QFile* file, const std::vector<RimSimWellFracture*>& fractures); static void writeSimWellFractureDataToTextFile(QFile* file, const std::vector<RimSimWellFracture*>& fractures);
static void writeWellPathFractureDataToTextFile(QFile* file, const std::vector<RimWellPathFracture*>& fractures);
}; };

View File

@@ -209,6 +209,8 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicWellPathsImportSsihubFeature"; commandIds << "RicWellPathsImportSsihubFeature";
commandIds << "RicWellLogsImportFileFeature"; commandIds << "RicWellLogsImportFileFeature";
commandIds << "Separator"; commandIds << "Separator";
commandIds << "RicExportWellPathFractureWellCompletionFeature";
commandIds << "Separator";
commandIds << "RicWellPathsDeleteAllFeature"; commandIds << "RicWellPathsDeleteAllFeature";
} }
else if (dynamic_cast<RimWellPath*>(uiItem)) else if (dynamic_cast<RimWellPath*>(uiItem))