mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1607 Record completion type of completion data and combine after all completions are calculated
This commit is contained in:
parent
771a47a287
commit
403bf1890c
@ -179,7 +179,7 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector
|
|||||||
QTextStream stream(&exportFile);
|
QTextStream stream(&exportFile);
|
||||||
RifEclipseDataTableFormatter formatter(stream);
|
RifEclipseDataTableFormatter formatter(stream);
|
||||||
|
|
||||||
std::map<IJKCellIndex, RigCompletionData> completionData;
|
std::map<IJKCellIndex, std::vector<RigCompletionData> > completionData;
|
||||||
|
|
||||||
for (auto wellPath : wellPaths)
|
for (auto wellPath : wellPaths)
|
||||||
{
|
{
|
||||||
@ -207,7 +207,7 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector
|
|||||||
std::vector<RigCompletionData> completions;
|
std::vector<RigCompletionData> completions;
|
||||||
for (auto& data : completionData)
|
for (auto& data : completionData)
|
||||||
{
|
{
|
||||||
completions.push_back(data.second);
|
completions.push_back(RigCompletionData::combine(data.second));
|
||||||
}
|
}
|
||||||
// Sort by well name / cell index
|
// Sort by well name / cell index
|
||||||
std::sort(completions.begin(), completions.end());
|
std::sort(completions.begin(), completions.end());
|
||||||
@ -525,18 +525,18 @@ void RicWellPathExportCompletionDataFeature::assignBranchAndSegmentNumbers(const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicWellPathExportCompletionDataFeature::appendCompletionData(std::map<IJKCellIndex, RigCompletionData>* completionData, const std::vector<RigCompletionData>& data)
|
void RicWellPathExportCompletionDataFeature::appendCompletionData(std::map<IJKCellIndex, std::vector<RigCompletionData> >* completionData, const std::vector<RigCompletionData>& data)
|
||||||
{
|
{
|
||||||
for (auto& completion : data)
|
for (auto& completion : data)
|
||||||
{
|
{
|
||||||
auto it = completionData->find(completion.cellIndex());
|
auto it = completionData->find(completion.cellIndex());
|
||||||
if (it != completionData->end())
|
if (it != completionData->end())
|
||||||
{
|
{
|
||||||
it->second = RigCompletionData::combine(it->second, completion);
|
it->second.push_back(completion);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
completionData->insert(std::pair<IJKCellIndex, RigCompletionData>(completion.cellIndex(), completion));
|
completionData->insert(std::pair<IJKCellIndex, std::vector<RigCompletionData> >(completion.cellIndex(), std::vector<RigCompletionData> {completion}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ private:
|
|||||||
static void calculateLateralIntersections(const RimEclipseCase* caseToApply, WellSegmentLocation* location, int* branchNum, int* segmentNum);
|
static void calculateLateralIntersections(const RimEclipseCase* caseToApply, WellSegmentLocation* location, int* branchNum, int* segmentNum);
|
||||||
static void assignBranchAndSegmentNumbers(const RimEclipseCase* caseToApply, std::vector<WellSegmentLocation>* locations);
|
static void assignBranchAndSegmentNumbers(const RimEclipseCase* caseToApply, std::vector<WellSegmentLocation>* locations);
|
||||||
|
|
||||||
static void appendCompletionData(std::map<IJKCellIndex, RigCompletionData>* completionData, const std::vector<RigCompletionData>& data);
|
static void appendCompletionData(std::map<IJKCellIndex, std::vector<RigCompletionData> >* completionData, const std::vector<RigCompletionData>& data);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "RiaLogging.h"
|
#include "RiaLogging.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <cmath> // Needed for HUGE_VAL on linux
|
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@ -59,25 +59,35 @@ RigCompletionData::RigCompletionData(const RigCompletionData& other)
|
|||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
RigCompletionData RigCompletionData::combine(const RigCompletionData& first, const RigCompletionData& second)
|
RigCompletionData RigCompletionData::combine(const std::vector<RigCompletionData>& completions)
|
||||||
{
|
{
|
||||||
RigCompletionData result(first);
|
CVF_ASSERT(!completions.empty());
|
||||||
CVF_ASSERT(result.m_wellName == second.m_wellName);
|
|
||||||
CVF_ASSERT(result.m_cellIndex == second.m_cellIndex);
|
|
||||||
|
|
||||||
if (onlyOneIsDefaulted(result.m_transmissibility, second.m_transmissibility))
|
auto it = completions.cbegin();
|
||||||
|
RigCompletionData result(*it);
|
||||||
|
++it;
|
||||||
|
|
||||||
|
for (; it != completions.cend(); ++it)
|
||||||
{
|
{
|
||||||
RiaLogging::error("Transmissibility defaulted in one but not both, will produce erroneous result");
|
if (it->completionType() != result.completionType())
|
||||||
}
|
{
|
||||||
else
|
RiaLogging::error(QString("Cannot combine completions of different types in same cell [%1, %2, %3]").arg(result.m_cellIndex.i).arg(result.m_cellIndex.j).arg(result.m_cellIndex.k));
|
||||||
{
|
continue;
|
||||||
result.m_transmissibility += second.m_transmissibility;
|
}
|
||||||
}
|
if (onlyOneIsDefaulted(result.m_transmissibility, it->m_transmissibility))
|
||||||
|
{
|
||||||
|
RiaLogging::error("Transmissibility defaulted in one but not both, will produce erroneous result");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.m_transmissibility += it->m_transmissibility;
|
||||||
|
}
|
||||||
|
|
||||||
result.m_metadata.reserve(result.m_metadata.size() + second.m_metadata.size());
|
result.m_metadata.reserve(result.m_metadata.size() + it->m_metadata.size());
|
||||||
result.m_metadata.insert(result.m_metadata.end(), second.m_metadata.begin(), second.m_metadata.end());
|
result.m_metadata.insert(result.m_metadata.end(), it->m_metadata.begin(), it->m_metadata.end());
|
||||||
|
|
||||||
result.m_count += second.m_count;
|
result.m_count += it->m_count;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -112,6 +122,7 @@ RigCompletionData& RigCompletionData::operator=(const RigCompletionData& other)
|
|||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
void RigCompletionData::setFromFracture(double transmissibility, double skinFactor)
|
void RigCompletionData::setFromFracture(double transmissibility, double skinFactor)
|
||||||
{
|
{
|
||||||
|
m_completionType = FRACTURE;
|
||||||
m_transmissibility = transmissibility;
|
m_transmissibility = transmissibility;
|
||||||
m_skinFactor = skinFactor;
|
m_skinFactor = skinFactor;
|
||||||
}
|
}
|
||||||
@ -121,6 +132,7 @@ void RigCompletionData::setFromFracture(double transmissibility, double skinFact
|
|||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
void RigCompletionData::setFromFishbone(double diameter, CellDirection direction)
|
void RigCompletionData::setFromFishbone(double diameter, CellDirection direction)
|
||||||
{
|
{
|
||||||
|
m_completionType = FISHBONES;
|
||||||
m_diameter = diameter;
|
m_diameter = diameter;
|
||||||
m_direction = direction;
|
m_direction = direction;
|
||||||
}
|
}
|
||||||
@ -130,6 +142,7 @@ void RigCompletionData::setFromFishbone(double diameter, CellDirection direction
|
|||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
void RigCompletionData::setFromFishbone(double transmissibility, double skinFactor)
|
void RigCompletionData::setFromFishbone(double transmissibility, double skinFactor)
|
||||||
{
|
{
|
||||||
|
m_completionType = FISHBONES;
|
||||||
m_transmissibility = transmissibility;
|
m_transmissibility = transmissibility;
|
||||||
m_skinFactor = skinFactor;
|
m_skinFactor = skinFactor;
|
||||||
}
|
}
|
||||||
@ -139,6 +152,7 @@ void RigCompletionData::setFromFishbone(double transmissibility, double skinFact
|
|||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
void RigCompletionData::setFromPerforation(double diameter, CellDirection direction)
|
void RigCompletionData::setFromPerforation(double diameter, CellDirection direction)
|
||||||
{
|
{
|
||||||
|
m_completionType = PERFORATION;
|
||||||
m_diameter = diameter;
|
m_diameter = diameter;
|
||||||
m_direction = direction;
|
m_direction = direction;
|
||||||
}
|
}
|
||||||
@ -204,4 +218,5 @@ void RigCompletionData::copy(RigCompletionData& target, const RigCompletionData&
|
|||||||
target.m_dFactor = from.m_dFactor;
|
target.m_dFactor = from.m_dFactor;
|
||||||
target.m_direction = from.m_direction;
|
target.m_direction = from.m_direction;
|
||||||
target.m_count = from.m_count;
|
target.m_count = from.m_count;
|
||||||
|
target.m_completionType = from.m_completionType;
|
||||||
}
|
}
|
||||||
|
@ -91,11 +91,17 @@ struct RigCompletionMetaData {
|
|||||||
class RigCompletionData : public cvf::Object
|
class RigCompletionData : public cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum CompletionType {
|
||||||
|
FISHBONES,
|
||||||
|
FRACTURE,
|
||||||
|
PERFORATION,
|
||||||
|
};
|
||||||
|
|
||||||
RigCompletionData(const QString wellName, const IJKCellIndex& cellIndex);
|
RigCompletionData(const QString wellName, const IJKCellIndex& cellIndex);
|
||||||
~RigCompletionData();
|
~RigCompletionData();
|
||||||
RigCompletionData(const RigCompletionData& other);
|
RigCompletionData(const RigCompletionData& other);
|
||||||
|
|
||||||
static RigCompletionData combine(const RigCompletionData& first, const RigCompletionData& second);
|
static RigCompletionData combine(const std::vector<RigCompletionData>& completions);
|
||||||
|
|
||||||
bool operator<(const RigCompletionData& other) const;
|
bool operator<(const RigCompletionData& other) const;
|
||||||
RigCompletionData& operator=(const RigCompletionData& other);
|
RigCompletionData& operator=(const RigCompletionData& other);
|
||||||
@ -119,6 +125,7 @@ public:
|
|||||||
double dFactor() const { return m_dFactor; }
|
double dFactor() const { return m_dFactor; }
|
||||||
CellDirection direction() const { return m_direction; }
|
CellDirection direction() const { return m_direction; }
|
||||||
size_t count() const { return m_count; }
|
size_t count() const { return m_count; }
|
||||||
|
CompletionType completionType() const { return m_completionType; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<RigCompletionMetaData> m_metadata;
|
std::vector<RigCompletionMetaData> m_metadata;
|
||||||
@ -136,6 +143,8 @@ private:
|
|||||||
// Number of parts that have contributed to this completion
|
// Number of parts that have contributed to this completion
|
||||||
size_t m_count;
|
size_t m_count;
|
||||||
|
|
||||||
|
CompletionType m_completionType;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool onlyOneIsDefaulted(double first, double second);
|
static bool onlyOneIsDefaulted(double first, double second);
|
||||||
static void copy(RigCompletionData& target, const RigCompletionData& from);
|
static void copy(RigCompletionData& target, const RigCompletionData& from);
|
||||||
|
Loading…
Reference in New Issue
Block a user