#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

@ -86,11 +86,11 @@ void RicExportFishbonesLateralsFeature::onActionTriggered(bool isChecked)
{
if (!fishbone->isChecked()) continue;
for (size_t subIndex = 0; subIndex < fishbone->locationOfSubs().size(); subIndex++)
for (auto& sub : fishbone->installedLateralIndices())
{
for (size_t lateralIndex = 0; lateralIndex < fishbone->lateralLengths().size(); lateralIndex++)
for (size_t lateralIndex : sub.lateralIndices)
{
std::vector<std::pair<cvf::Vec3d, double>> coordsAndMD = fishbone->coordsAndMDForLateral(subIndex, lateralIndex);
std::vector<std::pair<cvf::Vec3d, double>> coordsAndMD = fishbone->coordsAndMDForLateral(sub.subIndex, lateralIndex);
// Pad with "0" to get a total of two characters defining the sub index text
QString subIndexText = QString("%1").arg(fishboneSubIndex++, 2, 10, QChar('0'));
@ -106,12 +106,13 @@ void RicExportFishbonesLateralsFeature::onActionTriggered(bool isChecked)
int numberOfDecimals = 2;
// Export X and Y unchanged, invert sign of Z to get TVD, export MD unchanged
stream << formatNumber( coordMD.first.x(), numberOfDecimals);
stream << " " << formatNumber( coordMD.first.y(), numberOfDecimals);
stream << formatNumber(coordMD.first.x(), numberOfDecimals);
stream << " " << formatNumber(coordMD.first.y(), numberOfDecimals);
stream << " " << formatNumber(-coordMD.first.z(), numberOfDecimals);
stream << " " << formatNumber( coordMD.second, numberOfDecimals) << endl;
stream << " " << formatNumber(coordMD.second, numberOfDecimals) << endl;
}
stream << -999 << endl << endl;
}
}
}

View File

@ -230,12 +230,12 @@ void RicExportFishbonesWellSegmentsFeature::generateWelsegsTable(RifEclipseDataT
if (settings.lengthAndDepth() == RicExportWellSegmentsSettingsUi::INC)
{
depth = location.trueVerticalDepth - previousLocation.trueVerticalDepth;
length = location.fishbonesSubs->locationOfSubs()[location.subIndex] - previousLocation.fishbonesSubs->locationOfSubs()[previousLocation.subIndex];
length = location.fishbonesSubs->measuredDepth(location.subIndex) - previousLocation.fishbonesSubs->measuredDepth(previousLocation.subIndex);
}
else
{
depth += location.trueVerticalDepth - previousLocation.trueVerticalDepth;
length += location.fishbonesSubs->locationOfSubs()[location.subIndex] - previousLocation.fishbonesSubs->locationOfSubs()[previousLocation.subIndex];
length += location.fishbonesSubs->measuredDepth(location.subIndex) - previousLocation.fishbonesSubs->measuredDepth(previousLocation.subIndex);
}
formatter.comment(QString("Segment for sub %1").arg(location.subIndex));

View File

@ -503,12 +503,12 @@ std::vector<WellSegmentLocation> RicWellPathExportCompletionDataFeature::findWel
std::vector<WellSegmentLocation> wellSegmentLocations;
for (RimFishbonesMultipleSubs* subs : fishbonesSubs)
{
for (size_t subIndex = 0; subIndex < subs->locationOfSubs().size(); ++subIndex)
for (auto& sub : subs->installedLateralIndices())
{
double measuredDepth = subs->locationOfSubs()[subIndex];
double measuredDepth = subs->measuredDepth(sub.subIndex);
cvf::Vec3d position = wellPath->wellPathGeometry()->interpolatedPointAlongWellPath(measuredDepth);
WellSegmentLocation location = WellSegmentLocation(subs, measuredDepth, -position.z(), subIndex);
for (size_t lateralIndex = 0; lateralIndex < subs->lateralLengths().size(); ++lateralIndex)
WellSegmentLocation location = WellSegmentLocation(subs, measuredDepth, -position.z(), sub.subIndex);
for (size_t lateralIndex : sub.lateralIndices)
{
location.laterals.push_back(WellSegmentLateral(lateralIndex));
}

View File

@ -89,11 +89,11 @@ void RivFishbonesSubsPartMgr::buildParts(caf::DisplayCoordTransform* displayCoor
RivPipeGeometryGenerator geoGenerator;
for (size_t subIndex = 0; subIndex < m_rimFishbonesSubs->locationOfSubs().size(); subIndex++)
for (auto& sub : m_rimFishbonesSubs->installedLateralIndices())
{
for (size_t lateralIndex = 0; lateralIndex < m_rimFishbonesSubs->lateralLengths().size(); lateralIndex++)
for (size_t lateralIndex : sub.lateralIndices)
{
std::vector<cvf::Vec3d> lateralDomainCoords = m_rimFishbonesSubs->coordsForLateral(subIndex, lateralIndex);
std::vector<cvf::Vec3d> lateralDomainCoords = m_rimFishbonesSubs->coordsForLateral(sub.subIndex, lateralIndex);
std::vector<cvf::Vec3d> displayCoords;
for (auto domainCoord : lateralDomainCoords)

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

View File

@ -39,16 +39,30 @@ RigFisbonesGeometry::RigFisbonesGeometry(RimFishbonesMultipleSubs* fishbonesSub)
//--------------------------------------------------------------------------------------------------
std::vector<std::pair<cvf::Vec3d, double>> RigFisbonesGeometry::coordsForLateral(size_t subIndex, size_t lateralIndex) const
{
CVF_ASSERT(subIndex < m_fishbonesSub->locationOfSubs().size());
CVF_ASSERT(lateralIndex < m_fishbonesSub->lateralLengths().size());
bool found = false;
for (auto& sub : m_fishbonesSub->installedLateralIndices())
{
if (sub.subIndex == subIndex)
{
auto it = std::find(sub.lateralIndices.begin(), sub.lateralIndices.end(), lateralIndex);
if (it != sub.lateralIndices.end())
{
found = true;
break;
}
}
}
CVF_ASSERT(found);
cvf::Vec3d position;
cvf::Vec3d lateralInitialDirection;
cvf::Mat4d buildAngleRotationMatrix;
computeLateralPositionAndOrientation(subIndex, lateralIndex, &position, &lateralInitialDirection, &buildAngleRotationMatrix);
return computeCoordsAlongLateral(m_fishbonesSub->locationOfSubs()[subIndex], m_fishbonesSub->lateralLengths()[lateralIndex], position, lateralInitialDirection, buildAngleRotationMatrix);
return computeCoordsAlongLateral(m_fishbonesSub->measuredDepth(subIndex), m_fishbonesSub->lateralLengths()[lateralIndex], position, lateralInitialDirection, buildAngleRotationMatrix);
}
//--------------------------------------------------------------------------------------------------
@ -62,7 +76,7 @@ void RigFisbonesGeometry::computeLateralPositionAndOrientation(size_t subIndex,
RigWellPath* rigWellPath = wellPath->wellPathGeometry();
CVF_ASSERT(rigWellPath);
double measuredDepth = m_fishbonesSub->locationOfSubs()[subIndex];
double measuredDepth = m_fishbonesSub->measuredDepth(subIndex);
cvf::Vec3d position = rigWellPath->interpolatedPointAlongWellPath(measuredDepth);