2017-01-10 02:30:39 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-05-18 07:40:47 -05:00
|
|
|
#include "RifFractureExportTools.h"
|
2017-01-10 02:30:39 -06:00
|
|
|
|
2017-01-11 07:32:15 -06:00
|
|
|
#include "RiaApplication.h"
|
2017-02-28 03:01:31 -06:00
|
|
|
#include "RiaLogging.h"
|
|
|
|
|
2017-02-16 08:22:03 -06:00
|
|
|
#include "RigEclipseCaseData.h"
|
2017-01-11 07:32:15 -06:00
|
|
|
#include "RigFracture.h"
|
2017-05-16 09:18:56 -05:00
|
|
|
#include "RigFractureTransCalc.h"
|
|
|
|
#include "RigStimPlanFracTemplateCell.h"
|
2017-01-11 07:32:15 -06:00
|
|
|
#include "RigMainGrid.h"
|
2017-05-16 09:18:56 -05:00
|
|
|
#include "RigEclipseToStimPlanCellTransmissibilityCalculator.h"
|
2017-01-11 07:32:15 -06:00
|
|
|
|
2017-02-02 01:46:05 -06:00
|
|
|
#include "RimEclipseCase.h"
|
2017-01-11 07:32:15 -06:00
|
|
|
#include "RimEclipseResultDefinition.h"
|
2017-01-11 03:30:38 -06:00
|
|
|
#include "RimEclipseView.h"
|
|
|
|
#include "RimEclipseWell.h"
|
2017-01-12 06:29:18 -06:00
|
|
|
#include "RimEllipseFractureTemplate.h"
|
2017-01-31 08:58:13 -06:00
|
|
|
#include "RimFracture.h"
|
2017-05-16 09:18:56 -05:00
|
|
|
#include "RimFractureTemplate.h"
|
|
|
|
#include "RimSimWellFracture.h"
|
|
|
|
#include "RimStimPlanFractureTemplate.h"
|
2017-01-11 03:30:38 -06:00
|
|
|
#include "RimWellPath.h"
|
2017-01-10 02:30:39 -06:00
|
|
|
|
|
|
|
#include "cafProgressInfo.h"
|
|
|
|
|
|
|
|
#include <QFile>
|
2017-01-27 03:46:45 -06:00
|
|
|
#include <QString>
|
2017-01-30 07:47:56 -06:00
|
|
|
#include <QTextStream>
|
2017-01-10 02:30:39 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Constructor
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-18 07:40:47 -05:00
|
|
|
RifFractureExportTools::RifFractureExportTools()
|
2017-01-10 02:30:39 -06:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Destructor
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-18 07:40:47 -05:00
|
|
|
RifFractureExportTools::~RifFractureExportTools()
|
2017-01-10 02:30:39 -06:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-18 07:50:28 -05:00
|
|
|
bool RifFractureExportTools::exportFracturesToEclipseDataInputFile(const QString& fileName, const std::vector< RimFracture*>& fractures, RimEclipseCase* caseToApply)
|
2017-01-10 02:30:39 -06:00
|
|
|
{
|
2017-02-28 03:01:31 -06:00
|
|
|
RiaLogging::info(QString("Computing and writing COMPDAT values to file %1").arg(fileName));
|
|
|
|
|
2017-05-18 07:40:47 -05:00
|
|
|
const RigMainGrid* mainGrid = caseToApply->eclipseCaseData()->mainGrid();
|
2017-01-27 03:46:45 -06:00
|
|
|
if (!mainGrid) return false;
|
|
|
|
|
2017-01-10 02:30:39 -06:00
|
|
|
QFile file(fileName);
|
|
|
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-01-11 03:30:38 -06:00
|
|
|
caf::ProgressInfo pi(fractures.size(), QString("Writing data to file %1").arg(fileName));
|
2017-01-10 04:57:42 -06:00
|
|
|
RimEclipseWell* simWell = nullptr;
|
2017-01-11 03:30:38 -06:00
|
|
|
RimWellPath* wellPath = nullptr;
|
2017-01-10 02:30:39 -06:00
|
|
|
|
2017-05-18 07:40:47 -05:00
|
|
|
size_t progress = 0;
|
2017-01-10 04:57:42 -06:00
|
|
|
std::vector<size_t> ijk;
|
2017-01-19 03:01:07 -06:00
|
|
|
|
2017-01-27 03:46:45 -06:00
|
|
|
QTextStream out(&file);
|
|
|
|
out << "\n";
|
2017-03-06 08:14:11 -06:00
|
|
|
out << "-- Exported from ResInsight" << "\n";
|
|
|
|
|
2017-03-15 04:10:43 -05:00
|
|
|
RigEclipseCaseData::UnitsType caseUnit = caseToApply->eclipseCaseData()->unitsType();
|
2017-03-06 08:14:11 -06:00
|
|
|
if (caseUnit == RigEclipseCaseData::UNITS_METRIC) out << "-- Using metric unit system" << "\n";
|
|
|
|
if (caseUnit == RigEclipseCaseData::UNITS_FIELD) out << "-- Using field unit system" << "\n";
|
|
|
|
out << "\n";
|
2017-01-27 03:46:45 -06:00
|
|
|
|
2017-03-20 04:38:58 -05:00
|
|
|
//Included for debug / prototyping only
|
2017-04-20 07:35:12 -05:00
|
|
|
printTransmissibilityFractureToWell(fractures, out, caseToApply);
|
2017-04-20 05:16:13 -05:00
|
|
|
|
2017-04-18 06:34:32 -05:00
|
|
|
printStimPlanFractureTrans(fractures, out);
|
2017-04-20 05:16:13 -05:00
|
|
|
|
2017-04-05 07:40:54 -05:00
|
|
|
printStimPlanCellsMatrixTransContributions(fractures, caseToApply, out, wellPath, simWell, mainGrid);
|
2017-04-20 05:16:13 -05:00
|
|
|
|
2017-04-05 07:40:54 -05:00
|
|
|
printBackgroundDataHeaderLine(out);
|
|
|
|
|
2017-02-28 03:01:31 -06:00
|
|
|
RiaLogging::debug(QString("Writing intermediate results from COMPDAT calculation"));
|
2017-01-27 03:46:45 -06:00
|
|
|
|
2017-05-16 10:26:40 -05:00
|
|
|
std::map<RimFracture*, std::vector<RigFracturedEclipseCellExportData> > exportDataPrFracture;
|
|
|
|
|
2017-01-27 03:46:45 -06:00
|
|
|
for (RimFracture* fracture : fractures)
|
|
|
|
{
|
2017-03-21 09:29:22 -05:00
|
|
|
RigFractureTransCalc transmissibilityCalculator(caseToApply, fracture);
|
|
|
|
|
2017-03-21 07:43:44 -05:00
|
|
|
//TODO: Check that there is a fracture template available for given fracture....
|
2017-05-16 10:26:40 -05:00
|
|
|
|
|
|
|
std::vector<RigFracturedEclipseCellExportData> fracDataVector = transmissibilityCalculator.computeTransmissibilityFromPolygonWithInfiniteConductivityInFracture();
|
|
|
|
exportDataPrFracture[fracture] = fracDataVector;
|
2017-01-27 03:46:45 -06:00
|
|
|
|
2017-05-16 03:55:31 -05:00
|
|
|
for (RigFracturedEclipseCellExportData fracData : fracDataVector)
|
2017-01-27 03:46:45 -06:00
|
|
|
{
|
2017-01-30 07:47:56 -06:00
|
|
|
printBackgroundData(out, wellPath, simWell, fracture, mainGrid, fracData);
|
2017-01-27 03:46:45 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out << "\n";
|
|
|
|
|
2017-02-10 04:22:10 -06:00
|
|
|
out << qSetFieldWidth(7) << "COMPDAT" << "\n" << right << qSetFieldWidth(8);
|
2017-01-19 03:01:07 -06:00
|
|
|
for (RimFracture* fracture : fractures)
|
2017-01-10 02:30:39 -06:00
|
|
|
{
|
2017-02-28 03:01:31 -06:00
|
|
|
RiaLogging::debug(QString("Writing COMPDAT values for fracture %1").arg(fracture->name()));
|
2017-05-16 10:26:40 -05:00
|
|
|
std::vector<RigFracturedEclipseCellExportData> fracDataVector = exportDataPrFracture[fracture];
|
2017-01-11 07:32:15 -06:00
|
|
|
|
2017-05-16 03:55:31 -05:00
|
|
|
for (RigFracturedEclipseCellExportData fracData : fracDataVector)
|
2017-01-11 07:32:15 -06:00
|
|
|
{
|
2017-05-16 10:26:40 -05:00
|
|
|
if ( fracData.transmissibility > 0 )
|
2017-01-31 03:14:26 -06:00
|
|
|
{
|
2017-05-16 10:26:40 -05:00
|
|
|
printCOMPDATvalues(out, fracData, fracture, wellPath, simWell, mainGrid);
|
2017-01-31 03:14:26 -06:00
|
|
|
}
|
2017-01-11 07:32:15 -06:00
|
|
|
}
|
|
|
|
|
2017-01-27 03:46:45 -06:00
|
|
|
//TODO: If same cell is used for multiple fractures, the sum of contributions should be added to table.
|
|
|
|
|
2017-01-19 03:01:07 -06:00
|
|
|
progress++;
|
|
|
|
pi.setProgress(progress);
|
2017-01-10 02:30:39 -06:00
|
|
|
}
|
|
|
|
|
2017-02-10 04:22:10 -06:00
|
|
|
out << "/ \n";
|
|
|
|
|
2017-02-28 03:01:31 -06:00
|
|
|
RiaLogging::info(QString("Competed writing COMPDAT data to file %1").arg(fileName));
|
2017-01-11 03:30:38 -06:00
|
|
|
return true;
|
2017-01-11 02:30:34 -06:00
|
|
|
}
|
2017-01-30 07:47:56 -06:00
|
|
|
|
2017-03-20 04:38:58 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-18 07:40:47 -05:00
|
|
|
void RifFractureExportTools::performStimPlanUpscalingAndPrintResults(const std::vector<RimFracture *>& fractures, RimEclipseCase* caseToApply, QTextStream &out, RimWellPath* wellPath, RimEclipseWell* simWell, const RigMainGrid* mainGrid)
|
2017-03-20 04:38:58 -05:00
|
|
|
{
|
2017-03-20 08:04:02 -05:00
|
|
|
//TODO: Get these more generally:
|
2017-05-16 10:26:40 -05:00
|
|
|
|
2017-03-20 08:04:02 -05:00
|
|
|
QString resultName = "CONDUCTIVITY";
|
|
|
|
QString resultUnit = "md-m";
|
|
|
|
size_t timeStepIndex = 0;
|
|
|
|
|
2017-03-20 04:38:58 -05:00
|
|
|
for (RimFracture* fracture : fractures) //For testing upscaling...
|
|
|
|
{
|
2017-03-21 09:29:22 -05:00
|
|
|
RigFractureTransCalc transmissibilityCalculator(caseToApply, fracture);
|
2017-05-16 10:26:40 -05:00
|
|
|
|
|
|
|
std::vector<RigFracturedEclipseCellExportData> fracDataVector;
|
|
|
|
fracDataVector = transmissibilityCalculator.computeUpscaledPropertyFromStimPlan(resultName, resultUnit, timeStepIndex);
|
2017-03-20 04:38:58 -05:00
|
|
|
|
2017-03-20 06:29:09 -05:00
|
|
|
out << qSetFieldWidth(4);
|
|
|
|
out << "-- ";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(12);
|
|
|
|
out << "Well";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(16);
|
|
|
|
out << "Fracture name ";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(5);
|
|
|
|
out << "i"; // 2. I location grid block, adding 1 to go to eclipse 1-based grid definition
|
|
|
|
out << "j"; // 3. J location grid block, adding 1 to go to eclipse 1-based grid definition
|
|
|
|
out << "k"; // 4. K location of upper connecting grid block, adding 1 to go to eclipse 1-based grid definition
|
|
|
|
|
|
|
|
out << qSetFieldWidth(10);
|
|
|
|
out << "cellIndex";
|
2017-03-31 03:25:24 -05:00
|
|
|
out << "condHA. ";
|
|
|
|
out << "condAH. ";
|
2017-03-20 06:29:09 -05:00
|
|
|
|
|
|
|
out << "\n";
|
|
|
|
|
2017-05-16 03:55:31 -05:00
|
|
|
for (RigFracturedEclipseCellExportData fracData : fracDataVector)
|
2017-03-20 04:38:58 -05:00
|
|
|
{
|
2017-03-20 06:29:09 -05:00
|
|
|
|
2017-03-20 04:38:58 -05:00
|
|
|
out << qSetFieldWidth(4);
|
|
|
|
out << "-- ";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(12);
|
|
|
|
wellPath, simWell = nullptr;
|
|
|
|
fracture->firstAncestorOrThisOfType(simWell);
|
|
|
|
if (simWell) out << simWell->name + " "; // 1. Well name
|
|
|
|
fracture->firstAncestorOrThisOfType(wellPath);
|
|
|
|
if (wellPath) out << wellPath->name + " "; // 1. Well name
|
|
|
|
|
|
|
|
out << qSetFieldWidth(16);
|
|
|
|
out << fracture->name().left(15) + " ";
|
|
|
|
|
|
|
|
|
|
|
|
out << qSetFieldWidth(5);
|
|
|
|
size_t i, j, k;
|
|
|
|
mainGrid->ijkFromCellIndex(fracData.reservoirCellIndex, &i, &j, &k);
|
|
|
|
out << i + 1; // 2. I location grid block, adding 1 to go to eclipse 1-based grid definition
|
|
|
|
out << j + 1; // 3. J location grid block, adding 1 to go to eclipse 1-based grid definition
|
|
|
|
out << k + 1; // 4. K location of upper connecting grid block, adding 1 to go to eclipse 1-based grid definition
|
|
|
|
|
|
|
|
out << qSetFieldWidth(10);
|
2017-03-20 08:04:02 -05:00
|
|
|
out << fracData.reservoirCellIndex;
|
2017-03-31 03:25:24 -05:00
|
|
|
out << QString::number(fracData.upscaledStimPlanValueHA, 'f', 3);
|
|
|
|
out << QString::number(fracData.upscaledStimPlanValueAH, 'f', 3);
|
2017-03-20 04:38:58 -05:00
|
|
|
|
|
|
|
out << "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-04-05 07:40:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-18 07:40:47 -05:00
|
|
|
void RifFractureExportTools::printStimPlanCellsMatrixTransContributions(const std::vector<RimFracture *>& fractures, RimEclipseCase* caseToApply, QTextStream &out, RimWellPath* wellPath, RimEclipseWell* simWell, const RigMainGrid* mainGrid)
|
2017-04-05 07:40:54 -05:00
|
|
|
{
|
2017-04-18 06:34:32 -05:00
|
|
|
out << "StimPlan cells' matrix transmissibility and Eclipse Cell contributions \n";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(4);
|
|
|
|
out << "-- ";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(12);
|
|
|
|
out << "Well name "; // 1. Well name
|
|
|
|
|
|
|
|
out << qSetFieldWidth(16);
|
|
|
|
out << "Fracture name ";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(5);
|
|
|
|
out << "Ec i";
|
|
|
|
out << "Ec j";
|
|
|
|
out << "Ec k";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(10);
|
|
|
|
out << "Ecl cell";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(5);
|
|
|
|
out << "SP i";
|
|
|
|
out << "SP j";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(10);
|
|
|
|
out << "Tm contr";
|
|
|
|
|
|
|
|
out << "\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-05 07:40:54 -05:00
|
|
|
for (RimFracture* fracture : fractures)
|
|
|
|
{
|
|
|
|
RimStimPlanFractureTemplate* fracTemplateStimPlan;
|
|
|
|
if (dynamic_cast<RimStimPlanFractureTemplate*>(fracture->attachedFractureDefinition()))
|
|
|
|
{
|
|
|
|
fracTemplateStimPlan = dynamic_cast<RimStimPlanFractureTemplate*>(fracture->attachedFractureDefinition());
|
|
|
|
}
|
|
|
|
else continue;
|
|
|
|
|
|
|
|
RigFractureTransCalc transmissibilityCalculator(caseToApply, fracture);
|
2017-05-16 08:37:30 -05:00
|
|
|
double cDarcyInCorrectUnit = transmissibilityCalculator.cDarcy();
|
2017-04-05 07:40:54 -05:00
|
|
|
|
2017-05-11 05:24:57 -05:00
|
|
|
std::vector<RigStimPlanFracTemplateCell> stimPlanCells = fracTemplateStimPlan->getStimPlanCells();
|
2017-04-05 07:40:54 -05:00
|
|
|
|
2017-05-11 05:24:57 -05:00
|
|
|
for (RigStimPlanFracTemplateCell stimPlanCell : stimPlanCells)
|
2017-04-05 07:40:54 -05:00
|
|
|
{
|
2017-04-06 04:47:50 -05:00
|
|
|
if (stimPlanCell.getConductivtyValue() < 1e-7)
|
|
|
|
{
|
2017-05-16 08:37:30 -05:00
|
|
|
continue;
|
2017-04-06 04:47:50 -05:00
|
|
|
}
|
|
|
|
|
2017-05-11 05:20:09 -05:00
|
|
|
RigStimPlanFractureCell fracStimPlanCellData(stimPlanCell.getI(), stimPlanCell.getJ());
|
2017-04-06 04:47:50 -05:00
|
|
|
|
2017-05-16 09:04:32 -05:00
|
|
|
RigEclipseToStimPlanCellTransmissibilityCalculator eclToStimPlanTransCalc(caseToApply,
|
2017-05-16 08:37:30 -05:00
|
|
|
fracture->transformMatrix(),
|
|
|
|
fracture->attachedFractureDefinition()->skinFactor,
|
|
|
|
cDarcyInCorrectUnit,
|
|
|
|
stimPlanCell);
|
2017-04-05 07:40:54 -05:00
|
|
|
|
2017-05-16 08:37:30 -05:00
|
|
|
std::vector<size_t> stimPlanContributingEclipseCells = eclToStimPlanTransCalc.globalIndeciesToContributingEclipseCells();
|
|
|
|
std::vector<double> stimPlanContributingEclipseCellTransmissibilities = eclToStimPlanTransCalc.contributingEclipseCellTransmissibilities();
|
2017-04-05 07:40:54 -05:00
|
|
|
|
|
|
|
for (int i = 0; i < stimPlanContributingEclipseCells.size(); i++)
|
|
|
|
{
|
|
|
|
out << qSetFieldWidth(4);
|
|
|
|
out << "-- ";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(12);
|
|
|
|
wellPath, simWell = nullptr;
|
|
|
|
fracture->firstAncestorOrThisOfType(simWell);
|
|
|
|
if (simWell) out << simWell->name + " "; // 1. Well name
|
|
|
|
fracture->firstAncestorOrThisOfType(wellPath);
|
|
|
|
if (wellPath) out << wellPath->name + " "; // 1. Well name
|
|
|
|
|
|
|
|
out << qSetFieldWidth(16);
|
|
|
|
out << fracture->name().left(15) + " ";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(5);
|
|
|
|
size_t ii, jj, kk;
|
|
|
|
mainGrid->ijkFromCellIndex(stimPlanContributingEclipseCells[i], &ii, &jj, &kk);
|
|
|
|
out << ii + 1;
|
|
|
|
out << jj + 1;
|
|
|
|
out << kk + 1;
|
|
|
|
|
|
|
|
out << qSetFieldWidth(10);
|
|
|
|
out << stimPlanContributingEclipseCells[i];
|
|
|
|
|
|
|
|
out << qSetFieldWidth(5);
|
2017-04-06 02:34:38 -05:00
|
|
|
size_t spi = stimPlanCell.getI();
|
|
|
|
size_t spj = stimPlanCell.getJ();
|
2017-04-05 07:40:54 -05:00
|
|
|
|
|
|
|
out << spi;
|
|
|
|
out << spj;
|
|
|
|
|
|
|
|
out << qSetFieldWidth(10);
|
2017-05-15 07:13:59 -05:00
|
|
|
out << QString::number(stimPlanContributingEclipseCellTransmissibilities[i], 'e', 3);
|
2017-04-05 07:40:54 -05:00
|
|
|
|
|
|
|
out << "\n";
|
|
|
|
}
|
2017-04-25 09:08:44 -05:00
|
|
|
|
|
|
|
//TODO: add RigFractureStimPlanCellData to m_StimPlanCellsFractureData i RigFracture???
|
2017-04-18 06:34:32 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2017-04-05 07:40:54 -05:00
|
|
|
|
2017-04-18 06:34:32 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-18 07:40:47 -05:00
|
|
|
void RifFractureExportTools::printStimPlanFractureTrans(const std::vector<RimFracture *>& fractures, QTextStream &out)
|
2017-04-18 06:34:32 -05:00
|
|
|
{
|
|
|
|
out << "StimPlan cells' fracture transmissibility \n";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(4);
|
|
|
|
out << "-- ";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(5);
|
|
|
|
out << "SP i";
|
|
|
|
out << "SP j";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(10);
|
|
|
|
out << "Tf_hor";
|
|
|
|
out << "Tf_vert";
|
|
|
|
|
|
|
|
out << "\n";
|
|
|
|
|
|
|
|
if (fractures.size() < 1) return;
|
|
|
|
RimFracture* fracture = fractures[0];
|
|
|
|
|
|
|
|
RimStimPlanFractureTemplate* fracTemplateStimPlan;
|
|
|
|
if (dynamic_cast<RimStimPlanFractureTemplate*>(fracture->attachedFractureDefinition()))
|
|
|
|
{
|
|
|
|
fracTemplateStimPlan = dynamic_cast<RimStimPlanFractureTemplate*>(fracture->attachedFractureDefinition());
|
|
|
|
}
|
|
|
|
else return;
|
|
|
|
|
2017-05-11 05:24:57 -05:00
|
|
|
std::vector<RigStimPlanFracTemplateCell> stimPlanCells = fracTemplateStimPlan->getStimPlanCells();
|
2017-04-18 06:34:32 -05:00
|
|
|
|
2017-05-11 05:24:57 -05:00
|
|
|
for (RigStimPlanFracTemplateCell stimPlanCell : stimPlanCells)
|
2017-04-18 06:34:32 -05:00
|
|
|
{
|
|
|
|
if (stimPlanCell.getConductivtyValue() < 1e-7)
|
|
|
|
{
|
|
|
|
//If conductivity in stimPlanCell is 0, contributions might not be relevant...
|
|
|
|
continue;
|
2017-04-05 07:40:54 -05:00
|
|
|
}
|
|
|
|
|
2017-05-16 06:54:50 -05:00
|
|
|
double verticalTrans = RigFractureTransCalc::computeStimPlanCellTransmissibilityInFracture(stimPlanCell.getConductivtyValue(), stimPlanCell.cellSizeX(), stimPlanCell.cellSizeZ());
|
|
|
|
double horizontalTrans = RigFractureTransCalc::computeStimPlanCellTransmissibilityInFracture(stimPlanCell.getConductivtyValue(), stimPlanCell.cellSizeZ(), stimPlanCell.cellSizeX());
|
2017-04-18 06:34:32 -05:00
|
|
|
|
|
|
|
out << qSetFieldWidth(5);
|
|
|
|
size_t spi = stimPlanCell.getI();
|
|
|
|
size_t spj = stimPlanCell.getJ();
|
2017-04-05 07:40:54 -05:00
|
|
|
|
2017-04-18 06:34:32 -05:00
|
|
|
out << spi;
|
|
|
|
out << spj;
|
2017-04-05 07:40:54 -05:00
|
|
|
|
2017-04-18 06:34:32 -05:00
|
|
|
out << qSetFieldWidth(10);
|
2017-05-16 06:54:50 -05:00
|
|
|
out << QString::number(verticalTrans, 'e', 3);
|
|
|
|
out << QString::number(horizontalTrans, 'e', 3);
|
2017-04-05 07:40:54 -05:00
|
|
|
|
2017-04-18 06:34:32 -05:00
|
|
|
out << "\n";
|
2017-04-05 07:40:54 -05:00
|
|
|
}
|
2017-04-18 06:34:32 -05:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
2017-04-05 07:40:54 -05:00
|
|
|
}
|
|
|
|
|
2017-01-30 07:47:56 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-18 07:40:47 -05:00
|
|
|
void RifFractureExportTools::printCOMPDATvalues(QTextStream & out, RigFracturedEclipseCellExportData &fracData, RimFracture* fracture, RimWellPath* wellPath, RimEclipseWell* simWell, const RigMainGrid* mainGrid)
|
2017-01-30 07:47:56 -06:00
|
|
|
{
|
|
|
|
out << qSetFieldWidth(8);
|
|
|
|
if (fracData.transmissibility == cvf::UNDEFINED_DOUBLE || !(fracture->attachedFractureDefinition())) out << "--"; //Commenting out line in output file
|
|
|
|
|
|
|
|
wellPath, simWell = nullptr;
|
|
|
|
fracture->firstAncestorOrThisOfType(simWell);
|
|
|
|
if (simWell) out << simWell->name; // 1. Well name
|
|
|
|
fracture->firstAncestorOrThisOfType(wellPath);
|
|
|
|
if (wellPath) out << wellPath->name; // 1. Well name
|
|
|
|
|
|
|
|
out << qSetFieldWidth(5);
|
|
|
|
|
|
|
|
size_t i, j, k;
|
|
|
|
mainGrid->ijkFromCellIndex(fracData.reservoirCellIndex, &i, &j, &k);
|
|
|
|
out << i + 1; // 2. I location grid block, adding 1 to go to eclipse 1-based grid definition
|
|
|
|
out << j + 1; // 3. J location grid block, adding 1 to go to eclipse 1-based grid definition
|
|
|
|
out << k + 1; // 4. K location of upper connecting grid block, adding 1 to go to eclipse 1-based grid definition
|
|
|
|
out << k + 1; // 5. K location of lower connecting grid block, adding 1 to go to eclipse 1-based grid definition
|
|
|
|
|
|
|
|
out << "2* "; // Default value for
|
|
|
|
//6. Open / Shut flag of connection
|
|
|
|
// 7. Saturation table number for connection rel perm. Default value
|
|
|
|
|
2017-01-31 02:52:55 -06:00
|
|
|
out << qSetFieldWidth(12);
|
2017-01-30 07:47:56 -06:00
|
|
|
// 8. Transmissibility
|
2017-02-10 04:22:10 -06:00
|
|
|
if (fracData.transmissibility != cvf::UNDEFINED_DOUBLE) out << QString::number(fracData.transmissibility, 'e', 4);
|
2017-01-30 07:47:56 -06:00
|
|
|
else out << "UNDEF";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(4);
|
|
|
|
out << "2* "; // Default value for
|
|
|
|
// 9. Well bore diameter. Set to default
|
|
|
|
// 10. Effective Kh (perm times width)
|
|
|
|
|
|
|
|
if (fracture->attachedFractureDefinition())
|
|
|
|
{
|
|
|
|
out << fracture->attachedFractureDefinition()->skinFactor; // 11. Skin factor
|
|
|
|
}
|
|
|
|
else //If no attached fracture definition these parameters are set to UNDEF
|
|
|
|
{
|
|
|
|
out << "UNDEF";
|
|
|
|
}
|
|
|
|
|
|
|
|
out << "/";
|
|
|
|
out << " " << fracture->name(); //Fracture name as comment
|
|
|
|
out << "\n"; // Terminating entry
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-18 07:40:47 -05:00
|
|
|
void RifFractureExportTools::printBackgroundDataHeaderLine(QTextStream & out)
|
2017-01-30 07:47:56 -06:00
|
|
|
{
|
|
|
|
out << "-- Background data for calculation" << "\n\n";
|
|
|
|
|
|
|
|
|
|
|
|
//Write header line
|
|
|
|
out << qSetFieldWidth(4);
|
|
|
|
out << "--";
|
|
|
|
out << qSetFieldWidth(12);
|
|
|
|
out << "Well ";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(16);
|
|
|
|
out << "Fracture ";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(5);
|
|
|
|
out << "i";
|
|
|
|
out << "j";
|
|
|
|
out << "k";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(12);
|
|
|
|
out << "Ax";
|
|
|
|
out << "Ay";
|
|
|
|
out << "Az";
|
|
|
|
out << "TotArea";
|
|
|
|
|
|
|
|
out << "skinfac";
|
|
|
|
out << "FracLen";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(10);
|
|
|
|
out << "DX";
|
|
|
|
out << "DY";
|
|
|
|
out << "DZ";
|
|
|
|
|
2017-02-10 04:22:10 -06:00
|
|
|
out << qSetFieldWidth(12);
|
2017-01-30 07:47:56 -06:00
|
|
|
out << "PermX";
|
|
|
|
out << "PermY";
|
|
|
|
out << "PermZ";
|
2017-02-10 04:22:10 -06:00
|
|
|
|
|
|
|
out << qSetFieldWidth(8);
|
2017-01-30 07:47:56 -06:00
|
|
|
out << "NTG";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(12);
|
|
|
|
out << "T_x";
|
|
|
|
out << "T_y";
|
|
|
|
out << "T_z";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(15);
|
|
|
|
out << "Transm";
|
|
|
|
|
2017-02-10 04:22:10 -06:00
|
|
|
out << qSetFieldWidth(20);
|
|
|
|
out << "Status";
|
|
|
|
|
2017-01-30 07:47:56 -06:00
|
|
|
out << "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-18 07:40:47 -05:00
|
|
|
void RifFractureExportTools::printBackgroundData(QTextStream & out, RimWellPath* wellPath, RimEclipseWell* simWell, RimFracture* fracture, const RigMainGrid* mainGrid, RigFracturedEclipseCellExportData &fracData)
|
2017-01-30 07:47:56 -06:00
|
|
|
{
|
2017-02-10 04:22:10 -06:00
|
|
|
out << qSetFieldWidth(4);
|
|
|
|
out << "-- ";
|
2017-01-30 07:47:56 -06:00
|
|
|
|
2017-02-10 04:22:10 -06:00
|
|
|
out << qSetFieldWidth(12);
|
2017-01-30 07:47:56 -06:00
|
|
|
wellPath, simWell = nullptr;
|
|
|
|
fracture->firstAncestorOrThisOfType(simWell);
|
|
|
|
if (simWell) out << simWell->name + " " ; // 1. Well name
|
|
|
|
fracture->firstAncestorOrThisOfType(wellPath);
|
|
|
|
if (wellPath) out << wellPath->name + " "; // 1. Well name
|
|
|
|
|
|
|
|
out << qSetFieldWidth(16);
|
|
|
|
out << fracture->name().left(15) + " ";
|
|
|
|
|
|
|
|
|
|
|
|
out << qSetFieldWidth(5);
|
|
|
|
size_t i, j, k;
|
|
|
|
mainGrid->ijkFromCellIndex(fracData.reservoirCellIndex, &i, &j, &k);
|
|
|
|
out << i + 1; // 2. I location grid block, adding 1 to go to eclipse 1-based grid definition
|
|
|
|
out << j + 1; // 3. J location grid block, adding 1 to go to eclipse 1-based grid definition
|
|
|
|
out << k + 1; // 4. K location of upper connecting grid block, adding 1 to go to eclipse 1-based grid definition
|
|
|
|
|
|
|
|
out << qSetFieldWidth(12);
|
|
|
|
//Use f for float, e for exponent float and g for best choice of these two.
|
|
|
|
out << QString::number(fracData.projectedAreas.x(), 'g', 4);
|
|
|
|
out << QString::number(fracData.projectedAreas.y(), 'g', 4);
|
|
|
|
out << QString::number(fracData.projectedAreas.z(), 'g', 4);
|
|
|
|
out << QString::number(fracData.totalArea, 'g', 4);
|
|
|
|
|
|
|
|
out << QString::number(fracData.skinFactor, 'f', 2);
|
|
|
|
out << QString::number(fracData.fractureLenght, 'g', 3);
|
|
|
|
|
|
|
|
out << qSetFieldWidth(10);
|
|
|
|
out << QString::number(fracData.cellSizes.x(), 'f', 2);
|
|
|
|
out << QString::number(fracData.cellSizes.y(), 'f', 2);
|
|
|
|
out << QString::number(fracData.cellSizes.z(), 'f', 2);
|
|
|
|
|
2017-02-10 04:22:10 -06:00
|
|
|
out << qSetFieldWidth(12);
|
|
|
|
out << QString::number(fracData.permeabilities.x(), 'e', 3);
|
|
|
|
out << QString::number(fracData.permeabilities.y(), 'e', 3);
|
|
|
|
out << QString::number(fracData.permeabilities.z(), 'e', 3);
|
|
|
|
|
|
|
|
out << qSetFieldWidth(8);
|
2017-01-30 07:47:56 -06:00
|
|
|
out << QString::number(fracData.NTG, 'f', 2);
|
|
|
|
|
|
|
|
out << qSetFieldWidth(12);
|
|
|
|
out << QString::number(fracData.transmissibilities.x(), 'e', 3);
|
|
|
|
out << QString::number(fracData.transmissibilities.y(), 'e', 3);
|
|
|
|
out << QString::number(fracData.transmissibilities.z(), 'e', 3);
|
|
|
|
|
|
|
|
out << qSetFieldWidth(15);
|
2017-02-10 04:22:10 -06:00
|
|
|
out << QString::number(fracData.transmissibility, 'e', 3);
|
|
|
|
|
|
|
|
if (!fracData.cellIsActive)
|
|
|
|
{
|
|
|
|
out << qSetFieldWidth(20);
|
|
|
|
out << " INACTIVE CELL ";
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (fracData.cellIsActive && fracData.transmissibility > 0)
|
|
|
|
{
|
|
|
|
out << qSetFieldWidth(20);
|
|
|
|
out << " ACTIVE CELL ";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
out << qSetFieldWidth(20);
|
|
|
|
out << " INVALID DATA ";
|
|
|
|
}
|
2017-01-30 07:47:56 -06:00
|
|
|
|
|
|
|
out << "\n";
|
|
|
|
|
|
|
|
}
|
2017-04-20 05:16:13 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-18 07:40:47 -05:00
|
|
|
void RifFractureExportTools::printTransmissibilityFractureToWell(const std::vector<RimFracture *>& fractures, QTextStream &out, RimEclipseCase* caseToApply)
|
2017-04-20 05:16:13 -05:00
|
|
|
{
|
2017-04-25 09:08:44 -05:00
|
|
|
out << "-- Transmissibility From Fracture To Well \n";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(12);
|
|
|
|
out << "Well name ";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(16);
|
|
|
|
out << "Fracture name ";
|
|
|
|
out << "Inflow type ";
|
|
|
|
|
|
|
|
out << qSetFieldWidth(5);
|
|
|
|
out << " i ";
|
|
|
|
out << " j ";
|
|
|
|
|
|
|
|
out << "Tw";
|
|
|
|
out << "\n";
|
2017-04-20 05:16:13 -05:00
|
|
|
|
|
|
|
for (RimFracture* fracture : fractures)
|
|
|
|
{
|
|
|
|
out << qSetFieldWidth(12);
|
|
|
|
RimEclipseWell* simWell = nullptr;
|
|
|
|
RimWellPath* wellPath = nullptr;
|
|
|
|
fracture->firstAncestorOrThisOfType(simWell);
|
|
|
|
if (simWell) out << simWell->name + " "; // 1. Well name
|
|
|
|
fracture->firstAncestorOrThisOfType(wellPath);
|
|
|
|
if (wellPath) out << wellPath->name + " "; // 1. Well name
|
|
|
|
|
|
|
|
out << qSetFieldWidth(16);
|
|
|
|
out << fracture->name().left(15) + " ";
|
|
|
|
|
2017-04-20 07:35:12 -05:00
|
|
|
|
|
|
|
if (fracture->attachedFractureDefinition()->orientation == RimFractureTemplate::ALONG_WELL_PATH)
|
|
|
|
{
|
|
|
|
out << "Linear inflow";
|
2017-04-25 09:08:44 -05:00
|
|
|
out << qSetFieldWidth(5);
|
2017-04-20 07:35:12 -05:00
|
|
|
|
|
|
|
RimStimPlanFractureTemplate* fracTemplateStimPlan;
|
|
|
|
if (dynamic_cast<RimStimPlanFractureTemplate*>(fracture->attachedFractureDefinition()))
|
|
|
|
{
|
|
|
|
fracTemplateStimPlan = dynamic_cast<RimStimPlanFractureTemplate*>(fracture->attachedFractureDefinition());
|
|
|
|
}
|
|
|
|
else continue;
|
|
|
|
|
|
|
|
//TODO: Can be removed when implementation of dip angle is more general:
|
|
|
|
RimSimWellFracture* simWellFrac;
|
|
|
|
if (dynamic_cast<RimSimWellFracture*>(fracture))
|
|
|
|
{
|
|
|
|
simWellFrac = dynamic_cast<RimSimWellFracture*>(fracture);
|
|
|
|
}
|
|
|
|
else continue;
|
|
|
|
|
|
|
|
double wellDip = simWellFrac->wellDipAtFracturePosition();
|
|
|
|
|
|
|
|
double perforationLengthVert = fracture->perforationLength * cos(wellDip);
|
|
|
|
double perforationLengthHor = fracture->perforationLength * sin(wellDip);
|
2017-04-25 09:08:44 -05:00
|
|
|
|
|
|
|
std::pair<size_t, size_t> wellCenterStimPlanCellIJ = fracTemplateStimPlan->getStimPlanCellAtWellCenter();
|
|
|
|
out << qSetFieldWidth(5);
|
|
|
|
out << wellCenterStimPlanCellIJ.first;
|
|
|
|
out << wellCenterStimPlanCellIJ.second;
|
2017-04-20 07:35:12 -05:00
|
|
|
|
|
|
|
|
2017-04-25 09:08:44 -05:00
|
|
|
//RigStimPlanCell* stimPlanCell = fracTemplateStimPlan->getStimPlanCellAtIJ(wellCenterStimPlanCellIJ.first, wellCenterStimPlanCellIJ.second);
|
2017-05-11 05:24:57 -05:00
|
|
|
const RigStimPlanFracTemplateCell& stimPlanCell = fracTemplateStimPlan->stimPlanCellFromIndex(fracTemplateStimPlan->getGlobalIndexFromIJ(wellCenterStimPlanCellIJ.first, wellCenterStimPlanCellIJ.second));
|
2017-04-20 07:35:12 -05:00
|
|
|
|
|
|
|
RigFractureTransCalc transmissibilityCalculator(caseToApply, fracture);
|
2017-05-18 08:14:27 -05:00
|
|
|
double linTransInStimPlanCell = transmissibilityCalculator.computeLinearTransmissibilityToWellinStimPlanCell(stimPlanCell.getConductivtyValue(),
|
|
|
|
stimPlanCell.cellSizeX(),
|
|
|
|
stimPlanCell.cellSizeZ(),
|
|
|
|
perforationLengthVert,
|
|
|
|
perforationLengthHor,
|
|
|
|
fracture->perforationEfficiency,
|
|
|
|
fracture->attachedFractureDefinition()->skinFactor(),
|
|
|
|
transmissibilityCalculator.cDarcy());
|
2017-04-20 07:35:12 -05:00
|
|
|
|
2017-05-15 07:18:32 -05:00
|
|
|
out << qSetFieldWidth(10);
|
|
|
|
out << QString::number(linTransInStimPlanCell, 'f', 2);
|
2017-04-25 09:08:44 -05:00
|
|
|
out << "\n";
|
2017-04-20 07:35:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (fracture->attachedFractureDefinition()->orientation == RimFractureTemplate::TRANSVERSE_WELL_PATH
|
|
|
|
|| fracture->attachedFractureDefinition()->orientation == RimFractureTemplate::AZIMUTH)
|
2017-04-20 05:16:13 -05:00
|
|
|
{
|
2017-04-20 07:35:12 -05:00
|
|
|
out << "Radial inflow";
|
2017-04-20 05:16:13 -05:00
|
|
|
|
|
|
|
RimStimPlanFractureTemplate* fracTemplateStimPlan;
|
|
|
|
if (dynamic_cast<RimStimPlanFractureTemplate*>(fracture->attachedFractureDefinition()))
|
|
|
|
{
|
|
|
|
fracTemplateStimPlan = dynamic_cast<RimStimPlanFractureTemplate*>(fracture->attachedFractureDefinition());
|
|
|
|
}
|
|
|
|
else continue;
|
|
|
|
|
2017-04-25 09:08:44 -05:00
|
|
|
std::pair<size_t, size_t> wellCenterStimPlanCellIJ = fracTemplateStimPlan->getStimPlanCellAtWellCenter();
|
|
|
|
out << qSetFieldWidth(5);
|
|
|
|
out << wellCenterStimPlanCellIJ.first;
|
|
|
|
out << wellCenterStimPlanCellIJ.second;
|
|
|
|
|
2017-05-11 05:24:57 -05:00
|
|
|
const RigStimPlanFracTemplateCell& stimPlanCell = fracTemplateStimPlan->stimPlanCellFromIndex(fracTemplateStimPlan->getGlobalIndexFromIJ(wellCenterStimPlanCellIJ.first, wellCenterStimPlanCellIJ.second));
|
2017-04-20 05:16:13 -05:00
|
|
|
|
|
|
|
RigFractureTransCalc transmissibilityCalculator(caseToApply, fracture);
|
2017-05-18 08:14:27 -05:00
|
|
|
double radTransInStimPlanCell = transmissibilityCalculator.computeRadialTransmissibilityToWellinStimPlanCell(stimPlanCell.getConductivtyValue(),
|
|
|
|
stimPlanCell.cellSizeX(),
|
|
|
|
stimPlanCell.cellSizeZ(),
|
|
|
|
fracture->wellRadius(),
|
|
|
|
fracture->attachedFractureDefinition()->skinFactor(),
|
|
|
|
fracture->azimuth,
|
|
|
|
fracture->wellAzimuthAtFracturePosition(),
|
|
|
|
transmissibilityCalculator.cDarcy());
|
2017-04-20 05:16:13 -05:00
|
|
|
|
2017-05-15 07:18:32 -05:00
|
|
|
out << qSetFieldWidth(10);
|
|
|
|
out << QString::number(radTransInStimPlanCell, 'f', 2);
|
2017-04-25 09:08:44 -05:00
|
|
|
out << "\n";
|
|
|
|
|
2017-04-20 05:16:13 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-04-25 09:08:44 -05:00
|
|
|
out << "\n";
|
2017-04-20 05:16:13 -05:00
|
|
|
}
|