diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp index 15617b8863..374c13779b 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp @@ -18,6 +18,8 @@ #include "RicExportFractureCompletionsImpl.h" +#include "RicWellPathFractureReportItem.h" + #include "RiaLogging.h" #include "RimEclipseCase.h" @@ -34,15 +36,19 @@ #include "RimWellPathFracture.h" #include "RimWellPathFractureCollection.h" +#include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseToStimPlanCalculator.h" #include "RigEclipseToStimPlanCellTransmissibilityCalculator.h" #include "RigFractureCell.h" #include "RigFractureGrid.h" #include "RigFractureTransmissibilityEquations.h" #include "RigMainGrid.h" +#include "RigResultAccessorFactory.h" #include "RigSimWellData.h" #include "RigSimulationWellCoordsAndMD.h" #include "RigTransmissibilityCondenser.h" +#include "RigTransmissibilityEquations.h" #include "RigWellPath.h" #include "RigWellPathStimplanIntersector.h" @@ -51,10 +57,11 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector - RicExportFractureCompletionsImpl::generateCompdatValuesForWellPath(RimWellPath* wellPath, - RimEclipseCase* caseToApply, - QTextStream* outputStreamForIntermediateResultsText) +std::vector RicExportFractureCompletionsImpl::generateCompdatValuesForWellPath( + RimWellPath* wellPath, + RimEclipseCase* caseToApply, + std::vector* fractureDataForReport, + QTextStream* outputStreamForIntermediateResultsText) { std::vector fracturesAlongWellPath; @@ -73,6 +80,7 @@ std::vector wellPath->completions()->wellNameForExport(), wellPath->wellPathGeometry(), fracturesAlongWellPath, + fractureDataForReport, outputStreamForIntermediateResultsText); } @@ -92,6 +100,7 @@ std::vector RicExportFractureCompletionsImpl::generateCompdat wellPath->completions()->wellNameForExport(), wellPath->wellPathGeometry(), fracturesAlongWellPath, + nullptr, outputStreamForIntermediateResultsText); } @@ -119,7 +128,7 @@ std::vector } std::vector branchCompletions = generateCompdatValues( - eclipseCase, well->name(), branches[branchIndex], fractures, outputStreamForIntermediateResultsText); + eclipseCase, well->name(), branches[branchIndex], fractures, nullptr, outputStreamForIntermediateResultsText); completionData.insert(completionData.end(), branchCompletions.begin(), branchCompletions.end()); } @@ -131,10 +140,11 @@ std::vector /// //-------------------------------------------------------------------------------------------------- std::vector - RicExportFractureCompletionsImpl::generateCompdatValues(RimEclipseCase* caseToApply, - const QString& wellPathName, - const RigWellPath* wellPathGeometry, - const std::vector& fractures, + RicExportFractureCompletionsImpl::generateCompdatValues(RimEclipseCase* caseToApply, + const QString& wellPathName, + const RigWellPath* wellPathGeometry, + const std::vector& fractures, + std::vector* fractureDataReportItems, QTextStream* outputStreamForIntermediateResultsText) { std::vector fractureCompletions; @@ -180,57 +190,17 @@ std::vector } } - using CellIdxSpace = RigTransmissibilityCondenser::CellAddress; RigTransmissibilityCondenser transCondenser; ////// // Calculate Matrix To Fracture Trans + RigEclipseToStimPlanCalculator eclToFractureCalc(caseToApply, + fracture->transformMatrix(), + fracture->fractureTemplate()->skinFactor(), + cDarcyInCorrectUnit, + *fractureGrid); - const std::vector& fractureCells = fractureGrid->fractureCells(); - - for (const RigFractureCell& fractureCell : fractureCells) - { - if (!fractureCell.hasNonZeroConductivity()) continue; - - RigEclipseToStimPlanCellTransmissibilityCalculator eclToFractureTransCalc(caseToApply, - fracture->transformMatrix(), - fracture->fractureTemplate()->skinFactor(), - cDarcyInCorrectUnit, - fractureCell); - - const std::vector& fractureCellContributingEclipseCells = - eclToFractureTransCalc.globalIndiciesToContributingEclipseCells(); - const std::vector& fractureCellContributingEclipseCellTransmissibilities = - eclToFractureTransCalc.contributingEclipseCellTransmissibilities(); - - size_t stimPlanCellIndex = fractureGrid->getGlobalIndexFromIJ(fractureCell.getI(), fractureCell.getJ()); - - auto truncatedFractureCellIndices = - RimFractureContainmentTools::fracturedCellsTruncatedByFaults(caseToApply, fracture); - - for (size_t i = 0; i < fractureCellContributingEclipseCells.size(); i++) - { - if (fracture->isEclipseCellWithinContainment(caseToApply->eclipseCaseData()->mainGrid(), - truncatedFractureCellIndices, - fractureCellContributingEclipseCells[i])) - { - if (useFiniteConductivityInFracture) - { - transCondenser.addNeighborTransmissibility( - {true, CellIdxSpace::ECLIPSE, fractureCellContributingEclipseCells[i]}, - {false, CellIdxSpace::STIMPLAN, stimPlanCellIndex}, - fractureCellContributingEclipseCellTransmissibilities[i]); - } - else - { - transCondenser.addNeighborTransmissibility( - {true, CellIdxSpace::ECLIPSE, fractureCellContributingEclipseCells[i]}, - {true, CellIdxSpace::WELL, 1}, - fractureCellContributingEclipseCellTransmissibilities[i]); - } - } - } - } + eclToFractureCalc.appendDataToTransmissibilityCondenser(fracture, useFiniteConductivityInFracture, &transCondenser); ////// // Calculate Transmissibility in the fracture: From one StimPlan Cell to the other @@ -415,6 +385,108 @@ std::vector } } + if (fractureDataReportItems) + { + QString fractureTemplateName; + if (fracture->fractureTemplate()) + { + fractureTemplateName = fracture->fractureTemplate()->name(); + } + RicWellPathFractureReportItem reportItem(wellPathName, fracture->name(), fractureTemplateName); + + double transmissibility = 0.0; + double fcd = -1.0; + double area = 0.0; + + for (const auto& c : allCompletionsForOneFracture) + { + transmissibility += c.transmissibility(); + } + + auto areaPerEclipseCell = eclToFractureCalc.areaPerEclipseCell(); + for (const auto& areaPerEclipseCell : areaPerEclipseCell) + { + area += areaPerEclipseCell.second; + } + + reportItem.setData(transmissibility, allCompletionsForOneFracture.size(), fcd, area); + + double conductivity = 0.0; + double width = 0.0; + double height = 0.0; + double halfLength = 0.0; + { + auto* ellipseTemplate = dynamic_cast(fracTemplate); + if (ellipseTemplate) + { + conductivity = ellipseTemplate->conductivity(); + width = ellipseTemplate->width(); + height = ellipseTemplate->height(); + halfLength = ellipseTemplate->halfLength(); + } + + auto* stimplanTemplate = dynamic_cast(fracTemplate); + if (stimplanTemplate) + { + conductivity = stimplanTemplate->areaWeightedConductivity(); + width = stimplanTemplate->areaWeightedWidth(); + + height = stimplanTemplate->longestYRange(); + + double xLength = 0.0; + if (height > 1e-9) + { + xLength = area / height; + } + + // Compute half length defined as (total area / (H/2) ) + halfLength = xLength / 2.0; + } + } + reportItem.setWidthAndConductivity(width, conductivity); + reportItem.setHeightAndHalfLength(height, halfLength); + + double areaWeightedEclipseTransmissibility = 0.0; + + if (caseToApply && caseToApply->eclipseCaseData()) + { + RigCaseCellResultsData* gridCellResults = caseToApply->results(RiaDefines::MATRIX_MODEL); + if (gridCellResults) + { + gridCellResults->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "TRANX"); + gridCellResults->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "TRANY"); + gridCellResults->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "TRANZ"); + } + + cvf::ref tranxAccessObject = RigResultAccessorFactory::createFromUiResultName( + caseToApply->eclipseCaseData(), 0, RiaDefines::MATRIX_MODEL, 0, "TRANX"); + + cvf::ref tranyAccessObject = RigResultAccessorFactory::createFromUiResultName( + caseToApply->eclipseCaseData(), 0, RiaDefines::MATRIX_MODEL, 0, "TRANY"); + + cvf::ref tranzAccessObject = RigResultAccessorFactory::createFromUiResultName( + caseToApply->eclipseCaseData(), 0, RiaDefines::MATRIX_MODEL, 0, "TRANZ"); + + if (tranxAccessObject.notNull() && tranyAccessObject.notNull() && tranzAccessObject.notNull()) + { + for (const auto& areaPerEclipseCell : areaPerEclipseCell) + { + double tranx = tranxAccessObject->cellScalarGlobIdx(areaPerEclipseCell.first); + double trany = tranyAccessObject->cellScalarGlobIdx(areaPerEclipseCell.first); + double tranz = tranzAccessObject->cellScalarGlobIdx(areaPerEclipseCell.first); + + double transmissibilityForCell = RigTransmissibilityEquations::totalConnectionFactor(tranx, trany, tranz); + + areaWeightedEclipseTransmissibility += transmissibilityForCell * areaPerEclipseCell.second / area; + } + } + } + + reportItem.setAreaWeightedTransmissibility(areaWeightedEclipseTransmissibility); + + fractureDataReportItems->push_back(reportItem); + } + std::copy( allCompletionsForOneFracture.begin(), allCompletionsForOneFracture.end(), std::back_inserter(fractureCompletions)); @@ -424,18 +496,18 @@ std::vector << "\n" << "\n" << "\n----------- All Transmissibilities " << fracture->name() << " -------------------- \n\n"; - + (*outputStreamForIntermediateResultsText) << QString::fromStdString(transCondenser.neighborTransDebugOutput(mainGrid, fractureGrid)); - + (*outputStreamForIntermediateResultsText) << "\n" << "\n" << "\n----------- Condensed Results " << fracture->name() << " -------------------- \n\n"; - + (*outputStreamForIntermediateResultsText) << QString::fromStdString(transCondenser.condensedTransDebugOutput(mainGrid, fractureGrid)); - + (*outputStreamForIntermediateResultsText) << "\n"; } } diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.h b/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.h index a3137464ab..e8bd3751fe 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.h @@ -29,6 +29,7 @@ class RigWellPath; class RimEclipseCase; class RimFracture; class RimSimWellInView; +class RicWellPathFractureReportItem; //-------------------------------------------------------------------------------------------------- /// @@ -36,9 +37,11 @@ class RimSimWellInView; class RicExportFractureCompletionsImpl { public: - static std::vector generateCompdatValuesForWellPath(RimWellPath* wellPath, - RimEclipseCase* caseToApply, - QTextStream* outputStreamForIntermediateResultsText); + static std::vector + generateCompdatValuesForWellPath(RimWellPath* wellPath, + RimEclipseCase* caseToApply, + std::vector* fractureDataForReport, + QTextStream* outputStreamForIntermediateResultsText); static std::vector generateCompdatValuesForWellPathSingleFracture(RimWellPath* wellPath, @@ -51,9 +54,10 @@ public: QTextStream* outputStreamForIntermediateResultsText); private: - static std::vector generateCompdatValues(RimEclipseCase* caseToApply, - const QString& wellPathName, - const RigWellPath* wellPathGeometry, - const std::vector& fractures, + static std::vector generateCompdatValues(RimEclipseCase* caseToApply, + const QString& wellPathName, + const RigWellPath* wellPathGeometry, + const std::vector& fractures, + std::vector* fractureDataForReport, QTextStream* outputStreamForIntermediateResultsText); }; diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp index 5feb8b6a1c..a5c393bb97 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp @@ -26,6 +26,7 @@ #include "RicExportFeatureImpl.h" #include "RicExportFractureCompletionsImpl.h" #include "RicFishbonesTransmissibilityCalculationFeatureImp.h" +#include "RicWellPathFractureReportItem.h" #include "RifEclipseDataTableFormatter.h" @@ -57,6 +58,7 @@ #include "cvfPlane.h" +#include "RicWellPathFractureTextReportFeatureImpl.h" #include "RigVirtualPerforationTransmissibilities.h" #include @@ -73,23 +75,23 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve return; } - std::vector usedWellPaths; for (RimWellPath* wellPath : wellPaths) { if (wellPath->unitSystem() == exportSettings.caseToApply->eclipseCaseData()->unitsType()) { - usedWellPaths.push_back(wellPath); + usedWellPaths.push_back(wellPath); } else { - int caseId = exportSettings.caseToApply->caseId(); + int caseId = exportSettings.caseToApply->caseId(); QString format = QString("Unit systems for well path \"%1\" must match unit system of chosen eclipse case \"%2\""); - QString errMsg = format.arg(wellPath->name()).arg(caseId); + QString errMsg = format.arg(wellPath->name()).arg(caseId); RiaLogging::error(errMsg); } } + std::vector fractureDataReportItems; // FractureTransmissibilityExportInformation std::unique_ptr fractureTransmissibilityExportInformationStream = nullptr; @@ -144,7 +146,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve { std::vector perforationCompletionData = generatePerforationsCompdatValues(wellPath, exportSettings); - + appendCompletionData(&completionsPerEclipseCellAllCompletionTypes, perforationCompletionData); appendCompletionData(&completionsPerEclipseCellPerforations, perforationCompletionData); } @@ -155,7 +157,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve std::vector fishbonesCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneCompdatValuesUsingAdjustedCellVolume( wellPath, exportSettings); - + appendCompletionData(&completionsPerEclipseCellAllCompletionTypes, fishbonesCompletionData); appendCompletionData(&completionsPerEclipseCellFishbones, fishbonesCompletionData); } @@ -165,8 +167,11 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve { std::vector fractureCompletionData = RicExportFractureCompletionsImpl::generateCompdatValuesForWellPath( - wellPath, exportSettings.caseToApply(), fractureTransmissibilityExportInformationStream.get()); - + wellPath, + exportSettings.caseToApply(), + &fractureDataReportItems, + fractureTransmissibilityExportInformationStream.get()); + appendCompletionData(&completionsPerEclipseCellAllCompletionTypes, fractureCompletionData); appendCompletionData(&completionsPerEclipseCellFracture, fractureCompletionData); } @@ -221,7 +226,12 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve if (exportSettings.fileSplit == RicExportCompletionDataSettingsUi::UNIFIED_FILE) { const QString fileName = QString("UnifiedCompletions_%1").arg(eclipseCaseName); - sortAndExportCompletionsToFile(exportSettings.folder, fileName, completions, exportSettings.compdatExport); + sortAndExportCompletionsToFile(exportSettings.caseToApply, + exportSettings.folder, + fileName, + completions, + fractureDataReportItems, + exportSettings.compdatExport); progress.incrementProgress(); } else if (exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL) @@ -240,7 +250,12 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve if (wellCompletions.empty()) continue; QString fileName = QString("%1_unifiedCompletions_%2").arg(wellPath->name()).arg(eclipseCaseName); - sortAndExportCompletionsToFile(exportSettings.folder, fileName, wellCompletions, exportSettings.compdatExport); + sortAndExportCompletionsToFile(exportSettings.caseToApply, + exportSettings.folder, + fileName, + wellCompletions, + fractureDataReportItems, + exportSettings.compdatExport); progress.incrementProgress(); } } @@ -274,8 +289,12 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve if (completionType == RigCompletionData::PERFORATION) completionTypeText = "Perforation"; QString fileName = QString("%1_%2_%3").arg(wellPath->name()).arg(completionTypeText).arg(eclipseCaseName); - sortAndExportCompletionsToFile( - exportSettings.folder, fileName, wellCompletions, exportSettings.compdatExport); + sortAndExportCompletionsToFile(exportSettings.caseToApply, + exportSettings.folder, + fileName, + wellCompletions, + fractureDataReportItems, + exportSettings.compdatExport); } progress.incrementProgress(); @@ -301,7 +320,12 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions(const std::ve if (wellCompletions.empty()) continue; QString fileName = QString("%1_Fractures_%2").arg(simWell->name()).arg(eclipseCaseName); - sortAndExportCompletionsToFile(exportSettings.folder, fileName, wellCompletions, exportSettings.compdatExport); + sortAndExportCompletionsToFile(exportSettings.caseToApply, + exportSettings.folder, + fileName, + wellCompletions, + fractureDataReportItems, + exportSettings.compdatExport); progress.incrementProgress(); } @@ -336,7 +360,7 @@ std::vector { std::vector completionData = - RicExportFractureCompletionsImpl::generateCompdatValuesForWellPath(wellPath, eclipseCase, nullptr); + RicExportFractureCompletionsImpl::generateCompdatValuesForWellPath(wellPath, eclipseCase, nullptr, nullptr); std::copy(completionData.begin(), completionData.end(), std::back_inserter(completionsPerEclipseCell)); } @@ -490,9 +514,11 @@ RigCompletionData /// //-------------------------------------------------------------------------------------------------- void RicWellPathExportCompletionDataFeatureImpl::sortAndExportCompletionsToFile( + RimEclipseCase* eclipseCase, const QString& folderName, const QString& fileName, std::vector& completions, + const std::vector& wellPathFractureReportItems, RicExportCompletionDataSettingsUi::CompdatExportType exportType) { // Sort completions based on grid they belong to @@ -527,13 +553,15 @@ void RicWellPathExportCompletionDataFeatureImpl::sortAndExportCompletionsToFile( std::map> completionsForGrid; completionsForGrid.insert(std::pair>("", completionsForMainGrid)); - exportCompdatAndWpimultTables(folderName, fileName, completionsForGrid, exportType); + exportCompdatAndWpimultTables( + eclipseCase, folderName, fileName, completionsForGrid, wellPathFractureReportItems, exportType); } if (!completionsForSubGrids.empty()) { QString lgrFileName = fileName + "_LGR"; - exportCompdatAndWpimultTables(folderName, lgrFileName, completionsForSubGrids, exportType); + exportCompdatAndWpimultTables( + eclipseCase, folderName, lgrFileName, completionsForSubGrids, wellPathFractureReportItems, exportType); } } @@ -541,9 +569,11 @@ void RicWellPathExportCompletionDataFeatureImpl::sortAndExportCompletionsToFile( /// //-------------------------------------------------------------------------------------------------- void RicWellPathExportCompletionDataFeatureImpl::exportCompdatAndWpimultTables( + RimEclipseCase* sourceCase, const QString& folderName, const QString& fileName, const std::map>& completionsPerGrid, + const std::vector& wellPathFractureReportItems, RicExportCompletionDataSettingsUi::CompdatExportType exportType) { if (completionsPerGrid.empty()) return; @@ -566,7 +596,37 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompdatAndWpimultTables( return; } - QTextStream stream(&exportFile); + QTextStream stream(&exportFile); + + if (!wellPathFractureReportItems.empty()) + { + std::vector wellPathsToReport; + { + std::set wellPathsSet; + + auto allWellPaths = RicWellPathFractureTextReportFeatureImpl::wellPathsWithFractures(); + for (const auto& wellPath : allWellPaths) + { + for (const auto& reportItem : wellPathFractureReportItems) + { + if (reportItem.wellPathName() == wellPath->name()) + { + wellPathsSet.insert(wellPath); + } + } + } + + std::copy(wellPathsSet.begin(), wellPathsSet.end(), std::back_inserter(wellPathsToReport)); + + RicWellPathFractureTextReportFeatureImpl reportGenerator; + + QString summaryText = + reportGenerator.wellPathFractureReport(sourceCase, wellPathsToReport, wellPathFractureReportItems); + + stream << summaryText; + } + } + RifEclipseDataTableFormatter formatter(stream); formatter.setColumnSpacing(3); diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h index 0836e4c073..20a00a7785 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h @@ -21,6 +21,7 @@ #include "RigCompletionData.h" #include "RicExportCompletionDataSettingsUi.h" +#include "RicWellPathFractureReportItem.h" #include "cvfBase.h" #include "cvfVector3.h" @@ -163,14 +164,18 @@ private: static RigCompletionData combineEclipseCellCompletions(const std::vector& completions, const RicExportCompletionDataSettingsUi& settings); - static void sortAndExportCompletionsToFile(const QString& exportFolder, + static void sortAndExportCompletionsToFile(RimEclipseCase* eclipseCase, + const QString& exportFolder, const QString& fileName, std::vector& completions, + const std::vector& wellPathFractureReportItems, RicExportCompletionDataSettingsUi::CompdatExportType exportType); - static void exportCompdatAndWpimultTables(const QString& folderName, + static void exportCompdatAndWpimultTables(RimEclipseCase* sourceCase, + const QString& folderName, const QString& fileName, const std::map>& completionsPerGrid, + const std::vector& wellPathFractureReportItems, RicExportCompletionDataSettingsUi::CompdatExportType exportType); static void exportCompdatTableUsingFormatter(RifEclipseDataTableFormatter& formatter, diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeature.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeature.cpp index 686f516d58..d00c1f0820 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeature.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeature.cpp @@ -32,6 +32,7 @@ #include "RiuTextDialog.h" #include +#include "RicWellPathFractureReportItem.h" CAF_CMD_SOURCE_INIT(RicWellPathFractureTextReportFeature, "RicWellPathFractureTextReportFeature"); @@ -68,7 +69,8 @@ void RicWellPathFractureTextReportFeature::onActionTriggered(bool isChecked) RicWellPathFractureTextReportFeatureImpl impl; - QString reportText = impl.wellPathFractureReport(eclipseCase, wellPaths); + std::vector wellPathFractureReportItems; + QString reportText = impl.wellPathFractureReport(eclipseCase, wellPaths, wellPathFractureReportItems); RiuTextDialog* textDialog = new RiuTextDialog(nullptr); textDialog->resize(QSize(1000, 1000)); diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.cpp index b901223f5f..f55f1dcca0 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.cpp @@ -21,6 +21,7 @@ #include "RiaApplication.h" #include "RicExportFractureCompletionsImpl.h" +#include "RicWellPathFractureReportItem.h" #include "RifEclipseDataTableFormatter.h" @@ -30,6 +31,7 @@ #include "RimEllipseFractureTemplate.h" #include "RimFileWellPath.h" #include "RimFractureContainment.h" +#include "RimFractureTemplate.h" #include "RimFractureTemplateCollection.h" #include "RimOilField.h" #include "RimProject.h" @@ -40,8 +42,6 @@ #include "RimWellPathFracture.h" #include "RimWellPathFractureCollection.h" -#include "cvfGeometryTools.h" - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -69,14 +69,11 @@ RifEclipseOutputTableColumn floatNumberColumn(const QString& text) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RicWellPathFractureTextReportFeatureImpl::wellPathFractureReport(RimEclipseCase* sourceCase, - const std::vector& wellPaths) +QString RicWellPathFractureTextReportFeatureImpl::wellPathFractureReport( + RimEclipseCase* sourceCase, + const std::vector& wellPaths, + const std::vector& wellPathFractureReportItems) { - if (!sourceCase || wellPaths.empty()) - { - return ""; - } - QString lineStart = "--"; QString text; @@ -164,7 +161,7 @@ QString RicWellPathFractureTextReportFeatureImpl::wellPathFractureReport(RimEcli } { - QString tableText = createFractureCompletionSummaryText(sourceCase, wellPathFractures); + QString tableText = createFractureCompletionSummaryText(wellPathFractureReportItems); textStream << tableText; textStream << lineStart << "\n"; } @@ -569,8 +566,7 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureInstancesText( /// //-------------------------------------------------------------------------------------------------- QString RicWellPathFractureTextReportFeatureImpl::createFractureCompletionSummaryText( - RimEclipseCase* sourceCase, - const std::vector& wellPathFractures) const + const std::vector& wellPathFractureReportItems) const { QString tableText; @@ -606,7 +602,7 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureCompletionSummar formatter.add("[]"); // Fcd formatter.add("[m2]"); // Area formatter.add("[mDm]"); // KfWf - formatter.add("[Md]"); // Kf + formatter.add("[mD]"); // Kf formatter.add("[m]"); // wf formatter.add("[m]"); // Xf formatter.add("[m]"); // H @@ -619,80 +615,27 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureCompletionSummar // Cache the fracture template area, as this is a heavy operation std::map templateAreaMap; - for (auto& fracture : wellPathFractures) + for (const auto& reportItem : wellPathFractureReportItems) { - QString wellName; + QString wellPathName, fractureName, fractureTemplateName; + reportItem.getNames(wellPathName, fractureName, fractureTemplateName); - RimWellPath* wellPath = nullptr; - fracture->firstAncestorOrThisOfType(wellPath); - if (wellPath) - { - wellName = wellPath->name(); - } + formatter.add(wellPathName); + formatter.add(fractureName); + formatter.add(fractureTemplateName); - formatter.add(wellName); - formatter.add(fracture->name()); + formatter.add(reportItem.transmissibility()); + formatter.add(reportItem.connectionCount()); + formatter.add(reportItem.fcd()); + formatter.add(reportItem.area()); - if (fracture->fractureTemplate()) - { - formatter.add(fracture->fractureTemplate()->name()); - } - else - { - formatter.add("NA"); - } + formatter.add(reportItem.kfwf()); // KfWf + formatter.add(reportItem.kf()); // Kf + formatter.add(reportItem.wf()); // wf - 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.add(reportItem.xf()); // Xf + formatter.add(reportItem.h()); // H + formatter.add(reportItem.km()); // Km formatter.rowCompleted(); } diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.h b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.h index d1db01d815..6e0bceb0a2 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathFractureTextReportFeatureImpl.h @@ -27,6 +27,7 @@ class RimFractureTemplate; class RimEllipseFractureTemplate; class RimStimPlanFractureTemplate; class RifEclipseDataTableFormatter; +class RicWellPathFractureReportItem; //================================================================================================== /// @@ -34,7 +35,9 @@ class RifEclipseDataTableFormatter; class RicWellPathFractureTextReportFeatureImpl { public: - QString wellPathFractureReport(RimEclipseCase* sourceCase, const std::vector& wellPaths); + QString wellPathFractureReport(RimEclipseCase* sourceCase, + const std::vector& wellPaths, + const std::vector& wellPathFractureReportItems); static std::vector wellPathsWithFractures(); @@ -46,8 +49,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; + QString + createFractureCompletionSummaryText(const std::vector& wellPathFractureReportItems) const; void configureFormatter(RifEclipseDataTableFormatter* formatter) const; }; diff --git a/ApplicationCode/ReservoirDataModel/Completions/RigCompletionData.h b/ApplicationCode/ReservoirDataModel/Completions/RigCompletionData.h index de8c255c75..838532e602 100644 --- a/ApplicationCode/ReservoirDataModel/Completions/RigCompletionData.h +++ b/ApplicationCode/ReservoirDataModel/Completions/RigCompletionData.h @@ -24,8 +24,6 @@ #include -class RimEclipseCase; - //================================================================================================== /// //==================================================================================================