From 3aaadde5c01b560305da0ffe2fdfa16cfdf98f26 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 3 Aug 2018 13:35:03 +0200 Subject: [PATCH] #3038 Fracture Completion Summary : Add transmissibility, conn count and area --- .../RicExportFractureCompletionsImpl.cpp | 19 +++ .../RicExportFractureCompletionsImpl.h | 6 + ...cWellPathFractureTextReportFeatureImpl.cpp | 159 +++++++++++++++++- ...RicWellPathFractureTextReportFeatureImpl.h | 7 +- 4 files changed, 184 insertions(+), 7 deletions(-) diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp index 585114ae96..11f6680f61 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp @@ -75,6 +75,25 @@ std::vector RicExportFractureCompletionsImpl::generateCompdat outputStreamForIntermediateResultsText); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicExportFractureCompletionsImpl::generateCompdatValuesForWellPathSingleFracture( + RimWellPath* wellPath, + RimEclipseCase* caseToApply, + RimFracture* fracture, + QTextStream* outputStreamForIntermediateResultsText) +{ + std::vector fracturesAlongWellPath; + fracturesAlongWellPath.push_back(fracture); + + return generateCompdatValues(caseToApply, + wellPath->completions()->wellNameForExport(), + wellPath->wellPathGeometry(), + fracturesAlongWellPath, + outputStreamForIntermediateResultsText); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.h b/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.h index a5c268adc1..0a4805b75c 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.h @@ -41,6 +41,12 @@ public: RimEclipseCase* caseToApply, QTextStream* outputStreamForIntermediateResultsText); + static std::vector + generateCompdatValuesForWellPathSingleFracture(RimWellPath* wellPath, + RimEclipseCase* caseToApply, + RimFracture* fracture, + QTextStream* outputStreamForIntermediateResultsText); + static std::vector generateCompdatValuesForSimWell(RimEclipseCase* eclipseCase, const RimSimWellInView* well, QTextStream* outputStreamForIntermediateResultsText); diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.cpp index d03db23dce..b901223f5f 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.cpp @@ -20,8 +20,12 @@ #include "RiaApplication.h" +#include "RicExportFractureCompletionsImpl.h" + #include "RifEclipseDataTableFormatter.h" +#include "RigCompletionData.h" + #include "RimEclipseCase.h" #include "RimEllipseFractureTemplate.h" #include "RimFileWellPath.h" @@ -36,6 +40,8 @@ #include "RimWellPathFracture.h" #include "RimWellPathFractureCollection.h" +#include "cvfGeometryTools.h" + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -63,7 +69,7 @@ RifEclipseOutputTableColumn floatNumberColumn(const QString& text) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RicWellPathFractureTextReportFeatureImpl::wellPathFractureReport(const RimEclipseCase* sourceCase, +QString RicWellPathFractureTextReportFeatureImpl::wellPathFractureReport(RimEclipseCase* sourceCase, const std::vector& wellPaths) { if (!sourceCase || wellPaths.empty()) @@ -151,9 +157,17 @@ QString RicWellPathFractureTextReportFeatureImpl::wellPathFractureReport(const R } } - QString tableText = createFractureInstancesText(wellPathFractures); - textStream << tableText; - textStream << lineStart << "\n"; + { + QString tableText = createFractureInstancesText(wellPathFractures); + textStream << tableText; + textStream << lineStart << "\n"; + } + + { + QString tableText = createFractureCompletionSummaryText(sourceCase, wellPathFractures); + textStream << tableText; + textStream << lineStart << "\n"; + } } return text; @@ -551,6 +565,143 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureInstancesText( return tableText; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicWellPathFractureTextReportFeatureImpl::createFractureCompletionSummaryText( + RimEclipseCase* sourceCase, + const std::vector& wellPathFractures) const +{ + QString tableText; + + QTextStream stream(&tableText); + RifEclipseDataTableFormatter formatter(stream); + configureFormatter(&formatter); + + std::vector header = { + RifEclipseOutputTableColumn(""), + RifEclipseOutputTableColumn(""), + RifEclipseOutputTableColumn(""), + floatNumberColumn("Tr"), + floatNumberColumn("#con"), + floatNumberColumn("Fcd"), + floatNumberColumn("Area"), + floatNumberColumn("KfWf"), + floatNumberColumn("Kf"), + floatNumberColumn("wf"), + floatNumberColumn("Xf"), + floatNumberColumn("H"), + floatNumberColumn("Km"), + }; + + formatter.header(header); + + // Second header line + { + formatter.add("Well"); + formatter.add("Fracture"); + formatter.add("Template"); + formatter.add("[Sm3/d/bar]"); // Tr + formatter.add(""); // #con + formatter.add("[]"); // Fcd + formatter.add("[m2]"); // Area + formatter.add("[mDm]"); // KfWf + formatter.add("[Md]"); // Kf + formatter.add("[m]"); // wf + formatter.add("[m]"); // Xf + formatter.add("[m]"); // H + formatter.add("[mD]"); // Km + formatter.rowCompleted(); + } + + formatter.addHorizontalLine('-'); + + // Cache the fracture template area, as this is a heavy operation + std::map templateAreaMap; + + for (auto& fracture : wellPathFractures) + { + QString wellName; + + RimWellPath* wellPath = nullptr; + fracture->firstAncestorOrThisOfType(wellPath); + if (wellPath) + { + wellName = wellPath->name(); + } + + formatter.add(wellName); + formatter.add(fracture->name()); + + if (fracture->fractureTemplate()) + { + formatter.add(fracture->fractureTemplate()->name()); + } + else + { + formatter.add("NA"); + } + + std::vector completionDataOneFracture = + RicExportFractureCompletionsImpl::generateCompdatValuesForWellPathSingleFracture( + wellPath, sourceCase, fracture, nullptr); + + double aggregatedTransmissibility = 0.0; + for (const auto& c : completionDataOneFracture) + { + aggregatedTransmissibility += c.transmissibility(); + } + + double fractureArea = 0.0; + + if (fracture->fractureTemplate()) + { + auto it = templateAreaMap.find(fracture->fractureTemplate()); + if (it != templateAreaMap.end()) + { + fractureArea = it->second; + } + else + { + std::vector nodeCoords; + std::vector triangleIndices; + + fracture->fractureTemplate()->fractureTriangleGeometry(&nodeCoords, &triangleIndices); + + for (size_t triangleIndex = 0; triangleIndex < triangleIndices.size(); triangleIndex += 3) + { + std::vector polygon; + polygon.push_back(cvf::Vec3d(nodeCoords[triangleIndices[triangleIndex + 0]])); + polygon.push_back(cvf::Vec3d(nodeCoords[triangleIndices[triangleIndex + 1]])); + polygon.push_back(cvf::Vec3d(nodeCoords[triangleIndices[triangleIndex + 2]])); + + auto areaVector = cvf::GeometryTools::polygonAreaNormal3D(polygon); + double polygonArea = areaVector.length(); + fractureArea += polygonArea; + } + templateAreaMap[fracture->fractureTemplate()] = fractureArea; + } + } + + formatter.add(aggregatedTransmissibility); // Tr + formatter.add(completionDataOneFracture.size()); // #con + formatter.add(1.0); // Fcd + formatter.add(fractureArea); // Area + formatter.add(3.0); // KfWf + formatter.add(4.0); // Kf + formatter.add(5.0); // wf + formatter.add(6.0); // Xf + formatter.add(7.0); // H + formatter.add(8.0); // Km + + formatter.rowCompleted(); + } + + formatter.tableCompleted(); + + return tableText; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.h b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.h index 42edbb52aa..d1db01d815 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.h @@ -20,8 +20,6 @@ #include "cafCmdFeature.h" -#include - class RimWellPath; class RimWellPathFracture; class RimEclipseCase; @@ -36,7 +34,7 @@ class RifEclipseDataTableFormatter; class RicWellPathFractureTextReportFeatureImpl { public: - QString wellPathFractureReport(const RimEclipseCase* sourceCase, const std::vector& wellPaths); + QString wellPathFractureReport(RimEclipseCase* sourceCase, const std::vector& wellPaths); static std::vector wellPathsWithFractures(); @@ -48,5 +46,8 @@ private: QString createFractureText(const std::vector& fractureTemplates) const; QString createFractureInstancesText(const std::vector& fractureTemplates) const; + QString createFractureCompletionSummaryText(RimEclipseCase* sourceCase, + const std::vector& wellPathFractures) const; + void configureFormatter(RifEclipseDataTableFormatter* formatter) const; };