From 268fc4f368eeb90ae0767271efc388e5612fcb00 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 26 Nov 2018 09:40:58 +0100 Subject: [PATCH 1/8] #3753 : Non-Darcy perforations : Add calculation of effective height --- .../RigTransmissibilityEquations.cpp | 59 ++++++++++++++++--- .../RigTransmissibilityEquations.h | 21 +++++-- 2 files changed, 66 insertions(+), 14 deletions(-) diff --git a/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.cpp b/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.cpp index 9d2e225362..cb4de77e89 100644 --- a/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.cpp +++ b/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.cpp @@ -57,12 +57,12 @@ double RigTransmissibilityEquations::totalConnectionFactor(double transX, double //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigTransmissibilityEquations::totalPermeability(double cellPermX, - double cellPermY, - double cellPermZ, - const cvf::Vec3d& internalCellLengths, - double lateralNtg, - double ntg) +double RigTransmissibilityEquations::totalKh(double cellPermX, + double cellPermY, + double cellPermZ, + const cvf::Vec3d& internalCellLengths, + double lateralNtg, + double ntg) { // Compute kh for each local grid cell axis // Use permeability values for the two other axis @@ -70,9 +70,52 @@ double RigTransmissibilityEquations::totalPermeability(double cellPer double khy = sqrt(cellPermX * cellPermZ) * internalCellLengths.y() * lateralNtg; double khz = sqrt(cellPermX * cellPermY) * internalCellLengths.z() * ntg; - const double totalKh = cvf::Math::sqrt(khx * khx + khy * khy + khz * khz); + const double totKh = cvf::Math::sqrt(khx * khx + khy * khy + khz * khz); - return totalKh; + return totKh; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigTransmissibilityEquations::effectiveK(double cellPermX, + double cellPermY, + double cellPermZ, + const cvf::Vec3d& internalCellLengths, + double lateralNtg, + double ntg) +{ + // Compute kh for each local grid cell axis + // Use permeability values for the two other axis + + double lx = internalCellLengths.x() * lateralNtg; + double ly = internalCellLengths.y() * lateralNtg; + double lz = internalCellLengths.z() * ntg; + + double khx = sqrt(cellPermY * cellPermZ) * lx; + double khy = sqrt(cellPermX * cellPermZ) * ly; + double khz = sqrt(cellPermX * cellPermY) * lz; + + double nominator = khx + khy + khz; + double denominator = lx + ly + lz; + + const double effK = nominator / denominator; + + return effK; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigTransmissibilityEquations::effectiveH(const cvf::Vec3d& internalCellLengths, double lateralNtg, double ntg) +{ + double lx = internalCellLengths.x() * lateralNtg; + double ly = internalCellLengths.y() * lateralNtg; + double lz = internalCellLengths.z() * ntg; + + double effH = cvf::Math::sqrt(lx*lx + ly*ly + lz*lz); + + return effH; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.h b/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.h index 9601af55e0..009cd7c4c4 100644 --- a/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.h +++ b/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.h @@ -38,12 +38,21 @@ public: static double totalConnectionFactor(double transX, double transY, double transZ); - static double totalPermeability(double cellPermX, - double cellPermY, - double cellPermZ, - const cvf::Vec3d& internalCellLengths, - double lateralNtg, - double ntg); + static double totalKh(double cellPermX, + double cellPermY, + double cellPermZ, + const cvf::Vec3d& internalCellLengths, + double lateralNtg, + double ntg); + + static double effectiveK(double cellPermX, + double cellPermY, + double cellPermZ, + const cvf::Vec3d& internalCellLengths, + double lateralNtg, + double ntg); + + static double effectiveH(const cvf::Vec3d& internalCellLengths, double lateralNtg, double ntg); static double permeability(const double conductivity, const double width); From 243633137ac4f889cadaae0df8cccc6b5b7c3d98 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 26 Nov 2018 09:42:48 +0100 Subject: [PATCH 2/8] #3753 : Non-Darcy perforations : Use effectiveK and effectiveH --- ...sTransmissibilityCalculationFeatureImp.cpp | 8 +-- ...ellPathExportCompletionDataFeatureImpl.cpp | 61 +++++++++++-------- ...cWellPathExportCompletionDataFeatureImpl.h | 59 +++++++++++++++++- 3 files changed, 94 insertions(+), 34 deletions(-) diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp index 80a49e9def..378d19cc8b 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp @@ -131,7 +131,7 @@ std::vector { // No change in transmissibility for main bore auto transmissibilityAndPermeability = - RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibilityAndKh( + RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibilityData( settings.caseToApply, wellPath, wellBorePart.lengthsInCell, @@ -140,13 +140,13 @@ std::vector globalCellIndex, settings.useLateralNTG); - transmissibility = transmissibilityAndPermeability.first; + transmissibility = transmissibilityAndPermeability.connectionFactor(); } else { // Adjust transmissibility for fishbone laterals auto transmissibilityAndPermeability = - RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibilityAndKh( + RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibilityData( settings.caseToApply, wellPath, wellBorePart.lengthsInCell, @@ -157,7 +157,7 @@ std::vector numberOfLaterals, mainBoreDirection); - transmissibility = transmissibilityAndPermeability.first; + transmissibility = transmissibilityAndPermeability.connectionFactor(); } CellDirection direction = RicWellPathExportCompletionDataFeatureImpl::calculateCellMainDirection( diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp index c0eb5cba36..d487e3bfb2 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp @@ -1682,30 +1682,32 @@ std::vector RicWellPathExportCompletionDataFeatureImpl::gener double dFactor = RigCompletionData::defaultValue(); { - auto transmissibilityAndKh = calculateTransmissibilityAndKh(settings.caseToApply, - wellPath, - cell.intersectionLengthsInCellCS, - interval->skinFactor(), - interval->diameter(unitSystem) / 2, - cell.globCellIndex, - settings.useLateralNTG); + auto transmissibilityData = calculateTransmissibilityData(settings.caseToApply, + wellPath, + cell.intersectionLengthsInCellCS, + interval->skinFactor(), + interval->diameter(unitSystem) / 2, + cell.globCellIndex, + settings.useLateralNTG); - transmissibility = transmissibilityAndKh.first; + transmissibility = transmissibilityData.connectionFactor(); if (nonDarcyParameters->nonDarcyFlowType() == RimNonDarcyPerforationParameters::NON_DARCY_USER_DEFINED) { - kh = transmissibilityAndKh.second; + kh = transmissibilityData.kh(); dFactor = nonDarcyParameters->userDefinedDFactor(); } else if (nonDarcyParameters->nonDarcyFlowType() == RimNonDarcyPerforationParameters::NON_DARCY_COMPUTED) { - kh = transmissibilityAndKh.second; + kh = transmissibilityData.kh(); + + const double effectiveH = transmissibilityData.effectiveH(); const double effectivePermeability = - kh * nonDarcyParameters->gridPermeabilityScalingFactor() / cell.intersectionLengthsInCellCS.length(); + nonDarcyParameters->gridPermeabilityScalingFactor() * transmissibilityData.effectiveK(); dFactor = calculateDFactor(settings.caseToApply, - cell.intersectionLengthsInCellCS, + effectiveH, cell.globCellIndex, wellPath->perforationIntervalCollection()->nonDarcyParameters(), effectivePermeability); @@ -2318,16 +2320,16 @@ CellDirection RicWellPathExportCompletionDataFeatureImpl::calculateCellMainDirec //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::pair - RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibilityAndKh(RimEclipseCase* eclipseCase, - const RimWellPath* wellPath, - const cvf::Vec3d& internalCellLengths, - double skinFactor, - double wellRadius, - size_t globalCellIndex, - bool useLateralNTG, - size_t volumeScaleConstant, - CellDirection directionForVolumeScaling) +TransmissibilityData + RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibilityData(RimEclipseCase* eclipseCase, + const RimWellPath* wellPath, + const cvf::Vec3d& internalCellLengths, + double skinFactor, + double wellRadius, + size_t globalCellIndex, + bool useLateralNTG, + size_t volumeScaleConstant, + CellDirection directionForVolumeScaling) { RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); @@ -2354,7 +2356,7 @@ std::pair if (dxAccessObject.isNull() || dyAccessObject.isNull() || dzAccessObject.isNull() || permxAccessObject.isNull() || permyAccessObject.isNull() || permzAccessObject.isNull()) { - return std::make_pair(std::numeric_limits::infinity(), std::numeric_limits::infinity()); + return TransmissibilityData(); } double ntg = 1.0; @@ -2379,7 +2381,10 @@ std::pair double permy = permyAccessObject->cellScalarGlobIdx(globalCellIndex); double permz = permzAccessObject->cellScalarGlobIdx(globalCellIndex); - const double totalKh = RigTransmissibilityEquations::totalPermeability(permx, permy, permz, internalCellLengths, latNtg, ntg); + const double totalKh = RigTransmissibilityEquations::totalKh(permx, permy, permz, internalCellLengths, latNtg, ntg); + + const double effectiveK = RigTransmissibilityEquations::effectiveK(permx, permy, permz, internalCellLengths, latNtg, ntg); + const double effectiveH = RigTransmissibilityEquations::effectiveH(internalCellLengths, latNtg, ntg); double darcy = RiaEclipseUnitTools::darcysConstant(wellPath->unitSystem()); @@ -2399,14 +2404,16 @@ std::pair const double totalConnectionFactor = RigTransmissibilityEquations::totalConnectionFactor(transx, transy, transz); - return std::make_pair(totalConnectionFactor, totalKh); + TransmissibilityData trData; + trData.setData(effectiveH, effectiveK, totalConnectionFactor, totalKh); + return trData; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- double RicWellPathExportCompletionDataFeatureImpl::calculateDFactor(RimEclipseCase* eclipseCase, - const cvf::Vec3d& internalCellLengths, + double effectiveH, size_t globalCellIndex, const RimNonDarcyPerforationParameters* nonDarcyParameters, const double effectivePermeability) @@ -2443,7 +2450,7 @@ double RicWellPathExportCompletionDataFeatureImpl::calculateDFactor(RimEclipseCa return EQ::dFactor(alpha, betaFactor, effectivePermeability, - internalCellLengths.length(), + effectiveH, nonDarcyParameters->wellRadius(), nonDarcyParameters->relativeGasDensity(), nonDarcyParameters->gasViscosity()); diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h index 08dd321294..16e8d96df6 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h @@ -51,6 +51,59 @@ class SubSegmentIntersectionInfo; //================================================================================================== typedef std::shared_ptr QFilePtr; +class TransmissibilityData +{ +public: + TransmissibilityData() + : m_isValid(false) + , m_effectiveH(0.0) + , m_effectiveK(0.0) + , m_connectionFactor(0.0) + , m_kh(0.0) + { + } + + bool isValid() const + { + return m_isValid; + } + + void setData(double effectiveH, double effectiveK, double connectionFactor, double kh) + { + m_isValid = true; + + m_effectiveH = effectiveH; + m_effectiveK = effectiveK; + m_connectionFactor = connectionFactor; + m_kh = kh; + } + + double effectiveH() const + { + return m_effectiveH; + } + + double effectiveK() const + { + return m_effectiveK; + } + double connectionFactor() const + { + return m_connectionFactor; + } + double kh() const + { + return m_kh; + } + +private: + bool m_isValid; + double m_effectiveH; + double m_effectiveK; + double m_connectionFactor; + double m_kh; +}; + //================================================================================================== /// //================================================================================================== @@ -82,8 +135,8 @@ public: size_t globalCellIndex, const cvf::Vec3d& lengthsInCell); - static std::pair - calculateTransmissibilityAndKh(RimEclipseCase* eclipseCase, + static TransmissibilityData + calculateTransmissibilityData(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, const cvf::Vec3d& internalCellLengths, double skinFactor, @@ -94,7 +147,7 @@ public: CellDirection directionForVolumeScaling = CellDirection::DIR_I); static double calculateDFactor(RimEclipseCase* eclipseCase, - const cvf::Vec3d& internalCellLengths, + double effectiveH, size_t globalCellIndex, const RimNonDarcyPerforationParameters* nonDarcyParameters, const double effectivePermeability); From f6572e876ded81ac670f5c86998fee229171d6ba Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 26 Nov 2018 12:46:32 +0100 Subject: [PATCH 3/8] #3704 : Export completions : WELSPECL - one line per well --- ...ellPathExportCompletionDataFeatureImpl.cpp | 66 +++++++++++-------- ...cWellPathExportCompletionDataFeatureImpl.h | 5 +- 2 files changed, 43 insertions(+), 28 deletions(-) diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp index d487e3bfb2..c6d26579f7 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp @@ -1260,7 +1260,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspecsToFile(RimEclipse std::set wellPathSet; // Build list of unique RimWellPath - for (const auto completion : completions) + for (const auto& completion : completions) { const auto wellPath = findWellPathFromExportName(completion.wellName()); if (wellPath) @@ -1272,13 +1272,13 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspecsToFile(RimEclipse // Export for (const auto wellPath : wellPathSet) { - auto rimCcompletions = wellPath->completions(); - cvf::Vec2i ijIntersection = wellPathUpperGridIntersectionIJ(gridCase, wellPath); + auto rimCcompletions = wellPath->completions(); + auto ijIntersection = wellPathUpperGridIntersectionIJ(gridCase, wellPath); formatter.add(rimCcompletions->wellNameForExport()) .add(rimCcompletions->wellGroupNameForExport()) - .addOneBasedCellIndex(ijIntersection.x()) - .addOneBasedCellIndex(ijIntersection.y()) + .addOneBasedCellIndex(ijIntersection.second.x()) + .addOneBasedCellIndex(ijIntersection.second.y()) .add(rimCcompletions->referenceDepthForExport()) .add(rimCcompletions->wellTypeNameForExport()) .rowCompleted(); @@ -1311,32 +1311,44 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile( formatter.keyword("WELSPECL"); formatter.header(header); - std::map> wellPathMap; + std::map> wellPathToLgrNameMap; - // Build list of unique RimWellPath for each LGR - for (const auto completionsForLgr : completions) + for (const auto& completionsForLgr : completions) { - wellPathMap.insert(std::make_pair(completionsForLgr.first, std::set())); - - for (const auto completion : completionsForLgr.second) + for (const auto& completion : completionsForLgr.second) { const auto wellPath = findWellPathFromExportName(completion.wellName()); - if (wellPath) - { - wellPathMap[completionsForLgr.first].insert(wellPath); - } + auto item = wellPathToLgrNameMap.find(wellPath); + wellPathToLgrNameMap[wellPath].insert(completionsForLgr.first); } } - for (const auto wellPathsForLgr : wellPathMap) + for (const auto& wellPathsForLgr : wellPathToLgrNameMap) { - QString lgrName = wellPathsForLgr.first; + const RimWellPath* wellPath = wellPathsForLgr.first; - // Export - for (const auto wellPath : wellPathsForLgr.second) + std::tuple itemWithLowestMD = + std::make_tuple(std::numeric_limits::max(), cvf::Vec2i(), ""); + + // Find first LGR-intersection along the well path + + for (const auto& lgrName : wellPathsForLgr.second) { - auto rimCompletions = wellPath->completions(); - cvf::Vec2i ijIntersection = wellPathUpperGridIntersectionIJ(gridCase, wellPath, lgrName); + auto ijIntersection = wellPathUpperGridIntersectionIJ(gridCase, wellPath, lgrName); + if (ijIntersection.first < std::get<0>(itemWithLowestMD)) + { + itemWithLowestMD = std::make_tuple(ijIntersection.first, ijIntersection.second, lgrName); + } + } + + { + double measuredDepth = 0.0; + cvf::Vec2i ijIntersection; + QString lgrName; + + std::tie(measuredDepth, ijIntersection, lgrName) = itemWithLowestMD; + + auto rimCompletions = wellPath->completions(); formatter.add(rimCompletions->wellNameForExport()) .add(rimCompletions->wellGroupNameForExport()) @@ -1348,7 +1360,6 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile( .rowCompleted(); } } - formatter.tableCompleted(); } @@ -2529,9 +2540,10 @@ double RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibilityAsEc //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -cvf::Vec2i RicWellPathExportCompletionDataFeatureImpl::wellPathUpperGridIntersectionIJ(const RimEclipseCase* gridCase, - const RimWellPath* wellPath, - const QString& gridName) +std::pair + RicWellPathExportCompletionDataFeatureImpl::wellPathUpperGridIntersectionIJ(const RimEclipseCase* gridCase, + const RimWellPath* wellPath, + const QString& gridName) { const RigEclipseCaseData* caseData = gridCase->eclipseCaseData(); const RigMainGrid* mainGrid = caseData->mainGrid(); @@ -2562,11 +2574,11 @@ cvf::Vec2i RicWellPathExportCompletionDataFeatureImpl::wellPathUpperGridIntersec size_t i, j, k; if (grid->ijkFromCellIndex(gridLocalCellIndex, &i, &j, &k)) { - return cvf::Vec2i((int)i, (int)j); + return std::make_pair(intersection.startMD, cvf::Vec2i((int)i, (int)j)); } } } - return cvf::Vec2i(); + return std::make_pair(cvf::UNDEFINED_DOUBLE, cvf::Vec2i()); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h index 16e8d96df6..176fdb70c4 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h @@ -28,6 +28,7 @@ #include "cvfBase.h" #include "cvfVector3.h" +#include "cvfVector2.h" #include #include @@ -268,7 +269,9 @@ private: static void appendCompletionData(std::map>* completionData, const std::vector& data); - static cvf::Vec2i wellPathUpperGridIntersectionIJ(const RimEclipseCase* gridCase, const RimWellPath* wellPath, const QString& gridName = ""); + static std::pair wellPathUpperGridIntersectionIJ(const RimEclipseCase* gridCase, + const RimWellPath* wellPath, + const QString& gridName = ""); static void exportWellSegments(RimEclipseCase* eclipseCase, QFilePtr exportFile, From 49b5b603527e28881bd46af654c45e37974e3f58 Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Tue, 27 Nov 2018 10:53:14 +0100 Subject: [PATCH 4/8] #2396 Add support for locking axes in Cell RelPerm plot * Also put curves in a grid layout and shortened logarithmic label to fit better --- .../RiuRelativePermeabilityPlotPanel.cpp | 50 +++++++++++++++---- .../RiuRelativePermeabilityPlotPanel.h | 4 ++ 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp index ade790af26..917407d0b8 100644 --- a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp +++ b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp @@ -37,6 +37,7 @@ #include "qwt_scale_engine.h" #include +#include #include #include #include @@ -99,23 +100,29 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel(QDockWidget* m_selectedCurvesButtonGroup->addButton(new QCheckBox("PCOG"), RigFlowDiagSolverInterface::RelPermCurve::PCOG); QGroupBox* groupBox = new QGroupBox("Curves"); - QVBoxLayout* groupBoxLayout = new QVBoxLayout; + QGridLayout* groupBoxLayout = new QGridLayout; groupBox->setLayout(groupBoxLayout); QList checkButtonList = m_selectedCurvesButtonGroup->buttons(); for (int i = 0; i < checkButtonList.size(); i++) { checkButtonList[i]->setChecked(true); - groupBoxLayout->addWidget(checkButtonList[i]); + groupBoxLayout->addWidget(checkButtonList[i], i / 2, i % 2); } - m_logarithmicScaleKrAxisCheckBox = new QCheckBox("Logarithmic Scale\nKr Axis"); + m_logarithmicScaleKrAxisCheckBox = new QCheckBox("Log Scale Kr Axis"); m_showUnscaledCheckBox = new QCheckBox("Show Unscaled"); + m_fixedXAxisCheckBox = new QCheckBox("Fixed [0, 1] X-axis"); + m_fixedLeftYAxisCheckBox = new QCheckBox("Fixed [0, 1] Kr-axis"); + m_fixedXAxisCheckBox->setChecked(true); + m_fixedLeftYAxisCheckBox->setChecked(true); QVBoxLayout* leftLayout = new QVBoxLayout; leftLayout->addWidget(groupBox); leftLayout->addWidget(m_logarithmicScaleKrAxisCheckBox); leftLayout->addWidget(m_showUnscaledCheckBox); + leftLayout->addWidget(m_fixedXAxisCheckBox); + leftLayout->addWidget(m_fixedLeftYAxisCheckBox); leftLayout->addStretch(1); QHBoxLayout* mainLayout = new QHBoxLayout(); @@ -128,6 +135,8 @@ RiuRelativePermeabilityPlotPanel::RiuRelativePermeabilityPlotPanel(QDockWidget* connect(m_selectedCurvesButtonGroup, SIGNAL(buttonClicked(int)), SLOT(slotButtonInButtonGroupClicked(int))); connect(m_logarithmicScaleKrAxisCheckBox, SIGNAL(stateChanged(int)), SLOT(slotSomeCheckBoxStateChanged(int))); connect(m_showUnscaledCheckBox, SIGNAL(stateChanged(int)), SLOT(slotSomeCheckBoxStateChanged(int))); + connect(m_fixedXAxisCheckBox, SIGNAL(stateChanged(int)), SLOT(slotSomeCheckBoxStateChanged(int))); + connect(m_fixedLeftYAxisCheckBox, SIGNAL(stateChanged(int)), SLOT(slotSomeCheckBoxStateChanged(int))); plotUiSelectedCurves(); } @@ -208,7 +217,7 @@ void RiuRelativePermeabilityPlotPanel::clearPlot() m_caseName.clear(); m_cellReferenceText.clear(); - plotCurvesInQwt(m_unitSystem, m_allCurvesArr, m_swat, m_sgas, m_cellReferenceText, false, m_qwtPlot, &m_myPlotMarkers); + plotCurvesInQwt(m_unitSystem, m_allCurvesArr, m_swat, m_sgas, m_cellReferenceText, false, true, true, m_qwtPlot, &m_myPlotMarkers); } //-------------------------------------------------------------------------------------------------- @@ -226,8 +235,10 @@ void RiuRelativePermeabilityPlotPanel::plotUiSelectedCurves() { std::vector selectedCurves = gatherUiSelectedCurves(); - const bool useLogScale = m_logarithmicScaleKrAxisCheckBox->isChecked() ? true : false; - plotCurvesInQwt(m_unitSystem, selectedCurves, m_swat, m_sgas, m_cellReferenceText, useLogScale, m_qwtPlot, &m_myPlotMarkers); + const bool useLogScale = m_logarithmicScaleKrAxisCheckBox->isChecked(); + const bool fixedXAxis = m_fixedXAxisCheckBox->isChecked(); + const bool fixedYAxis = m_fixedLeftYAxisCheckBox->isChecked(); + plotCurvesInQwt(m_unitSystem, selectedCurves, m_swat, m_sgas, m_cellReferenceText, useLogScale, fixedXAxis, fixedYAxis, m_qwtPlot, &m_myPlotMarkers); } //-------------------------------------------------------------------------------------------------- @@ -282,7 +293,9 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::Unit double swat, double sgas, QString cellReferenceText, - bool logScaleLeftAxis, + bool logScaleLeftAxis, + bool fixedXAxis, + bool fixedLeftYAxis, QwtPlot* plot, std::vector* myPlotMarkers) { @@ -403,7 +416,6 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::Unit if (!dynamic_cast(plot->axisScaleEngine(QwtPlot::yLeft))) { plot->setAxisScaleEngine(QwtPlot::yLeft, new QwtLogScaleEngine); - //plot->setAxisAutoScale(QwtPlot::yLeft, true); } } else @@ -411,10 +423,30 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::Unit if (!dynamic_cast(plot->axisScaleEngine(QwtPlot::yLeft))) { plot->setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine); - //plot->setAxisAutoScale(QwtPlot::yLeft, true); } } + if (fixedXAxis) + { + plot->setAxisScale(QwtPlot::xBottom, 0.0, 1.0); + plot->setAxisAutoScale(QwtPlot::xBottom, false); + } + else + { + plot->setAxisAutoScale(QwtPlot::xBottom, true); + } + + if (fixedLeftYAxis) + { + plot->setAxisScale(QwtPlot::yLeft, 0.0, 1.0); + plot->setAxisAutoScale(QwtPlot::yLeft, false); + } + else + { + plot->setAxisAutoScale(QwtPlot::yLeft, true); + } + + QString titleStr = "Relative Permeability"; if (!cellReferenceText.isEmpty()) diff --git a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.h b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.h index 93c09fa40c..d5a5d65b03 100644 --- a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.h +++ b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.h @@ -81,6 +81,8 @@ private: double sgas, QString cellReferenceText, bool logScaleLeftAxis, + bool fixedXAxis, + bool fixedLeftYAxis, QwtPlot* plot, std::vector* myPlotMarkers); @@ -128,6 +130,8 @@ private: QButtonGroup* m_selectedCurvesButtonGroup; QCheckBox* m_showUnscaledCheckBox; QCheckBox* m_logarithmicScaleKrAxisCheckBox; + QCheckBox* m_fixedXAxisCheckBox; + QCheckBox* m_fixedLeftYAxisCheckBox; std::unique_ptr m_plotUpdater; }; From d743602b81bf9f94b5f3997cb8d1dffc9e5c5744 Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Tue, 27 Nov 2018 11:29:55 +0100 Subject: [PATCH 5/8] #2396 Set better fixed y-axis range for logarithmic scaling --- .../UserInterface/RiuRelativePermeabilityPlotPanel.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp index 917407d0b8..ed8c43f4d6 100644 --- a/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp +++ b/ApplicationCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp @@ -438,7 +438,14 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt(RiaEclipseUnitTools::Unit if (fixedLeftYAxis) { - plot->setAxisScale(QwtPlot::yLeft, 0.0, 1.0); + if (logScaleLeftAxis) + { + plot->setAxisScale(QwtPlot::yLeft, 1.0e-6, 1.0); + } + else + { + plot->setAxisScale(QwtPlot::yLeft, 0.0, 1.0); + } plot->setAxisAutoScale(QwtPlot::yLeft, false); } else From 70eca210bfab53f3301bb1d94b6a69bbfdaf99ed Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Tue, 27 Nov 2018 13:18:03 +0100 Subject: [PATCH 6/8] #3765 Support Eclipse cases in Memory Management case list --- ApplicationCode/Application/RiaMemoryCleanup.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/Application/RiaMemoryCleanup.cpp b/ApplicationCode/Application/RiaMemoryCleanup.cpp index ecfb05e607..15deb8b822 100644 --- a/ApplicationCode/Application/RiaMemoryCleanup.cpp +++ b/ApplicationCode/Application/RiaMemoryCleanup.cpp @@ -218,9 +218,14 @@ QList RiaMemoryCleanup::calculateValueOptions(const caf: RimProject* proj = RiaApplication::instance()->project(); if (proj) { - std::vector cases = proj->geoMechCases(); + std::vector eclipseCases = proj->eclipseCases(); + for (RimEclipseCase* c : eclipseCases) + { + options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon())); + } - for (RimGeoMechCase* c : cases) + std::vector geoMechCases = proj->geoMechCases(); + for (RimGeoMechCase* c : geoMechCases) { options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon())); } From 5498c2f466d691e4c1d852916ec401cc5624e9f6 Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Tue, 27 Nov 2018 13:39:11 +0100 Subject: [PATCH 7/8] #3766 Hide blank grid children in GeoMech cases --- .../ProjectDataModel/RimEclipseCase.cpp | 2 +- .../ProjectDataModel/RimGridCollection.cpp | 27 ++++++++++--------- .../ProjectDataModel/RimGridCollection.h | 4 +-- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index 1ebbee3de5..6c46324d5b 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -851,7 +851,7 @@ bool RimEclipseCase::openReserviorCase() descendantsIncludingThisOfType(gridColls); for (RimGridCollection* gridCollection : gridColls) { - gridCollection->syncFromMainGrid(); + gridCollection->syncFromMainEclipseGrid(); } } diff --git a/ApplicationCode/ProjectDataModel/RimGridCollection.cpp b/ApplicationCode/ProjectDataModel/RimGridCollection.cpp index cfbdf6196b..b8643e1593 100644 --- a/ApplicationCode/ProjectDataModel/RimGridCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimGridCollection.cpp @@ -361,9 +361,9 @@ caf::PdmFieldHandle* RimGridCollection::objectToggleField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCollection::syncFromMainGrid() +void RimGridCollection::syncFromMainEclipseGrid() { - auto mainGrid = this->mainGrid(); + auto mainGrid = this->mainEclipseGrid(); if (mainGrid) { m_mainGrid->setName("Main Grid"); @@ -471,14 +471,17 @@ void RimGridCollection::initAfterRead() //-------------------------------------------------------------------------------------------------- void RimGridCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/) { - uiTreeOrdering.add(m_mainGrid()); - if (hasPersistentLgrs()) + if (mainEclipseGrid()) { - uiTreeOrdering.add(m_persistentLgrs()); - } - if (hasTemporaryLgrs()) - { - uiTreeOrdering.add(m_temporaryLgrs()); + uiTreeOrdering.add(m_mainGrid()); + if (hasPersistentLgrs()) + { + uiTreeOrdering.add(m_persistentLgrs()); + } + if (hasTemporaryLgrs()) + { + uiTreeOrdering.add(m_temporaryLgrs()); + } } uiTreeOrdering.skipRemainingChildren(true); } @@ -486,7 +489,7 @@ void RimGridCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrder //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const RigMainGrid* RimGridCollection::mainGrid() const +const RigMainGrid* RimGridCollection::mainEclipseGrid() const { RimEclipseCase* eclipseCase; firstAncestorOrThisOfType(eclipseCase); @@ -498,7 +501,7 @@ const RigMainGrid* RimGridCollection::mainGrid() const //-------------------------------------------------------------------------------------------------- bool RimGridCollection::hasPersistentLgrs() const { - auto mainGrid = this->mainGrid(); + auto mainGrid = this->mainEclipseGrid(); if (!mainGrid) return false; for (size_t i = 1; i < mainGrid->gridCount(); i++) @@ -514,7 +517,7 @@ bool RimGridCollection::hasPersistentLgrs() const //-------------------------------------------------------------------------------------------------- bool RimGridCollection::hasTemporaryLgrs() const { - auto mainGrid = this->mainGrid(); + auto mainGrid = this->mainEclipseGrid(); if (!mainGrid) return false; for (size_t i = 1; i < mainGrid->gridCount(); i++) diff --git a/ApplicationCode/ProjectDataModel/RimGridCollection.h b/ApplicationCode/ProjectDataModel/RimGridCollection.h index c8d7b18a0c..273832d2f1 100644 --- a/ApplicationCode/ProjectDataModel/RimGridCollection.h +++ b/ApplicationCode/ProjectDataModel/RimGridCollection.h @@ -103,7 +103,7 @@ public: std::vector indicesToVisibleGrids() const; caf::PdmFieldHandle* objectToggleField() override; - void syncFromMainGrid(); + void syncFromMainEclipseGrid(); void setMainGridActive(bool active); static const QString persistentGridUiName(); @@ -115,7 +115,7 @@ protected: void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override; private: - const RigMainGrid* mainGrid() const; + const RigMainGrid* mainEclipseGrid() const; bool hasPersistentLgrs() const; bool hasTemporaryLgrs() const; From 5496430de7474bab8877435e08f725cbd45d20cc Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 27 Nov 2018 13:21:55 +0100 Subject: [PATCH 8/8] Upped version to ResInsight-2018.11.0-RC1 --- ResInsightVersion.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 31b0c25688..92e9e28db7 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -1,16 +1,16 @@ set(RESINSIGHT_MAJOR_VERSION 2018) -set(RESINSIGHT_MINOR_VERSION 05) -set(RESINSIGHT_PATCH_VERSION 1) +set(RESINSIGHT_MINOR_VERSION 11) +set(RESINSIGHT_PATCH_VERSION 0) # Opional text with no restrictions -set(RESINSIGHT_VERSION_TEXT "-dev") +set(RESINSIGHT_VERSION_TEXT "-RC1") # Optional text # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".12") +#set(RESINSIGHT_DEV_VERSION ".12") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f")