#1493 Remove old export fracture on selected wellpaths feature

This commit is contained in:
Jacob Støren
2017-06-01 17:09:04 +02:00
parent 252defd96a
commit 4c873b6925
5 changed files with 0 additions and 387 deletions

View File

@@ -51,7 +51,6 @@ ${CEE_CURRENT_LIST_DIR}RicSimWellFracturesDeleteAllFeature.h
${CEE_CURRENT_LIST_DIR}RicExportSimWellFractureWellCompletionFeature.h ${CEE_CURRENT_LIST_DIR}RicExportSimWellFractureWellCompletionFeature.h
${CEE_CURRENT_LIST_DIR}RicExportSelectedSimWellFractureWellCompletionFeature.h ${CEE_CURRENT_LIST_DIR}RicExportSelectedSimWellFractureWellCompletionFeature.h
${CEE_CURRENT_LIST_DIR}RicExportWellPathFractureWellCompletionFeature.h ${CEE_CURRENT_LIST_DIR}RicExportWellPathFractureWellCompletionFeature.h
${CEE_CURRENT_LIST_DIR}RicExportSelectedWellPathFractureWellCompletionFeature.h
${CEE_CURRENT_LIST_DIR}RicConvertFractureTemplateUnitFeature.h ${CEE_CURRENT_LIST_DIR}RicConvertFractureTemplateUnitFeature.h
${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToMetricFeature.h ${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToMetricFeature.h
${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToFieldFeature.h ${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToFieldFeature.h
@@ -114,7 +113,6 @@ ${CEE_CURRENT_LIST_DIR}RicSimWellFracturesDeleteAllFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportSimWellFractureWellCompletionFeature.cpp ${CEE_CURRENT_LIST_DIR}RicExportSimWellFractureWellCompletionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportSelectedSimWellFractureWellCompletionFeature.cpp ${CEE_CURRENT_LIST_DIR}RicExportSelectedSimWellFractureWellCompletionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportWellPathFractureWellCompletionFeature.cpp ${CEE_CURRENT_LIST_DIR}RicExportWellPathFractureWellCompletionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportSelectedWellPathFractureWellCompletionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicConvertFractureTemplateUnitFeature.cpp ${CEE_CURRENT_LIST_DIR}RicConvertFractureTemplateUnitFeature.cpp
${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToMetricFeature.cpp ${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToMetricFeature.cpp
${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToFieldFeature.cpp ${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToFieldFeature.cpp

View File

@@ -1,105 +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 "RicExportSelectedWellPathFractureWellCompletionFeature.h"
#include "RiaApplication.h"
#include "RifFractureExportTools.h"
#include "RifFractureExportTools.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "RimFracture.h"
#include "RimFractureExportSettings.h"
#include "RimWellPath.h"
#include "RiuMainWindow.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
#include <QMessageBox>
#include <QString>
#include <QFileInfo>
CAF_CMD_SOURCE_INIT(RicExportSelectedWellPathFractureWellCompletionFeature, "RicExportSelectedWellPathFractureWellCompletionFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportSelectedWellPathFractureWellCompletionFeature::onActionTriggered(bool isChecked)
{
std::vector<RimWellPath*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
if (!selection.size()) return;
RimFractureExportSettings exportSettings;
RiaApplication* app = RiaApplication::instance();
QString projectFolder = app->currentProjectPath();
RimView* view = app->activeReservoirView();
RimEclipseCase* caseToApply;
view->firstAncestorOrThisOfType(caseToApply);
if (!caseToApply) return;
exportSettings.caseToApply = caseToApply;
if (projectFolder.isEmpty())
{
projectFolder = caseToApply->locationOnDisc();
}
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("FRACTURE_EXPORT_DIR", projectFolder);
QString outputFileName = defaultDir + "/Fractures";
exportSettings.fileName = outputFileName;
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Fracture Well Completion Data", "");
if (propertyDialog.exec() == QDialog::Accepted)
{
RiaApplication::instance()->setLastUsedDialogDirectory("FRACTURE_EXPORT_DIR", QFileInfo(exportSettings.fileName).absolutePath());
RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(exportSettings.fileName, selection[0], exportSettings.caseToApply);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportSelectedWellPathFractureWellCompletionFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/FractureSymbol16x16.png"));
actionToSetup->setText("Export Fracture Well Completion Data for Selected wells");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicExportSelectedWellPathFractureWellCompletionFeature::isCommandEnabled()
{
return true;
}

View File

@@ -1,39 +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 "cafCmdFeature.h"
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RicExportSelectedWellPathFractureWellCompletionFeature : 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

@@ -172,242 +172,6 @@ bool RifFractureExportTools::exportFracturesToEclipseDataInputFile(const QString
return true; return true;
} }
//--------------------------------------------------------------------------------------------------
///
// Loop over fractures in well path (all)
// Loop over stimplancells
// if cell Is Contributing cond > 0
// Calculate Matrix To Fracture Trans
// Add to condenser
// Loop over stimplanecells (i, j)
// if cell Is Contributing cond > 0
// Calculate trans to neighbor (+i, +j )
// Add to condenser
// Find well cells (Perforated Well Path, Radius, Positioned Fracture)
// For each well cell
// Find path intersection
// Use LinT + 1/2 radialT on each end if endpoints are inside cell
// Add to condenser
// Add eclipse cell transmissibilities to a map <eclipsecell index, map<fractureptr, transmissibility> >
// For all transmissibilities
// summarize all fractures contributions pr cell,
// Print COMPDAT entry
//
//--------------------------------------------------------------------------------------------------
void RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(const QString& fileName,
const RimWellPath* wellPath,
const RimEclipseCase* caseToApply)
{
std::vector<RimFracture*> fracturesAlongWellPath;
wellPath->descendantsIncludingThisOfType(fracturesAlongWellPath);
double cDarcyInCorrectUnit = caseToApply->eclipseCaseData()->darchysValue();
const RigMainGrid* mainGrid = caseToApply->eclipseCaseData()->mainGrid();
// To handle several fractures in the same eclipse cell we need to keep track of the transmissibility
// to the well from each fracture intersecting the cell and sum these transmissibilities at the end.
// std::map <eclipseCellIndex ,map< fracture, trans> >
std::map <size_t, std::map<RimFracture*, double> > eclCellIdxToTransPrFractureMap;
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
return;
}
QTextStream out(&file);
out << "\n";
out << "-- Exported from ResInsight" << "\n";
out << "\n";
for (RimFracture* fracture : fracturesAlongWellPath)
{
using CellIdxSpace = RigTransmissibilityCondenser::CellAddress;
RimFractureTemplate* fracTemplate = fracture->attachedFractureDefinition();
const RigFractureGrid* fractureGrid = fracTemplate->fractureGrid();
RigTransmissibilityCondenser transCondenser;
//////
// Calculate Matrix To Fracture Trans
std::vector<RigFractureCell> fractureCells = fractureGrid->fractureCells();
for (const RigFractureCell fractureCell : fractureCells)
{
if (fractureCell.getConductivtyValue() < 1e-7) continue;
RigEclipseToStimPlanCellTransmissibilityCalculator eclToFractureTransCalc(caseToApply,
fracture->transformMatrix(),
fracture->attachedFractureDefinition()->skinFactor,
cDarcyInCorrectUnit,
fractureCell);
const std::vector<size_t>& fractureCellContributingEclipseCells = eclToFractureTransCalc.globalIndeciesToContributingEclipseCells();
const std::vector<double>& fractureCellContributingEclipseCellTransmissibilities = eclToFractureTransCalc.contributingEclipseCellTransmissibilities();
size_t stimPlanCellIndex = fractureGrid->getGlobalIndexFromIJ(fractureCell.getI(), fractureCell.getJ());
for (size_t i = 0; i < fractureCellContributingEclipseCells.size(); i++)
{
transCondenser.addNeighborTransmissibility({ true, CellIdxSpace::ECLIPSE, fractureCellContributingEclipseCells[i] },
{ false, CellIdxSpace::STIMPLAN, stimPlanCellIndex },
fractureCellContributingEclipseCellTransmissibilities[i]);
}
}
//////
// Calculate Transmissibility in the fracture: From one StimPlan Cell to the other
for (size_t i = 0; i < fractureGrid->iCellCount(); i++)
{
for (size_t j = 0; j < fractureGrid->jCellCount(); j++)
{
size_t fractureCellIndex = fractureGrid->getGlobalIndexFromIJ(i, j);
const RigFractureCell fractureCell = fractureGrid->cellFromIndex(fractureCellIndex);
if (fractureCell.getConductivtyValue() < 1e-7) continue;
if (i < fractureGrid->iCellCount()-1)
{
size_t fractureCellNeighbourXIndex = fractureGrid->getGlobalIndexFromIJ(i + 1, j);
const RigFractureCell fractureCellNeighbourX = fractureGrid->cellFromIndex(fractureCellNeighbourXIndex);
double horizontalTransToXneigbour =
RigFractureTransmissibilityEquations::centerToCenterFractureCellTrans(fractureCell.getConductivtyValue(),
fractureCell.cellSizeX(),
fractureCell.cellSizeZ(),
fractureCellNeighbourX.getConductivtyValue(),
fractureCellNeighbourX.cellSizeX(),
fractureCellNeighbourX.cellSizeZ(),
cDarcyInCorrectUnit);
transCondenser.addNeighborTransmissibility({ false, RigTransmissibilityCondenser::CellAddress::STIMPLAN, fractureCellIndex },
{ false, RigTransmissibilityCondenser::CellAddress::STIMPLAN, fractureCellNeighbourXIndex },
horizontalTransToXneigbour);
}
if (j < fractureGrid->jCellCount()-1)
{
size_t fractureCellNeighbourZIndex = fractureGrid->getGlobalIndexFromIJ(i, j + 1);
const RigFractureCell fractureCellNeighbourZ = fractureGrid->cellFromIndex(fractureCellNeighbourZIndex);
double verticalTransToZneigbour =
RigFractureTransmissibilityEquations::centerToCenterFractureCellTrans(fractureCell.getConductivtyValue(),
fractureCell.cellSizeZ(),
fractureCell.cellSizeX(),
fractureCellNeighbourZ.getConductivtyValue(),
fractureCellNeighbourZ.cellSizeZ(),
fractureCellNeighbourZ.cellSizeX(),
cDarcyInCorrectUnit);
transCondenser.addNeighborTransmissibility({ false, RigTransmissibilityCondenser::CellAddress::STIMPLAN, fractureCellIndex },
{ false, RigTransmissibilityCondenser::CellAddress::STIMPLAN, fractureCellNeighbourZIndex },
verticalTransToZneigbour);
}
}
}
/////
// Calculate transmissibility into the well
RigWellPathStimplanIntersector wellFractureIntersector(wellPath->wellPathGeometry(), fracture);
const std::map<size_t, RigWellPathStimplanIntersector::WellCellIntersection >& fractureWellCells = wellFractureIntersector.intersections();
for (const auto& fracCellIdxIsectDataPair : fractureWellCells)
{
size_t fracWellCellIdx = fracCellIdxIsectDataPair.first;
RigWellPathStimplanIntersector::WellCellIntersection intersection = fracCellIdxIsectDataPair.second;
const RigFractureCell fractureWellCell = fractureGrid->cellFromIndex(fracWellCellIdx);
double radialTrans = 0.0;
if (intersection.endpointCount)
{
radialTrans = RigFractureTransmissibilityEquations::fractureCellToWellRadialTrans(fractureWellCell.getConductivtyValue(),
fractureWellCell.cellSizeX(),
fractureWellCell.cellSizeZ(),
fracture->wellRadius(),
fracTemplate->skinFactor(),
cDarcyInCorrectUnit);
}
double linearTrans = 0.0;
if (intersection.hlength > 0.0 || intersection.vlength > 0.0 )
{
linearTrans = RigFractureTransmissibilityEquations::fractureCellToWellLinearTrans(fractureWellCell.getConductivtyValue(),
fractureWellCell.cellSizeX(),
fractureWellCell.cellSizeZ(),
intersection.vlength,
intersection.hlength ,
fracture->perforationEfficiency,
fracTemplate->skinFactor(),
cDarcyInCorrectUnit);
}
double totalWellTrans = 0.5 * intersection.endpointCount * radialTrans + linearTrans;
transCondenser.addNeighborTransmissibility( { true, RigTransmissibilityCondenser::CellAddress::WELL, 1},
{ false, RigTransmissibilityCondenser::CellAddress::STIMPLAN, fracWellCellIdx },
totalWellTrans);
}
/////
// Insert total transmissibility from eclipse-cell to well for this fracture into the map
std::set<RigTransmissibilityCondenser::CellAddress> externalCells = transCondenser.externalCells();
for (RigTransmissibilityCondenser::CellAddress externalCell : externalCells)
{
if (externalCell.m_cellIndexSpace == RigTransmissibilityCondenser::CellAddress::ECLIPSE)
{
double trans = transCondenser.condensedTransmissibility(externalCell, { true, RigTransmissibilityCondenser::CellAddress::WELL, 1 });
eclCellIdxToTransPrFractureMap[externalCell.m_globalCellIdx][fracture] = trans;
}
}
out << "\n" << "\n" << "\n----------- All Transimissibilities " << fracture->name() << " -------------------- \n\n";
out << QString::fromStdString(transCondenser.neighborTransDebugOutput(mainGrid, fractureGrid));
out << "\n" << "\n" << "\n----------- Condensed Results -------------------- \n\n";
out << QString::fromStdString(transCondenser.condensedTransDebugOutput(mainGrid, fractureGrid));
out << "\n" ;
}
out << qSetFieldWidth(7) << "COMPDAT" << "\n" << right << qSetFieldWidth(8);
for ( const auto& eclCellIdxFractureTransPair : eclCellIdxToTransPrFractureMap )
{
const auto& fracTransMap = eclCellIdxFractureTransPair.second;
double skinFactor = cvf::UNDEFINED_DOUBLE;
double totalCellToWellTrans = 0.0;
QString fractureNames;
for ( const auto& fracTransPair: fracTransMap )
{
totalCellToWellTrans += fracTransPair.second;
// Selecting the last existing skin factor TODO: What should we do ? Use highest/lowest ... ?
if ( fracTransPair.first->attachedFractureDefinition() )
{
skinFactor = fracTransPair.first->attachedFractureDefinition()->skinFactor();
}
fractureNames += fracTransPair.first->name() + "(" + QString::number(fracTransPair.second) + ")"+ " ";
}
if ( true)// totalCellToWellTrans > 0 )
{
size_t i, j, k;
mainGrid->ijkFromCellIndex(eclCellIdxFractureTransPair.first, &i, &j, &k);
printCOMPDATvalues(out, totalCellToWellTrans, i, j, k, fractureNames, skinFactor, wellPath->name());
}
}
out << "/ \n";
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -53,11 +53,6 @@ public:
const std::vector<RimFracture*>& fractures, const std::vector<RimFracture*>& fractures,
RimEclipseCase* caseToApply); RimEclipseCase* caseToApply);
static void exportWellPathFracturesToEclipseDataInputFile(const QString& fileName,
const RimWellPath* wellPath,
const RimEclipseCase* caseToApply);
private: private:
static void printCOMPDATvalues(QTextStream & out, static void printCOMPDATvalues(QTextStream & out,