diff --git a/ApplicationCode/Commands/CompletionExportCommands/CMakeLists_files.cmake b/ApplicationCode/Commands/CompletionExportCommands/CMakeLists_files.cmake index ba757cea64..a481bb6bcc 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/CMakeLists_files.cmake +++ b/ApplicationCode/Commands/CompletionExportCommands/CMakeLists_files.cmake @@ -15,6 +15,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicMswCompletions.h ${CMAKE_CURRENT_LIST_DIR}/RicMswExportInfo.h ${CMAKE_CURRENT_LIST_DIR}/RicMswSegment.h ${CMAKE_CURRENT_LIST_DIR}/RicMswSubSegment.h +${CMAKE_CURRENT_LIST_DIR}/RicMswValveAccumulators.h ${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureTextReportFeatureImpl.h ${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureReportItem.h ${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForTemporaryLgrsFeature.h @@ -37,6 +38,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicMswCompletions.cpp ${CMAKE_CURRENT_LIST_DIR}/RicMswExportInfo.cpp ${CMAKE_CURRENT_LIST_DIR}/RicMswSegment.cpp ${CMAKE_CURRENT_LIST_DIR}/RicMswSubSegment.cpp +${CMAKE_CURRENT_LIST_DIR}/RicMswValveAccumulators.cpp ${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureTextReportFeatureImpl.cpp ${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureReportItem.cpp ${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForTemporaryLgrsFeature.cpp diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicMswCompletions.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicMswCompletions.cpp index 3f6cb7ce08..2abaa3fb2a 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicMswCompletions.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicMswCompletions.cpp @@ -17,7 +17,10 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RicMswCompletions.h" + #include "RicMswSubSegment.h" + +#include "RimWellPathValve.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -97,8 +100,54 @@ void RicMswCompletion::setLabel(const QString& label) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RicMswICD::RicMswICD(const QString& label, size_t index /*= cvf::UNDEFINED_SIZE_T*/, int branchNumber /*= cvf::UNDEFINED_INT*/) +RicMswFracture::RicMswFracture(const QString& label, + size_t index /*= cvf::UNDEFINED_SIZE_T*/, + int branchNumber /*= cvf::UNDEFINED_INT*/) : RicMswCompletion(label, index, branchNumber) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigCompletionData::CompletionType RicMswFracture::completionType() const +{ + return RigCompletionData::FRACTURE; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicMswPerforation::RicMswPerforation(const QString& label, + size_t index /*= cvf::UNDEFINED_SIZE_T*/, + int branchNumber /*= cvf::UNDEFINED_INT*/) + : RicMswCompletion(label, index, branchNumber) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigCompletionData::CompletionType RicMswPerforation::completionType() const +{ + return RigCompletionData::PERFORATION; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicMswValve::RicMswValve(const QString& label, + size_t index /*= cvf::UNDEFINED_SIZE_T*/, + int branchNumber /*= cvf::UNDEFINED_INT*/) + : RicMswCompletion(label, index, branchNumber) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicMswICD::RicMswICD(const QString& label, size_t index /*= cvf::UNDEFINED_SIZE_T*/, int branchNumber /*= cvf::UNDEFINED_INT*/) + : RicMswValve(label, index, branchNumber) , m_flowCoefficient(0.0) , m_area(0.0) { @@ -154,42 +203,6 @@ RigCompletionData::CompletionType RicMswFishbonesICD::completionType() const return RigCompletionData::FISHBONES_ICD; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RicMswFracture::RicMswFracture(const QString& label, - size_t index /*= cvf::UNDEFINED_SIZE_T*/, - int branchNumber /*= cvf::UNDEFINED_INT*/) - : RicMswCompletion(label, index, branchNumber) -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RigCompletionData::CompletionType RicMswFracture::completionType() const -{ - return RigCompletionData::FRACTURE; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RicMswPerforation::RicMswPerforation(const QString& label, - size_t index /*= cvf::UNDEFINED_SIZE_T*/, - int branchNumber /*= cvf::UNDEFINED_INT*/) - : RicMswCompletion(label, index, branchNumber) -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RigCompletionData::CompletionType RicMswPerforation::completionType() const -{ - return RigCompletionData::PERFORATION; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -207,5 +220,3 @@ RigCompletionData::CompletionType RicMswPerforationICD::completionType() const { return RigCompletionData::PERFORATION_ICD; } - - diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicMswCompletions.h b/ApplicationCode/Commands/CompletionExportCommands/RicMswCompletions.h index 771f66b3ae..18874a6a6b 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicMswCompletions.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicMswCompletions.h @@ -27,6 +27,8 @@ #include #include +class RimWellPathValve; + //================================================================================================== /// //================================================================================================== @@ -70,7 +72,37 @@ public: //================================================================================================== /// //================================================================================================== -class RicMswICD : public RicMswCompletion +class RicMswFracture : public RicMswCompletion +{ +public: + RicMswFracture(const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT); + RigCompletionData::CompletionType completionType() const override; +}; + +//================================================================================================== +/// +//================================================================================================== +class RicMswPerforation : public RicMswCompletion +{ +public: + RicMswPerforation(const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT); + RigCompletionData::CompletionType completionType() const override; +}; + +//================================================================================================== +/// +//================================================================================================== +class RicMswValve : public RicMswCompletion +{ +public: + RicMswValve(const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT); + virtual ~RicMswValve() {} +}; + +//================================================================================================== +/// +//================================================================================================== +class RicMswICD : public RicMswValve { public: RicMswICD(const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT); @@ -93,26 +125,6 @@ public: RigCompletionData::CompletionType completionType() const override; }; -//================================================================================================== -/// -//================================================================================================== -class RicMswFracture : public RicMswCompletion -{ -public: - RicMswFracture(const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT); - RigCompletionData::CompletionType completionType() const override; -}; - -//================================================================================================== -/// -//================================================================================================== -class RicMswPerforation : public RicMswCompletion -{ -public: - RicMswPerforation(const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT); - RigCompletionData::CompletionType completionType() const override; -}; - //================================================================================================== /// //================================================================================================== @@ -122,5 +134,3 @@ public: RicMswPerforationICD(const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT); RigCompletionData::CompletionType completionType() const override; }; - - diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicMswValveAccumulators.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicMswValveAccumulators.cpp new file mode 100644 index 0000000000..14159cf96d --- /dev/null +++ b/ApplicationCode/Commands/CompletionExportCommands/RicMswValveAccumulators.cpp @@ -0,0 +1,42 @@ +#include "RicMswValveAccumulators.h" + +#include "RicMswCompletions.h" + +#include "RimWellPathValve.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicMswICDAccumulator::RicMswICDAccumulator(RiaEclipseUnitTools::UnitSystem unitSystem) + : RicMswValveAccumulator(unitSystem) + , m_areaSum(0.0) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicMswICDAccumulator::accumulateValveParameters(const RimWellPathValve* wellPathValve, double contributionFraction) +{ + double icdOrificeRadius = wellPathValve->orificeDiameter(m_unitSystem) / 2; + double icdArea = icdOrificeRadius * icdOrificeRadius * cvf::PI_D; + + m_areaSum += icdArea * contributionFraction; + m_coefficientCalculator.addValueAndWeight(wellPathValve->flowCoefficient(), icdArea * contributionFraction); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicMswICDAccumulator::applyToSuperValve(std::shared_ptr valve) +{ + std::shared_ptr icd = std::dynamic_pointer_cast(valve); + CVF_ASSERT(icd); + icd->setArea(m_areaSum); + if (m_coefficientCalculator.validAggregatedWeight()) + { + icd->setFlowCoefficient(m_coefficientCalculator.weightedMean()); + } +} + + diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicMswValveAccumulators.h b/ApplicationCode/Commands/CompletionExportCommands/RicMswValveAccumulators.h new file mode 100644 index 0000000000..2b11a28108 --- /dev/null +++ b/ApplicationCode/Commands/CompletionExportCommands/RicMswValveAccumulators.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2018 Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#pragma once + +#include "RiaEclipseUnitTools.h" +#include "RiaWeightedMeanCalculator.h" + +#include + +class RimWellPathValve; +class RicMswValve; + +//================================================================================================== +/// +//================================================================================================== +class RicMswValveAccumulator +{ +public: + RicMswValveAccumulator(RiaEclipseUnitTools::UnitSystem unitSystem) : m_unitSystem(unitSystem) {} + virtual void accumulateValveParameters(const RimWellPathValve* wellPathValve, double contributionFraction) = 0; + virtual void applyToSuperValve(std::shared_ptr valve) = 0; + +protected: + RiaEclipseUnitTools::UnitSystem m_unitSystem; +}; + +//================================================================================================== +/// +//================================================================================================== +class RicMswICDAccumulator : public RicMswValveAccumulator +{ +public: + RicMswICDAccumulator(RiaEclipseUnitTools::UnitSystem unitSystem); + void accumulateValveParameters(const RimWellPathValve* wellPathValve, double contributionFraction) override; + void applyToSuperValve(std::shared_ptr valve) override; + +private: + RiaWeightedMeanCalculator m_coefficientCalculator; + double m_areaSum; +}; + + diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp index b18baf6cc8..a24cf6037c 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp @@ -24,6 +24,7 @@ #include "RicExportCompletionDataSettingsUi.h" #include "RicExportFractureCompletionsImpl.h" #include "RicMswExportInfo.h" +#include "RicMswValveAccumulators.h" #include "RicWellPathExportCompletionsFileTools.h" #include "RifEclipseDataTableFormatter.h" @@ -1055,10 +1056,10 @@ void RicWellPathExportMswCompletionsImpl::assignValveContributionsToSuperValves( ValveContributionMap assignedRegularValves; for (std::shared_ptr segment : mainBoreSegments) { - std::shared_ptr superValve; + std::shared_ptr superValve; for (auto completion : segment->completions()) { - std::shared_ptr valve = std::dynamic_pointer_cast(completion); + std::shared_ptr valve = std::dynamic_pointer_cast(completion); if (valve) { superValve = valve; @@ -1068,8 +1069,11 @@ void RicWellPathExportMswCompletionsImpl::assignValveContributionsToSuperValves( if (!superValve) continue; - double totalIcdArea = 0.0; - RiaWeightedMeanCalculator coeffMeanCalc; + std::shared_ptr accumulator; + if (std::dynamic_pointer_cast(superValve)) + { + accumulator.reset(new RicMswICDAccumulator(unitSystem)); + } for (const RimPerforationInterval* interval : perforationIntervals) { @@ -1086,21 +1090,17 @@ void RicWellPathExportMswCompletionsImpl::assignValveContributionsToSuperValves( double overlapEnd = std::min(valveSegment.second, segment->endMD()); double overlap = std::max(0.0, overlapEnd - overlapStart); - if (overlap > 0.0) + if (overlap > 0.0 && accumulator) { assignedRegularValves[superValve].insert(std::make_pair(valve, nSubValve)); - double icdOrificeRadius = valve->orificeDiameter(unitSystem) / 2; - double icdArea = icdOrificeRadius * icdOrificeRadius * cvf::PI_D * overlap / valveSegmentLength; - totalIcdArea += icdArea; - coeffMeanCalc.addValueAndWeight(valve->flowCoefficient(), icdArea); + accumulator->accumulateValveParameters(valve, overlap / valveSegmentLength); } } } } - superValve->setArea(totalIcdArea); - if (coeffMeanCalc.validAggregatedWeight()) + if (superValve && accumulator) { - superValve->setFlowCoefficient(coeffMeanCalc.weightedMean()); + accumulator->applyToSuperValve(superValve); } }