Merge branch 'fishbones' into pre-proto

This commit is contained in:
Bjørnar Grip Fjær
2017-06-01 12:32:36 +02:00
97 changed files with 9865 additions and 1293 deletions

View File

@@ -5,13 +5,14 @@ if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RifEclipseDataTableFormatter.h
${CEE_CURRENT_LIST_DIR}RifEclipseInputFileTools.h
${CEE_CURRENT_LIST_DIR}RifEclipseOutputFileTools.h
${CEE_CURRENT_LIST_DIR}RifEclipseOutputTableFormatter.h
${CEE_CURRENT_LIST_DIR}RifEclipseRestartDataAccess.h
${CEE_CURRENT_LIST_DIR}RifEclipseRestartFilesetAccess.h
${CEE_CURRENT_LIST_DIR}RifEclipseSummaryTools.h
${CEE_CURRENT_LIST_DIR}RifEclipseUnifiedRestartFileAccess.h
${CEE_CURRENT_LIST_DIR}RifPerforationIntervalReader.h
${CEE_CURRENT_LIST_DIR}RifReaderEclipseInput.h
${CEE_CURRENT_LIST_DIR}RifReaderEclipseOutput.h
${CEE_CURRENT_LIST_DIR}RifReaderEclipseSummary.h
@@ -26,13 +27,14 @@ ${CEE_CURRENT_LIST_DIR}RifFractureExportTools.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RifEclipseDataTableFormatter.cpp
${CEE_CURRENT_LIST_DIR}RifEclipseInputFileTools.cpp
${CEE_CURRENT_LIST_DIR}RifEclipseOutputFileTools.cpp
${CEE_CURRENT_LIST_DIR}RifEclipseOutputTableFormatter.cpp
${CEE_CURRENT_LIST_DIR}RifEclipseRestartDataAccess.cpp
${CEE_CURRENT_LIST_DIR}RifEclipseRestartFilesetAccess.cpp
${CEE_CURRENT_LIST_DIR}RifEclipseUnifiedRestartFileAccess.cpp
${CEE_CURRENT_LIST_DIR}RifEclipseSummaryTools.cpp
${CEE_CURRENT_LIST_DIR}RifPerforationIntervalReader.cpp
${CEE_CURRENT_LIST_DIR}RifReaderEclipseInput.cpp
${CEE_CURRENT_LIST_DIR}RifReaderEclipseOutput.cpp
${CEE_CURRENT_LIST_DIR}RifReaderEclipseSummary.cpp

View File

