Create LGR : Use all well cells if no completions are defined (#7285)

* #7274 Create LGR : Use all well cells if no completions are defined

* #7263  Create LGR : Not working in console mode 

Guard access to RiaApplication

* Add pytest for create_lgr_for_completion

* Add pytest for create_lgr_for_completion

* #7289 Script : Add execute of last used script

* #7291 Python : Guard access to RiaMainWindow
This commit is contained in:
Magne Sjaastad
2021-01-26 20:34:31 +01:00
committed by GitHub
parent f8aae6691d
commit 0ec612ae86
11 changed files with 101 additions and 20 deletions
@@ -476,6 +476,13 @@ std::vector<LgrInfo>
{
auto intersectingCells =
cellsIntersectingCompletions( eclipseCase, wellPath, timeStep, completionTypes, &isIntersectingOtherLgrs );
if ( intersectingCells.empty() )
{
// Find all grid cells intersected by well path
intersectingCells = allIntersectedCells( eclipseCase, wellPath );
}
auto newLgrs = buildLgrsPerMainCell( firstLgrId + (int)lgrs.size(),
eclipseCase,
wellPath,
@@ -494,13 +501,15 @@ std::vector<LgrInfo>
timeStep,
completionTypes,
wellsIntersectingOtherLgrs );
auto newLgrs = buildLgrsPerCompletion( firstLgrId + (int)lgrs.size(),
eclipseCase,
intersectingCells,
lgrCellCounts,
lgrNameFactory );
lgrs.insert( lgrs.end(), newLgrs.begin(), newLgrs.end() );
if ( !intersectingCells.empty() )
{
auto newLgrs = buildLgrsPerCompletion( firstLgrId + (int)lgrs.size(),
eclipseCase,
intersectingCells,
lgrCellCounts,
lgrNameFactory );
lgrs.insert( lgrs.end(), newLgrs.begin(), newLgrs.end() );
}
}
else if ( splitType == Lgr::LGR_PER_WELL )
{
@@ -511,11 +520,23 @@ std::vector<LgrInfo>
auto intersectingCells =
cellsIntersectingCompletions( eclipseCase, wellPath, timeStep, completionTypes, &isIntersectingOtherLgrs );
lgrs.push_back( buildLgr( lgrId, lgrName, eclipseCase, wellPath->name(), intersectingCells, lgrCellCounts ) );
if ( intersectingCells.empty() )
{
// Find all grid cells intersected by well path
intersectingCells = allIntersectedCells( eclipseCase, wellPath );
}
if ( !intersectingCells.empty() )
{
lgrs.push_back(
buildLgr( lgrId, lgrName, eclipseCase, wellPath->name(), intersectingCells, lgrCellCounts ) );
}
if ( isIntersectingOtherLgrs ) wellsIntersectingOtherLgrs->push_back( wellPath->name() );
}
}
return lgrs;
}
@@ -745,6 +766,28 @@ std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
return completionToCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionDataGridCell> RicExportLgrFeature::allIntersectedCells( RimEclipseCase* eclipseCase,
const RimWellPath* wellPath )
{
std::vector<RigCompletionDataGridCell> cells;
const RigMainGrid* mainGrid = eclipseCase->mainGrid();
auto globalCellIndices =
RigWellPathIntersectionTools::findIntersectedGlobalCellIndices( eclipseCase->eclipseCaseData(),
wellPath->wellPathGeometry()->wellPathPoints() );
for ( const auto& globalCellIndex : globalCellIndices )
{
cells.push_back( RigCompletionDataGridCell( globalCellIndex, mainGrid ) );
}
return cells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -228,6 +228,9 @@ private:
const std::set<RigCompletionData::CompletionType>& completionTypes,
QStringList* wellsIntersectingOtherLgrs );
static std::vector<RigCompletionDataGridCell> allIntersectedCells( RimEclipseCase* eclipseCase,
const RimWellPath* wellPath );
static int firstAvailableLgrId( const RigMainGrid* mainGrid );
static const RigGridBase* hostGrid( const RigMainGrid* mainGrid, size_t reservoirCellIndex );
};