#3850 Implement calculation of AICD length

This commit is contained in:
Gaute Lindkvist 2018-12-11 16:21:17 +01:00
parent e510237793
commit 3dafd06859
7 changed files with 69 additions and 25 deletions

View File

@ -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;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -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;
};

View File

@ -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;
}
}

View File

@ -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;
};

View File

@ -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));
}

View File

@ -17,7 +17,9 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellPathAicdParameters.h"
#include "RimPerforationInterval.h"
#include "RimWellPath.h"
#include "RimWellPathValve.h"
#include "cafPdmUiDoubleValueEditor.h"
#include "cafPdmUiGroup.h"
@ -70,7 +72,6 @@ RimWellPathAicdParameters::RimWellPathAicdParameters()
CAF_PDM_InitFieldNoDefault(&m_aicdParameterFields[AICD_VOL_FLOW_EXP], "VolumeFlowRateExponent", "Volume Flow Rate Exponent", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_aicdParameterFields[AICD_VISOSITY_FUNC_EXP], "ViscosityFunctionExponent", "Viscosity Function Exponent", "", "", "");
CAF_PDM_InitField(&m_aicdParameterFields[AICD_LENGTH], "LengthAICD", QString("12.0"), "Length of AICD", "", "", "");
CAF_PDM_InitField(&m_aicdParameterFields[AICD_CRITICAL_WATER_IN_LIQUID_FRAC], "CriticalWaterLiquidFractionEmul", QString("1*"), "Critical Water in Liquid Fraction for emulsions", "", "", "");
CAF_PDM_InitField(&m_aicdParameterFields[AICD_EMULSION_VISC_TRANS_REGION], "ViscosityTransitionRegionEmul", QString("1*"), "Emulsion Viscosity Transition Region", "", "", "");
CAF_PDM_InitField(&m_aicdParameterFields[AICD_MAX_RATIO_EMULSION_VISC], "MaxRatioOfEmulsionVisc", QString("1*"), "Max Ratio of Emulsion to Continuous Viscosity", "", "", "");
@ -161,7 +162,7 @@ void RimWellPathAicdParameters::defineUiOrdering(QString uiConfigName, caf::PdmU
}
caf::PdmUiGroup* additionalGroup = uiOrdering.addNewGroup("Additional Parameters");
for (int i = (int)AICD_LENGTH; i < (int)AICD_NUM_PARAMS; ++i)
for (int i = (int)AICD_NUM_REQ_PARAMS; i < (int)AICD_NUM_PARAMS; ++i)
{
additionalGroup->add(&m_aicdParameterFields[(AICDParameters) i]);
}
@ -211,13 +212,11 @@ void RimWellPathAicdParameters::setUnitLabels()
if (isMetric())
{
m_aicdParameterFields[AICD_DENSITY_CALIB_FLUID].uiCapability()->setUiName("Calibration Fluid Density (kg / m ^ 3)");
m_aicdParameterFields[AICD_LENGTH].uiCapability()->setUiName("Length of AICD (m)");
m_aicdParameterFields[AICD_MAX_FLOW_RATE].uiCapability()->setUiName("Max Flow Rate for AICD Device(m ^ 3 / day)");
}
else
{
m_aicdParameterFields[AICD_DENSITY_CALIB_FLUID].uiCapability()->setUiName("Calibration Fluid Density (lb / ft ^3)");
m_aicdParameterFields[AICD_LENGTH].uiCapability()->setUiName("Length of AICD (ft)");
m_aicdParameterFields[AICD_MAX_FLOW_RATE].uiCapability()->setUiName("Max Flow Rate for AICD Device(ft ^ 3 / day)");
}
}

View File

@ -31,8 +31,7 @@ enum AICDParameters
AICD_VOL_FLOW_EXP,
AICD_VISOSITY_FUNC_EXP,
AICD_NUM_REQ_PARAMS,
AICD_LENGTH = AICD_NUM_REQ_PARAMS,
AICD_CRITICAL_WATER_IN_LIQUID_FRAC,
AICD_CRITICAL_WATER_IN_LIQUID_FRAC = AICD_NUM_REQ_PARAMS,
AICD_EMULSION_VISC_TRANS_REGION,
AICD_MAX_RATIO_EMULSION_VISC,
AICD_MAX_FLOW_RATE,
@ -55,6 +54,7 @@ public:
bool isOpen() const;
std::array<double, AICD_NUM_PARAMS> doubleValues() const;
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;