#3268 MSW export. Export completions for all wells

This commit is contained in:
Bjørn Erik Jensen 2018-09-06 08:05:18 +02:00 committed by Magne Sjaastad
parent a6e1d24d56
commit 99676897b3
2 changed files with 89 additions and 59 deletions

View File

@ -361,22 +361,50 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve
}
else if (exportSettings.compdatExport == RicExportCompletionDataSettingsUi::MULTI_SEGMENT_WELL)
{
RimWellPath* wellPath = wellPaths.front();
if (exportSettings.includeFractures())
{
auto fractures = wellPath->fractureCollection()->fractures();
exportWellSegments(exportSettings.caseToApply,
exportSettings.folder,
wellPath, fractures);
QString fileName = QString("%1-Fracture-Welsegs").arg(exportSettings.caseToApply->caseUserDescription());
QFilePtr exportFile = openFileForExport(exportSettings.folder, fileName);
for (const auto wellPath : wellPaths)
{
auto fractures = wellPath->fractureCollection()->fractures();
exportWellSegments(exportSettings.caseToApply,
exportFile,
wellPath, fractures);
}
exportFile->close();
}
if (exportSettings.includeFishbones())
{
auto fishbones = wellPath->fishbonesCollection()->fishbonesSubs();
exportWellSegments(exportSettings.caseToApply,
exportSettings.folder,
wellPath, fishbones);
QString fileName = QString("%1-Fishbone-Welsegs").arg(exportSettings.caseToApply->caseUserDescription());
QFilePtr exportFile = openFileForExport(exportSettings.folder, fileName);
for (const auto wellPath : wellPaths)
{
auto fishbones = wellPath->fishbonesCollection()->fishbonesSubs();
exportWellSegments(exportSettings.caseToApply,
exportFile,
wellPath, fishbones);
}
exportFile->close();
}
if (false && exportSettings.includePerforations())
{
QString fileName = QString("%1-Perforation-Welsegs").arg(exportSettings.caseToApply->caseUserDescription());
QFilePtr exportFile = openFileForExport(exportSettings.folder, fileName);
for (const auto wellPath : wellPaths)
{
auto perforations = wellPath->perforationIntervalCollection()->perforations();
exportWellSegments(exportSettings.caseToApply,
exportFile,
wellPath, perforations);
}
exportFile->close();
}
}
}
@ -1740,6 +1768,18 @@ RicMswExportInfo
return exportInfo;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswExportInfo RicWellPathExportCompletionDataFeatureImpl::generatePerforationsMswExportInfo(RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
const std::vector<const RimPerforationInterval*>& perforationIntervals)
{
return RicMswExportInfo(wellPath, RiaEclipseUnitTools::UNITS_METRIC, 0, "LENdep", "pRES");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -2173,7 +2213,7 @@ cvf::Vec2i RicWellPathExportCompletionDataFeatureImpl::wellPathUpperGridIntersec
///
//--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(RimEclipseCase* eclipseCase,
const QString& exportFolder,
QFilePtr exportFile,
const RimWellPath* wellPath,
const std::vector<RimWellPathFracture*>& fractures)
{
@ -2183,30 +2223,9 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(RimEclipseCa
return;
}
QString fileName = QString("%1-Fracture-Welsegs").arg(eclipseCase->caseUserDescription());
fileName = caf::Utils::makeValidFileBasename(fileName);
QDir dir(exportFolder);
if (!dir.exists())
{
bool createdPath = dir.mkpath(".");
if (createdPath)
RiaLogging::info("Export Fracture Well Segments: Created export folder " + exportFolder);
else
RiaLogging::error("Export Fracture Well Segments: Selected output folder does not exist, and could not be created.");
}
QString filePath = dir.filePath(fileName);
QFile exportFile(filePath);
if (!exportFile.open(QIODevice::WriteOnly))
{
RiaLogging::error(QString("Export Fracture Well Segments: Could not open the file: %1").arg(filePath));
return;
}
RicMswExportInfo exportInfo = RicWellPathExportCompletionDataFeatureImpl::generateFracturesMswExportInfo(eclipseCase, wellPath, fractures);
QTextStream stream(&exportFile);
QTextStream stream(exportFile.get());
RifEclipseDataTableFormatter formatter(stream);
RicWellPathExportCompletionDataFeatureImpl::generateWelsegsTable(formatter, exportInfo);
RicWellPathExportCompletionDataFeatureImpl::generateCompsegTables(formatter, exportInfo);
@ -2216,7 +2235,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(RimEclipseCa
///
//--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(RimEclipseCase* eclipseCase,
const QString& exportFolder,
QFilePtr exportFile,
const RimWellPath* wellPath,
const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs)
{
@ -2226,30 +2245,9 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(RimEclipseCa
return;
}
QString fileName = QString("%1-Fishbone-Welsegs").arg(eclipseCase->caseUserDescription());
fileName = caf::Utils::makeValidFileBasename(fileName);
QDir dir(exportFolder);
if (!dir.exists())
{
bool createdPath = dir.mkpath(".");
if (createdPath)
RiaLogging::info("Created export folder " + exportFolder);
else
RiaLogging::error("Selected output folder does not exist, and could not be created.");
}
QString filePath = dir.filePath(fileName);
QFile exportFile(filePath);
if (!exportFile.open(QIODevice::WriteOnly))
{
RiaLogging::error(QString("Export Well Segments: Could not open the file: %1").arg(filePath));
return;
}
RicMswExportInfo exportInfo = RicWellPathExportCompletionDataFeatureImpl::generateFishbonesMswExportInfo(eclipseCase, wellPath, fishbonesSubs);
QTextStream stream(&exportFile);
QTextStream stream(exportFile.get());
RifEclipseDataTableFormatter formatter(stream);
RicWellPathExportCompletionDataFeatureImpl::generateWelsegsTable(formatter, exportInfo);
RicWellPathExportCompletionDataFeatureImpl::generateCompsegTables(formatter, exportInfo);
@ -2257,6 +2255,28 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(RimEclipseCa
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(RimEclipseCase* eclipseCase,
QFilePtr exportFile,
const RimWellPath* wellPath,
const std::vector<const RimPerforationInterval*>& perforationIntervals)
{
if (eclipseCase == nullptr)
{
RiaLogging::error("Export Well Segments: Cannot export completions data without specified eclipse case");
return;
}
RicMswExportInfo exportInfo = RicWellPathExportCompletionDataFeatureImpl::generatePerforationsMswExportInfo(eclipseCase, wellPath, perforationIntervals);
QTextStream stream(exportFile.get());
RifEclipseDataTableFormatter formatter(stream);
RicWellPathExportCompletionDataFeatureImpl::generateWelsegsTable(formatter, exportInfo);
RicWellPathExportCompletionDataFeatureImpl::generateCompsegTables(formatter, exportInfo);
RicWellPathExportCompletionDataFeatureImpl::generateWsegvalvTable(formatter, exportInfo);
}
//--------------------------------------------------------------------------------------------------
/// Internal function
//--------------------------------------------------------------------------------------------------

View File

@ -38,6 +38,7 @@ class RigMainGrid;
class RimEclipseCase;
class RimFishbonesMultipleSubs;
class RimSimWellInView;
class RimPerforationInterval;
class RimWellPath;
class RimWellPathFracture;
class RifEclipseDataTableFormatter;
@ -69,7 +70,11 @@ public:
const RimWellPath* wellPath,
const std::vector<RimWellPathFracture*>& fractures);
static CellDirection calculateDirectionInCell(RimEclipseCase* eclipseCase,
static RicMswExportInfo generatePerforationsMswExportInfo(RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
const std::vector<const RimPerforationInterval*>& perforationIntervals);
static CellDirection calculateDirectionInCell(RimEclipseCase* eclipseCase,
size_t globalCellIndex,
const cvf::Vec3d& lengthsInCell);
@ -194,12 +199,17 @@ private:
static cvf::Vec2i wellPathUpperGridIntersectionIJ(const RimEclipseCase* gridCase, const RimWellPath* wellPath, const QString& gridName = "");
static void exportWellSegments(RimEclipseCase* eclipseCase,
const QString& exportFolder,
QFilePtr exportFile,
const RimWellPath* wellPath,
const std::vector<RimWellPathFracture*>& fractures);
static void exportWellSegments(RimEclipseCase* eclipseCase,
const QString& exportFolder,
QFilePtr exportFile,
const RimWellPath* wellPath,
const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs);
static void exportWellSegments(RimEclipseCase* eclipseCase,
QFilePtr exportFile,
const RimWellPath* wellPath,
const std::vector<const RimPerforationInterval*>& perforationIntervals);
};