diff --git a/ApplicationCode/Application/RiaFractureDefines.cpp b/ApplicationCode/Application/RiaFractureDefines.cpp index 74f3b87d49..57054a44a5 100644 --- a/ApplicationCode/Application/RiaFractureDefines.cpp +++ b/ApplicationCode/Application/RiaFractureDefines.cpp @@ -27,27 +27,37 @@ QString RiaDefines::conductivityResultName() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QString RiaDefines::unitStringConductivity(RiaEclipseUnitTools::UnitSystem unitSystem) { switch (unitSystem) { - case RiaEclipseUnitTools::UNITS_METRIC: return "md-m"; - case RiaEclipseUnitTools::UNITS_FIELD: return "md-ft"; - default: return ""; + case RiaEclipseUnitTools::UNITS_METRIC: + return "md-m"; + case RiaEclipseUnitTools::UNITS_FIELD: + return "md-ft"; + default: + return ""; } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- double RiaDefines::nonDarcyFlowAlpha(RiaEclipseUnitTools::UnitSystem unitSystem) { switch (unitSystem) { - case RiaEclipseUnitTools::UNITS_METRIC: return 2.24460e-10; - case RiaEclipseUnitTools::UNITS_FIELD: return 6.83352e-8; - default: return 0.0; + case RiaEclipseUnitTools::UNITS_METRIC: + return 2.24460e-10; + case RiaEclipseUnitTools::UNITS_FIELD: + return 6.83352e-8; + case RiaEclipseUnitTools::UNITS_LAB: + return 5.41375E-11; + // case RiaEclipseUnitTools::PVT_METRIC: return 2.25533E-10; + + default: + return 0.0; } } diff --git a/ApplicationCode/Application/RiaFractureDefines.h b/ApplicationCode/Application/RiaFractureDefines.h index a87bbe5acf..238ae71c98 100644 --- a/ApplicationCode/Application/RiaFractureDefines.h +++ b/ApplicationCode/Application/RiaFractureDefines.h @@ -27,5 +27,5 @@ namespace RiaDefines QString conductivityResultName(); QString unitStringConductivity(RiaEclipseUnitTools::UnitSystem unitSystem); -double nonDarcyFlowAlpha(RiaEclipseUnitTools::UnitSystem unitSystem); -}; +double nonDarcyFlowAlpha(RiaEclipseUnitTools::UnitSystem unitSystem); +}; // namespace RiaDefines diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp index ead249d6a7..80a49e9def 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::calculateTransmissibilityAndPermeability( + RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibilityAndKh( settings.caseToApply, wellPath, wellBorePart.lengthsInCell, @@ -146,7 +146,7 @@ std::vector { // Adjust transmissibility for fishbone laterals auto transmissibilityAndPermeability = - RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibilityAndPermeability( + RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibilityAndKh( settings.caseToApply, wellPath, wellBorePart.lengthsInCell, diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp index b9a027c64e..9926175c38 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp @@ -20,6 +20,7 @@ #include "RiaApplication.h" #include "RiaFilePathTools.h" +#include "RiaFractureDefines.h" #include "RiaLogging.h" #include "RiaPreferences.h" @@ -1658,46 +1659,39 @@ std::vector RicWellPathExportCompletionDataFeatureImpl::gener const RimNonDarcyPerforationParameters* nonDarcyParameters = wellPath->perforationIntervalCollection()->nonDarcyParameters(); - double transmissibility = 0.0; - double effectivePermeability = 0.0; + double transmissibility = 0.0; + double kh = RigCompletionData::defaultValue(); + double dFactor = RigCompletionData::defaultValue(); + { - auto transmissibilityAndPermeability = - calculateTransmissibilityAndPermeability(settings.caseToApply, - wellPath, - cell.intersectionLengthsInCellCS, - interval->skinFactor(), - interval->diameter(unitSystem) / 2, - cell.globCellIndex, - settings.useLateralNTG); + auto transmissibilityAndKh = calculateTransmissibilityAndKh(settings.caseToApply, + wellPath, + cell.intersectionLengthsInCellCS, + interval->skinFactor(), + interval->diameter(unitSystem) / 2, + cell.globCellIndex, + settings.useLateralNTG); - transmissibility = transmissibilityAndPermeability.first; + transmissibility = transmissibilityAndKh.first; - if (nonDarcyParameters->nonDarcyFlowType() != RimNonDarcyPerforationParameters::NON_DARCY_NONE) + if (nonDarcyParameters->nonDarcyFlowType() == RimNonDarcyPerforationParameters::NON_DARCY_USER_DEFINED) { - effectivePermeability = - transmissibilityAndPermeability.second * nonDarcyParameters->gridPermeabilityScalingFactor(); + kh = transmissibilityAndKh.second; + dFactor = nonDarcyParameters->userDefinedDFactor(); } - } + else if (nonDarcyParameters->nonDarcyFlowType() == RimNonDarcyPerforationParameters::NON_DARCY_COMPUTED) + { + kh = transmissibilityAndKh.second; - double dFactor = RigCompletionData::defaultValue(); - double kh = RigCompletionData::defaultValue(); + const double effectivePermeability = + kh * nonDarcyParameters->gridPermeabilityScalingFactor() / cell.intersectionLengthsInCellCS.length(); - if (nonDarcyParameters->nonDarcyFlowType() == RimNonDarcyPerforationParameters::NON_DARCY_USER_DEFINED) - { - dFactor = nonDarcyParameters->userDefinedDFactor(); - } - else if (nonDarcyParameters->nonDarcyFlowType() == RimNonDarcyPerforationParameters::NON_DARCY_COMPUTED) - { - dFactor = calculateDFactor(settings.caseToApply, - cell.intersectionLengthsInCellCS, - cell.globCellIndex, - wellPath->perforationIntervalCollection()->nonDarcyParameters(), - effectivePermeability); - } - - if (nonDarcyParameters->nonDarcyFlowType() != RimNonDarcyPerforationParameters::NON_DARCY_NONE) - { - kh = effectivePermeability * cell.intersectionLengthsInCellCS.length(); + dFactor = calculateDFactor(settings.caseToApply, + cell.intersectionLengthsInCellCS, + cell.globCellIndex, + wellPath->perforationIntervalCollection()->nonDarcyParameters(), + effectivePermeability); + } } completion.setTransAndWPImultBackgroundDataFromPerforation( @@ -2307,15 +2301,15 @@ CellDirection RicWellPathExportCompletionDataFeatureImpl::calculateCellMainDirec /// //-------------------------------------------------------------------------------------------------- std::pair - RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibilityAndPermeability(RimEclipseCase* eclipseCase, - const RimWellPath* wellPath, - const cvf::Vec3d& internalCellLengths, - double skinFactor, - double wellRadius, - size_t globalCellIndex, - bool useLateralNTG, - size_t volumeScaleConstant, - CellDirection directionForVolumeScaling) + 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) { RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); @@ -2367,7 +2361,7 @@ std::pair double permy = permyAccessObject->cellScalarGlobIdx(globalCellIndex); double permz = permzAccessObject->cellScalarGlobIdx(globalCellIndex); - const double totalPermeabilityForCell = RigTransmissibilityEquations::totalPermeability(permx, permy, permz); + const double totalKh = RigTransmissibilityEquations::totalPermeability(permx, permy, permz, internalCellLengths, latNtg, ntg); double darcy = RiaEclipseUnitTools::darcysConstant(wellPath->unitSystem()); @@ -2387,7 +2381,7 @@ std::pair const double totalConnectionFactor = RigTransmissibilityEquations::totalConnectionFactor(transx, transy, transz); - return std::make_pair(totalConnectionFactor, totalPermeabilityForCell); + return std::make_pair(totalConnectionFactor, totalKh); } //-------------------------------------------------------------------------------------------------- @@ -2401,10 +2395,15 @@ double RicWellPathExportCompletionDataFeatureImpl::calculateDFactor(RimEclipseCa { using EQ = RigPerforationTransmissibilityEquations; + if (!eclipseCase || !eclipseCase->eclipseCaseData()) + { + return std::numeric_limits::infinity(); + } + + RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); + double porosity = 0.0; { - RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); - eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PORO"); cvf::ref poroAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PORO"); @@ -2421,7 +2420,9 @@ double RicWellPathExportCompletionDataFeatureImpl::calculateDFactor(RimEclipseCa porosity, nonDarcyParameters->porosityScalingFactor()); - return EQ::dFactor(nonDarcyParameters->unitConstant(), + const double alpha = RiaDefines::nonDarcyFlowAlpha(eclipseCaseData->unitsType()); + + return EQ::dFactor(alpha, betaFactor, effectivePermeability, internalCellLengths.length(), diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h index 2e59eb871f..08dd321294 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h @@ -83,7 +83,7 @@ public: const cvf::Vec3d& lengthsInCell); static std::pair - calculateTransmissibilityAndPermeability(RimEclipseCase* eclipseCase, + calculateTransmissibilityAndKh(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, const cvf::Vec3d& internalCellLengths, double skinFactor, diff --git a/ApplicationCode/Commands/ViewLink/RicLinkViewFeature.cpp b/ApplicationCode/Commands/ViewLink/RicLinkViewFeature.cpp index 6301c5299b..e304e812b1 100644 --- a/ApplicationCode/Commands/ViewLink/RicLinkViewFeature.cpp +++ b/ApplicationCode/Commands/ViewLink/RicLinkViewFeature.cpp @@ -23,9 +23,10 @@ #include "RicLinkVisibleViewsFeature.h" -#include "RimProject.h" #include "Rim3dView.h" +#include "RimContourMapView.h" #include "RimGridView.h" +#include "RimProject.h" #include "RimViewLinkerCollection.h" #include "RimViewLinker.h" @@ -42,9 +43,14 @@ bool RicLinkViewFeature::isCommandEnabled() { std::vector allSelectedItems; std::vector selectedGridViews; + std::vector selectedContourMaps; + caf::SelectionManager::instance()->selectedItems(allSelectedItems); caf::SelectionManager::instance()->objectsByType(&selectedGridViews); - if (selectedGridViews.size() > 1u && allSelectedItems.size() == selectedGridViews.size()) + caf::SelectionManager::instance()->objectsByType(&selectedContourMaps); + size_t selectedRegularGridViews = selectedGridViews.size() - selectedContourMaps.size(); + + if (selectedGridViews.size() > 1u && selectedRegularGridViews >= 1u && allSelectedItems.size() == selectedGridViews.size()) { return true; } @@ -80,8 +86,10 @@ void RicLinkViewFeature::onActionTriggered(bool isChecked) { std::vector allSelectedItems; std::vector selectedGridViews; + caf::SelectionManager::instance()->selectedItems(allSelectedItems); caf::SelectionManager::instance()->objectsByType(&selectedGridViews); + if (selectedGridViews.size() > 1u && allSelectedItems.size() == selectedGridViews.size()) { RicLinkVisibleViewsFeature::linkViews(selectedGridViews); diff --git a/ApplicationCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp b/ApplicationCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp index b6b0dcb134..ee891554a2 100644 --- a/ApplicationCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp +++ b/ApplicationCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp @@ -23,9 +23,10 @@ #include "RicLinkVisibleViewsFeatureUi.h" -#include "RimViewController.h" -#include "RimProject.h" +#include "RimContourMapView.h" #include "RimGridView.h" +#include "RimProject.h" +#include "RimViewController.h" #include "RimViewLinker.h" #include "RimViewLinkerCollection.h" @@ -147,6 +148,15 @@ void RicLinkVisibleViewsFeature::linkViews(std::vector& views) RimProject* proj = RiaApplication::instance()->project(); RimViewLinker* viewLinker = proj->viewLinkerCollection->viewLinker(); + std::vector masterCandidates; + for (RimGridView* view : views) + { + if (dynamic_cast(view) == nullptr) + { + masterCandidates.push_back(view); + } + } + if (!viewLinker) { // Create a new view linker @@ -155,15 +165,20 @@ void RicLinkVisibleViewsFeature::linkViews(std::vector& views) { return; } + CVF_ASSERT(!masterCandidates.empty()); - RicLinkVisibleViewsFeatureUi featureUi; - featureUi.setViews(views); + RimGridView* masterView = masterCandidates.front(); + if (masterCandidates.size() > 1u) + { + RicLinkVisibleViewsFeatureUi featureUi; + featureUi.setViews(masterCandidates); - caf::PdmUiPropertyViewDialog propertyDialog(nullptr, &featureUi, "Select Master View", ""); - propertyDialog.setWindowIcon(QIcon(":/chain.png")); - if (propertyDialog.exec() != QDialog::Accepted) return; + caf::PdmUiPropertyViewDialog propertyDialog(nullptr, &featureUi, "Select Master View", ""); + propertyDialog.setWindowIcon(QIcon(":/chain.png")); + if (propertyDialog.exec() != QDialog::Accepted) return; - RimGridView* masterView = featureUi.masterView(); + masterView = featureUi.masterView(); + } viewLinker = new RimViewLinker; proj->viewLinkerCollection()->viewLinker = viewLinker; viewLinker->setMasterView(masterView); diff --git a/ApplicationCode/Commands/ViewLink/RicSetMasterViewFeature.cpp b/ApplicationCode/Commands/ViewLink/RicSetMasterViewFeature.cpp index 1bed9c55c6..a6643c3cd9 100644 --- a/ApplicationCode/Commands/ViewLink/RicSetMasterViewFeature.cpp +++ b/ApplicationCode/Commands/ViewLink/RicSetMasterViewFeature.cpp @@ -21,8 +21,9 @@ #include "RiaApplication.h" -#include "RimProject.h" +#include "RimContourMapView.h" #include "RimGridView.h" +#include "RimProject.h" #include "RimViewController.h" #include "RimViewLinker.h" #include "RimViewLinkerCollection.h" @@ -54,6 +55,11 @@ bool RicSetMasterViewFeature::isCommandEnabled() return false; } + if (dynamic_cast(activeView) != nullptr) + { + return false; + } + return true; } diff --git a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp index 0857ac8471..235348e9c6 100644 --- a/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -177,60 +177,62 @@ void RivWellPathPartMgr::appendWellPathAttributesToModel(cvf::ModelBasicList* for (RimWellPathAttribute* attribute : attributes) { - if (attribute->componentType() == RiaDefines::CASING) + if (attribute->isEnabled()) { - double wellPathRadius = this->wellPathRadius(characteristicCellSize, this->wellPathCollection()); - double endMD = attribute->endMD(); - double shoeLength = wellPathRadius; - double shoeStartMD = endMD - shoeLength; - - std::vector displayCoords; - displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(shoeStartMD))); - displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD))); - displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD))); - - std::vector radii; - radii.push_back(wellPathRadius); - radii.push_back(wellPathRadius * 2.5); - radii.push_back(wellPathRadius * 1.1); - - cvf::ref objectSourceInfo = new RivObjectSourceInfo(attribute); - - cvf::Collection parts; - geoGenerator.tubeWithCenterLinePartsAndVariableWidth(&parts, displayCoords, radii, attribute->defaultComponentColor()); - for (auto part : parts) + if (attribute->componentType() == RiaDefines::CASING) { - part->setSourceInfo(objectSourceInfo.p()); - model->addPart(part.p()); + double wellPathRadius = this->wellPathRadius(characteristicCellSize, this->wellPathCollection()); + double endMD = attribute->endMD(); + double shoeLength = wellPathRadius; + double shoeStartMD = endMD - shoeLength; + + std::vector displayCoords; + displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(shoeStartMD))); + displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD))); + displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD))); + + std::vector radii; + radii.push_back(wellPathRadius); + radii.push_back(wellPathRadius * 2.5); + radii.push_back(wellPathRadius * 1.1); + + cvf::ref objectSourceInfo = new RivObjectSourceInfo(attribute); + + cvf::Collection parts; + geoGenerator.tubeWithCenterLinePartsAndVariableWidth(&parts, displayCoords, radii, attribute->defaultComponentColor()); + for (auto part : parts) + { + part->setSourceInfo(objectSourceInfo.p()); + model->addPart(part.p()); + } } - } - else if (attribute->componentType() == RiaDefines::PACKER) - { - double wellPathRadius = this->wellPathRadius(characteristicCellSize, this->wellPathCollection()); - double startMD = attribute->startMD(); - double packerLength = wellPathRadius; - double endMD = attribute->startMD() + packerLength; - - std::vector displayCoords; - displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(startMD))); - displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(startMD))); - displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD))); - displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD))); - - std::vector radii; - radii.push_back(wellPathRadius); - radii.push_back(wellPathRadius * 2.5); - radii.push_back(wellPathRadius * 2.5); - radii.push_back(wellPathRadius); - - cvf::ref objectSourceInfo = new RivObjectSourceInfo(attribute); - - cvf::Collection parts; - geoGenerator.tubeWithCenterLinePartsAndVariableWidth(&parts, displayCoords, radii, attribute->defaultComponentColor()); - for (auto part : parts) + else if (attribute->componentType() == RiaDefines::PACKER) { - part->setSourceInfo(objectSourceInfo.p()); - model->addPart(part.p()); + double wellPathRadius = this->wellPathRadius(characteristicCellSize, this->wellPathCollection()); + double startMD = attribute->startMD(); + double endMD = attribute->endMD(); + + std::vector displayCoords; + displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(startMD))); + displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(startMD))); + displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD))); + displayCoords.push_back(displayCoordTransform->transformToDisplayCoord(m_rimWellPath->wellPathGeometry()->interpolatedPointAlongWellPath(endMD))); + + std::vector radii; + radii.push_back(wellPathRadius); + radii.push_back(wellPathRadius * 1.5); + radii.push_back(wellPathRadius * 1.5); + radii.push_back(wellPathRadius); + + cvf::ref objectSourceInfo = new RivObjectSourceInfo(attribute); + + cvf::Collection parts; + geoGenerator.tubeWithCenterLinePartsAndVariableWidth(&parts, displayCoords, radii, attribute->defaultComponentColor()); + for (auto part : parts) + { + part->setSourceInfo(objectSourceInfo.p()); + model->addPart(part.p()); + } } } } diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.cpp index 7effceada7..d2a6b65f0f 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.cpp @@ -632,6 +632,17 @@ cvf::BoundingBox RimFishbonesMultipleSubs::boundingBoxInDomainCoords() const return bb; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimFishbonesMultipleSubs::isEnabled() const +{ + RimFishbonesCollection* collection; + this->firstAncestorOrThisOfTypeAsserted(collection); + + return collection->isChecked() && isActive(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.h b/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.h index dd357d7546..d43a556003 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.h @@ -110,6 +110,7 @@ public: cvf::BoundingBox boundingBoxInDomainCoords() const override; // Overrides from RimWellPathCompletionsInterface + bool isEnabled() const override; RiaDefines::WellPathComponentType componentType() const override; QString componentLabel() const override; QString componentTypeLabel() const override; diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp index f8c57b18f9..126f076068 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp @@ -39,6 +39,7 @@ #include "RimReservoirCellResultsStorage.h" #include "RimStimPlanColors.h" #include "RimStimPlanFractureTemplate.h" +#include "RimWellPathFractureCollection.h" #include "RivWellFracturePartMgr.h" @@ -286,6 +287,16 @@ void RimFracture::clearCachedNonDarcyProperties() m_cachedFractureProperties = NonDarcyData(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimFracture::isEnabled() const +{ + RimWellPathFractureCollection* fractureCollection = nullptr; + this->firstAncestorOrThisOfTypeAsserted(fractureCollection); + return fractureCollection->isChecked() && isChecked(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFracture.h b/ApplicationCode/ProjectDataModel/Completions/RimFracture.h index 6f20a6cac1..72568c69c4 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFracture.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimFracture.h @@ -129,6 +129,7 @@ public: friend class RimFractureTemplate; // RimWellPathCompletionsInterface overrides. + bool isEnabled() const override; RiaDefines::WellPathComponentType componentType() const override; QString componentLabel() const override; QString componentTypeLabel() const override; diff --git a/ApplicationCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.cpp b/ApplicationCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.cpp index 4d5320d1d9..9d79c4dc43 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.cpp @@ -49,14 +49,6 @@ RimNonDarcyPerforationParameters::RimNonDarcyPerforationParameters() CAF_PDM_InitField(&m_userDefinedDFactor, "UserDefinedDFactor", 1.0, "D Factor", "", "", ""); - CAF_PDM_InitField(&m_unitConstant, - "UnitConstant", - 1.0, - " Unit Constant (α)", - "", - "Unit:[cP*Day*m2/(Forch*mD*Sm3)]", - ""); - CAF_PDM_InitField(&m_gridPermeabilityScalingFactor, "GridPermeabilityScalingFactor", 1.0, @@ -65,7 +57,7 @@ RimNonDarcyPerforationParameters::RimNonDarcyPerforationParameters() "", ""); - CAF_PDM_InitField(&m_wellRadius, "WellRadius", 0.15, "Well Radius (rw) [m]", "", "", ""); + CAF_PDM_InitField(&m_wellRadius, "WellRadius", 0.108, "Well Radius (rw) [m]", "", "", ""); CAF_PDM_InitField(&m_relativeGasDensity, "RelativeGasDensity", @@ -117,14 +109,6 @@ double RimNonDarcyPerforationParameters::userDefinedDFactor() const return m_userDefinedDFactor; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RimNonDarcyPerforationParameters::unitConstant() const -{ - return m_unitConstant; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -210,7 +194,6 @@ void RimNonDarcyPerforationParameters::defineUiOrdering(QString uiConfigName, ca { { auto group = nonDarcyFlowGroup->addNewGroup("Parameters"); - group->add(&m_unitConstant); group->add(&m_gridPermeabilityScalingFactor); group->add(&m_wellRadius); group->add(&m_relativeGasDensity); diff --git a/ApplicationCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.h b/ApplicationCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.h index 7fb36af7ea..be92fdc7da 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.h @@ -40,7 +40,6 @@ public: NonDarcyFlowEnum nonDarcyFlowType() const; double userDefinedDFactor() const; - double unitConstant() const; double gridPermeabilityScalingFactor() const; double wellRadius() const; double relativeGasDensity() const; @@ -57,7 +56,6 @@ private: caf::PdmField> m_nonDarcyFlowType; caf::PdmField m_userDefinedDFactor; - caf::PdmField m_unitConstant; caf::PdmField m_gridPermeabilityScalingFactor; caf::PdmField m_wellRadius; caf::PdmField m_relativeGasDensity; diff --git a/ApplicationCode/ProjectDataModel/Completions/RimPerforationInterval.cpp b/ApplicationCode/ProjectDataModel/Completions/RimPerforationInterval.cpp index f6f0f44e2f..8ad18b95bb 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimPerforationInterval.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimPerforationInterval.cpp @@ -23,6 +23,7 @@ #include "RigCaseCellResultsData.h" #include "RigWellPath.h" +#include "RimPerforationCollection.h" #include "RimProject.h" #include "RimWellPath.h" #include "RimWellPathValve.h" @@ -232,6 +233,16 @@ std::vector RimPerforationInterval::valves() const return allValves; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPerforationInterval::isEnabled() const +{ + RimPerforationCollection* perforationCollection; + this->firstAncestorOrThisOfTypeAsserted(perforationCollection); + return perforationCollection->isChecked() && isChecked(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimPerforationInterval.h b/ApplicationCode/ProjectDataModel/Completions/RimPerforationInterval.h index 5492a24c21..3dfffc3459 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimPerforationInterval.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimPerforationInterval.h @@ -70,6 +70,7 @@ public: std::vector valves() const; // RimWellPathCompletionInterface overrides + bool isEnabled() const override; RiaDefines::WellPathComponentType componentType() const override; QString componentLabel() const override; QString componentTypeLabel() const override; diff --git a/ApplicationCode/ProjectDataModel/Completions/RimWellPathComponentInterface.h b/ApplicationCode/ProjectDataModel/Completions/RimWellPathComponentInterface.h index 0740de316b..950d3e0c84 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimWellPathComponentInterface.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimWellPathComponentInterface.h @@ -31,6 +31,7 @@ class RimWellPathComponentInterface { public: + virtual bool isEnabled() const = 0; virtual RiaDefines::WellPathComponentType componentType() const = 0; virtual QString componentLabel() const = 0; virtual QString componentTypeLabel() const = 0; diff --git a/ApplicationCode/ProjectDataModel/Completions/RimWellPathValve.cpp b/ApplicationCode/ProjectDataModel/Completions/RimWellPathValve.cpp index 9c11f7170f..8027fe538b 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimWellPathValve.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimWellPathValve.cpp @@ -103,6 +103,16 @@ std::vector RimWellPathValve::valveLocations() const return valveDepths; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimWellPathValve::isEnabled() const +{ + RimPerforationInterval* perforationInterval = nullptr; + this->firstAncestorOrThisOfType(perforationInterval); + return perforationInterval->isEnabled() && isChecked(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimWellPathValve.h b/ApplicationCode/ProjectDataModel/Completions/RimWellPathValve.h index 4eb848d57b..a33a2403bd 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimWellPathValve.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimWellPathValve.h @@ -46,6 +46,7 @@ public: std::vector valveLocations() const; // Overrides from RimWellPathCompletionInterface + bool isEnabled() const override; RiaDefines::WellPathComponentType componentType() const override; QString componentLabel() const override; QString componentTypeLabel() const override; diff --git a/ApplicationCode/ProjectDataModel/Rim3dWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/Rim3dWellLogExtractionCurve.cpp index 34c168c5c2..d36f5aa619 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dWellLogExtractionCurve.cpp @@ -138,7 +138,7 @@ QString Rim3dWellLogExtractionCurve::resultPropertyString() const QString name; if (eclipseCase) { - name = caf::Utils::makeValidFileBasename(m_eclipseResultDefinition->resultVariableUiName()); + name = caf::Utils::makeValidFileBasename(m_eclipseResultDefinition->resultVariableUiShortName()); } else if (geoMechCase) { diff --git a/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp index b495f5784b..1f75f6ca5b 100644 --- a/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationCode/ProjectDataModel/RimContourMapProjection.cpp @@ -658,8 +658,8 @@ void RimContourMapProjection::defineUiOrdering(QString uiConfigName, caf::PdmUiO { caf::PdmUiGroup* mainGroup = uiOrdering.addNewGroup("Projection Settings"); mainGroup->add(&m_relativeSampleSpacing); - mainGroup->add(&m_resultAggregation); mainGroup->add(&m_showContourLines); + mainGroup->add(&m_resultAggregation); caf::PdmUiGroup* weightingGroup = uiOrdering.addNewGroup("Mean Weighting Options"); weightingGroup->add(&m_weightByParameter); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 62d0628ee0..936aa73dbe 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -553,11 +553,11 @@ QList RimEclipseResultDefinition::calculateValueOptions( { if ( fieldNeedingOptions == &m_resultVariableUiField ) { - options.push_back(calcTimeOfFlightOptionItem()); + options.push_back(caf::PdmOptionItemInfo(timeOfFlightString(false), RIG_FLD_TOF_RESNAME)); if (m_phaseSelection() == RigFlowDiagResultAddress::PHASE_ALL) { options.push_back(caf::PdmOptionItemInfo("Tracer Cell Fraction (Sum)", RIG_FLD_CELL_FRACTION_RESNAME)); - options.push_back(calcMaxFractionTracerOptionItem()); + options.push_back(caf::PdmOptionItemInfo(maxFractionTracerString(false), RIG_FLD_MAX_FRACTION_TRACER_RESNAME)); options.push_back(caf::PdmOptionItemInfo("Injector Producer Communication", RIG_FLD_COMMUNICATION_RESNAME)); } } @@ -742,69 +742,7 @@ QString RimEclipseResultDefinition::resultVariableUiName() const { if (resultType() == RiaDefines::FLOW_DIAGNOSTICS) { - QString fullName; - - if (m_flowTracerSelectionMode() == FLOW_TR_BY_SELECTION) - { - RigFlowDiagResultAddress flowDiagRes = flowDiagResAddress(); - - bool allInjectors = injectorSelectionState() == ALL_SELECTED; - bool allProducers = producerSelectionState() == ALL_SELECTED; - - if (allInjectors && allProducers) - { - QString allTracersText = caf::AppEnum< FlowTracerSelectionType >::uiText(FLOW_TR_INJ_AND_PROD); - - fullName = QString::fromStdString(flowDiagResAddress().uiShortText()); - fullName += QString(" (%1)").arg(allTracersText); - } - else if (allInjectors) - { - QStringList fullTracerList; - QStringList listOfSelectedProducers; - QString allInjectorsText = caf::AppEnum< FlowTracerSelectionType >::uiText(FLOW_TR_INJECTORS); - for (const QString& producer : m_selectedProducerTracers()) - { - listOfSelectedProducers.push_back(producer); - } - fullTracerList.push_back(allInjectorsText); - if (!listOfSelectedProducers.empty()) - { - fullTracerList.push_back(listOfSelectedProducers.join(", ")); - } - fullName = QString::fromStdString(flowDiagResAddress().uiShortText()); - fullName += QString(" (%1)").arg(fullTracerList.join(", ")); - } - else if (allProducers) - { - QStringList fullTracerList; - QStringList listOfSelectedInjectors; - QString allProducersText = caf::AppEnum< FlowTracerSelectionType >::uiText(FLOW_TR_PRODUCERS); - for (const QString& injector : m_selectedInjectorTracers()) - { - listOfSelectedInjectors.push_back(injector); - } - fullTracerList.push_back(allProducersText); - if (!listOfSelectedInjectors.empty()) - { - fullTracerList.push_back(listOfSelectedInjectors.join(", ")); - } - - fullName = QString::fromStdString(flowDiagResAddress().uiShortText()); - fullName += QString(" (%1)").arg(fullTracerList.join(", ")); - } - else - { - fullName = QString::fromStdString(flowDiagResAddress().uiText()); - } - } - else - { - fullName = QString::fromStdString(flowDiagResAddress().uiShortText()); - fullName += QString(" (%1)").arg(m_flowTracerSelectionMode().uiText()); - } - - return fullName; + return flowDiagResUiText(false, 32); } return m_resultVariable(); @@ -817,16 +755,7 @@ QString RimEclipseResultDefinition::resultVariableUiShortName() const { if (resultType() == RiaDefines::FLOW_DIAGNOSTICS) { - QString candidate = resultVariableUiName(); - QString postfix = "...)"; - int stringSizeLimit = 32; - if (candidate.size() > stringSizeLimit + postfix.size()) - { - candidate = candidate.left(stringSizeLimit); - candidate += postfix; - } - - return candidate; + return flowDiagResUiText(true, 24); } return m_resultVariable(); @@ -1279,6 +1208,37 @@ bool RimEclipseResultDefinition::hasDualPorFractureResult() return false; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimEclipseResultDefinition::flowDiagResUiText(bool shortLabel, int maxTracerStringLength) const +{ + QString uiText = QString::fromStdString(flowDiagResAddress().variableName); + if (flowDiagResAddress().variableName == RIG_FLD_TOF_RESNAME) + { + uiText = timeOfFlightString(shortLabel); + } + else if (flowDiagResAddress().variableName == RIG_FLD_MAX_FRACTION_TRACER_RESNAME) + { + uiText = maxFractionTracerString(shortLabel); + } + + QString tracersString = selectedTracersString(); + + if (!tracersString.isEmpty()) + { + const QString postfix = "..."; + + if (tracersString.size() > maxTracerStringLength + postfix.size()) + { + tracersString = tracersString.left(maxTracerStringLength); + tracersString += postfix; + } + uiText += QString("\n%1").arg(tracersString); + } + return uiText; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1407,53 +1367,122 @@ QList RimEclipseResultDefinition::calcOptionsForSelected //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -caf::PdmOptionItemInfo RimEclipseResultDefinition::calcTimeOfFlightOptionItem() +QString RimEclipseResultDefinition::timeOfFlightString(bool shorter) const { + QString tofString; + bool multipleSelected = false; if (injectorSelectionState() != NONE_SELECTED && producerSelectionState() != NONE_SELECTED) { - return caf::PdmOptionItemInfo("Residence Time (Average)", RIG_FLD_TOF_RESNAME); + tofString = shorter ? "Res.Time" : "Residence Time"; + multipleSelected = true; } - else if (injectorSelectionState() == ONE_SELECTED && producerSelectionState() == NONE_SELECTED) + else if (injectorSelectionState() != NONE_SELECTED) { - return caf::PdmOptionItemInfo("Forward Time Of Flight", RIG_FLD_TOF_RESNAME); + tofString = shorter ? "Fwd.TOF" : "Forward Time Of Flight"; } - else if (injectorSelectionState() >= MULTIPLE_SELECTED && producerSelectionState() == NONE_SELECTED) + else if (producerSelectionState() != NONE_SELECTED) { - return caf::PdmOptionItemInfo("Forward Time Of Flight (Average)", RIG_FLD_TOF_RESNAME); + tofString = shorter ? "Rev.TOF" : "Reverse Time Of Flight"; } - else if (injectorSelectionState() == NONE_SELECTED && producerSelectionState() == ONE_SELECTED) + else { - return caf::PdmOptionItemInfo("Reverse Time Of Flight", RIG_FLD_TOF_RESNAME); + tofString = shorter ? "TOF" : "Time Of Flight"; } - else if (injectorSelectionState() == NONE_SELECTED && producerSelectionState() >= MULTIPLE_SELECTED) + + multipleSelected = multipleSelected || + injectorSelectionState() >= MULTIPLE_SELECTED || producerSelectionState() >= MULTIPLE_SELECTED; + + if (multipleSelected && !shorter) { - return caf::PdmOptionItemInfo("Reverse Time Of Flight (Average)", RIG_FLD_TOF_RESNAME); + tofString += " (Average)"; } - return caf::PdmOptionItemInfo("Time Of Flight", RIG_FLD_TOF_RESNAME); + return tofString; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -caf::PdmOptionItemInfo RimEclipseResultDefinition::calcMaxFractionTracerOptionItem() +QString RimEclipseResultDefinition::maxFractionTracerString(bool shorter) const { - if (injectorSelectionState() == ONE_SELECTED && producerSelectionState() == NONE_SELECTED) + QString mfString; + if (injectorSelectionState() >= ONE_SELECTED && producerSelectionState() == NONE_SELECTED) { - return caf::PdmOptionItemInfo("Flooding Region", RIG_FLD_MAX_FRACTION_TRACER_RESNAME); + mfString = shorter ? "FloodReg" : "Flooding Region"; + if (injectorSelectionState() >= MULTIPLE_SELECTED) + mfString += "s"; } - else if (injectorSelectionState() >= MULTIPLE_SELECTED && producerSelectionState() == NONE_SELECTED) + else if (injectorSelectionState() == NONE_SELECTED && producerSelectionState() >= ONE_SELECTED) { - return caf::PdmOptionItemInfo("Flooding Regions", RIG_FLD_MAX_FRACTION_TRACER_RESNAME); + mfString = shorter ? "DrainReg" : "Drainage Region"; + if (producerSelectionState() >= MULTIPLE_SELECTED) + mfString += "s"; } - else if (injectorSelectionState() == NONE_SELECTED && producerSelectionState() == ONE_SELECTED) + else { - return caf::PdmOptionItemInfo("Drainage Region", RIG_FLD_MAX_FRACTION_TRACER_RESNAME); + mfString = shorter ? "Drain&FloodReg" : "Drainage/Flooding Regions"; } - else if (injectorSelectionState() == NONE_SELECTED && producerSelectionState() >= MULTIPLE_SELECTED) + return mfString; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimEclipseResultDefinition::selectedTracersString() const +{ + QStringList fullTracersList; + + FlowTracerSelectionState injectorState = injectorSelectionState(); + FlowTracerSelectionState producerState = producerSelectionState(); + + if (injectorState == ALL_SELECTED && producerState == ALL_SELECTED) { - return caf::PdmOptionItemInfo("Drainage Regions", RIG_FLD_MAX_FRACTION_TRACER_RESNAME); + fullTracersList += caf::AppEnum::uiText(FLOW_TR_INJ_AND_PROD); } - return caf::PdmOptionItemInfo("Drainage/Flooding Regions", RIG_FLD_MAX_FRACTION_TRACER_RESNAME); + else + { + if (injectorState == ALL_SELECTED) + { + fullTracersList += caf::AppEnum::uiText(FLOW_TR_INJECTORS); + } + + if (producerState == ALL_SELECTED) + { + fullTracersList += caf::AppEnum::uiText(FLOW_TR_PRODUCERS); + } + + if (injectorSelectionState() == ONE_SELECTED || injectorSelectionState() == MULTIPLE_SELECTED) + { + QStringList listOfSelectedInjectors; + for (const QString& injector : m_selectedInjectorTracers()) + { + listOfSelectedInjectors.push_back(injector); + } + if (!listOfSelectedInjectors.empty()) + { + fullTracersList += listOfSelectedInjectors.join(", "); + } + } + + if (producerSelectionState() == ONE_SELECTED || producerSelectionState() == MULTIPLE_SELECTED) + { + QStringList listOfSelectedProducers; + for (const QString& producer : m_selectedProducerTracers()) + { + listOfSelectedProducers.push_back(producer); + } + if (!listOfSelectedProducers.empty()) + { + fullTracersList.push_back(listOfSelectedProducers.join(", ")); + } + } + } + + QString tracersText; + if (!fullTracersList.empty()) + { + tracersText = fullTracersList.join(", "); + } + return tracersText; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h index 651303a3d1..41e4db4dcb 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h @@ -163,15 +163,19 @@ private: bool operator()(const QString& lhs, const QString& rhs) const; }; -private: +private: void assignFlowSolutionFromCase(); bool hasDualPorFractureResult(); + QString flowDiagResUiText(bool shortLabel, int maxTracerStringLength = std::numeric_limits::max()) const; + QList calcOptionsForVariableUiFieldStandard(); QList calcOptionsForSelectedTracerField(bool injector); - caf::PdmOptionItemInfo calcTimeOfFlightOptionItem(); - caf::PdmOptionItemInfo calcMaxFractionTracerOptionItem(); + QString timeOfFlightString(bool shorter) const; + QString maxFractionTracerString(bool shorter) const; + + QString selectedTracersString() const; void changedTracerSelectionField(bool injector); QStringList getResultNamesForCurrentUiResultType(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index d9caf38c87..abaec62c4f 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -1139,7 +1139,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, if (resultColors->hasResult() && resultColors->legendConfig()->showLegend()) { - resultColors->legendConfig()->setTitle(legendLabel + resultColors->resultVariableUiShortName()); + resultColors->legendConfig()->setTitle(legendLabel + resultColors->resultVariableUiName()); m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->titledOverlayFrame()); } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index 4e29ea03ca..20f2df7036 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -794,7 +794,7 @@ QString RimWellLogExtractionCurve::wellLogChannelName() const QString name; if (eclipseCase) { - name = caf::Utils::makeValidFileBasename( m_eclipseResultDefinition->resultVariableUiName()); + name = caf::Utils::makeValidFileBasename( m_eclipseResultDefinition->resultVariableUiShortName()); } else if (geoMechCase) { diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index 9fba6caaea..09f1ebf484 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -1799,7 +1799,6 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot() m_wellPathAttributePlotObjects.push_back(std::unique_ptr(new RiuWellPathComponentPlotItem(wellPathAttributeSource()))); } - if (m_showWellPathAttributes) { if (m_wellPathAttributeCollection) @@ -1813,13 +1812,16 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot() std::set attributesAssignedToLegend; for (RimWellPathAttribute* attribute : attributes) { - std::unique_ptr plotItem(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), attribute)); - QString legendTitle = plotItem->legendTitle(); - bool contributeToLegend = m_wellPathAttributesInLegend() && - !attributesAssignedToLegend.count(legendTitle); - plotItem->setContributeToLegend(contributeToLegend); - m_wellPathAttributePlotObjects.push_back(std::move(plotItem)); - attributesAssignedToLegend.insert(legendTitle); + if (attribute->isEnabled()) + { + std::unique_ptr plotItem(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), attribute)); + QString legendTitle = plotItem->legendTitle(); + bool contributeToLegend = m_wellPathAttributesInLegend() && + !attributesAssignedToLegend.count(legendTitle); + plotItem->setContributeToLegend(contributeToLegend); + m_wellPathAttributePlotObjects.push_back(std::move(plotItem)); + attributesAssignedToLegend.insert(legendTitle); + } } } } @@ -1831,13 +1833,16 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot() std::set completionsAssignedToLegend; for (const RimWellPathComponentInterface* completion : allCompletions) { - std::unique_ptr plotItem(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), completion)); - QString legendTitle = plotItem->legendTitle(); - bool contributeToLegend = m_wellPathCompletionsInLegend() && - !completionsAssignedToLegend.count(legendTitle); - plotItem->setContributeToLegend(contributeToLegend); - m_wellPathAttributePlotObjects.push_back(std::move(plotItem)); - completionsAssignedToLegend.insert(legendTitle); + if (completion->isEnabled()) + { + std::unique_ptr plotItem(new RiuWellPathComponentPlotItem(wellPathAttributeSource(), completion)); + QString legendTitle = plotItem->legendTitle(); + bool contributeToLegend = m_wellPathCompletionsInLegend() && + !completionsAssignedToLegend.count(legendTitle); + plotItem->setContributeToLegend(contributeToLegend); + m_wellPathAttributePlotObjects.push_back(std::move(plotItem)); + completionsAssignedToLegend.insert(legendTitle); + } } } diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.cpp b/ApplicationCode/ProjectDataModel/RimWellPath.cpp index bfb95add8a..f5fdce2345 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPath.cpp @@ -188,6 +188,14 @@ double RimWellPath::wellPathRadiusScaleFactor() const return m_wellPathRadiusScaleFactor(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimWellPath::isEnabled() const +{ + return m_showWellPath; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellPath.h b/ApplicationCode/ProjectDataModel/RimWellPath.h index d0e6af00b8..4c5ccde6a4 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPath.h +++ b/ApplicationCode/ProjectDataModel/RimWellPath.h @@ -124,6 +124,7 @@ public: // RimWellPathComponentInterface overrides + bool isEnabled() const override; RiaDefines::WellPathComponentType componentType() const override; QString componentLabel() const override; QString componentTypeLabel() const override; diff --git a/ApplicationCode/ProjectDataModel/RimWellPathAttribute.cpp b/ApplicationCode/ProjectDataModel/RimWellPathAttribute.cpp index 23bfff2eaf..31e99f5c8d 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathAttribute.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathAttribute.cpp @@ -91,6 +91,16 @@ void RimWellPathAttribute::setDepthsFromWellPath(const RimWellPath* wellPath) m_endMD = wellPath->wellPathGeometry()->measureDepths().back(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimWellPathAttribute::isEnabled() const +{ + RimWellPathAttributeCollection* collection = nullptr; + this->firstAncestorOrThisOfTypeAsserted(collection); + return collection->isChecked(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -217,12 +227,16 @@ void RimWellPathAttribute::fieldChangedByUi(const caf::PdmFieldHandle* changedFi this->firstAncestorOrThisOfTypeAsserted(wellPath); m_startMD = wellPath->wellPathGeometry()->measureDepths().front(); } + else if (m_type() == RiaDefines::PACKER) + { + m_endMD = m_startMD + 2; + } } if (changedField == &m_startMD) { if (m_type() == RiaDefines::PACKER) { - m_endMD = m_startMD + 50; + m_endMD = m_startMD + 2; } } diff --git a/ApplicationCode/ProjectDataModel/RimWellPathAttribute.h b/ApplicationCode/ProjectDataModel/RimWellPathAttribute.h index 509c88b921..effd3e18c1 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathAttribute.h +++ b/ApplicationCode/ProjectDataModel/RimWellPathAttribute.h @@ -46,6 +46,7 @@ public: void setDepthsFromWellPath(const RimWellPath* wellPath); // Overrides from RimWellPathCompletionInterface + bool isEnabled() const override; RiaDefines::WellPathComponentType componentType() const override; QString componentLabel() const override; QString componentTypeLabel() const override; @@ -54,9 +55,9 @@ public: double endMD() const override; private: - bool isDiameterSupported() const; + bool isDiameterSupported() const; QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; - static QString generateInchesLabel(double diameter); + static QString generateInchesLabel(double diameter); void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; diff --git a/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.cpp b/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.cpp index e5d8364ece..4e272eb66b 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.cpp @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RimWellPathAttributeCollection.h" +#include "RimProject.h" #include "RimWellPathAttribute.h" #include "RimWellLogTrack.h" @@ -37,6 +38,7 @@ RimWellPathAttributeCollection::RimWellPathAttributeCollection() m_attributes.uiCapability()->setUiEditorTypeName(caf::PdmUiTableViewEditor::uiEditorTypeName()); m_attributes.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); m_attributes.uiCapability()->setCustomContextMenuEnabled(true); + this->setName("Casing Design"); } //-------------------------------------------------------------------------------------------------- @@ -157,3 +159,20 @@ void RimWellPathAttributeCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering { uiTreeOrdering.skipRemainingChildren(true); } + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathAttributeCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue) +{ + if (changedField == this->objectToggleField()) + { + RimProject* proj; + this->firstAncestorOrThisOfTypeAsserted(proj); + proj->scheduleCreateDisplayModelAndRedrawAllViews(); + this->updateAllReferringTracks(); + } +} diff --git a/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.h b/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.h index 0fce98c610..48e0615aea 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.h +++ b/ApplicationCode/ProjectDataModel/RimWellPathAttributeCollection.h @@ -17,6 +17,8 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once +#include "RimCheckableNamedObject.h" + #include "cafAppEnum.h" #include "cvfBase.h" #include "cafPdmChildArrayField.h" @@ -25,7 +27,7 @@ class RimWellPathAttribute; -class RimWellPathAttributeCollection : public caf::PdmObject +class RimWellPathAttributeCollection : public RimCheckableNamedObject { CAF_PDM_HEADER_INIT; public: @@ -37,11 +39,13 @@ public: void insertAttribute(RimWellPathAttribute* insertBefore, RimWellPathAttribute* attribute); void deleteAttribute(RimWellPathAttribute* attributeToDelete); void deleteAllAttributes(); + protected: void defineCustomContextMenu(const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget) override; void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override; + void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; private: caf::PdmChildArrayField m_attributes; diff --git a/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp b/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp index 1917ec4b28..77fad44b56 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp @@ -31,8 +31,8 @@ RimWellPathTarget::RimWellPathTarget() CAF_PDM_InitField(&m_isEnabled, "IsEnabled", true, "", "", "", ""); //m_targetType.uiCapability()->setUiHidden(true); CAF_PDM_InitFieldNoDefault(&m_targetPoint, "TargetPoint", "Point", "", "", ""); - CAF_PDM_InitField(&m_dogleg1, "Dogleg1", 3.0, "DL in", "", "", ""); - CAF_PDM_InitField(&m_dogleg2, "Dogleg2", 3.0, "DL out", "", "", ""); + CAF_PDM_InitField(&m_dogleg1, "Dogleg1", 3.0, "DL in", "", "[deg/30m]", ""); + CAF_PDM_InitField(&m_dogleg2, "Dogleg2", 3.0, "DL out", "", "[deg/30m]", ""); CAF_PDM_InitFieldNoDefault(&m_targetType, "TargetType", "Type", "", "", ""); m_targetType.uiCapability()->setUiHidden(true); CAF_PDM_InitField(&m_hasTangentConstraintUiField, "HasTangentConstraint", false, "Dir", "", "", ""); diff --git a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp index 42f26f00a9..bf147f136b 100644 --- a/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigGeoMechWellLogExtractor.cpp @@ -113,7 +113,7 @@ float RigGeoMechWellLogExtractor::calculatePorePressureInSegment(int64_t interse double porePressure = hydroStaticPorePressureBar; // 1: Try pore pressure from the grid - if (porePressure == hydroStaticPorePressureBar && averageSegmentPorePressureBar != std::numeric_limits::infinity()) + if (porePressure == hydroStaticPorePressureBar && averageSegmentPorePressureBar > 0.0) { porePressure = averageSegmentPorePressureBar; } @@ -137,6 +137,8 @@ float RigGeoMechWellLogExtractor::calculatePorePressureInSegment(int64_t interse porePressure = pascalToBar(poreElementPressuresPascal[elmIdx]); } // 4: If no pore-pressure was found, the default value of hydrostatic pore pressure is used. + + CVF_ASSERT(porePressure >= 0.0); return porePressure; } diff --git a/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.cpp b/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.cpp index 1992f52044..9d2e225362 100644 --- a/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.cpp +++ b/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.cpp @@ -18,9 +18,6 @@ #include "RigTransmissibilityEquations.h" -#include "cvfBase.h" -#include "cvfMath.h" - #include #include @@ -60,19 +57,26 @@ double RigTransmissibilityEquations::totalConnectionFactor(double transX, double //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigTransmissibilityEquations::totalPermeability(const double permx, const double permy, const double permz) +double RigTransmissibilityEquations::totalPermeability(double cellPermX, + double cellPermY, + double cellPermZ, + const cvf::Vec3d& internalCellLengths, + double lateralNtg, + double ntg) { - const double kx = cvf::Math::sqrt(permy * permz); - const double ky = cvf::Math::sqrt(permx * permz); - const double kz = cvf::Math::sqrt(permy * permx); + // Compute kh for each local grid cell axis + // Use permeability values for the two other axis + double khx = sqrt(cellPermY * cellPermZ) * internalCellLengths.x() * lateralNtg; + double khy = sqrt(cellPermX * cellPermZ) * internalCellLengths.y() * lateralNtg; + double khz = sqrt(cellPermX * cellPermY) * internalCellLengths.z() * ntg; - const double totalPerm = cvf::Math::sqrt(kx * kx + ky * ky + kz * kz); + const double totalKh = cvf::Math::sqrt(khx * khx + khy * khy + khz * khz); - return totalPerm; + return totalKh; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- double RigTransmissibilityEquations::permeability(const double conductivity, const double width) { diff --git a/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.h b/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.h index ba5dfc9029..9601af55e0 100644 --- a/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.h +++ b/ApplicationCode/ReservoirDataModel/RigTransmissibilityEquations.h @@ -18,6 +18,10 @@ #pragma once +#include "cvfBase.h" +#include "cvfMath.h" +#include "cvfVector3.h" + class RigTransmissibilityEquations { public: @@ -34,7 +38,12 @@ public: static double totalConnectionFactor(double transX, double transY, double transZ); - static double totalPermeability(const double permx, const double permy, const double permz); + static double totalPermeability(double cellPermX, + double cellPermY, + double cellPermZ, + const cvf::Vec3d& internalCellLengths, + double lateralNtg, + double ntg); static double permeability(const double conductivity, const double width); diff --git a/Fwk/AppFwk/CommonCode/cafUtils.cpp b/Fwk/AppFwk/CommonCode/cafUtils.cpp index 25a0927946..e531f34338 100644 --- a/Fwk/AppFwk/CommonCode/cafUtils.cpp +++ b/Fwk/AppFwk/CommonCode/cafUtils.cpp @@ -143,6 +143,7 @@ QString Utils::makeValidFileBasename(const QString& fileBasenameCandidate) cleanBasename.replace("|", "_"); cleanBasename.replace("?", "_"); cleanBasename.replace("*", "_"); + cleanBasename.replace("\n", "_"); cleanBasename.replace(QRegExp("_+"), "_");