mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3850 Implement calculation of AICD length
This commit is contained in:
@@ -271,6 +271,22 @@ void RicMswPerforationAICD::setIsOpen(bool deviceOpen)
|
||||
m_deviceOpen = deviceOpen;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RicMswPerforationAICD::length() const
|
||||
{
|
||||
return m_length;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicMswPerforationAICD::setLength(double length)
|
||||
{
|
||||
m_length = length;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -146,10 +146,12 @@ public:
|
||||
RicMswPerforationAICD(const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT);
|
||||
RigCompletionData::CompletionType completionType() const override;
|
||||
|
||||
bool isValid() const;
|
||||
void setIsValid(bool valid);
|
||||
bool isOpen() const;
|
||||
void setIsOpen(bool deviceOpen);
|
||||
bool isValid() const;
|
||||
void setIsValid(bool valid);
|
||||
bool isOpen() const;
|
||||
void setIsOpen(bool deviceOpen);
|
||||
double length() const;
|
||||
void setLength(double length);
|
||||
|
||||
const std::array<double, AICD_NUM_PARAMS>& values() const;
|
||||
std::array<double, AICD_NUM_PARAMS>& values();
|
||||
@@ -158,4 +160,5 @@ private:
|
||||
bool m_valid;
|
||||
bool m_deviceOpen;
|
||||
std::array<double, AICD_NUM_PARAMS> m_parameters;
|
||||
double m_length;
|
||||
};
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "RicMswCompletions.h"
|
||||
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimWellPathValve.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -35,7 +36,7 @@ RicMswICDAccumulator::RicMswICDAccumulator(RiaEclipseUnitTools::UnitSystem unitS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicMswICDAccumulator::accumulateValveParameters(const RimWellPathValve* wellPathValve, double contributionFraction)
|
||||
bool RicMswICDAccumulator::accumulateValveParameters(const RimWellPathValve* wellPathValve, size_t subValve, double contributionFraction)
|
||||
{
|
||||
CVF_ASSERT(wellPathValve);
|
||||
if (wellPathValve->componentType() == RiaDefines::ICV || wellPathValve->componentType() == RiaDefines::ICD)
|
||||
@@ -75,7 +76,7 @@ RicMswAICDAccumulator::RicMswAICDAccumulator(RiaEclipseUnitTools::UnitSystem uni
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicMswAICDAccumulator::accumulateValveParameters(const RimWellPathValve* wellPathValve, double contributionFraction)
|
||||
bool RicMswAICDAccumulator::accumulateValveParameters(const RimWellPathValve* wellPathValve, size_t subValve, double contributionFraction)
|
||||
{
|
||||
CVF_ASSERT(wellPathValve);
|
||||
if (wellPathValve->componentType() == RiaDefines::AICD)
|
||||
@@ -93,6 +94,18 @@ bool RicMswAICDAccumulator::accumulateValveParameters(const RimWellPathValve* we
|
||||
m_meanCalculators[i].addValueAndWeight(values[i], contributionFraction);
|
||||
}
|
||||
}
|
||||
std::pair<double, double> valveSegment = wellPathValve->valveSegments()[subValve];
|
||||
double valveSegmentLength = std::fabs(valveSegment.second - valveSegment.first);
|
||||
const RimPerforationInterval* perfInterval = nullptr;
|
||||
wellPathValve->firstAncestorOrThisOfTypeAsserted(perfInterval);
|
||||
double perfIntervalLength = std::fabs(perfInterval->endMD() - perfInterval->startMD());
|
||||
double lengthFraction = 1.0;
|
||||
if (perfIntervalLength > 1.0e-8)
|
||||
{
|
||||
lengthFraction = valveSegmentLength / perfIntervalLength;
|
||||
}
|
||||
|
||||
m_lengthCalculator.addValueAndWeight(lengthFraction, contributionFraction);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -123,6 +136,10 @@ void RicMswAICDAccumulator::applyToSuperValve(std::shared_ptr<RicMswValve> valve
|
||||
}
|
||||
aicd->setIsValid(m_valid);
|
||||
aicd->setIsOpen(m_deviceOpen);
|
||||
if (m_lengthCalculator.validAggregatedWeight())
|
||||
{
|
||||
aicd->setLength(m_lengthCalculator.weightedMean());
|
||||
}
|
||||
aicd->values() = values;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicMswValveAccumulator
|
||||
{
|
||||
public:
|
||||
RicMswValveAccumulator(RiaEclipseUnitTools::UnitSystem unitSystem) : m_unitSystem(unitSystem) {}
|
||||
virtual bool accumulateValveParameters(const RimWellPathValve* wellPathValve, double contributionFraction) = 0;
|
||||
virtual bool accumulateValveParameters(const RimWellPathValve* wellPathValve, size_t subValve, double contributionFraction) = 0;
|
||||
virtual void applyToSuperValve(std::shared_ptr<RicMswValve> valve) = 0;
|
||||
|
||||
protected:
|
||||
@@ -48,7 +48,7 @@ class RicMswICDAccumulator : public RicMswValveAccumulator
|
||||
{
|
||||
public:
|
||||
RicMswICDAccumulator(RiaEclipseUnitTools::UnitSystem unitSystem);
|
||||
bool accumulateValveParameters(const RimWellPathValve* wellPathValve, double contributionFraction) override;
|
||||
bool accumulateValveParameters(const RimWellPathValve* wellPathValve, size_t subValve, double contributionFraction) override;
|
||||
void applyToSuperValve(std::shared_ptr<RicMswValve> valve) override;
|
||||
|
||||
private:
|
||||
@@ -63,11 +63,12 @@ class RicMswAICDAccumulator : public RicMswValveAccumulator
|
||||
{
|
||||
public:
|
||||
RicMswAICDAccumulator(RiaEclipseUnitTools::UnitSystem unitSystem);
|
||||
bool accumulateValveParameters(const RimWellPathValve* wellPathValve, double contributionFraction) override;
|
||||
bool accumulateValveParameters(const RimWellPathValve* wellPathValve, size_t subValve, double contributionFraction) override;
|
||||
void applyToSuperValve(std::shared_ptr<RicMswValve> valve) override;
|
||||
|
||||
private:
|
||||
bool m_valid;
|
||||
bool m_deviceOpen;
|
||||
std::array<RiaWeightedMeanCalculator<double>, AICD_NUM_PARAMS> m_meanCalculators;
|
||||
RiaWeightedMeanCalculator<double> m_lengthCalculator;
|
||||
};
|
||||
@@ -693,20 +693,20 @@ void RicWellPathExportMswCompletionsImpl::generateWsegAicdTable(RifEclipseDataTa
|
||||
{
|
||||
formatter.keyword("WSEGAICD");
|
||||
std::vector<RifEclipseOutputTableColumn> header = {
|
||||
RifEclipseOutputTableColumn("Well"),
|
||||
RifEclipseOutputTableColumn("Seg1"),
|
||||
RifEclipseOutputTableColumn("Seg2"),
|
||||
RifEclipseOutputTableColumn("str"),
|
||||
RifEclipseOutputTableColumn("len"),
|
||||
RifEclipseOutputTableColumn("rho"),
|
||||
RifEclipseOutputTableColumn("mu"),
|
||||
RifEclipseOutputTableColumn("Wl"),
|
||||
RifEclipseOutputTableColumn("S1"),
|
||||
RifEclipseOutputTableColumn("S2"),
|
||||
RifEclipseOutputTableColumn("St"),
|
||||
RifEclipseOutputTableColumn("Ln"),
|
||||
RifEclipseOutputTableColumn("Rho"),
|
||||
RifEclipseOutputTableColumn("Mu"),
|
||||
RifEclipseOutputTableColumn("#8"),
|
||||
RifEclipseOutputTableColumn("#9"),
|
||||
RifEclipseOutputTableColumn("#10"),
|
||||
RifEclipseOutputTableColumn("#11"),
|
||||
RifEclipseOutputTableColumn("x"),
|
||||
RifEclipseOutputTableColumn("y"),
|
||||
RifEclipseOutputTableColumn("o"),
|
||||
RifEclipseOutputTableColumn("O/C"),
|
||||
RifEclipseOutputTableColumn("#15"),
|
||||
RifEclipseOutputTableColumn("#16"),
|
||||
RifEclipseOutputTableColumn("#17"),
|
||||
@@ -731,7 +731,7 @@ void RicWellPathExportMswCompletionsImpl::generateWsegAicdTable(RifEclipseDataTa
|
||||
|
||||
std::array<double, AICD_NUM_PARAMS> values = aicd->values();
|
||||
formatter.add(values[AICD_STRENGTH]);
|
||||
formatter.add(values[AICD_LENGTH]); // 5
|
||||
formatter.add(aicd->length()); // 5
|
||||
formatter.add(values[AICD_DENSITY_CALIB_FLUID]);
|
||||
formatter.add(values[AICD_VISCOSITY_CALIB_FLUID]);
|
||||
formatter.addValueOrDefaultMarker(values[AICD_CRITICAL_WATER_IN_LIQUID_FRAC], RicMswExportInfo::defaultDoubleValue());
|
||||
@@ -1099,11 +1099,15 @@ void RicWellPathExportMswCompletionsImpl::assignSuperValveCompletions(
|
||||
|
||||
for (const RimPerforationInterval* interval : perforationIntervals)
|
||||
{
|
||||
if (!interval->isChecked()) continue;
|
||||
|
||||
std::vector<const RimWellPathValve*> perforationValves;
|
||||
interval->descendantsIncludingThisOfType(perforationValves);
|
||||
|
||||
for (const RimWellPathValve* valve : perforationValves)
|
||||
{
|
||||
if (!valve->isChecked()) continue;
|
||||
|
||||
bool isAicd = valve->componentType() == RiaDefines::AICD;
|
||||
for (size_t nSubValve = 0u; nSubValve < valve->valveLocations().size(); ++nSubValve)
|
||||
{
|
||||
@@ -1207,11 +1211,15 @@ void RicWellPathExportMswCompletionsImpl::assignValveContributionsToSuperValves(
|
||||
|
||||
for (const RimPerforationInterval* interval : perforationIntervals)
|
||||
{
|
||||
if (!interval->isChecked()) continue;
|
||||
|
||||
std::vector<const RimWellPathValve*> perforationValves;
|
||||
interval->descendantsIncludingThisOfType(perforationValves);
|
||||
|
||||
for (const RimWellPathValve* valve : perforationValves)
|
||||
{
|
||||
if (!valve->isChecked()) continue;
|
||||
|
||||
for (size_t nSubValve = 0u; nSubValve < valve->valveSegments().size(); ++nSubValve)
|
||||
{
|
||||
std::pair<double, double> valveSegment = valve->valveSegments()[nSubValve];
|
||||
@@ -1222,7 +1230,7 @@ void RicWellPathExportMswCompletionsImpl::assignValveContributionsToSuperValves(
|
||||
|
||||
if (overlap > 0.0 && accumulator)
|
||||
{
|
||||
if (accumulator->accumulateValveParameters(valve, overlap / valveSegmentLength))
|
||||
if (accumulator->accumulateValveParameters(valve, nSubValve, overlap / valveSegmentLength))
|
||||
{
|
||||
assignedRegularValves[superValve].insert(std::make_pair(valve, nSubValve));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user