diff --git a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp index d17e9a606e..5b2566f9c4 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp @@ -33,6 +33,7 @@ #include "RimFishbonesMultipleSubs.h" #include "RimWellPath.h" #include "RimWellPathCompletions.h" +#include "RigWellLogExtractor.h" //-------------------------------------------------------------------------------------------------- /// @@ -182,7 +183,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter(unitSystem); for (const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths()) { - std::vector intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), + std::vector intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), fishbonesPath->coordinates(), fishbonesPath->measuredDepths()); for (auto& cell : intersectedCells) @@ -191,7 +192,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor(); QString completionMetaData = fishbonesPath->name(); - WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.internalCellLengths, + WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.intersectionLengthsInCellCS, diameter / 2, skinFactor, isMainBore, @@ -219,7 +220,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(st std::pair< std::vector, std::vector > fishbonePerfWellPathCoords = wellPath->wellPathGeometry()->clippedPointSubset(wellPath->fishbonesCollection()->startMD(), wellPathEndMD); - std::vector intersectedCellsIntersectionInfo = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), + std::vector intersectedCellsIntersectionInfo = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), fishbonePerfWellPathCoords.first, fishbonePerfWellPathCoords.second); @@ -227,7 +228,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(st { double skinFactor = wellPath->fishbonesCollection()->mainBoreSkinFactor(); QString completionMetaData = wellPath->name() + " main bore"; - WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.internalCellLengths, + WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.intersectionLengthsInCellCS, holeDiameter / 2, skinFactor, isMainBore, diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp index 81cd170821..7e4ec9fb49 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp @@ -62,6 +62,7 @@ #include #include #include +#include "RigWellLogExtractor.h" CAF_CMD_SOURCE_INIT(RicWellPathExportCompletionDataFeature, "RicWellPathExportCompletionDataFeature"); @@ -718,7 +719,7 @@ std::vector RicWellPathExportCompletionDataFeature::generateP using namespace std; pair, vector > perforationPointsAndMD = wellPath->wellPathGeometry()->clippedPointSubset(interval->startMD(), interval->endMD()); - std::vector intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), + std::vector intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), perforationPointsAndMD.first, perforationPointsAndMD.second); for (auto& cell : intersectedCells) @@ -729,11 +730,11 @@ std::vector RicWellPathExportCompletionDataFeature::generateP size_t i, j, k; settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.globCellIndex, &i, &j, &k); RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k)); - CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.globCellIndex, cell.internalCellLengths); + CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.globCellIndex, cell.intersectionLengthsInCellCS); double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply, wellPath, - cell.internalCellLengths, + cell.intersectionLengthsInCellCS, interval->skinFactor(), interval->diameter(unitSystem) / 2, cell.globCellIndex, @@ -880,7 +881,7 @@ void RicWellPathExportCompletionDataFeature::assignLateralIntersections(const Ri lateralMDs.push_back(coordMD.second); } - std::vector intersections = RigWellPathIntersectionTools::findCellsIntersectedByPath(caseToApply->eclipseCaseData(), + std::vector intersections = RigWellPathIntersectionTools::findCellsIntersectedByPath(caseToApply->eclipseCaseData(), lateralCoords, lateralMDs); @@ -903,7 +904,7 @@ void RicWellPathExportCompletionDataFeature::assignLateralIntersections(const Ri intersection->globCellIndex, mdFromPreviousIntersection, tvdChangeFromPreviousIntersection, - intersection->internalCellLengths); + intersection->intersectionLengthsInCellCS); lateral.intersections.push_back(lateralIntersection); diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp index 78c3f07a85..06a0f8e269 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseWellLogExtractor.cpp @@ -134,53 +134,6 @@ void RigEclipseWellLogExtractor::curveData(const RigResultAccessor* resultAccess } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RigEclipseWellLogExtractor::cellIntersectionInfo() -{ - //std::vector intersectionInfos = this->intersectionInfo(); - // - //for (const auto& cellIntersectInfo: intersectionInfos) - //{ - // cvf::Vec3d internalCellLengths; - // internalCellLengths = RigWellPathIntersectionTools::calculateLengthInCell(m_caseData->mainGrid(), - // cellIntersectInfo.globCellIndex, - // cellIntersectInfo.startPoint, - // cellIntersectInfo.endPoint); - // - //} - - std::vector cellIntersectionInfos; - - if (m_intersections.size() > 1) - { - cellIntersectionInfos.reserve(m_intersections.size()-1); - - for (size_t cpIdx = 0; cpIdx < m_intersections.size()-1; ++cpIdx) - { - size_t cellIdx1 = m_intersectedCellsGlobIdx[cpIdx]; - size_t cellIdx2 = m_intersectedCellsGlobIdx[cpIdx+1]; - - if (cellIdx1 == cellIdx2) - { - cvf::Vec3d internalCellLengths; - internalCellLengths = RigWellPathIntersectionTools::calculateLengthInCell(m_caseData->mainGrid(), - cellIdx1, - m_intersections[cpIdx], - m_intersections[cpIdx+1]); - - cellIntersectionInfos.push_back(EclipseWellPathCellIntersectionInfo(cellIdx1, - m_intersections[cpIdx], - m_intersections[cpIdx+1], - internalCellLengths)); - } - } - } - - return cellIntersectionInfos; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -199,4 +152,14 @@ std::vector RigEclipseWellLogExtractor::findCloseCells(const cvf::Boundi return closeCells; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec3d RigEclipseWellLogExtractor::calculateLengthInCell(size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint) const +{ + std::array hexCorners; + m_caseData->mainGrid()->cellCornerVertices(cellIndex, hexCorners.data()); + + return RigWellPathIntersectionTools::calculateLengthInCell(hexCorners, startPoint, endPoint); +} diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseWellLogExtractor.h b/ApplicationCode/ReservoirDataModel/RigEclipseWellLogExtractor.h index fc65b1f9c9..20ed0e13c9 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseWellLogExtractor.h +++ b/ApplicationCode/ReservoirDataModel/RigEclipseWellLogExtractor.h @@ -25,8 +25,6 @@ class RigEclipseCaseData; class RigWellPath; class RigResultAccessor; -struct EclipseWellPathCellIntersectionInfo; - namespace cvf { class BoundingBox; } @@ -42,12 +40,14 @@ public: void curveData(const RigResultAccessor* resultAccessor, std::vector* values ); const RigEclipseCaseData* caseData() { return m_caseData.p();} - std::vector cellIntersectionInfo(); const std::vector& intersectedCellsGlobIdx(); protected: void calculateIntersection(); std::vector findCloseCells(const cvf::BoundingBox& bb); + virtual cvf::Vec3d calculateLengthInCell(size_t cellIndex, + const cvf::Vec3d& startPoint, + const cvf::Vec3d& endPoint) const override; cvf::cref m_caseData; }; diff --git a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp index ef9543ec84..9c451682f3 100644 --- a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp @@ -29,6 +29,7 @@ #include "RigWellLogExtractionTools.h" #include "RigWellPath.h" #include "cvfGeometryTools.h" +#include "RigWellPathIntersectionTools.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -190,4 +191,26 @@ std::vector RigGeoMechWellLogExtractor::findCloseCells(const cvf::Boundi return closeCells; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec3d RigGeoMechWellLogExtractor::calculateLengthInCell(size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint) const +{ + std::array hexCorners; + + const RigFemPart* femPart = m_caseData->femParts()->part(0); + const std::vector& nodeCoords = femPart->nodes().coordinates; + const int* cornerIndices = femPart->connectivities(cellIndex); + + hexCorners[0] = cvf::Vec3d(nodeCoords[cornerIndices[0]]); + hexCorners[1] = cvf::Vec3d(nodeCoords[cornerIndices[1]]); + hexCorners[2] = cvf::Vec3d(nodeCoords[cornerIndices[2]]); + hexCorners[3] = cvf::Vec3d(nodeCoords[cornerIndices[3]]); + hexCorners[4] = cvf::Vec3d(nodeCoords[cornerIndices[4]]); + hexCorners[5] = cvf::Vec3d(nodeCoords[cornerIndices[5]]); + hexCorners[6] = cvf::Vec3d(nodeCoords[cornerIndices[6]]); + hexCorners[7] = cvf::Vec3d(nodeCoords[cornerIndices[7]]); + + return RigWellPathIntersectionTools::calculateLengthInCell(hexCorners, startPoint, endPoint); +} diff --git a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.h b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.h index 3121913339..e93db4dcfa 100644 --- a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.h +++ b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.h @@ -51,6 +51,9 @@ public: private: void calculateIntersection(); std::vector findCloseCells(const cvf::BoundingBox& bb); + virtual cvf::Vec3d calculateLengthInCell(size_t cellIndex, + const cvf::Vec3d& startPoint, + const cvf::Vec3d& endPoint) const override; cvf::ref m_caseData; }; diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.cpp b/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.cpp index 14d345c3bd..4cf7cb02e0 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.cpp @@ -63,6 +63,8 @@ std::vector RigWellLogExtractor::intersectionInfo( cellInfo.intersectedCellFaceIn = m_intersectedCellFaces[i]; cellInfo.intersectedCellFaceOut = m_intersectedCellFaces[i+1]; + cellInfo.intersectionLengthsInCellCS = this->calculateLengthInCell(cellInfo.globCellIndex, cellInfo.startPoint, cellInfo.endPoint); + infoVector.push_back(cellInfo); } diff --git a/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.h b/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.h index 1a60da6b87..0adb457b03 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.h +++ b/ApplicationCode/ReservoirDataModel/RigWellLogExtractor.h @@ -42,6 +42,7 @@ struct WellPathCellIntersectionInfo cvf::Vec3d endPoint; double startMD; double endMD; + cvf::Vec3d intersectionLengthsInCellCS; cvf::StructGridInterface::FaceType intersectedCellFaceIn; cvf::StructGridInterface::FaceType intersectedCellFaceOut; @@ -76,9 +77,10 @@ protected: void populateReturnArrays(std::map &uniqueIntersections); void appendIntersectionToArrays(double measuredDepth, const HexIntersectionInfo& intersection); - std::vector m_measuredDepth; - std::vector m_trueVerticalDepth; - + virtual cvf::Vec3d calculateLengthInCell(size_t cellIndex, + const cvf::Vec3d& startPoint, + const cvf::Vec3d& endPoint) const = 0; + std::vector m_intersections; std::vector m_intersectedCellsGlobIdx; std::vector @@ -86,6 +88,10 @@ protected: cvf::cref m_wellPath; +private: + std::vector m_measuredDepth; + std::vector m_trueVerticalDepth; + std::string m_wellCaseErrorMsgName; }; diff --git a/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp b/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp index ded66c2f76..03f2b76f71 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.cpp @@ -34,11 +34,11 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigWellPathIntersectionTools::findCellsIntersectedByPath(const RigEclipseCaseData* caseData, +std::vector RigWellPathIntersectionTools::findCellsIntersectedByPath(const RigEclipseCaseData* caseData, const std::vector& pathCoords, const std::vector& pathMds) { - std::vector intersectionInfos; + std::vector intersectionInfos; const RigMainGrid* grid = caseData->mainGrid(); if (pathCoords.size() < 2) return intersectionInfos; @@ -51,7 +51,7 @@ std::vector RigWellPathIntersectionTools::f dummyWellPath.p(), caseData->ownerCase()->caseUserDescription().toStdString()); - return extractor->cellIntersectionInfo(); + return extractor->intersectionInfo(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.h b/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.h index 35d310a24c..bcbe426fb9 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.h +++ b/ApplicationCode/ReservoirDataModel/RigWellPathIntersectionTools.h @@ -29,27 +29,7 @@ class RigWellPath; class RigMainGrid; class RigEclipseCaseData; - -//================================================================================================== -/// -//================================================================================================== -struct EclipseWellPathCellIntersectionInfo -{ - EclipseWellPathCellIntersectionInfo(size_t globReservoirCellIndex, - cvf::Vec3d startPoint, - cvf::Vec3d endPoint, - cvf::Vec3d internalCellLengths) - : globCellIndex(globReservoirCellIndex), - startPoint(startPoint), - endPoint(endPoint), - internalCellLengths(internalCellLengths) - {} - - size_t globCellIndex; - cvf::Vec3d startPoint; - cvf::Vec3d endPoint; - cvf::Vec3d internalCellLengths; // intersectionLengthsInCellCS -}; +struct WellPathCellIntersectionInfo; //================================================================================================== /// @@ -57,7 +37,7 @@ struct EclipseWellPathCellIntersectionInfo class RigWellPathIntersectionTools { public: - static std::vector findCellsIntersectedByPath(const RigEclipseCaseData* caseData, + static std::vector findCellsIntersectedByPath(const RigEclipseCaseData* caseData, const std::vector& pathCoords, const std::vector& pathMds);