#1758 Add support for export of COMPDATL for LGR grid

This commit is contained in:
Magne Sjaastad 2018-01-30 09:08:26 +01:00
parent c0359f1776
commit 028b5303a7
5 changed files with 110 additions and 45 deletions

View File

@ -344,21 +344,14 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
{
if (externalCell.m_cellIndexSpace == RigTransmissibilityCondenser::CellAddress::ECLIPSE)
{
if (externalCell.m_globalCellIdx > mainGrid->cellCount())
{
RiaLogging::error(QString("LGR cells (not supported) found in export of COMPDAT values for fracture %1").arg(fracture->name()));
}
else
{
double trans = transCondenser.condensedTransmissibility(externalCell, { true, RigTransmissibilityCondenser::CellAddress::WELL, 1 });
double trans = transCondenser.condensedTransmissibility(externalCell, { true, RigTransmissibilityCondenser::CellAddress::WELL, 1 });
eclCellIdxToTransPrFractureMap[externalCell.m_globalCellIdx][fracture] = trans;
eclCellIdxToTransPrFractureMap[externalCell.m_globalCellIdx][fracture] = trans;
RigCompletionData compDat(wellPathName, IJKCellIndex(externalCell.m_globalCellIdx, caseToApply));
compDat.setFromFracture(trans, fracture->fractureTemplate()->skinFactor());
compDat.addMetadata(fracture->name(), QString::number(trans));
fractureCompletions.push_back(compDat);
}
RigCompletionData compDat(wellPathName, IJKCellIndex(externalCell.m_globalCellIdx, caseToApply));
compDat.setFromFracture(trans, fracture->fractureTemplate()->skinFactor());
compDat.addMetadata(fracture->name(), QString::number(trans));
fractureCompletions.push_back(compDat);
}
}
@ -375,4 +368,3 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
return fractureCompletions;
}

View File

