2017-05-15 09:04:11 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2017-05-16 07:50:54 -05:00
|
|
|
// Copyright (C) 2017 Statoil ASA
|
2017-05-15 09:04:11 -05:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
2017-05-30 08:00:14 -05:00
|
|
|
#include "RifEclipseDataTableFormatter.h"
|
2017-05-19 04:28:02 -05:00
|
|
|
|
|
|
|
#include "RigWellLogExtractionTools.h"
|
2017-05-29 06:13:25 -05:00
|
|
|
#include "RigWellPathIntersectionTools.h"
|
|
|
|
#include "RigCompletionData.h"
|
2017-05-15 09:04:11 -05:00
|
|
|
|
2017-05-30 07:37:51 -05:00
|
|
|
#include "RicExportCompletionDataSettingsUi.h"
|
2017-05-19 09:45:07 -05:00
|
|
|
|
2017-05-15 09:04:11 -05:00
|
|
|
#include "cafCmdFeature.h"
|
|
|
|
|
|
|
|
#include "cvfBoundingBox.h"
|
|
|
|
|
2017-05-19 04:28:02 -05:00
|
|
|
|
2017-05-15 09:04:11 -05:00
|
|
|
class RimWellPath;
|
|
|
|
class RimEclipseCase;
|
|
|
|
class RigEclipseCaseData;
|
|
|
|
class RigMainGrid;
|
|
|
|
class RigCell;
|
2017-05-19 04:28:02 -05:00
|
|
|
class RimFishbonesMultipleSubs;
|
|
|
|
|
2017-05-19 09:45:07 -05:00
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
|
|
|
struct WellSegmentLateralIntersection {
|
|
|
|
WellSegmentLateralIntersection(int segmentNumber, int attachedSegmentNumber, size_t cellIndex, double length, double depth)
|
|
|
|
: segmentNumber(segmentNumber),
|
|
|
|
attachedSegmentNumber(attachedSegmentNumber),
|
|
|
|
cellIndex(cellIndex),
|
|
|
|
length(length),
|
|
|
|
depth(depth),
|
|
|
|
mainBoreCell(false)
|
|
|
|
{}
|
|
|
|
|
2017-05-22 06:23:48 -05:00
|
|
|
int segmentNumber;
|
|
|
|
int attachedSegmentNumber;
|
|
|
|
size_t cellIndex;
|
|
|
|
bool mainBoreCell;
|
|
|
|
double length;
|
|
|
|
double depth;
|
2017-06-07 09:04:34 -05:00
|
|
|
cvf::Vec3d lengthsInCell;
|
2017-05-19 09:45:07 -05:00
|
|
|
};
|
2017-05-15 09:04:11 -05:00
|
|
|
|
2017-05-19 04:28:02 -05:00
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
|
|
|
struct WellSegmentLateral {
|
2017-06-02 03:40:20 -05:00
|
|
|
WellSegmentLateral(size_t lateralIndex)
|
|
|
|
: lateralIndex(lateralIndex),
|
|
|
|
branchNumber(0)
|
|
|
|
{}
|
2017-05-19 04:28:02 -05:00
|
|
|
|
2017-05-19 09:45:07 -05:00
|
|
|
size_t lateralIndex;
|
|
|
|
int branchNumber;
|
|
|
|
std::vector<WellSegmentLateralIntersection> intersections;
|
2017-05-19 04:28:02 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
|
|
|
struct WellSegmentLocation {
|
2017-05-19 09:45:07 -05:00
|
|
|
WellSegmentLocation(const RimFishbonesMultipleSubs* subs, double measuredDepth, double trueVerticalDepth, size_t subIndex, int segmentNumber = -1)
|
2017-05-19 04:28:02 -05:00
|
|
|
: fishbonesSubs(subs),
|
|
|
|
measuredDepth(measuredDepth),
|
|
|
|
trueVerticalDepth(trueVerticalDepth),
|
|
|
|
subIndex(subIndex),
|
2017-05-19 09:45:07 -05:00
|
|
|
segmentNumber(segmentNumber)
|
2017-05-19 04:28:02 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
const RimFishbonesMultipleSubs* fishbonesSubs;
|
|
|
|
double measuredDepth;
|
|
|
|
double trueVerticalDepth;
|
|
|
|
size_t subIndex;
|
|
|
|
int segmentNumber;
|
2017-06-02 05:50:16 -05:00
|
|
|
int icdBranchNumber;
|
|
|
|
int icdSegmentNumber;
|
2017-05-19 04:28:02 -05:00
|
|
|
std::vector<WellSegmentLateral> laterals;
|
|
|
|
};
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
2017-05-15 09:04:11 -05:00
|
|
|
struct EclipseCellIndexRange {
|
|
|
|
size_t i;
|
|
|
|
size_t j;
|
|
|
|
size_t k1;
|
|
|
|
size_t k2;
|
|
|
|
};
|
|
|
|
|
2017-05-19 04:28:02 -05:00
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
2017-05-15 09:04:11 -05:00
|
|
|
typedef std::tuple<size_t, size_t, size_t> EclipseCellIndex;
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
2017-05-16 07:50:54 -05:00
|
|
|
class RicWellPathExportCompletionDataFeature : public caf::CmdFeature
|
2017-05-15 09:04:11 -05:00
|
|
|
{
|
|
|
|
CAF_CMD_HEADER_INIT;
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// Overrides
|
|
|
|
virtual bool isCommandEnabled() override;
|
|
|
|
virtual void onActionTriggered(bool isChecked) override;
|
|
|
|
virtual void setupActionLook(QAction* actionToSetup) override;
|
|
|
|
|
2017-05-29 08:52:35 -05:00
|
|
|
std::vector<RimWellPath*> selectedWellPaths();
|
|
|
|
|
2017-05-29 08:39:37 -05:00
|
|
|
public:
|
|
|
|
static std::vector<WellSegmentLocation> findWellSegmentLocations(const RimEclipseCase* caseToApply, const RimWellPath* wellPath);
|
|
|
|
static std::vector<WellSegmentLocation> findWellSegmentLocations(const RimEclipseCase* caseToApply, const RimWellPath* wellPath, const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs);
|
|
|
|
|
2017-06-12 06:40:49 -05:00
|
|
|
//functions also used by RicFishbonesTransmissibilityCalculationFeatureImp
|
|
|
|
static std::vector<size_t> findIntersectingCells(const RigEclipseCaseData* grid, const std::vector<cvf::Vec3d>& coords);
|
|
|
|
static void markWellPathCells(const std::vector<size_t>& wellPathCells, std::vector<WellSegmentLocation>* locations);
|
|
|
|
static CellDirection calculateDirectionInCell(RimEclipseCase* eclipseCase, size_t cellIndex, const cvf::Vec3d& lengthsInCell);
|
2017-06-13 08:37:06 -05:00
|
|
|
|
|
|
|
static double calculateTransmissibility(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, const cvf::Vec3d& internalCellLengths, double skinFactor, double wellRadius, size_t cellIndex, size_t volumeScaleConstant = 1, QString directionForVolumeScaling = "DX");
|
2017-05-15 09:04:11 -05:00
|
|
|
private:
|
2017-05-30 07:37:51 -05:00
|
|
|
static void exportCompletions(const std::vector<RimWellPath*>& wellPaths, const RicExportCompletionDataSettingsUi& exportSettings);
|
2017-05-29 06:13:25 -05:00
|
|
|
|
2017-05-30 08:00:14 -05:00
|
|
|
static void generateCompdatTable(RifEclipseDataTableFormatter& formatter, const std::vector<RigCompletionData>& completionData);
|
|
|
|
static void generateWpimultTable(RifEclipseDataTableFormatter& formatter, const std::vector<RigCompletionData>& completionData);
|
2017-05-29 06:13:25 -05:00
|
|
|
|
2017-05-30 07:37:51 -05:00
|
|
|
static std::vector<RigCompletionData> generatePerforationsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings);
|
2017-05-19 09:45:07 -05:00
|
|
|
|
2017-05-19 04:28:02 -05:00
|
|
|
static bool wellSegmentLocationOrdering(const WellSegmentLocation& first, const WellSegmentLocation& second);
|
|
|
|
static bool isPointBetween(const cvf::Vec3d& pointA, const cvf::Vec3d& pointB, const cvf::Vec3d& needle);
|
2017-05-19 09:45:07 -05:00
|
|
|
static void calculateLateralIntersections(const RimEclipseCase* caseToApply, WellSegmentLocation* location, int* branchNum, int* segmentNum);
|
|
|
|
static void assignBranchAndSegmentNumbers(const RimEclipseCase* caseToApply, std::vector<WellSegmentLocation>* locations);
|
2017-05-22 06:23:48 -05:00
|
|
|
|
2017-06-15 02:11:55 -05:00
|
|
|
static void appendCompletionData(std::map<IJKCellIndex, std::vector<RigCompletionData> >* completionData, const std::vector<RigCompletionData>& data);
|
2017-05-29 08:52:35 -05:00
|
|
|
|
2017-05-15 09:04:11 -05:00
|
|
|
};
|
2017-06-12 06:40:49 -05:00
|
|
|
|