@@ -16,21 +16,21 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RifEclipseOutputTableFormatter.h"
#include "RifEclipseDataTableFormatter.h"
#include "cvfAssert.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseOutputTableFormatter::RifEclipseOutputTableFormatter(QTextStream& out) : m_out(out)
RifEclipseDataTableFormatter::RifEclipseDataTableFormatter(QTextStream& out) : m_out(out)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseOutputTableFormatter::~RifEclipseOutputTableFormatter()
RifEclipseDataTableFormatter::~RifEclipseDataTableFormatter()
{
CVF_ASSERT(m_buffer.empty());
CVF_ASSERT(m_columns.empty());
@@ -39,7 +39,7 @@ RifEclipseOutputTableFormatter::~RifEclipseOutputTableFormatter()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseOutputTableFormatter::outputBuffer()
void RifEclipseDataTableFormatter::outputBuffer()
{
if (m_columns.size() > 0)
{
@@ -74,7 +74,7 @@ void RifEclipseOutputTableFormatter::outputBuffer()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseOutputTableFormatter::outputComment(RifEclipseOutputTableLine& comment)
void RifEclipseDataTableFormatter::outputComment(RifEclipseOutputTableLine& comment)
{
m_out << "-- " << comment.data[0] << "\n";
}
@@ -82,7 +82,7 @@ void RifEclipseOutputTableFormatter::outputComment(RifEclipseOutputTableLine& co
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseOutputTableFormatter::tableCompleted()
void RifEclipseDataTableFormatter::tableCompleted()
{
outputBuffer();
// Output an "empty" line after a finished table
@@ -92,7 +92,7 @@ void RifEclipseOutputTableFormatter::tableCompleted()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::keyword(const QString keyword)
RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::keyword(const QString keyword)
{
CVF_ASSERT(m_buffer.empty());
CVF_ASSERT(m_columns.empty());
@@ -103,7 +103,7 @@ RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::keyword(const QS
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::header(const std::vector<RifEclipseOutputTableColumn> header)
RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::header(const std::vector<RifEclipseOutputTableColumn> header)
{
outputBuffer();
m_columns = header;
@@ -117,7 +117,7 @@ RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::header(const std
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::comment(const QString comment)
RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::comment(const QString comment)
{
RifEclipseOutputTableLine line;
line.data.push_back(comment);
@@ -136,7 +136,7 @@ RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::comment(const QS
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::add(const QString str)
RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::add(const QString str)
{
size_t column = m_lineBuffer.size();
CVF_ASSERT(column < m_columns.size());
@@ -148,7 +148,7 @@ RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::add(const QStrin
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::add(double num)
RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::add(double num)
{
size_t column = m_lineBuffer.size();
CVF_ASSERT(column < m_columns.size());
@@ -160,7 +160,7 @@ RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::add(double num)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::add(int num)
RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::add(int num)
{
size_t column = m_lineBuffer.size();
CVF_ASSERT(column < m_columns.size());
@@ -172,7 +172,7 @@ RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::add(int num)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::add(size_t num)
RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::add(size_t num)
{
size_t column = m_lineBuffer.size();
CVF_ASSERT(column < m_columns.size());
@@ -184,7 +184,7 @@ RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::add(size_t num)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::addZeroBasedCellIndex(size_t index)
RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::addZeroBasedCellIndex(size_t index)
{
size_t column = m_lineBuffer.size();
CVF_ASSERT(column < m_columns.size());
@@ -200,7 +200,7 @@ RifEclipseOutputTableFormatter& RifEclipseOutputTableFormatter::addZeroBasedCell
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseOutputTableFormatter::rowCompleted()
void RifEclipseDataTableFormatter::rowCompleted()
{
RifEclipseOutputTableLine line;
line.data = m_lineBuffer;
@@ -212,7 +212,7 @@ void RifEclipseOutputTableFormatter::rowCompleted()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RifEclipseOutputTableFormatter::measure(const QString str)
int RifEclipseDataTableFormatter::measure(const QString str)
{
return str.length();
}
@@ -220,7 +220,7 @@ int RifEclipseOutputTableFormatter::measure(const QString str)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RifEclipseOutputTableFormatter::measure(double num)
int RifEclipseDataTableFormatter::measure(double num)
{
return format(num).length();
}
@@ -228,7 +228,7 @@ int RifEclipseOutputTableFormatter::measure(double num)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RifEclipseOutputTableFormatter::measure(int num)
int RifEclipseDataTableFormatter::measure(int num)
{
return format(num).length();
}
@@ -236,7 +236,7 @@ int RifEclipseOutputTableFormatter::measure(int num)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RifEclipseOutputTableFormatter::measure(size_t num)
int RifEclipseDataTableFormatter::measure(size_t num)
{
return format(num).length();
}
@@ -244,7 +244,7 @@ int RifEclipseOutputTableFormatter::measure(size_t num)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RifEclipseOutputTableFormatter::format(double num)
QString RifEclipseDataTableFormatter::format(double num)
{
return QString("%1").arg(num, 0, 'f', m_doubleDecimals);
}
@@ -252,7 +252,7 @@ QString RifEclipseOutputTableFormatter::format(double num)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RifEclipseOutputTableFormatter::format(int num)
QString RifEclipseDataTableFormatter::format(int num)
{
return QString("%1").arg(num);
}
@@ -260,7 +260,7 @@ QString RifEclipseOutputTableFormatter::format(int num)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RifEclipseOutputTableFormatter::format(size_t num)
QString RifEclipseDataTableFormatter::format(size_t num)
{
return QString("%1").arg(num);
}
@@ -268,7 +268,7 @@ QString RifEclipseOutputTableFormatter::format(size_t num)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RifEclipseOutputTableFormatter::formatColumn(const QString str, RifEclipseOutputTableColumn column)
QString RifEclipseDataTableFormatter::formatColumn(const QString str, RifEclipseOutputTableColumn column)
{
if (column.alignment == LEFT)
{

View File

@@ -71,20 +71,20 @@ struct RifEclipseOutputTableColumn
//==================================================================================================
//
//==================================================================================================
class RifEclipseOutputTableFormatter
class RifEclipseDataTableFormatter
{
public:
RifEclipseOutputTableFormatter(QTextStream& out);
virtual ~RifEclipseOutputTableFormatter();
RifEclipseDataTableFormatter(QTextStream& out);
virtual ~RifEclipseDataTableFormatter();
RifEclipseOutputTableFormatter& keyword(const QString keyword);
RifEclipseOutputTableFormatter& header(std::vector<RifEclipseOutputTableColumn> tableHeader);
RifEclipseOutputTableFormatter& add(const QString str);
RifEclipseOutputTableFormatter& add(double num);
RifEclipseOutputTableFormatter& add(int num);
RifEclipseOutputTableFormatter& add(size_t num);
RifEclipseOutputTableFormatter& addZeroBasedCellIndex(size_t index);
RifEclipseOutputTableFormatter& comment(const QString str);
RifEclipseDataTableFormatter& keyword(const QString keyword);
RifEclipseDataTableFormatter& header(std::vector<RifEclipseOutputTableColumn> tableHeader);
RifEclipseDataTableFormatter& add(const QString str);
RifEclipseDataTableFormatter& add(double num);
RifEclipseDataTableFormatter& add(int num);
RifEclipseDataTableFormatter& add(size_t num);
RifEclipseDataTableFormatter& addZeroBasedCellIndex(size_t index);
RifEclipseDataTableFormatter& comment(const QString str);
void rowCompleted();
void tableCompleted();

View File

@@ -0,0 +1,125 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RifPerforationIntervalReader.h"
#include <QFile>
#include <QDate>
const QString PERFORATION_KEY("perforation");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<QString, std::vector<RifPerforationInterval> > RifPerforationIntervalReader::readPerforationIntervals(const QStringList& filePaths)
{
std::map<QString, std::vector<RifPerforationInterval>> perforationIntervals;
foreach (QString filePath, filePaths)
{
readFileIntoMap(filePath, &perforationIntervals);
}
return perforationIntervals;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<QString, std::vector<RifPerforationInterval> > RifPerforationIntervalReader::readPerforationIntervals(const QString& filePath)
{
std::map<QString, std::vector<RifPerforationInterval> > perforationIntervals;
readFileIntoMap(filePath, &perforationIntervals);
return perforationIntervals;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifPerforationIntervalReader::readFileIntoMap(const QString& filePath, std::map<QString, std::vector<RifPerforationInterval>>* perforations)
{
QFile data(filePath);
if (!data.open(QFile::ReadOnly))
{
return;
}
QString wellName;
do {
QString line = data.readLine();
if (line.startsWith("--"))
{
// Skip comment
continue;
}
// Replace any tabs with spaces to enable splitting on spaces
line.replace("\t", " ");
QStringList parts = line.split(" ", QString::SkipEmptyParts);
if (line.startsWith("WELLNAME"))
{
// Save current well name
if (parts.size() == 2)
{
wellName = parts[1].trimmed();
}
}
else if (parts.size() >= 6)
{
RifPerforationInterval interval;
int mdStartIndex;
if (parts[3] == PERFORATION_KEY)
{
interval.date = QDate::fromString(QString("%1 %2 %3").arg(parts[0]).arg(parts[1]).arg(parts[2]), "dd MMM yyyy");
interval.startOfHistory = false;
mdStartIndex = 4;
}
else if (parts[1] == PERFORATION_KEY)
{
interval.startOfHistory = true;
mdStartIndex = 2;
}
else
{
continue;
}
interval.startMD = parts[mdStartIndex].toDouble();
interval.endMD = parts[mdStartIndex + 1].toDouble();
interval.diameter = parts[mdStartIndex + 2].toDouble();
interval.skinFactor = parts[mdStartIndex + 3].toDouble();
auto match = perforations->find(wellName);
if (match == perforations->end())
{
(*perforations)[wellName] = std::vector<RifPerforationInterval>();
}
(*perforations)[wellName].push_back(interval);
}
} while (!data.atEnd());
}

View File

@@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimPerforationInterval.h"
#include <map>
#include <QString>
struct RifPerforationInterval
{
double startMD;
double endMD;
double diameter;
double skinFactor;
bool startOfHistory;
QDate date;
};
//==================================================================================================
///
//==================================================================================================
class RifPerforationIntervalReader
{
public:
static std::map<QString, std::vector<RifPerforationInterval> > readPerforationIntervals(const QStringList& filePaths);
static std::map<QString, std::vector<RifPerforationInterval> > readPerforationIntervals(const QString& filePath);
private:
static void readFileIntoMap(const QString& filePath, std::map<QString, std::vector<RifPerforationInterval> >* perforations);
};

View File

@@ -971,13 +971,22 @@ RigWellResultPoint RifReaderEclipseOutput::createWellResultPoint(const RigGridBa
resultPoint.m_oilRate = oilRate;
resultPoint.m_waterRate = waterRate;
/// Unit conversion for use with Well Allocation plots
// Convert Gas to oil equivalents
// If field unit, the Gas is in Mega ft^3 while the others are in [stb] (barrel)
// Unused Gas to Barrel conversion
// we convert gas to stb as well. Based on
// 1 [stb] = 0.15898729492800007 [m^3]
// 1 [ft] = 0.3048 [m]
// megaFt3ToStbFactor = 1.0 / (1.0e-6 * 0.15898729492800007 * ( 1.0 / 0.3048 )^3 )
double megaFt3ToStbFactor = 178107.60668;
if (m_eclipseCase->unitsType() == RigEclipseCaseData::UNITS_FIELD) gasRate = megaFt3ToStbFactor * gasRate;
// double megaFt3ToStbFactor = 178107.60668;
double fieldGasToOilEquivalent = 1.0e6/5800; // Mega ft^3 to BOE
double metricGasToOilEquivalent = 1.0/1.0e3; // Sm^3 Gas to Sm^3 oe
if (m_eclipseCase->unitsType() == RigEclipseCaseData::UNITS_FIELD) gasRate = fieldGasToOilEquivalent * gasRate;
if (m_eclipseCase->unitsType() == RigEclipseCaseData::UNITS_METRIC) gasRate = metricGasToOilEquivalent * gasRate;
resultPoint.m_gasRate = gasRate;
}