mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
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:
parent
f8aae6691d
commit
0ec612ae86
@ -33,11 +33,11 @@
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafPdmUiTreeView.h"
|
||||
#include "cafProgressState.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QTreeView>
|
||||
|
||||
#include "cafProgressState.h"
|
||||
#include <set>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -113,7 +113,12 @@ void RiaCompletionTypeCalculationScheduler::slotRecalculateCompletionType()
|
||||
std::set<RimEclipseCase*> uniqueCases( m_eclipseCasesToRecalculate.begin(), m_eclipseCasesToRecalculate.end() );
|
||||
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
QModelIndex mi = RiuMainWindow::instance()->projectTreeView()->treeView()->currentIndex();
|
||||
|
||||
QModelIndex mi;
|
||||
if ( RiuMainWindow::instance() )
|
||||
{
|
||||
mi = RiuMainWindow::instance()->projectTreeView()->treeView()->currentIndex();
|
||||
}
|
||||
|
||||
for ( RimEclipseCase* eclipseCase : uniqueCases )
|
||||
{
|
||||
@ -138,10 +143,13 @@ void RiaCompletionTypeCalculationScheduler::slotRecalculateCompletionType()
|
||||
if ( activeView && activeView->viewer() )
|
||||
{
|
||||
RiaApplication::instance()->setActiveReservoirView( activeView );
|
||||
if ( RiuMainWindow::instance() )
|
||||
{
|
||||
RiuMainWindow::instance()->setActiveViewer( activeView->viewer()->layoutWidget() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( mi.isValid() )
|
||||
if ( mi.isValid() && RiuMainWindow::instance() )
|
||||
{
|
||||
RiuMainWindow::instance()->projectTreeView()->treeView()->setCurrentIndex( mi );
|
||||
}
|
||||
@ -155,6 +163,14 @@ RiaCompletionTypeCalculationScheduler::~RiaCompletionTypeCalculationScheduler()
|
||||
delete m_recalculateCompletionTypeTimer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaCompletionTypeCalculationScheduler::RiaCompletionTypeCalculationScheduler()
|
||||
: m_recalculateCompletionTypeTimer( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -27,6 +27,9 @@
|
||||
class QTimer;
|
||||
class RimEclipseCase;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RiaCompletionTypeCalculationScheduler : public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
@ -40,10 +43,7 @@ private slots:
|
||||
void slotRecalculateCompletionType();
|
||||
|
||||
private:
|
||||
RiaCompletionTypeCalculationScheduler()
|
||||
: m_recalculateCompletionTypeTimer( nullptr )
|
||||
{
|
||||
}
|
||||
RiaCompletionTypeCalculationScheduler();
|
||||
~RiaCompletionTypeCalculationScheduler() override;
|
||||
|
||||
RiaCompletionTypeCalculationScheduler( const RiaCompletionTypeCalculationScheduler& o ) = delete;
|
||||
|
@ -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,7 +501,8 @@ std::vector<LgrInfo>
|
||||
timeStep,
|
||||
completionTypes,
|
||||
wellsIntersectingOtherLgrs );
|
||||
|
||||
if ( !intersectingCells.empty() )
|
||||
{
|
||||
auto newLgrs = buildLgrsPerCompletion( firstLgrId + (int)lgrs.size(),
|
||||
eclipseCase,
|
||||
intersectingCells,
|
||||
@ -502,6 +510,7 @@ std::vector<LgrInfo>
|
||||
lgrNameFactory );
|
||||
lgrs.insert( lgrs.end(), newLgrs.begin(), newLgrs.end() );
|
||||
}
|
||||
}
|
||||
else if ( splitType == Lgr::LGR_PER_WELL )
|
||||
{
|
||||
for ( const auto& wellPath : wellPaths )
|
||||
@ -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 );
|
||||
};
|
||||
|
@ -114,9 +114,13 @@ void RicCreateTemporaryLgrFeature::createLgrsForWellPaths( std::vector<RimWellPa
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTemporaryLgrFeature::updateViews( RimEclipseCase* eclipseCase )
|
||||
{
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
RiaGuiApplication* guiApp = nullptr;
|
||||
if ( RiaGuiApplication::isRunning() )
|
||||
{
|
||||
guiApp = RiaGuiApplication::instance();
|
||||
}
|
||||
|
||||
app->clearAllSelections();
|
||||
if ( guiApp ) guiApp->clearAllSelections();
|
||||
|
||||
deleteAllCachedData( eclipseCase );
|
||||
RimProject::current()->mainPlotCollection()->deleteAllCachedData();
|
||||
@ -124,7 +128,7 @@ void RicCreateTemporaryLgrFeature::updateViews( RimEclipseCase* eclipseCase )
|
||||
|
||||
RimProject::current()->mainPlotCollection()->wellLogPlotCollection()->reloadAllPlots();
|
||||
|
||||
eclipseCase->createDisplayModelAndUpdateAllViews();
|
||||
if ( guiApp ) eclipseCase->createDisplayModelAndUpdateAllViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
0
ApplicationLibCode/UnitTests/TestData/RifRoffReader/code_names_and_values_mismatch.roff
Normal file → Executable file
0
ApplicationLibCode/UnitTests/TestData/RifRoffReader/code_names_and_values_mismatch.roff
Normal file → Executable file
0
ApplicationLibCode/UnitTests/TestData/RifRoffReader/code_names_missing.roff
Normal file → Executable file
0
ApplicationLibCode/UnitTests/TestData/RifRoffReader/code_names_missing.roff
Normal file → Executable file
0
ApplicationLibCode/UnitTests/TestData/RifRoffReader/code_values_integer_wrong.roff
Normal file → Executable file
0
ApplicationLibCode/UnitTests/TestData/RifRoffReader/code_values_integer_wrong.roff
Normal file → Executable file
0
ApplicationLibCode/UnitTests/TestData/RifRoffReader/code_values_missing.roff
Normal file → Executable file
0
ApplicationLibCode/UnitTests/TestData/RifRoffReader/code_values_missing.roff
Normal file → Executable file
0
ApplicationLibCode/UnitTests/TestData/RifRoffReader/facies_info.roff
Normal file → Executable file
0
ApplicationLibCode/UnitTests/TestData/RifRoffReader/facies_info.roff
Normal file → Executable file
@ -8,3 +8,18 @@ sys.path.insert(1, os.path.join(sys.path[0], '../../'))
|
||||
import rips
|
||||
|
||||
import dataroot
|
||||
|
||||
def test_create_lgr_well(rips_instance, initialize_test):
|
||||
case = rips_instance.project.load_case(
|
||||
dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID")
|
||||
assert(case.name == "TEST10K_FLT_LGR_NNC")
|
||||
assert(len(case.grids()) == 2)
|
||||
|
||||
well_files=[dataroot.PATH + "/TEST10K_FLT_LGR_NNC/wellpath_a.dev"]
|
||||
rips_instance.project.import_well_paths(well_path_files=well_files)
|
||||
|
||||
time_step=5
|
||||
well_path_names=["Well Path A"]
|
||||
case.create_lgr_for_completion(time_step, well_path_names, refinement_i=2, refinement_j=3,refinement_k=1, split_type="LGR_PER_WELL")
|
||||
assert(len(case.grids()) == 3)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user