#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,23 +361,51 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve
} }
else if (exportSettings.compdatExport == RicExportCompletionDataSettingsUi::MULTI_SEGMENT_WELL) else if (exportSettings.compdatExport == RicExportCompletionDataSettingsUi::MULTI_SEGMENT_WELL)
{ {
RimWellPath* wellPath = wellPaths.front();
if (exportSettings.includeFractures()) if (exportSettings.includeFractures())
{
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(); auto fractures = wellPath->fractureCollection()->fractures();
exportWellSegments(exportSettings.caseToApply, exportWellSegments(exportSettings.caseToApply,
exportSettings.folder, exportFile,
wellPath, fractures); wellPath, fractures);
} }
exportFile->close();
}
if (exportSettings.includeFishbones()) if (exportSettings.includeFishbones())
{
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(); auto fishbones = wellPath->fishbonesCollection()->fishbonesSubs();
exportWellSegments(exportSettings.caseToApply, exportWellSegments(exportSettings.caseToApply,
exportSettings.folder, exportFile,
wellPath, fishbones); 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; 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, void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(RimEclipseCase* eclipseCase,
const QString& exportFolder, QFilePtr exportFile,
const RimWellPath* wellPath, const RimWellPath* wellPath,
const std::vector<RimWellPathFracture*>& fractures) const std::vector<RimWellPathFracture*>& fractures)
{ {
@ -2183,30 +2223,9 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(RimEclipseCa
return; 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); RicMswExportInfo exportInfo = RicWellPathExportCompletionDataFeatureImpl::generateFracturesMswExportInfo(eclipseCase, wellPath, fractures);
QTextStream stream(&exportFile); QTextStream stream(exportFile.get());
RifEclipseDataTableFormatter formatter(stream); RifEclipseDataTableFormatter formatter(stream);
RicWellPathExportCompletionDataFeatureImpl::generateWelsegsTable(formatter, exportInfo); RicWellPathExportCompletionDataFeatureImpl::generateWelsegsTable(formatter, exportInfo);
RicWellPathExportCompletionDataFeatureImpl::generateCompsegTables(formatter, exportInfo); RicWellPathExportCompletionDataFeatureImpl::generateCompsegTables(formatter, exportInfo);
@ -2216,7 +2235,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(RimEclipseCa
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(RimEclipseCase* eclipseCase, void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(RimEclipseCase* eclipseCase,
const QString& exportFolder, QFilePtr exportFile,
const RimWellPath* wellPath, const RimWellPath* wellPath,
const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs) const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs)
{ {
@ -2226,30 +2245,9 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWellSegments(RimEclipseCa
return; 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); RicMswExportInfo exportInfo = RicWellPathExportCompletionDataFeatureImpl::generateFishbonesMswExportInfo(eclipseCase, wellPath, fishbonesSubs);
QTextStream stream(&exportFile); QTextStream stream(exportFile.get());
RifEclipseDataTableFormatter formatter(stream); RifEclipseDataTableFormatter formatter(stream);
RicWellPathExportCompletionDataFeatureImpl::generateWelsegsTable(formatter, exportInfo); RicWellPathExportCompletionDataFeatureImpl::generateWelsegsTable(formatter, exportInfo);
RicWellPathExportCompletionDataFeatureImpl::generateCompsegTables(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 /// Internal function
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

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