£8014 : Fix MSW valve export

This commit is contained in:
Magne Sjaastad 2021-10-29 14:43:56 +02:00 committed by GitHub
parent ea496072b8
commit 299217e219
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 73 additions and 40 deletions

View File

@ -278,6 +278,14 @@ std::unique_ptr<RicMswCompletion> RicMswSegment::removeCompletion( RicMswComplet
return removedCompletion;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSegment::deleteAllCompletions()
{
m_completions.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -76,6 +76,7 @@ public:
void addCompletion( std::unique_ptr<RicMswCompletion> completion );
std::unique_ptr<RicMswCompletion> removeCompletion( RicMswCompletion* completion );
void deleteAllCompletions();
void addIntersection( std::shared_ptr<RicMswSegmentCellIntersection> intersection );

View File

@ -550,36 +550,29 @@ void RicMswTableFormatterTools::generateWsegvalvTableRecursively( gsl::not_null<
{
if ( RigCompletionData::isWsegValveTypes( completion->completionType() ) )
{
auto wsegValve = static_cast<RicMswWsegValve*>( completion );
if ( !wsegValve->segments().empty() )
// Related function RicWellPathExportMswCompletionsImpl::moveIntersectionsToSuperICDsOrAICDs
auto wsegValve = static_cast<RicMswWsegValve*>( completion );
int segmentNumber = -1;
for ( auto seg : wsegValve->segments() )
{
CVF_ASSERT( wsegValve->segments().size() == 1u );
if ( seg->segmentNumber() > -1 ) segmentNumber = seg->segmentNumber();
if ( seg->intersections().empty() ) continue;
auto firstSubSegment = wsegValve->segments().front();
size_t cellIndex = seg->intersections().front()->globalCellIndex();
// TODO: The following line was blocking export of valves for fishbones
// Unclear why this line was included. Remove when MSW export has ben verified correctly
// if ( !firstSubSegment->intersections().empty() )
QString comment;
if ( wsegValve->completionType() == RigCompletionData::CompletionType::PERFORATION_ICD ||
wsegValve->completionType() == RigCompletionData::CompletionType::PERFORATION_ICV )
{
QString comment;
if ( wsegValve->completionType() == RigCompletionData::CompletionType::PERFORATION_ICD ||
wsegValve->completionType() == RigCompletionData::CompletionType::PERFORATION_ICV )
{
comment = wsegValve->label();
}
size_t cellIndex = std::numeric_limits<size_t>::max();
if ( !firstSubSegment->intersections().empty() )
{
cellIndex = firstSubSegment->intersections().front()->globalCellIndex();
}
wsegvalveData[cellIndex].push_back( WsegvalveData( wellNameForExport,
comment,
firstSubSegment->segmentNumber(),
wsegValve->flowCoefficient(),
wsegValve->area() ) );
comment = wsegValve->label();
}
wsegvalveData[cellIndex].push_back( WsegvalveData( wellNameForExport,
comment,
segmentNumber,
wsegValve->flowCoefficient(),
wsegValve->area() ) );
}
}
}
@ -739,22 +732,19 @@ void RicMswTableFormatterTools::generateWsegAicdTableRecursively( RicMswExportIn
auto aicd = static_cast<const RicMswPerforationAICD*>( completion );
if ( aicd->isValid() )
{
if ( !aicd->segments().empty() )
int segmentNumber = -1;
for ( auto seg : aicd->segments() )
{
CVF_ASSERT( aicd->segments().size() == 1u );
auto firstSegment = aicd->segments().front();
if ( seg->segmentNumber() > -1 ) segmentNumber = seg->segmentNumber();
if ( seg->intersections().empty() ) continue;
size_t cellIndex = std::numeric_limits<size_t>::max();
if ( !firstSegment->intersections().empty() )
{
cellIndex = firstSegment->intersections().front()->globalCellIndex();
}
size_t cellIndex = seg->intersections().front()->globalCellIndex();
auto wellName = exportInfo.mainBoreBranch()->wellPath()->completionSettings()->wellNameForExport();
auto comment = aicd->label();
aicdValveData[cellIndex].push_back( AicdWsegvalveData( wellName,
comment,
firstSegment->segmentNumber(),
segmentNumber,
aicd->flowScalingFactor(),
aicd->isOpen(),
aicd->values() ) );

View File

@ -1622,13 +1622,13 @@ void RicWellPathExportMswCompletionsImpl::moveIntersectionsToSuperICDsOrAICDs( g
std::vector<RicMswCompletion*> perforations;
for ( auto completion : segment->completions() )
{
if ( RigCompletionData::isPerforationValve( completion->completionType() ) )
if ( completion->completionType() == RigCompletionData::CompletionType::PERFORATION_ICD ||
completion->completionType() == RigCompletionData::CompletionType::PERFORATION_AICD )
{
superValve = completion;
}
else
else if ( completion->completionType() == RigCompletionData::CompletionType::PERFORATION )
{
CVF_ASSERT( completion->completionType() == RigCompletionData::CompletionType::PERFORATION );
perforations.push_back( completion );
}
}
@ -1636,21 +1636,55 @@ void RicWellPathExportMswCompletionsImpl::moveIntersectionsToSuperICDsOrAICDs( g
if ( superValve == nullptr ) continue;
CVF_ASSERT( superValve->segments().size() == 1u );
double aggregatedMinStartMD = std::numeric_limits<double>::max();
// Remove and take over ownership of the superValve completion
auto completionPtr = segment->removeCompletion( superValve );
for ( auto perforation : perforations )
{
for ( auto subSegment : perforation->segments() )
{
aggregatedMinStartMD = std::min( aggregatedMinStartMD, subSegment->startMD() );
// The valve completions on the main branch will be deleted. Create a segment with startMD and
// endMD representing the perforation along main well path to be connected to the valve. When COMPSEGS
// data is exported, the startMD and endMD of the segment is used to define the Start Length and End
// Length of the COMPSEGS keyword
//
// Example output
//
// COMPSEGS
// --Name
// Well - 1 /
// --I J K Branch no Start Length End Length
// 17 17 9 2 3030.71791 3034.01331 /
// 17 18 9 3 3034.01331 3125.47617 /
auto valveInflowSegment =
std::make_unique<RicMswSegment>( QString( "%1 real valve segment " ).arg( branch->label() ),
subSegment->startMD(),
subSegment->endMD(),
subSegment->startTVD(),
subSegment->endTVD() );
for ( auto intersectionPtr : subSegment->intersections() )
{
completionPtr->segments()[0]->addIntersection( intersectionPtr );
valveInflowSegment->addIntersection( intersectionPtr );
}
completionPtr->addSegment( std::move( valveInflowSegment ) );
}
}
// Remove all completions and re-add the super valve
segment->completions().clear();
segment->addCompletion( std::move( completionPtr ) );
segment->deleteAllCompletions();
auto segmentWithLowerMD = branch->findClosestSegmentWithLowerMD( aggregatedMinStartMD );
if ( segmentWithLowerMD )
{
segmentWithLowerMD->addCompletion( std::move( completionPtr ) );
}
}
}