mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1092 - pre-proto - Adding function writeFracturesToTextFile which replaces old functions which were separate for SimWellFractures and WellPathFractures.
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
#include "RifEclipseExportTools.h"
|
||||
#include "RifEclipseExportTools.h"
|
||||
|
||||
#include "RimBinaryExportSettings.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
@@ -41,6 +40,7 @@
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
#include "RimFracture.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicExportSimWellFractureWellCompletionFeature, "RicExportSimWellFractureWellCompletionFeature");
|
||||
|
||||
@@ -58,6 +58,8 @@ void RicExportSimWellFractureWellCompletionFeature::onActionTriggered(bool isChe
|
||||
|
||||
RimEclipseWellCollection* eclipseWellColl = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(eclipseWellColl);
|
||||
std::vector<RimFracture*> fractures;
|
||||
eclipseWellColl->descendantsIncludingThisOfType(fractures);
|
||||
|
||||
RimEclipseView* eclipseWiew = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(eclipseWiew);
|
||||
@@ -77,7 +79,7 @@ void RicExportSimWellFractureWellCompletionFeature::onActionTriggered(bool isChe
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Fracture Well Completion Data", "");
|
||||
if (propertyDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
bool isOk = RifEclipseExportTools::writeSimWellFracturesToTextFile(exportSettings.fileName, eclipseWellColl);
|
||||
bool isOk = RifEclipseExportTools::writeFracturesToTextFile(exportSettings.fileName, fractures);
|
||||
|
||||
if (!isOk)
|
||||
{
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
#include "RifEclipseExportTools.h"
|
||||
#include "RifEclipseExportTools.h"
|
||||
|
||||
#include "RimBinaryExportSettings.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimFracture.h"
|
||||
#include "RimFractureExportSettings.h"
|
||||
|
||||
#include "RimView.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmObjectHandle.h"
|
||||
@@ -41,8 +41,6 @@
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimView.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicExportWellPathFractureWellCompletionFeature, "RicExportWellPathFractureWellCompletionFeature");
|
||||
|
||||
@@ -60,6 +58,8 @@ void RicExportWellPathFractureWellCompletionFeature::onActionTriggered(bool isCh
|
||||
|
||||
RimWellPathCollection* wellpathColl = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(wellpathColl);
|
||||
std::vector<RimFracture*> fractures;
|
||||
wellpathColl->descendantsIncludingThisOfType(fractures);
|
||||
|
||||
RimFractureExportSettings exportSettings;
|
||||
|
||||
@@ -81,7 +81,7 @@ void RicExportWellPathFractureWellCompletionFeature::onActionTriggered(bool isCh
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Fracture Well Completion Data", "");
|
||||
if (propertyDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
bool isOk = RifEclipseExportTools::writeWellPathFracturesToTextFile(exportSettings.fileName, wellpathColl);
|
||||
bool isOk = RifEclipseExportTools::writeFracturesToTextFile(exportSettings.fileName, fractures);
|
||||
|
||||
if (!isOk)
|
||||
{
|
||||
|
||||
@@ -18,20 +18,16 @@
|
||||
|
||||
#include "RifEclipseExportTools.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimFracture.h"
|
||||
#include "RimFractureDefinition.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include <QTextStream>
|
||||
#include <QFile>
|
||||
#include "RimSimWellFracture.h"
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPathFracture.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
|
||||
|
||||
@@ -56,70 +52,39 @@ RifEclipseExportTools::~RifEclipseExportTools()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifEclipseExportTools::writeSimWellFracturesToTextFile(const QString& fileName, RimEclipseWellCollection* wellColl)
|
||||
bool RifEclipseExportTools::writeFracturesToTextFile(const QString& fileName, const std::vector<RimFracture*>& fractures)
|
||||
{
|
||||
|
||||
std::vector<RimSimWellFracture*> fractures;
|
||||
wellColl->descendantsIncludingThisOfType(fractures);
|
||||
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
writeSimWellFractureDataToTextFile(&file, fractures);
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseExportTools::writeSimWellFractureDataToTextFile(QFile* file, const std::vector<RimSimWellFracture*>& fractures)
|
||||
{
|
||||
QTextStream out(file);
|
||||
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()));
|
||||
caf::ProgressInfo pi(fractures.size(), QString("Writing data to file %1").arg(fileName));
|
||||
|
||||
RimSimWellFracture* fracture;
|
||||
RimFracture* fracture;
|
||||
RimEclipseWell* simWell = nullptr;
|
||||
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);
|
||||
wellPath, simWell = nullptr;
|
||||
fracture->firstAncestorOrThisOfType(simWell);
|
||||
out << simWell->name;; // 1. Well name
|
||||
if (simWell) out << simWell->name; // 1. Well name
|
||||
fracture->firstAncestorOrThisOfType(wellPath);
|
||||
if (wellPath) out << wellPath->name; // 1. Well name
|
||||
|
||||
|
||||
out << qSetFieldWidth(5);
|
||||
ijk = fracture->getIJK();
|
||||
@@ -138,9 +103,9 @@ void RifEclipseExportTools::writeSimWellFractureDataToTextFile(QFile* file, cons
|
||||
out << "1* "; // 9. Well bore diameter. Set to default
|
||||
|
||||
out << qSetFieldWidth(8);
|
||||
out << fracture->fractureDefinition->effectiveKh(); // 10. Effective Kh (perm times width)
|
||||
out << fracture->attachedFractureDefinition()->effectiveKh(); // 10. Effective Kh (perm times width)
|
||||
out << qSetFieldWidth(4);
|
||||
out << fracture->fractureDefinition->skinFactor; // 11. Skin factor
|
||||
out << fracture->attachedFractureDefinition()->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.
|
||||
@@ -151,61 +116,7 @@ void RifEclipseExportTools::writeSimWellFractureDataToTextFile(QFile* file, cons
|
||||
pi.setProgress(i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,10 +28,7 @@
|
||||
#include <QString>
|
||||
|
||||
|
||||
class RimEclipseWellCollection;
|
||||
class RimSimWellFracture;
|
||||
class RimWellPathCollection;
|
||||
class RimWellPathFracture;
|
||||
class RimFracture;
|
||||
class QFile;
|
||||
|
||||
|
||||
@@ -48,14 +45,7 @@ public:
|
||||
RifEclipseExportTools();
|
||||
virtual ~RifEclipseExportTools();
|
||||
|
||||
|
||||
static bool writeSimWellFracturesToTextFile(const QString& fileName, RimEclipseWellCollection* wellColl);
|
||||
static bool writeWellPathFracturesToTextFile(const QString& fileName, RimWellPathCollection* wellColl);
|
||||
|
||||
|
||||
private:
|
||||
static void writeSimWellFractureDataToTextFile(QFile* file, const std::vector<RimSimWellFracture*>& fractures);
|
||||
static void writeWellPathFractureDataToTextFile(QFile* file, const std::vector<RimWellPathFracture*>& fractures);
|
||||
static bool writeFracturesToTextFile(const QString& fileName, const std::vector<RimFracture*>& fractures);
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -47,7 +47,9 @@ public:
|
||||
virtual cvf::Vec3d centerPointForFracture() = 0;
|
||||
virtual RimFractureDefinition* attachedFractureDefinition() = 0;
|
||||
|
||||
virtual std::vector<std::pair<size_t, size_t>> getFracturedCells();
|
||||
virtual std::vector<std::pair<size_t, size_t>> getFracturedCells();
|
||||
virtual std::vector<size_t> getIJK() = 0;
|
||||
|
||||
|
||||
bool hasValidGeometry() const;
|
||||
void computeGeometry();
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
void setIJK(size_t i, size_t j, size_t k);
|
||||
std::vector<size_t> getIJK();
|
||||
std::vector<size_t> getIJK() override;
|
||||
void setCellCenterPosition();
|
||||
// Overrides from RimFracture
|
||||
virtual cvf::Vec3d centerPointForFracture() override;
|
||||
|
||||
@@ -123,6 +123,21 @@ RimFractureDefinition* RimWellPathFracture::attachedFractureDefinition()
|
||||
return fractureDefinition();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<size_t> RimWellPathFracture::getIJK()
|
||||
{
|
||||
//TODO: Need to find these indecies.
|
||||
//For now just writing dummy values to be able to test fracture export function.
|
||||
std::vector<size_t> ijk;
|
||||
ijk.push_back(1);
|
||||
ijk.push_back(2);
|
||||
ijk.push_back(3);
|
||||
|
||||
return ijk;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -65,6 +65,8 @@ public:
|
||||
virtual cvf::Vec3d centerPointForFracture() override;
|
||||
virtual RimFractureDefinition* attachedFractureDefinition() override;
|
||||
|
||||
virtual std::vector<size_t> getIJK() override;
|
||||
|
||||
protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||
cvf::Vec3d fracturePositionForUi() const;
|
||||
|
||||
Reference in New Issue
Block a user