diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index 1543f50c80..9fcff02517 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -458,16 +458,6 @@ if (RESINSIGHT_PRIVATE_INSTALL) set_target_properties (ResInsight PROPERTIES INSTALL_RPATH "${RESINSIGHT_INSTALL_RPATH}") - # Find Qt libraries and sym links - file (GLOB RESINSIGHT_FILES - ${QT_LIBRARY_DIR}/libQtCore.so* - ${QT_LIBRARY_DIR}/libQtGui.so* - ${QT_LIBRARY_DIR}/libQtOpenGL.so* - ${QT_LIBRARY_DIR}/libQtNetwork.so* - ${QT_LIBRARY_DIR}/libQtScript.so* - ${QT_LIBRARY_DIR}/libQtScriptTools.so* - ) - endif() if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp index d160f97dcd..b465c9bedc 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp @@ -36,6 +36,7 @@ #include "RimLegendConfig.h" #include "RivFemPickSourceInfo.h" +#include "RivPartPriority.h" #include "RivResultToTextureMapper.h" #include "RivScalarMapperUtils.h" #include "RivSourceInfo.h" @@ -159,8 +160,7 @@ void RivFemPartPartMgr::generatePartGeometry(RivFemPartGeometryGenerator& geoBui caf::MeshEffectGenerator effGen(prefs->defaultGridLineColors()); eff = effGen.generateCachedEffect(); - // Set priority to make sure fault lines are rendered first - part->setPriority(10); + part->setPriority(RivPartPriority::PartType::MeshLines); part->setEnableMask(meshSurfaceBit); part->setEffect(eff.p()); @@ -196,7 +196,7 @@ void RivFemPartPartMgr::updateCellColor(cvf::Color4f color) if (color.a() < 1.0f) { // Set priority to make sure this transparent geometry are rendered last - if (m_surfaceFaces.notNull()) m_surfaceFaces->setPriority(100); + if (m_surfaceFaces.notNull()) m_surfaceFaces->setPriority(RivPartPriority::PartType::Transparent); } m_opacityLevel = color.a(); diff --git a/ApplicationCode/ModelVisualization/CMakeLists_files.cmake b/ApplicationCode/ModelVisualization/CMakeLists_files.cmake index b4de330654..9cb91845a0 100644 --- a/ApplicationCode/ModelVisualization/CMakeLists_files.cmake +++ b/ApplicationCode/ModelVisualization/CMakeLists_files.cmake @@ -35,6 +35,7 @@ ${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.h ${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h ${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.h ${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.h +${CEE_CURRENT_LIST_DIR}RivPartPriority.h ${CEE_CURRENT_LIST_DIR}RivWellFracturePartMgr.h ) diff --git a/ApplicationCode/ModelVisualization/GridBox/RivGridBoxGenerator.cpp b/ApplicationCode/ModelVisualization/GridBox/RivGridBoxGenerator.cpp index 00b58c061c..9fe3defa9e 100644 --- a/ApplicationCode/ModelVisualization/GridBox/RivGridBoxGenerator.cpp +++ b/ApplicationCode/ModelVisualization/GridBox/RivGridBoxGenerator.cpp @@ -22,6 +22,7 @@ #include "RiaApplication.h" +#include "RivPartPriority.h" #include "RivPatchGenerator.h" #include "cafEffectGenerator.h" @@ -620,7 +621,7 @@ void RivGridBoxGenerator::createLegend(EdgeType edge, cvf::Collection depth->enableDepthTest(false); eff->setRenderState(depth.p()); - part->setPriority(1500); + part->setPriority(RivPartPriority::PartType::Text); part->setEffect(eff.p()); parts->push_back(part.p()); diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp index 7d3c8cc9bf..a2e18da07e 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp @@ -37,6 +37,7 @@ #include "RivIntersectionBoxSourceInfo.h" #include "RivIntersectionPartMgr.h" +#include "RivPartPriority.h" #include "RivResultToTextureMapper.h" #include "RivScalarMapperUtils.h" #include "RivTernaryScalarMapper.h" @@ -213,10 +214,6 @@ void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex) } -const int priCrossSectionGeo = 1; -const int priNncGeo = 2; -const int priMesh = 3; - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -246,7 +243,7 @@ void RivIntersectionBoxPartMgr::generatePartGeometry() part->updateBoundingBox(); part->setEnableMask(faultBit); - part->setPriority(priCrossSectionGeo); + part->setPriority(RivPartPriority::PartType::Intersection); m_intersectionBoxFaces = part; } @@ -268,7 +265,7 @@ void RivIntersectionBoxPartMgr::generatePartGeometry() part->updateBoundingBox(); part->setEnableMask(meshFaultBit); - part->setPriority(priMesh); + part->setPriority(RivPartPriority::PartType::MeshLines); m_intersectionBoxGridLines = part; } diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp index d537d982c6..9d78e729f6 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp @@ -39,6 +39,7 @@ #include "RivHexGridIntersectionTools.h" #include "RivIntersectionGeometryGenerator.h" #include "RivIntersectionSourceInfo.h" +#include "RivPartPriority.h" #include "RivResultToTextureMapper.h" #include "RivScalarMapperUtils.h" #include "RivTernaryScalarMapper.h" @@ -382,10 +383,6 @@ void RivIntersectionPartMgr::calculateEclipseTextureCoordinates(cvf::Vec2fArray* } } -const int priCrossSectionGeo = 1; -const int priNncGeo = 2; -const int priMesh = 3; - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -416,7 +413,7 @@ void RivIntersectionPartMgr::generatePartGeometry() part->updateBoundingBox(); part->setEnableMask(faultBit); - part->setPriority(priCrossSectionGeo); + part->setPriority(RivPartPriority::PartType::Intersection); m_crossSectionFaces = part; } @@ -438,7 +435,7 @@ void RivIntersectionPartMgr::generatePartGeometry() part->updateBoundingBox(); part->setEnableMask(meshFaultBit); - part->setPriority(priMesh); + part->setPriority(RivPartPriority::PartType::MeshLines); m_crossSectionGridLines = part; } @@ -478,7 +475,7 @@ void RivIntersectionPartMgr::createPolyLineParts(bool useBufferObjects) part->setDrawable(polylineGeo.p()); part->updateBoundingBox(); - part->setPriority(10000); + part->setPriority(RivPartPriority::PartType::Highlight); // Always show this part, also when mesh is turned off //part->setEnableMask(meshFaultBit); @@ -510,7 +507,7 @@ void RivIntersectionPartMgr::createPolyLineParts(bool useBufferObjects) part->setDrawable(polylinePointsGeo.p()); part->updateBoundingBox(); - part->setPriority(10000); + part->setPriority(RivPartPriority::PartType::Highlight); // Always show this part, also when mesh is turned off //part->setEnableMask(meshFaultBit); @@ -558,7 +555,7 @@ void RivIntersectionPartMgr::createExtrusionDirParts(bool useBufferObjects) part->setDrawable(polylineGeo.p()); part->updateBoundingBox(); - part->setPriority(10000); + part->setPriority(RivPartPriority::PartType::Highlight); // Always show this part, also when mesh is turned off //part->setEnableMask(meshFaultBit); @@ -590,7 +587,7 @@ void RivIntersectionPartMgr::createExtrusionDirParts(bool useBufferObjects) part->setDrawable(polylinePointsGeo.p()); part->updateBoundingBox(); - part->setPriority(10000); + part->setPriority(RivPartPriority::PartType::Highlight); // Always show this part, also when mesh is turned off //part->setEnableMask(meshFaultBit); diff --git a/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp b/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp index e6d3088633..725fb8f63c 100644 --- a/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp @@ -33,6 +33,7 @@ #include "RimLegendConfig.h" #include "RimTernaryLegendConfig.h" +#include "RivPartPriority.h" #include "RivResultToTextureMapper.h" #include "RivScalarMapperUtils.h" #include "RivSourceInfo.h" @@ -206,10 +207,6 @@ void RivFaultPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimEclipse } } -const int priFaultGeo = 1; -const int priNncGeo = 2; -const int priMesh = 3; - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -240,7 +237,7 @@ void RivFaultPartMgr::generatePartGeometry() part->updateBoundingBox(); part->setEnableMask(faultBit); - part->setPriority(priFaultGeo); + part->setPriority(RivPartPriority::PartType::Fault); m_nativeFaultFaces = part; } @@ -262,7 +259,7 @@ void RivFaultPartMgr::generatePartGeometry() part->updateBoundingBox(); part->setEnableMask(meshFaultBit); - part->setPriority(priMesh); + part->setPriority(RivPartPriority::PartType::MeshLines); m_nativeFaultGridLines = part; } @@ -292,7 +289,7 @@ void RivFaultPartMgr::generatePartGeometry() part->updateBoundingBox(); part->setEnableMask(faultBit); - part->setPriority(priFaultGeo); + part->setPriority(RivPartPriority::PartType::Fault); m_oppositeFaultFaces = part; } @@ -314,7 +311,7 @@ void RivFaultPartMgr::generatePartGeometry() part->updateBoundingBox(); part->setEnableMask(meshFaultBit); - part->setPriority(priMesh); + part->setPriority(RivPartPriority::PartType::MeshLines); m_oppositeFaultGridLines = part; } @@ -342,7 +339,7 @@ void RivFaultPartMgr::generatePartGeometry() part->updateBoundingBox(); part->setEnableMask(faultBit); - part->setPriority(priNncGeo); + part->setPriority(RivPartPriority::PartType::Nnc); m_NNCFaces = part; } @@ -397,18 +394,18 @@ void RivFaultPartMgr::updatePartEffect() if (m_opacityLevel < 1.0f) { // Set priority to make sure this transparent geometry are rendered last - if (m_nativeFaultFaces.notNull()) m_nativeFaultFaces->setPriority(100 + priFaultGeo); - if (m_oppositeFaultFaces.notNull()) m_oppositeFaultFaces->setPriority(100 + priFaultGeo); - if (m_NNCFaces.notNull()) m_NNCFaces->setPriority(100 + priNncGeo); + if (m_nativeFaultFaces.notNull()) m_nativeFaultFaces->setPriority(RivPartPriority::PartType::TransparentFault); + if (m_oppositeFaultFaces.notNull()) m_oppositeFaultFaces->setPriority(RivPartPriority::PartType::TransparentFault); + if (m_NNCFaces.notNull()) m_NNCFaces->setPriority(RivPartPriority::PartType::TransparentNnc); if (m_nativeFaultGridLines.notNull()) { - m_nativeFaultGridLines->setPriority(100 + priMesh); + m_nativeFaultGridLines->setPriority(RivPartPriority::PartType::TransparentMeshLines); } if (m_oppositeFaultGridLines.notNull()) { - m_oppositeFaultGridLines->setPriority(100 + priMesh); + m_oppositeFaultGridLines->setPriority(RivPartPriority::PartType::TransparentMeshLines); } } } @@ -481,7 +478,7 @@ void RivFaultPartMgr::createLabelWithAnchorLine(const cvf::Part* part) cvf::ref eff = new cvf::Effect; part->setEffect(eff.p()); - part->setPriority(1000); + part->setPriority(RivPartPriority::PartType::Text); m_faultLabelPart = part; } diff --git a/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp b/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp index 10a630be8c..35b210f56e 100644 --- a/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp @@ -37,6 +37,7 @@ #include "RimTernaryLegendConfig.h" #include "RivCellEdgeEffectGenerator.h" +#include "RivPartPriority.h" #include "RivResultToTextureMapper.h" #include "RivScalarMapperUtils.h" #include "RivSourceInfo.h" @@ -164,8 +165,7 @@ void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoB caf::MeshEffectGenerator effGen(prefs->defaultGridLineColors()); eff = effGen.generateCachedEffect(); - // Set priority to make sure fault lines are rendered first - part->setPriority(10); + part->setPriority(RivPartPriority::PartType::MeshLines); part->setEnableMask(meshSurfaceBit); part->setEffect(eff.p()); @@ -200,8 +200,7 @@ void RivGridPartMgr::updateCellColor(cvf::Color4f color) if (color.a() < 1.0f) { - // Set priority to make sure this transparent geometry are rendered last - if (m_surfaceFaces.notNull()) m_surfaceFaces->setPriority(100); + if (m_surfaceFaces.notNull()) m_surfaceFaces->setPriority(RivPartPriority::PartType::Transparent); } m_opacityLevel = color.a(); diff --git a/ApplicationCode/ModelVisualization/RivPartPriority.h b/ApplicationCode/ModelVisualization/RivPartPriority.h new file mode 100644 index 0000000000..9d72e7fa56 --- /dev/null +++ b/ApplicationCode/ModelVisualization/RivPartPriority.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2017- Statoil ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + + + +//-------------------------------------------------------------------------------------------------- +/// Class used to manage part render priorities +/// +/// The render priority determines the order in which parts get rendered. Parts with lower priorities +/// get rendered first. The default priority is 0. +/// +/// See also cvf::Part::setPriority() +/// +//-------------------------------------------------------------------------------------------------- +class RivPartPriority +{ +public: + enum PartType + { + BaseLevel, + Fault, + Nnc, + Intersection, + CrossSectionNnc, + MeshLines, + Transparent, + TransparentFault, + TransparentNnc, + TransparentMeshLines, + Highlight, + Text + }; + +}; diff --git a/ApplicationCode/ModelVisualization/RivSingleCellPartGenerator.cpp b/ApplicationCode/ModelVisualization/RivSingleCellPartGenerator.cpp index 6001c9f4d0..5819cbfa89 100644 --- a/ApplicationCode/ModelVisualization/RivSingleCellPartGenerator.cpp +++ b/ApplicationCode/ModelVisualization/RivSingleCellPartGenerator.cpp @@ -27,6 +27,7 @@ #include "RimGeoMechCase.h" #include "RivFemPartGeometryGenerator.h" +#include "RivPartPriority.h" #include "cafEffectGenerator.h" #include "cvfPart.h" @@ -75,7 +76,7 @@ cvf::ref RivSingleCellPartGenerator::createPart(const cvf::Color3f co part->setEffect(eff.p()); - part->setPriority(10000); + part->setPriority(RivPartPriority::PartType::Highlight); return part; } diff --git a/ApplicationCode/ModelVisualization/RivWellHeadPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellHeadPartMgr.cpp index 458a2f53d8..45cb14665a 100644 --- a/ApplicationCode/ModelVisualization/RivWellHeadPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellHeadPartMgr.cpp @@ -35,6 +35,7 @@ #include "RimEclipseWellCollection.h" #include "RivPipeGeometryGenerator.h" +#include "RivPartPriority.h" #include "RivSimWellPipeSourceInfo.h" #include "cafEffectGenerator.h" @@ -142,11 +143,18 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex) whEndPos.z() = activeCellsBoundingBoxMax.z(); } + double pipeRadius = m_rimReservoirView->wellCollection()->pipeScaleFactor() * m_rimWell->pipeScaleFactor() * characteristicCellSize; + if (wellResultFrame.m_isOpen) + { + // Use slightly larger well head arrow when well is open + pipeRadius *= 1.1; + } + // Upper part of simulation well pipe is defined to use branch index 0 cvf::ref sourceInfo = new RivSimWellPipeSourceInfo(m_rimWell, 0); cvf::Vec3d arrowPosition = whEndPos; - arrowPosition.z() += 2.0; + arrowPosition.z() += pipeRadius; // Well head pipe geometry { @@ -160,12 +168,6 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex) pipeGeomGenerator->setPipeColor(well->wellPipeColor()); pipeGeomGenerator->setCrossSectionVertexCount(m_rimReservoirView->wellCollection()->pipeCrossSectionVertexCount()); - double pipeRadius = m_rimReservoirView->wellCollection()->pipeScaleFactor() * m_rimWell->pipeScaleFactor() * characteristicCellSize; - if (wellResultFrame.m_isOpen) - { - // Use slightly larger well head arrow when well is open - pipeRadius *= 1.1; - } pipeGeomGenerator->setRadius(pipeRadius); @@ -343,7 +345,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex) cvf::ref eff = new cvf::Effect; part->setEffect(eff.p()); - part->setPriority(11); + part->setPriority(RivPartPriority::PartType::Text); part->setSourceInfo(sourceInfo.p()); m_wellHeadLabelPart = part; diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp index 485363a0d5..6f24d6a3f8 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -30,6 +30,7 @@ #include "RimWellPathFractureCollection.h" #include "RivPipeGeometryGenerator.h" +#include "RivPartPriority.h" #include "RivWellFracturePartMgr.h" #include "RivWellPathPartMgr.h" #include "RivWellPathSourceInfo.h" @@ -239,7 +240,7 @@ void RivWellPathPartMgr::buildWellPathParts(cvf::Vec3d displayModelOffset, doubl cvf::ref eff = new cvf::Effect; part->setEffect(eff.p()); - part->setPriority(1000); + part->setPriority(RivPartPriority::Text); m_wellLabelPart = part; } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp b/ApplicationCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp index 673989e841..a54e0edc67 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp @@ -312,7 +312,11 @@ cvf::Color3f RimFlowDiagSolution::tracerColor(QString tracerName) } } - return cvf::Color3f::DARK_GRAY; + if (tracerName == RIG_FLOW_TOTAL_NAME) return cvf::Color3f::LIGHT_GRAY; + if (tracerName == RIG_RESERVOIR_TRACER_NAME) return cvf::Color3f::LIGHT_GRAY; + if (tracerName == RIG_TINY_TRACER_GROUP_NAME) return cvf::Color3f::DARK_GRAY; + + return cvf::Color3f::LIGHT_GRAY; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 63a54a99ba..c4075dcf55 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -20,7 +20,10 @@ #include "RiaApplication.h" +#include "RigAccWellFlowCalculator.h" #include "RigEclipseCaseData.h" +#include "RigFlowDiagResultAddress.h" +#include "RigFlowDiagResults.h" #include "RigSimulationWellCenterLineCalculator.h" #include "RigSimulationWellCoordsAndMD.h" #include "RigSingleWellResultsData.h" @@ -32,26 +35,36 @@ #include "RimEclipseWell.h" #include "RimEclipseWellCollection.h" #include "RimFlowDiagSolution.h" +#include "RimProject.h" #include "RimTotalWellAllocationPlot.h" #include "RimWellFlowRateCurve.h" #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" +#include "RimWellAllocationPlotLegend.h" #include "RiuMainPlotWindow.h" #include "RiuWellAllocationPlot.h" -#include "RigAccWellFlowCalculator.h" -#include "RimProject.h" #include "RiuWellLogTrack.h" -#include "RimWellAllocationPlotLegend.h" CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot"); - - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- +namespace caf +{ + +template<> +void AppEnum::setUp() +{ + addItem(RimWellAllocationPlot::ACCUMULATED, "ACCUMULATED", "Well Flow"); + addItem(RimWellAllocationPlot::INFLOW, "INFLOW", "In Flow"); + setDefault(RimWellAllocationPlot::ACCUMULATED); + +} +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -70,6 +83,8 @@ RimWellAllocationPlot::RimWellAllocationPlot() CAF_PDM_InitField(&m_timeStep, "PlotTimeStep", 0, "Time Step", "", "", ""); CAF_PDM_InitField(&m_wellName, "WellName", QString("None"), "Well", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_flowDiagSolution, "FlowDiagSolution", "Flow Diag Solution", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_flowType, "FlowType", "Flow Type", "", "", ""); + CAF_PDM_InitField(&m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", ""); CAF_PDM_InitField(&m_smallContributionsThreshold, "SmallContributionsThreshold", 0.005, "Threshold", "", "", ""); @@ -183,20 +198,20 @@ void RimWellAllocationPlot::updateFromWell() pipeBranchesCLCoords, pipeBranchesCellIds); - std::map* > tracerCellFractionValues = findRelevantTracerCellFractions(wellResults); + std::map* > tracerFractionCellValues = findRelevantTracerCellFractions(wellResults); std::unique_ptr< RigAccWellFlowCalculator > wfCalculator; double smallContributionThreshold = 0.0; if (m_groupSmallContributions()) smallContributionThreshold = m_smallContributionsThreshold; - if ( tracerCellFractionValues.size() ) + if ( tracerFractionCellValues.size() ) { bool isProducer = wellResults->wellProductionType(m_timeStep) == RigWellResultFrame::PRODUCER ; RigEclCellIndexCalculator cellIdxCalc(m_case->reservoirData()->mainGrid(), m_case->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)); wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords, pipeBranchesCellIds, - tracerCellFractionValues, + tracerFractionCellValues, cellIdxCalc, smallContributionThreshold, isProducer)); @@ -231,24 +246,26 @@ void RimWellAllocationPlot::updateFromWell() accumulatedWellFlowPlot()->addTrack(plotTrack); - std::vector connNumbers; - { - const std::vector& connNumbersSize_t = wfCalculator->connectionNumbersFromTop(brIdx); - for ( size_t conNumb : connNumbersSize_t ) connNumbers.push_back(static_cast(conNumb)); - } + std::vector connNumbers = wfCalculator->connectionNumbersFromTop(brIdx); if ( m_flowDiagSolution ) { std::vector tracerNames = wfCalculator->tracerNames(); for (const QString& tracerName: tracerNames) { - const std::vector& accFlow = wfCalculator->accumulatedTracerFlowPrConnection(tracerName, brIdx); + const std::vector& accFlow = m_flowType == ACCUMULATED ? + wfCalculator->accumulatedTracerFlowPrConnection(tracerName, brIdx): + wfCalculator->tracerFlowPrConnection(tracerName, brIdx); + addStackedCurve(tracerName, connNumbers, accFlow, plotTrack); } } else { - const std::vector& accFlow = wfCalculator->accumulatedTotalFlowPrConnection(brIdx); + const std::vector& accFlow = m_flowType == ACCUMULATED ? + wfCalculator->accumulatedFlowPrConnection(brIdx): + wfCalculator->flowPrConnection(brIdx); + addStackedCurve("Total", connNumbers, accFlow, plotTrack); } @@ -601,7 +618,8 @@ void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedF || changedField == &m_timeStep || changedField == &m_flowDiagSolution || changedField == &m_groupSmallContributions - || changedField == &m_smallContributionsThreshold ) + || changedField == &m_smallContributionsThreshold + || changedField == &m_flowType ) { loadDataAndUpdate(); } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h index 5ea657520d..a6d0636b59 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h @@ -49,6 +49,8 @@ namespace caf { class RimWellAllocationPlot : public RimViewWindow { CAF_PDM_HEADER_INIT; +public: + enum FlowType { ACCUMULATED, INFLOW}; public: RimWellAllocationPlot(); @@ -115,6 +117,7 @@ private: caf::PdmPtrField m_flowDiagSolution; caf::PdmField m_groupSmallContributions; caf::PdmField m_smallContributionsThreshold; + caf::PdmField > m_flowType; QPointer m_wellAllocationPlotWidget; diff --git a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp index 12e8aa384a..59da784404 100644 --- a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp +++ b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp @@ -19,27 +19,48 @@ #include "RigAccWellFlowCalculator.h" #include "RigSingleWellResultsData.h" +#include "RigMainGrid.h" +#include "RigActiveCellInfo.h" +#include "RigFlowDiagResults.h" -#define RIG_FLOW_TOTAL_NAME "Total" -#define RIG_RESERVOIR_TRACER_NAME "Reservoir" -#define RIG_TINY_TRACER_GROUP_NAME "Other" +//================================================================================================== +/// +/// +//================================================================================================== //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vector >& pipeBranchesCLCoords, - const std::vector< std::vector >& pipeBranchesCellIds, - const std::map* >& tracerCellFractionValues, +size_t RigEclCellIndexCalculator::resultCellIndex(size_t gridIndex, size_t gridCellIndex) const +{ + const RigGridBase* grid = m_mainGrid->gridByIndex(gridIndex); + size_t reservoirCellIndex = grid->reservoirCellIndex(gridCellIndex); + + return m_activeCellInfo->cellResultIndex(reservoirCellIndex); +} + + +//================================================================================================== +/// +/// +//================================================================================================== + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vector >& pipeBranchesCLCoords, + const std::vector< std::vector >& pipeBranchesCellIds, + const std::map* >& tracerCellFractionValues, const RigEclCellIndexCalculator cellIndexCalculator, double smallContribThreshold, - bool isProducer): - m_pipeBranchesCLCoords(pipeBranchesCLCoords), - m_pipeBranchesCellIds(pipeBranchesCellIds), - m_tracerCellFractionValues(&tracerCellFractionValues), - m_cellIndexCalculator(cellIndexCalculator), - m_smallContributionsThreshold(smallContribThreshold) + bool isProducer) + : m_pipeBranchesCLCoords(pipeBranchesCLCoords), + m_pipeBranchesCellIds(pipeBranchesCellIds), + m_tracerCellFractionValues(&tracerCellFractionValues), + m_cellIndexCalculator(cellIndexCalculator), + m_smallContributionsThreshold(smallContribThreshold) { - m_accConnectionFlowPrBranch.resize(m_pipeBranchesCellIds.size()); + m_connectionFlowPrBranch.resize(m_pipeBranchesCellIds.size()); if (isWellFlowConsistent(isProducer)) { @@ -66,15 +87,15 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto /// //-------------------------------------------------------------------------------------------------- RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vector >& pipeBranchesCLCoords, - const std::vector< std::vector >& pipeBranchesCellIds, - double smallContribThreshold ): - m_pipeBranchesCLCoords(pipeBranchesCLCoords), - m_pipeBranchesCellIds(pipeBranchesCellIds), - m_tracerCellFractionValues(nullptr), - m_cellIndexCalculator(RigEclCellIndexCalculator(nullptr, nullptr)), - m_smallContributionsThreshold(smallContribThreshold) + const std::vector< std::vector >& pipeBranchesCellIds, + double smallContribThreshold) + : m_pipeBranchesCLCoords(pipeBranchesCLCoords), + m_pipeBranchesCellIds(pipeBranchesCellIds), + m_tracerCellFractionValues(nullptr), + m_cellIndexCalculator(RigEclCellIndexCalculator(nullptr, nullptr)), + m_smallContributionsThreshold(smallContribThreshold) { - m_accConnectionFlowPrBranch.resize(m_pipeBranchesCellIds.size()); + m_connectionFlowPrBranch.resize(m_pipeBranchesCellIds.size()); m_tracerNames.push_back(RIG_FLOW_TOTAL_NAME); @@ -84,35 +105,67 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator(const std::vector< std::vecto //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const std::vector& RigAccWellFlowCalculator::accumulatedTotalFlowPrConnection(size_t branchIdx) +const std::vector& RigAccWellFlowCalculator::accumulatedFlowPrConnection(size_t branchIdx) const { - CVF_ASSERT(m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer.find(RIG_FLOW_TOTAL_NAME) != m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer.end()); - - return m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer[RIG_FLOW_TOTAL_NAME]; + return accumulatedTracerFlowPrConnection(RIG_FLOW_TOTAL_NAME, branchIdx); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const std::vector& RigAccWellFlowCalculator::accumulatedTracerFlowPrConnection(const QString& tracerName, size_t branchIdx) +const std::vector& RigAccWellFlowCalculator::accumulatedTracerFlowPrConnection(const QString& tracerName, size_t branchIdx) const { - CVF_ASSERT(m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer.find(tracerName) != m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer.end()); - - return m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer[tracerName]; + auto flowPrTracerIt = m_connectionFlowPrBranch[branchIdx].accFlowPrTracer.find(tracerName); + if ( flowPrTracerIt != m_connectionFlowPrBranch[branchIdx].accFlowPrTracer.end()) + { + return flowPrTracerIt->second; + } + else + { + CVF_ASSERT(false); + static std::vector dummy; + return dummy; + } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const std::vector& RigAccWellFlowCalculator::connectionNumbersFromTop(size_t branchIdx) const +const std::vector& RigAccWellFlowCalculator::flowPrConnection(size_t branchIdx) const { - return m_accConnectionFlowPrBranch[branchIdx].connectionNumbersFromTop; + return tracerFlowPrConnection(RIG_FLOW_TOTAL_NAME, branchIdx); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector > RigAccWellFlowCalculator::totalWellFlowPrTracer() +const std::vector& RigAccWellFlowCalculator::tracerFlowPrConnection(const QString& tracerName, size_t branchIdx) const +{ + auto flowPrTracerIt = m_connectionFlowPrBranch[branchIdx].flowPrTracer.find(tracerName); + if ( flowPrTracerIt != m_connectionFlowPrBranch[branchIdx].flowPrTracer.end()) + { + return flowPrTracerIt->second; + } + else + { + CVF_ASSERT(false); + static std::vector dummy; + return dummy; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector& RigAccWellFlowCalculator::connectionNumbersFromTop(size_t branchIdx) const +{ + return m_connectionFlowPrBranch[branchIdx].depthValuesFromTop; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector > RigAccWellFlowCalculator::totalWellFlowPrTracer() const { std::vector tracerNames = this->tracerNames(); std::vector > tracerWithValues; @@ -130,7 +183,7 @@ std::vector > RigAccWellFlowCalculator::totalWellFlow //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector > RigAccWellFlowCalculator::totalTracerFractions() +std::vector > RigAccWellFlowCalculator::totalTracerFractions() const { std::vector > totalFlows = totalWellFlowPrTracer(); @@ -150,7 +203,10 @@ std::vector > RigAccWellFlowCalculator::totalTracerFr return totalFlows; } -bool RigAccWellFlowCalculator::isWellFlowConsistent( bool isProducer) +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigAccWellFlowCalculator::isWellFlowConsistent( bool isProducer) const { bool isConsistent = true; for (const std::vector & branch : m_pipeBranchesCellIds) @@ -181,11 +237,7 @@ void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection(size_t branc size_t prevConnIndx = -1; int clSegIdx = static_cast(branchCells.size()) - 1; - std::map >& accConnFlowFractionsPrTracer = m_accConnectionFlowPrBranch[branchIdx].accConnFlowFractionsPrTracer; - std::vector& connNumbersFromTop = m_accConnectionFlowPrBranch[branchIdx].connectionNumbersFromTop; - - std::vector accFlow; - accFlow.resize(m_tracerNames.size(), 0.0); + std::vector accFlowPrTracer(m_tracerNames.size(), 0.0); while ( clSegIdx >= 0 ) { @@ -201,6 +253,7 @@ void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection(size_t branc } // Accumulate the connection-cell's fraction flows + std::vector flowPrTracer(m_tracerNames.size(), 0.0); if ( m_tracerCellFractionValues ) { @@ -215,19 +268,25 @@ void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection(size_t branc double cellTracerFraction = (*tracerFractionIt.second)[resCellIndex]; if (cellTracerFraction != HUGE_VAL && cellTracerFraction == cellTracerFraction) { - accFlow[tracerIdx] += cellTracerFraction * branchCells[clSegIdx].flowRate(); + double tracerFlow = cellTracerFraction * branchCells[clSegIdx].flowRate(); + flowPrTracer[tracerIdx] = tracerFlow; + accFlowPrTracer[tracerIdx] += tracerFlow; + totalTracerFractionInCell += cellTracerFraction; } tracerIdx++; } - double reservoirFraction = 1.0 - totalTracerFractionInCell; - accFlow[tracerIdx] += reservoirFraction * branchCells[clSegIdx].flowRate(); + double reservoirFraction = 1.0 - totalTracerFractionInCell; + double reservoirTracerFlow = reservoirFraction * branchCells[clSegIdx].flowRate(); + flowPrTracer[tracerIdx] = reservoirTracerFlow; + accFlowPrTracer[tracerIdx] += reservoirTracerFlow; } } else { - accFlow[0] += branchCells[clSegIdx].flowRate(); + accFlowPrTracer[0] += branchCells[clSegIdx].flowRate(); + flowPrTracer[0] = branchCells[clSegIdx].flowRate(); } // Add the total accumulated (fraction) flows from any branches connected to this cell @@ -237,39 +296,47 @@ void RigAccWellFlowCalculator::calculateAccumulatedFlowPrConnection(size_t branc std::vector downstreamBranches = findDownstreamBranchIdxs(branchCells[clSegIdx]); for ( size_t dsBidx : downstreamBranches ) { - if ( dsBidx != branchIdx && m_accConnectionFlowPrBranch[dsBidx].connectionNumbersFromTop.size() == 0 ) // Not this branch or already calculated + if ( dsBidx != branchIdx && m_connectionFlowPrBranch[dsBidx].depthValuesFromTop.size() == 0 ) // Not this branch or already calculated { calculateAccumulatedFlowPrConnection(dsBidx, connNumFromTop); - BranchResult& accConnFlowFractionsDsBranch = m_accConnectionFlowPrBranch[dsBidx]; + BranchFlow& accConnFlowFractionsDsBranch = m_connectionFlowPrBranch[dsBidx]; size_t tracerIdx = 0; for ( const auto & tracerName: m_tracerNames ) { - accFlow[tracerIdx] += accConnFlowFractionsDsBranch.accConnFlowFractionsPrTracer[tracerName].back(); + accFlowPrTracer[tracerIdx] += accConnFlowFractionsDsBranch.accFlowPrTracer[tracerName].back(); tracerIdx++; } } } // Push back the accumulated result into the storage - - size_t tracerIdx = 0; - for ( const auto & tracerName: m_tracerNames ) { - accConnFlowFractionsPrTracer[tracerName].push_back(accFlow[tracerIdx]); - tracerIdx++; + std::vector& connNumbersFromTop = m_connectionFlowPrBranch[branchIdx].depthValuesFromTop; + std::map >& branchAccFlowPrTracer = m_connectionFlowPrBranch[branchIdx].accFlowPrTracer; + std::map >& branchFlowPrTracer = m_connectionFlowPrBranch[branchIdx].flowPrTracer; + + size_t tracerIdx = 0; + for ( const auto & tracerName: m_tracerNames ) + { + branchAccFlowPrTracer[tracerName].push_back(accFlowPrTracer[tracerIdx]); + branchFlowPrTracer[tracerName].push_back(flowPrTracer[tracerIdx]); + tracerIdx++; + } + + + connNumbersFromTop.push_back(connNumFromTop); } - connNumbersFromTop.push_back(connNumFromTop); - --clSegIdx; + } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigAccWellFlowCalculator::wrpToConnectionIndexFromBottom(const std::vector &branchCells) +std::vector RigAccWellFlowCalculator::wrpToConnectionIndexFromBottom(const std::vector &branchCells) const { std::vector resPointToConnectionIndexFromBottom; resPointToConnectionIndexFromBottom.resize(branchCells.size(), -1); @@ -311,7 +378,7 @@ std::vector RigAccWellFlowCalculator::wrpToConnectionIndexFromBottom(con //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RigAccWellFlowCalculator::connectionIndexFromTop(const std::vector& resPointToConnectionIndexFromBottom, size_t clSegIdx) +size_t RigAccWellFlowCalculator::connectionIndexFromTop(const std::vector& resPointToConnectionIndexFromBottom, size_t clSegIdx) { return resPointToConnectionIndexFromBottom.front() - resPointToConnectionIndexFromBottom[clSegIdx]; } @@ -319,7 +386,7 @@ size_t RigAccWellFlowCalculator::connectionIndexFromTop(const std::vector RigAccWellFlowCalculator::findDownstreamBranchIdxs(const RigWellResultPoint& connectionPoint) +std::vector RigAccWellFlowCalculator::findDownstreamBranchIdxs(const RigWellResultPoint& connectionPoint) const { std::vector downStreamBranchIdxs; @@ -346,8 +413,11 @@ void RigAccWellFlowCalculator::sortTracers() for (const QString& tracerName: m_tracerNames) { const std::vector& mainBranchAccFlow = accumulatedTracerFlowPrConnection(tracerName, 0); + double totalFlow = 0.0; + if (mainBranchAccFlow.size()) totalFlow = - abs( mainBranchAccFlow.back() ); // Based on size in reverse order (biggest to least) + sortedTracers.insert({totalFlow, tracerName}); } @@ -359,61 +429,83 @@ void RigAccWellFlowCalculator::sortTracers() } //-------------------------------------------------------------------------------------------------- -/// +/// Concatenate small tracers into an "Other" group //-------------------------------------------------------------------------------------------------- void RigAccWellFlowCalculator::groupSmallContributions() { - // Concatenate small tracers into an "Other" group - if ( m_smallContributionsThreshold > 0.0 ) + if ( ! (m_smallContributionsThreshold > 0.0) ) return; + + // Find the tracers we need to group + + std::vector tracersToGroup; { std::vector > totalTracerFractions = this->totalTracerFractions(); if ( totalTracerFractions.size() < 5 ) return; // No grouping for few legend items - std::vector tracersToGroup; for ( const auto& tracerPair : totalTracerFractions ) { if ( abs(tracerPair.second) <= m_smallContributionsThreshold ) tracersToGroup.push_back(tracerPair.first); } - - if ( tracersToGroup.size() < 2 ) return; // Must at least group two ... - - for ( BranchResult& brRes : m_accConnectionFlowPrBranch ) - { - std::vector groupedConnectionValues(brRes.connectionNumbersFromTop.size(), 0.0); - for ( const QString& tracername:tracersToGroup ) - { - auto it = brRes.accConnFlowFractionsPrTracer.find(tracername); - if ( it != brRes.accConnFlowFractionsPrTracer.end() ) - { - const std::vector& tracerVals = it->second; - for ( size_t cIdx = 0; cIdx < groupedConnectionValues.size(); ++cIdx ) - { - groupedConnectionValues[cIdx] += tracerVals[cIdx]; - } - } - brRes.accConnFlowFractionsPrTracer.erase(it); - } - - brRes.accConnFlowFractionsPrTracer[RIG_TINY_TRACER_GROUP_NAME] = groupedConnectionValues; - } - - std::vector filteredTracernames; - for ( const QString& tracerName: m_tracerNames ) - { - bool isDeleted = false; - for ( const QString& deletedTracerName: tracersToGroup ) - { - if ( tracerName == deletedTracerName ) { isDeleted = true; break; } - } - - if ( !isDeleted ) filteredTracernames.push_back(tracerName); - } - - m_tracerNames.swap(filteredTracernames); - m_tracerNames.push_back(RIG_TINY_TRACER_GROUP_NAME); } + + if ( tracersToGroup.size() < 2 ) return; // Must at least group two ... + + // Concatenate the values for each branch, erasing the tracers being grouped, replaced with the concatenated values + + for ( BranchFlow& brRes : m_connectionFlowPrBranch ) + { + groupSmallTracers( brRes.accFlowPrTracer, tracersToGroup); + groupSmallTracers( brRes.flowPrTracer, tracersToGroup); + } + + // Remove the grouped tracer names from the tracerName list, and replace with the "Others" name + + std::vector filteredTracernames; + for ( const QString& tracerName: m_tracerNames ) + { + bool isDeleted = false; + for ( const QString& deletedTracerName: tracersToGroup ) + { + if ( tracerName == deletedTracerName ) { isDeleted = true; break; } + } + + if ( !isDeleted ) filteredTracernames.push_back(tracerName); + } + + m_tracerNames.swap(filteredTracernames); + m_tracerNames.push_back(RIG_TINY_TRACER_GROUP_NAME); + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigAccWellFlowCalculator::groupSmallTracers(std::map> &branchFlowSet, std::vector tracersToGroup) +{ + if ( branchFlowSet.empty() ) return; + + size_t depthCount = branchFlowSet.begin()->second.size(); + std::vector groupedAccFlowValues(depthCount, 0.0); + + for ( const QString& tracername:tracersToGroup ) + { + auto it = branchFlowSet.find(tracername); + + if ( it != branchFlowSet.end() ) + { + const std::vector& tracerVals = it->second; + for ( size_t cIdx = 0; cIdx < groupedAccFlowValues.size(); ++cIdx ) + { + groupedAccFlowValues[cIdx] += tracerVals[cIdx]; + } + } + + branchFlowSet.erase(it); + } + + branchFlowSet[RIG_TINY_TRACER_GROUP_NAME] = groupedAccFlowValues; } diff --git a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.h b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.h index 024c6c9ea4..1b185fdca3 100644 --- a/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.h +++ b/ApplicationCode/ReservoirDataModel/RigAccWellFlowCalculator.h @@ -17,16 +17,15 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once - +#include +#include //================================================================================================== /// /// //================================================================================================== -#include "RigActiveCellInfo.h" -#include "RigMainGrid.h" -#include "RigFlowDiagResults.h" -struct RigWellResultPoint; +class RigMainGrid; +class RigActiveCellInfo; class RigEclCellIndexCalculator { @@ -35,13 +34,7 @@ public: : m_mainGrid(mainGrid), m_activeCellInfo(activeCellInfo) {} - size_t resultCellIndex(size_t gridIndex, size_t gridCellIndex) const - { - const RigGridBase* grid = m_mainGrid->gridByIndex(gridIndex); - size_t reservoirCellIndex = grid->reservoirCellIndex(gridCellIndex); - - return m_activeCellInfo->cellResultIndex(reservoirCellIndex); - } + size_t resultCellIndex(size_t gridIndex, size_t gridCellIndex) const; private: const RigMainGrid* m_mainGrid; @@ -53,6 +46,12 @@ private: /// //================================================================================================== +#include +#include "cvfBase.h" +#include "cvfVector3.h" + +struct RigWellResultPoint; + class RigAccWellFlowCalculator { @@ -68,39 +67,51 @@ public: const std::vector< std::vector >& pipeBranchesCellIds, double smallContribThreshold); - const std::vector& accumulatedTotalFlowPrConnection( size_t branchIdx);// const; - const std::vector& accumulatedTracerFlowPrConnection(const QString& tracerName, size_t branchIdx);// const; - const std::vector& connectionNumbersFromTop(size_t branchIdx) const; - const std::vector& tracerNames() const { return m_tracerNames;} + const std::vector& accumulatedFlowPrConnection( size_t branchIdx) const; + const std::vector& accumulatedTracerFlowPrConnection(const QString& tracerName, size_t branchIdx) const; + const std::vector& flowPrConnection( size_t branchIdx) const; + const std::vector& tracerFlowPrConnection(const QString& tracerName, size_t branchIdx) const; + const std::vector& connectionNumbersFromTop(size_t branchIdx) const; + const std::vector& tracerNames() const { return m_tracerNames;} + + std::vector > totalTracerFractions() const; - std::vector > totalTracerFractions(); private: - bool isWellFlowConsistent(bool isProducer); - void calculateAccumulatedFlowPrConnection( size_t branchIdx, size_t startConnectionNumberFromTop); - std::vector wrpToConnectionIndexFromBottom( const std::vector &branchCells); - static size_t connectionIndexFromTop( const std::vector& resPointToConnectionIndexFromBottom, size_t clSegIdx); - std::vector findDownstreamBranchIdxs( const RigWellResultPoint& connectionPoint); + void calculateAccumulatedFlowPrConnection( size_t branchIdx, size_t startConnectionNumberFromTop); + void calculateFlowPrPseudoLength(size_t branchIdx, double startPseudoLengthFromTop); + void sortTracers(); + void groupSmallContributions(); - std::vector > totalWellFlowPrTracer() ; - void sortTracers(); + void groupSmallTracers(std::map> &branchFlowSet, + std::vector tracersToGroup); - void groupSmallContributions(); + bool isWellFlowConsistent(bool isProducer) const; + std::vector wrpToConnectionIndexFromBottom( const std::vector &branchCells) const; + static size_t connectionIndexFromTop( const std::vector& resPointToConnectionIndexFromBottom, size_t clSegIdx) ; + std::vector findDownstreamBranchIdxs( const RigWellResultPoint& connectionPoint) const; - const std::vector< std::vector >& m_pipeBranchesCLCoords; - const std::vector< std::vector >& m_pipeBranchesCellIds; - const std::map* >* m_tracerCellFractionValues; - RigEclCellIndexCalculator m_cellIndexCalculator; - std::vector m_tracerNames; - double m_smallContributionsThreshold; + std::vector > totalWellFlowPrTracer() const; - struct BranchResult + + const std::vector< std::vector >& m_pipeBranchesCLCoords; + const std::vector< std::vector >& m_pipeBranchesCellIds; + const std::map* >* m_tracerCellFractionValues; + RigEclCellIndexCalculator m_cellIndexCalculator; + std::vector m_tracerNames; + double m_smallContributionsThreshold; + + struct BranchFlow { - std::vector connectionNumbersFromTop; - std::map > accConnFlowFractionsPrTracer; - }; + std::vector depthValuesFromTop; + std::map > accFlowPrTracer; + std::map > flowPrTracer; + }; + + std::vector< BranchFlow > m_connectionFlowPrBranch; + std::vector< BranchFlow > m_pseudoLengthFlowPrBranch; + std::vector< BranchFlow > m_tvdFlowPrBranch; - std::vector< BranchResult > m_accConnectionFlowPrBranch; }; diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.h b/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.h index d0c4df3f6f..00194712b2 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.h +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.h @@ -25,6 +25,10 @@ #define RIG_FLD_MAX_FRACTION_TRACER_RESNAME "MaxFractionTracer" #define RIG_FLD_COMMUNICATION_RESNAME "Communication" +#define RIG_FLOW_TOTAL_NAME "Total" +#define RIG_RESERVOIR_TRACER_NAME "Reservoir" +#define RIG_TINY_TRACER_GROUP_NAME "Other" + class RigFlowDiagResultAddress { diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.cpp b/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.cpp index d7c501c513..a19963ebd8 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.cpp @@ -26,6 +26,8 @@ #include "RimEclipseCase.h" #include "RimEclipseResultCase.h" #include "RimFlowDiagSolution.h" +#include "RigFlowDiagResultFrames.h" +#include "RigStatisticsDataCache.h" //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.h b/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.h index 87ed2426de..57081b6915 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.h +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.h @@ -26,11 +26,11 @@ #include #include -#include "RigFlowDiagResultFrames.h" -#include "RigStatisticsDataCache.h" #include "cafPdmPointer.h" #include "RimFlowDiagSolution.h" +class RigFlowDiagResultFrames; +class RigStatisticsDataCache; class RigFlowDiagSolverInterface; class RigActiveCellInfo;