mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
@@ -91,7 +91,7 @@ void RifReaderOpmRft::values( const RifEclipseRftAddress& rftAddress, std::vecto
|
||||
}
|
||||
else if ( rftAddress.segmentResultName() == RiaDefines::segmentBranchNumberResultName() )
|
||||
{
|
||||
auto branchNumbers = segment.branchIds();
|
||||
auto branchNumbers = segment.tubingBranchIds();
|
||||
for ( const auto& branchNumber : branchNumbers )
|
||||
{
|
||||
values->push_back( branchNumber );
|
||||
@@ -156,6 +156,9 @@ std::set<QDateTime>
|
||||
RifReaderOpmRft::availableTimeSteps( const QString& wellName,
|
||||
const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName )
|
||||
{
|
||||
if ( wellLogChannelName == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES )
|
||||
return m_rftSegmentTimeSteps;
|
||||
|
||||
std::set<QDateTime> timeSteps;
|
||||
|
||||
for ( const auto& address : m_addresses )
|
||||
@@ -301,6 +304,8 @@ void RifReaderOpmRft::buildMetaData()
|
||||
|
||||
auto dt = RiaQDateTimeTools::createUtcDateTime( QDate( y, m, d ) );
|
||||
|
||||
m_rftSegmentTimeSteps.insert( dt );
|
||||
|
||||
auto segmentCount = segmentData.topology().size();
|
||||
|
||||
for ( const auto& resultNameAndSize : resultNameAndSizes )
|
||||
@@ -394,9 +399,10 @@ void RifReaderOpmRft::buildSegmentData()
|
||||
}
|
||||
}
|
||||
|
||||
auto wellDateKey = std::make_pair( wellName, date );
|
||||
|
||||
auto wellDateKey = std::make_pair( wellName, date );
|
||||
m_rftWellDateSegments[wellDateKey] = segment;
|
||||
|
||||
buildSegmentBranchTypes( wellDateKey );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -445,6 +451,69 @@ void RifReaderOpmRft::importWellNames()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderOpmRft::buildSegmentBranchTypes( const RftSegmentKey& segmentKey )
|
||||
{
|
||||
auto wellName = segmentKey.first;
|
||||
auto date = segmentKey.second;
|
||||
RifRftSegment& segmentRef = m_rftWellDateSegments[segmentKey];
|
||||
|
||||
int y = std::get<0>( date );
|
||||
int m = std::get<1>( date );
|
||||
int d = std::get<2>( date );
|
||||
|
||||
auto dt = RiaQDateTimeTools::createUtcDateTime( QDate( y, m, d ) );
|
||||
|
||||
std::vector<double> seglenstValues;
|
||||
std::vector<double> seglenenValues;
|
||||
{
|
||||
auto resultName =
|
||||
RifEclipseRftAddress::createSegmentAddress( QString::fromStdString( wellName ), dt, "SEGLENST", -1 );
|
||||
|
||||
values( resultName, &seglenstValues );
|
||||
|
||||
if ( seglenstValues.size() > 2 )
|
||||
{
|
||||
seglenstValues[0] = seglenstValues[1];
|
||||
}
|
||||
}
|
||||
{
|
||||
auto resultName =
|
||||
RifEclipseRftAddress::createSegmentAddress( QString::fromStdString( wellName ), dt, "SEGLENEN", -1 );
|
||||
|
||||
values( resultName, &seglenenValues );
|
||||
}
|
||||
|
||||
if ( !seglenenValues.empty() && !seglenstValues.empty() )
|
||||
{
|
||||
auto branchIds = segmentRef.branchIds();
|
||||
for ( auto id : branchIds )
|
||||
{
|
||||
double minimumMD = std::numeric_limits<double>::max();
|
||||
double maximumMD = std::numeric_limits<double>::min();
|
||||
|
||||
auto indices = segmentRef.indicesForBranchNumber( id );
|
||||
for ( auto i : indices )
|
||||
{
|
||||
minimumMD = std::min( minimumMD, seglenstValues[i] );
|
||||
maximumMD = std::max( maximumMD, seglenenValues[i] );
|
||||
}
|
||||
|
||||
double length = maximumMD - minimumMD;
|
||||
|
||||
segmentRef.setBranchLength( id, length );
|
||||
|
||||
const double tubingThreshold = 1.0;
|
||||
RiaDefines::RftBranchType branchType = RiaDefines::RftBranchType::RFT_UNKNOWN;
|
||||
if ( length > tubingThreshold ) branchType = RiaDefines::RftBranchType::RFT_TUBING;
|
||||
|
||||
segmentRef.setBranchType( id, branchType );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -63,6 +63,7 @@ private:
|
||||
void segmentDataDebugLog() const;
|
||||
bool isOpen() const;
|
||||
void importWellNames();
|
||||
void buildSegmentBranchTypes( const RftSegmentKey& segmentKey );
|
||||
|
||||
std::vector<int> importWellData( const std::string& wellName, const std::string& propertyName, const RftDate& date ) const;
|
||||
|
||||
@@ -77,4 +78,5 @@ private:
|
||||
std::set<QString> m_wellNames;
|
||||
|
||||
std::map<RftSegmentKey, RifRftSegment> m_rftWellDateSegments;
|
||||
std::set<QDateTime> m_rftSegmentTimeSteps;
|
||||
};
|
||||
|
||||
@@ -110,6 +110,27 @@ std::vector<Opm::EclIO::EclFile::EclEntry> RifRftSegment::resultNameAndSize() co
|
||||
return m_resultNameAndSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<int> RifRftSegment::tubingBranchIds() const
|
||||
{
|
||||
std::vector<int> filteredBranchIds;
|
||||
|
||||
for ( auto branchId : branchIds() )
|
||||
{
|
||||
if ( m_branchType.count( branchId ) )
|
||||
{
|
||||
if ( m_branchType.at( branchId ) == RiaDefines::RftBranchType::RFT_TUBING )
|
||||
{
|
||||
filteredBranchIds.push_back( branchId );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return filteredBranchIds;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -128,6 +149,22 @@ std::vector<int> RifRftSegment::branchIds() const
|
||||
return v;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifRftSegment::setBranchLength( int branchId, double length )
|
||||
{
|
||||
m_branchLength[branchId] = length;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifRftSegment::setBranchType( int branchId, RiaDefines::RftBranchType branchType )
|
||||
{
|
||||
m_branchType[branchId] = branchType;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
#include "RiaRftDefines.h"
|
||||
#include "opm/io/eclipse/EclFile.hpp"
|
||||
|
||||
class RifRftSegmentData
|
||||
@@ -52,11 +53,18 @@ public:
|
||||
void addResultNameAndSize( const Opm::EclIO::EclFile::EclEntry& resultNameAndSize );
|
||||
std::vector<Opm::EclIO::EclFile::EclEntry> resultNameAndSize() const;
|
||||
|
||||
std::vector<int> tubingBranchIds() const;
|
||||
std::vector<int> branchIds() const;
|
||||
|
||||
void setBranchLength( int branchId, double length );
|
||||
void setBranchType( int branchId, RiaDefines::RftBranchType branchType );
|
||||
|
||||
std::vector<size_t> indicesForBranchNumber( int branchNumber ) const;
|
||||
|
||||
private:
|
||||
std::vector<RifRftSegmentData> m_topology;
|
||||
std::vector<Opm::EclIO::EclFile::EclEntry> m_resultNameAndSize;
|
||||
|
||||
std::map<int, double> m_branchLength;
|
||||
std::map<int, RiaDefines::RftBranchType> m_branchType;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user