#1548 Remove fishbones laterals based on success rate

This commit is contained in:
Bjørnar Grip Fjær
2017-06-02 10:16:16 +02:00
parent bc99c1d843
commit a52d70c424
8 changed files with 103 additions and 37 deletions

View File

@@ -80,11 +80,11 @@ void RimCompletionCellIntersectionCalc::calculateWellPathIntersections(const Rim
//--------------------------------------------------------------------------------------------------
void RimCompletionCellIntersectionCalc::calculateFishbonesIntersections(const RimFishbonesMultipleSubs* fishbonesSubs, const RigMainGrid* grid, std::vector<double>& values)
{
for (size_t subIndex = 0; subIndex < fishbonesSubs->locationOfSubs().size(); ++subIndex)
for (auto& sub : fishbonesSubs->installedLateralIndices())
{
for (size_t lateralIndex = 0; lateralIndex < fishbonesSubs->lateralCountPerSub(); ++lateralIndex)
for (size_t lateralIndex : sub.lateralIndices)
{
std::vector<HexIntersectionInfo> intersections = RigWellPathIntersectionTools::getIntersectedCells(grid, fishbonesSubs->coordsForLateral(subIndex, lateralIndex));
std::vector<HexIntersectionInfo> intersections = RigWellPathIntersectionTools::getIntersectedCells(grid, fishbonesSubs->coordsForLateral(sub.subIndex, lateralIndex));
for (auto& intersection : intersections)
{
values[intersection.m_hexIndex] = RimDefines::FISHBONE;

View File

@@ -72,8 +72,7 @@ RimFishbonesMultipleSubs::RimFishbonesMultipleSubs()
CAF_PDM_InitField(&m_lateralOpenHoleRoghnessFactor, "LateralOpenHoleRoghnessFactor", 0.001, "Open Hole Roghness Factor [m]", "", "", "");
CAF_PDM_InitField(&m_lateralTubingRoghnessFactor, "LateralTubingRoghnessFactor", 1e-5, "Tubing Roghness Factor [m]", "", "", "");
CAF_PDM_InitField(&m_lateralLengthFraction, "LateralLengthFraction", 0.8, "Length Fraction [0..1]", "", "", "");
CAF_PDM_InitField(&m_lateralInstallFraction, "LateralInstallFraction", 0.7, "Install Fraction [0..1]", "", "", "");
CAF_PDM_InitField(&m_lateralInstallSuccessFraction, "LateralInstallSuccessFraction", 0.7, "Install Success Rate [0..1]", "", "", "");
CAF_PDM_InitField(&m_icdCount, "IcdCount", size_t(2), "ICDs per Sub", "", "", "");
CAF_PDM_InitField(&m_icdOrificeDiameter, "IcdOrificeDiameter", 7.0, "ICD Orifice Diameter [mm]", "", "", "");
@@ -102,6 +101,8 @@ RimFishbonesMultipleSubs::RimFishbonesMultipleSubs()
m_name.uiCapability()->setUiReadOnly(true);
m_rigFishbonesGeometry = std::unique_ptr<RigFisbonesGeometry>(new RigFisbonesGeometry(this));
computeSubLateralIndices();
}
//--------------------------------------------------------------------------------------------------
@@ -125,14 +126,17 @@ void RimFishbonesMultipleSubs::setMeasuredDepthAndCount(double measuredDepth, do
computeRangesAndLocations();
computeRotationAngles();
computeSubLateralIndices();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimFishbonesMultipleSubs::locationOfSubs() const
double RimFishbonesMultipleSubs::measuredDepth(size_t subIndex) const
{
return m_locationOfSubs;
CVF_ASSERT(subIndex < m_locationOfSubs().size());
return m_locationOfSubs()[subIndex];
}
//--------------------------------------------------------------------------------------------------
@@ -277,6 +281,14 @@ void RimFishbonesMultipleSubs::fieldChangedByUi(const caf::PdmFieldHandle* chang
computeRotationAngles();
}
if (recomputeLocations ||
changedField == &m_locationOfSubs ||
changedField == &m_lateralInstallSuccessFraction ||
changedField == &m_lateralCountPerSub)
{
computeSubLateralIndices();
}
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted(proj);
proj->removeResult(RimDefines::DYNAMIC_NATIVE, RimDefines::completionTypeResultName());
@@ -381,14 +393,8 @@ void RimFishbonesMultipleSubs::defineUiOrdering(QString uiConfigName, caf::PdmUi
lateralConfigGroup->add(&m_fixedInstallationRotationAngle);
}
lateralConfigGroup->add(&m_lateralInstallSuccessFraction);
{
caf::PdmUiGroup* successGroup = lateralConfigGroup->addNewGroup("Installation Success Fractions");
successGroup->setCollapsedByDefault(true);
successGroup->add(&m_lateralLengthFraction);
successGroup->add(&m_lateralInstallFraction);
}
}
{
@@ -451,6 +457,7 @@ void RimFishbonesMultipleSubs::initAfterRead()
{
computeRotationAngles();
}
computeSubLateralIndices();
}
//--------------------------------------------------------------------------------------------------
@@ -503,6 +510,36 @@ void RimFishbonesMultipleSubs::computeRotationAngles()
m_installationRotationAngles = vals;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::computeSubLateralIndices()
{
m_subLateralIndices.clear();
for (size_t subIndex = 0; subIndex < m_locationOfSubs().size(); ++subIndex)
{
SubLateralIndex subLateralIndex{ subIndex };
for (size_t lateralIndex = 0; lateralIndex < m_lateralCountPerSub(); ++lateralIndex)
{
subLateralIndex.lateralIndices.push_back(lateralIndex);
}
m_subLateralIndices.push_back(subLateralIndex);
}
double numLaterals = static_cast<double>(m_locationOfSubs().size() * m_lateralCountPerSub);
int numToRemove = static_cast<int>(std::round((1 - m_lateralInstallSuccessFraction) * numLaterals));
srand(m_randomSeed());
while (numToRemove > 0)
{
int subIndexToRemove;
do {
subIndexToRemove = rand() % m_subLateralIndices.size();
} while (m_subLateralIndices[subIndexToRemove].lateralIndices.empty());
int lateralIndexToRemove = rand() % m_subLateralIndices[subIndexToRemove].lateralIndices.size();
m_subLateralIndices[subIndexToRemove].lateralIndices.erase(m_subLateralIndices[subIndexToRemove].lateralIndices.begin() + lateralIndexToRemove);
--numToRemove;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -35,6 +35,15 @@
class RigFisbonesGeometry;
//==================================================================================================
///
///
//==================================================================================================
struct SubLateralIndex {
size_t subIndex;
std::vector<size_t> lateralIndices;
};
//==================================================================================================
///
///
@@ -64,9 +73,9 @@ public:
void setMeasuredDepthAndCount(double measuredDepth, double spacing, int subCount);
std::vector<double> locationOfSubs() const;
double measuredDepth(size_t subIndex) const;
double rotationAngle(size_t subIndex) const;
double rotationAngle(size_t index) const;
double exitAngle() const;
double buildAngle() const;
@@ -76,6 +85,8 @@ public:
size_t lateralCountPerSub() const;
std::vector<double> lateralLengths() const;
const std::vector<SubLateralIndex>& installedLateralIndices() const { return m_subLateralIndices; };
std::vector<cvf::Vec3d> coordsForLateral(size_t subIndex, size_t lateralIndex) const;
std::vector<std::pair<cvf::Vec3d, double>> coordsAndMDForLateral(size_t subIndex, size_t lateralIndex) const;
@@ -95,10 +106,11 @@ protected:
private:
void computeRangesAndLocations();
void computeRotationAngles();
void computeSubLateralIndices();
static std::vector<double> locationsFromStartSpacingAndCount(double start, double spacing, size_t count);
static int randomValueFromRange(int min, int max);
private:
caf::PdmField<size_t> m_lateralCountPerSub;
caf::PdmField<QString> m_lateralLength;
@@ -111,8 +123,7 @@ private:
caf::PdmField<double> m_lateralOpenHoleRoghnessFactor;
caf::PdmField<double> m_lateralTubingRoghnessFactor;
caf::PdmField<double> m_lateralLengthFraction;
caf::PdmField<double> m_lateralInstallFraction;
caf::PdmField<double> m_lateralInstallSuccessFraction;
caf::PdmField<size_t> m_icdCount;
caf::PdmField<double> m_icdOrificeDiameter;
@@ -132,5 +143,8 @@ private:
caf::PdmChildField<RimFishbonesPipeProperties*> m_pipeProperties;
caf::PdmField<uint> m_randomSeed;
std::unique_ptr<RigFisbonesGeometry> m_rigFishbonesGeometry;
std::vector<SubLateralIndex> m_subLateralIndices;
};