mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
Completions could interleave mainbore and lateral connections, since the final sort ordered by well name, completion type and measured depth, and each lateral has its own independent MD scale. Connections for a well's mainbore should all come before connections for its side steps. Added RicScheduleDataGenerator::sortCompletionsMainBoreFirst(), which groups completions by owning well path (via RigCompletionData::sourcePdmObject()) and emits them in the traversal order of RimWellPath::allWellPathLaterals(), mainbore first. Sibling laterals are ordered by tie-in measured depth, as allWellPathLaterals() itself is not deterministic. The sort is applied in completionDataForWellPaths() so schedule export, COMPDAT/COMPLUMP export and the gRPC/Python query all get the same ordering.
143 lines
8.2 KiB
C++
143 lines
8.2 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2017 Statoil 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 "RigCompletionData.h"
|
|
|
|
#include "RicExportCompletionDataSettingsUi.h"
|
|
|
|
#include "cvfVector2.h"
|
|
#include "cvfVector3.h"
|
|
|
|
#include <QDateTime>
|
|
#include <QFile>
|
|
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <vector>
|
|
|
|
class RigCell;
|
|
class RigEclipseCaseData;
|
|
class RigMainGrid;
|
|
class RimEclipseCase;
|
|
class RimFishbones;
|
|
class RimPerforationInterval;
|
|
class RimWellPath;
|
|
class RimWellPathValve;
|
|
class RimWellPathFracture;
|
|
class RimNonDarcyPerforationParameters;
|
|
class RifTextDataTableFormatter;
|
|
class RigVirtualPerforationTransmissibilities;
|
|
class SubSegmentIntersectionInfo;
|
|
|
|
//==================================================================================================
|
|
///
|
|
//==================================================================================================
|
|
using QFilePtr = std::shared_ptr<QFile>;
|
|
|
|
//==================================================================================================
|
|
///
|
|
//==================================================================================================
|
|
class RicWellPathExportCompletionDataFeatureImpl
|
|
{
|
|
public:
|
|
static void exportCompletions( const std::vector<RimWellPath*>& wellPaths, const RicExportCompletionDataSettingsUi& exportSettings );
|
|
|
|
static std::vector<RigCompletionData> computeStaticCompletionsForWellPath( RimWellPath* wellPath, RimEclipseCase* eclipseCase );
|
|
|
|
static std::vector<RigCompletionData>
|
|
computeDynamicCompletionsForWellPath( RimWellPath* wellPath, RimEclipseCase* eclipseCase, size_t timeStepIndex );
|
|
|
|
static std::vector<RigCompletionData>
|
|
completionDataForWellPath( RimWellPath* wellPath, RimEclipseCase* eCase, const std::optional<QDateTime>& exportDate = std::nullopt );
|
|
|
|
// Completion data for several well paths (including their laterals), combined per cell into one connection.
|
|
// Connections are ordered with each well path's mainbore connections first, followed by each lateral's
|
|
// (depth-first), matching ResInsight's internal completion ordering (see
|
|
// https://github.com/OPM/ResInsight/issues/14963).
|
|
static std::vector<RigCompletionData> completionDataForWellPaths( const std::vector<RimWellPath*>& wellPaths,
|
|
RimEclipseCase* eCase,
|
|
const std::optional<QDateTime>& exportDate = std::nullopt );
|
|
|
|
static std::pair<double, cvf::Vec2i>
|
|
wellPathUpperGridIntersectionIJ( const RimEclipseCase* gridCase, const RimWellPath* wellPath, const QString& gridName = "" );
|
|
|
|
static std::optional<QDateTime> exportDateForTimeStep( const RimEclipseCase* eclipseCase, size_t timeStepIndex );
|
|
|
|
private:
|
|
static std::vector<RigCompletionData> generatePerforationsCompdatValues( const RimWellPath* wellPath,
|
|
const std::vector<const RimPerforationInterval*>& intervals,
|
|
const RicExportCompletionDataSettingsUi& settings,
|
|
const std::optional<QDateTime>& exportDate = std::nullopt );
|
|
|
|
static RigCompletionData combineEclipseCellCompletions( const std::vector<RigCompletionData>& completions,
|
|
const RicExportCompletionDataSettingsUi& settings );
|
|
|
|
static std::vector<RigCompletionData> mainGridCompletions( const std::vector<RigCompletionData>& allCompletions );
|
|
|
|
static std::map<QString, std::vector<RigCompletionData>> subGridsCompletions( const std::vector<RigCompletionData>& allCompletions );
|
|
|
|
static void exportWellPathFractureReport( RimEclipseCase* sourceCase,
|
|
QFilePtr exportFile,
|
|
const std::vector<RicWellPathFractureReportItem>& wellPathFractureReportItems );
|
|
|
|
static void exportWelspecsToFile( RimEclipseCase* gridCase,
|
|
QFilePtr exportFile,
|
|
const std::vector<RigCompletionData>& completions,
|
|
bool exportDataSourceAsComment );
|
|
|
|
static void exportWelspeclToFile( RimEclipseCase* gridCase,
|
|
QFilePtr exportFile,
|
|
const std::map<QString, std::vector<RigCompletionData>>& completions );
|
|
|
|
static void sortAndExportCompletionsToFile( RimEclipseCase* eclipseCase,
|
|
const QString& exportFolder,
|
|
const QString& fileName,
|
|
const std::vector<RigCompletionData>& completions,
|
|
const std::vector<RicWellPathFractureReportItem>& wellPathFractureReportItems,
|
|
RicExportCompletionDataSettingsUi::CompdatExportType exportType,
|
|
bool exportDataSourceAsComment,
|
|
bool exportWelspec );
|
|
|
|
static void exportCompdatAndWpimultTables( RimEclipseCase* sourceCase,
|
|
QFilePtr exportFile,
|
|
const std::map<QString, std::vector<RigCompletionData>>& completionsPerGrid,
|
|
RicExportCompletionDataSettingsUi::CompdatExportType exportType,
|
|
bool exportDataSourceAsComment );
|
|
|
|
static void exportCompdatTableUsingFormatter( RifTextDataTableFormatter& formatter,
|
|
const QString& gridName,
|
|
const std::vector<RigCompletionData>& completionData );
|
|
|
|
static void exportComplumpTableUsingFormatter( RifTextDataTableFormatter& formatter,
|
|
const QString& gridName,
|
|
const std::vector<RigCompletionData>& completionData );
|
|
|
|
static void exportWpimultTableUsingFormatter( RifTextDataTableFormatter& formatter,
|
|
const QString& gridName,
|
|
const std::vector<RigCompletionData>& completionData );
|
|
|
|
static void appendCompletionData( std::map<size_t, std::vector<RigCompletionData>>* completionData,
|
|
const std::vector<RigCompletionData>& data );
|
|
|
|
static void exportCarfinForTemporaryLgrs( const RimEclipseCase* sourceCase, const QString& folder );
|
|
|
|
static RimWellPath* topLevelWellPath( const RigCompletionData& completion );
|
|
};
|