#3779 Implement accumulator system for ICDs in preparation of using this for AICDs

This commit is contained in:
Gaute Lindkvist 2018-12-07 13:18:01 +01:00
parent 6e1b8adba1
commit ddd454077f
6 changed files with 196 additions and 74 deletions

View File

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

View File

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

View File

@ -27,6 +27,8 @@
#include <QString>
#include <memory>
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;
};

View File

@ -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<RicMswValve> valve)
{
std::shared_ptr<RicMswICD> icd = std::dynamic_pointer_cast<RicMswICD>(valve);
CVF_ASSERT(icd);
icd->setArea(m_areaSum);
if (m_coefficientCalculator.validAggregatedWeight())
{
icd->setFlowCoefficient(m_coefficientCalculator.weightedMean());
}
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaEclipseUnitTools.h"
#include "RiaWeightedMeanCalculator.h"
#include <memory>
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<RicMswValve> 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<RicMswValve> valve) override;
private:
RiaWeightedMeanCalculator<double> m_coefficientCalculator;
double m_areaSum;
};

View File

@ -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<RicMswSegment> segment : mainBoreSegments)
{
std::shared_ptr<RicMswPerforationICD> superValve;
std::shared_ptr<RicMswValve> superValve;
for (auto completion : segment->completions())
{
std::shared_ptr<RicMswPerforationICD> valve = std::dynamic_pointer_cast<RicMswPerforationICD>(completion);
std::shared_ptr<RicMswValve> valve = std::dynamic_pointer_cast<RicMswValve>(completion);
if (valve)
{
superValve = valve;
@ -1068,8 +1069,11 @@ void RicWellPathExportMswCompletionsImpl::assignValveContributionsToSuperValves(
if (!superValve) continue;
double totalIcdArea = 0.0;
RiaWeightedMeanCalculator<double> coeffMeanCalc;
std::shared_ptr<RicMswValveAccumulator> accumulator;
if (std::dynamic_pointer_cast<const RicMswPerforationICD>(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);
}
}