@ -576,9 +576,44 @@ void RicWellPathExportCompletionDataFeature::printCompletionsToFile(const QStrin
std::vector<RigCompletionData>& completions,
RicExportCompletionDataSettingsUi::CompdatExportType exportType)
{
//TODO: Check that completion is ready for export
std::set<QString> gridNames;
QDir exportFolder = QDir(folderName);
for (const auto& c : completions)
{
gridNames.insert(c.cellIndex().lgrName());
}
for (const auto& gridName : gridNames)
{
std::vector<RigCompletionData> completionsForGrid;
for (const auto& c : completions)
{
if (gridName == c.cellIndex().lgrName())
{
completionsForGrid.push_back(c);
}
}
QString lgrFileName = fileName;
if (!gridName.isEmpty())
{
lgrFileName += "_";
lgrFileName += gridName;
}
printCompletionsToFileLgr(folderName, lgrFileName, completionsForGrid, exportType);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeature::printCompletionsToFileLgr(const QString& folderName, const QString& fileName, std::vector<RigCompletionData>& completions, RicExportCompletionDataSettingsUi::CompdatExportType exportType)
{
if (completions.empty()) return;
QDir exportFolder(folderName);
if (!exportFolder.exists())
{
@ -589,7 +624,7 @@ void RicWellPathExportCompletionDataFeature::printCompletionsToFile(const QStrin
QString filePath = exportFolder.filePath(fileName);
QFile exportFile(filePath);
if (!exportFile.open(QIODevice::WriteOnly))
if (!exportFile.open(QIODevice::WriteOnly))
{
RiaLogging::error(QString("Export Completions Data: Could not open the file: %1").arg(filePath));
return;
@ -602,8 +637,7 @@ void RicWellPathExportCompletionDataFeature::printCompletionsToFile(const QStrin
std::sort(completions.begin(), completions.end());
// Print completion data
generateCompdatTable(formatter, completions);
generateCompdatTable(formatter, completions[0].cellIndex().lgrName(), completions);
if (exportType == RicExportCompletionDataSettingsUi::WPIMULT_AND_DEFAULT_CONNECTION_FACTORS)
{
@ -655,26 +689,53 @@ std::map<IJKCellIndex, std::vector<RigCompletionData> > RicWellPathExportComplet
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeature::generateCompdatTable(RifEclipseDataTableFormatter& formatter, const std::vector<RigCompletionData>& completionData)
void RicWellPathExportCompletionDataFeature::generateCompdatTable(RifEclipseDataTableFormatter& formatter, const QString& lgrName, const std::vector<RigCompletionData>& completionData)
{
std::vector<RifEclipseOutputTableColumn> header = {
RifEclipseOutputTableColumn("Well"),
RifEclipseOutputTableColumn("I"),
RifEclipseOutputTableColumn("J"),
RifEclipseOutputTableColumn("K1"),
RifEclipseOutputTableColumn("K2"),
RifEclipseOutputTableColumn("Status"),
RifEclipseOutputTableColumn("SAT"),
RifEclipseOutputTableColumn("TR", RifEclipseOutputTableDoubleFormatting(RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC)),
RifEclipseOutputTableColumn("DIAM"),
RifEclipseOutputTableColumn("KH"),
RifEclipseOutputTableColumn("S"),
RifEclipseOutputTableColumn("Df"),
RifEclipseOutputTableColumn("DIR"),
RifEclipseOutputTableColumn("r0")
};
std::vector<RifEclipseOutputTableColumn> header;
formatter.keyword("COMPDAT");
if (lgrName.isEmpty())
{
header = {
RifEclipseOutputTableColumn("Well"),
RifEclipseOutputTableColumn("I"),
RifEclipseOutputTableColumn("J"),
RifEclipseOutputTableColumn("K1"),
RifEclipseOutputTableColumn("K2"),
RifEclipseOutputTableColumn("Status"),
RifEclipseOutputTableColumn("SAT"),
RifEclipseOutputTableColumn("TR", RifEclipseOutputTableDoubleFormatting(RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC)),
RifEclipseOutputTableColumn("DIAM"),
RifEclipseOutputTableColumn("KH"),
RifEclipseOutputTableColumn("S"),
RifEclipseOutputTableColumn("Df"),
RifEclipseOutputTableColumn("DIR"),
RifEclipseOutputTableColumn("r0")
};
formatter.keyword("COMPDAT");
}
else
{
header = {
RifEclipseOutputTableColumn("Well"),
RifEclipseOutputTableColumn("LgrName"),
RifEclipseOutputTableColumn("I"),
RifEclipseOutputTableColumn("J"),
RifEclipseOutputTableColumn("K1"),
RifEclipseOutputTableColumn("K2"),
RifEclipseOutputTableColumn("Status"),
RifEclipseOutputTableColumn("SAT"),
RifEclipseOutputTableColumn("TR", RifEclipseOutputTableDoubleFormatting(RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC)),
RifEclipseOutputTableColumn("DIAM"),
RifEclipseOutputTableColumn("KH"),
RifEclipseOutputTableColumn("S"),
RifEclipseOutputTableColumn("Df"),
RifEclipseOutputTableColumn("DIR"),
RifEclipseOutputTableColumn("r0")
};
formatter.keyword("COMPDATL");
}
formatter.header(header);
for (const RigCompletionData& data : completionData)
@ -690,6 +751,12 @@ void RicWellPathExportCompletionDataFeature::generateCompdatTable(RifEclipseData
formatter.comment(QString("%1 : %2").arg(metadata.name).arg(metadata.comment));
}
formatter.add(data.wellName());
if (!lgrName.isEmpty())
{
formatter.add(lgrName);
}
formatter.addZeroBasedCellIndex(data.cellIndex().localCellIndexI()).addZeroBasedCellIndex(data.cellIndex().localCellIndexJ()).addZeroBasedCellIndex(data.cellIndex().localCellIndexK()).addZeroBasedCellIndex(data.cellIndex().localCellIndexK());
switch (data.connectionState())
{

View File

@ -154,11 +154,14 @@ public:
private:
static RigCompletionData combineEclipseCellCompletions(const std::vector<RigCompletionData>& completions,
const RicExportCompletionDataSettingsUi& settings);
static void printCompletionsToFile(const QString& exportFolder, const QString& fileName, std::vector<RigCompletionData>& completions, RicExportCompletionDataSettingsUi::CompdatExportType exportType);
static void printCompletionsToFileLgr(const QString& folderName, const QString& fileName, std::vector<RigCompletionData>& completions, RicExportCompletionDataSettingsUi::CompdatExportType exportType);
static std::vector<RigCompletionData> getCompletionsForWellAndCompletionType(const std::vector<RigCompletionData>& completions, const QString& wellName, RigCompletionData::CompletionType completionType);
static std::map<IJKCellIndex, std::vector<RigCompletionData> > getCompletionsForWell(const std::map<IJKCellIndex, std::vector<RigCompletionData>>& cellToCompletionMap, const QString& wellName);
static void generateCompdatTable(RifEclipseDataTableFormatter& formatter, const std::vector<RigCompletionData>& completionData);
static void generateCompdatTable(RifEclipseDataTableFormatter& formatter, const QString& lgrName, const std::vector<RigCompletionData>& completionData);
static void generateWpimultTable(RifEclipseDataTableFormatter& formatter, const std::vector<RigCompletionData>& completionData);
static std::vector<RigCompletionData> generatePerforationsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings);

View File

@ -467,3 +467,11 @@ QString IJKCellIndex::oneBasedLocalCellIndexString() const
return text;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString IJKCellIndex::lgrName() const
{
return m_lgrName;
}

View File

@ -52,13 +52,6 @@ public:
IJKCellIndex(size_t globalCellIndex, const RimEclipseCase* eclipseCase);
IJKCellIndex(const IJKCellIndex& other)
{
m_localCellIndexI = other.m_localCellIndexI;
m_localCellIndexJ = other.m_localCellIndexJ;
m_localCellIndexK = other.m_localCellIndexK;
}
bool operator==(const IJKCellIndex& other) const
{
return m_localCellIndexI == other.m_localCellIndexI && m_localCellIndexJ == other.m_localCellIndexJ && m_localCellIndexK == other.m_localCellIndexK;
@ -80,6 +73,8 @@ public:
QString oneBasedLocalCellIndexString() const;
QString lgrName() const;
private:
size_t m_globalCellIndex;
QString m_lgrName;