#3553 Temp LGR. Error handling, bug fixes

This commit is contained in:
Bjørn Erik Jensen
2018-10-29 10:52:59 +01:00
parent 04c07154b0
commit a1c8275eed
7 changed files with 449 additions and 130 deletions

View File

@@ -30,6 +30,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigCell.h"
#include "RigCellGeometryTools.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
@@ -111,37 +112,37 @@ void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked)
RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo(RiaDefines::MATRIX_MODEL);
RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo(RiaDefines::FRACTURE_MODEL);
bool intersectsExistingLgr = false;
bool intersectingOtherLgr = false;
for (const auto& wellPath : wellPaths)
{
try
bool intersectingLgrs = false;
auto lgrs = RicExportLgrFeature::buildLgrsForWellPath(wellPath,
eclipseCase,
timeStep,
lgrCellCounts,
splitType,
completionTypes,
&intersectingLgrs);
if (intersectingLgrs) intersectingOtherLgr = true;
auto mainGrid = eclipseCase->eclipseCaseData()->mainGrid();
for (auto lgr : lgrs)
{
std::vector<LgrInfo> lgrs = RicExportLgrFeature::buildLgrsForWellPath(
wellPath, eclipseCase, timeStep, lgrCellCounts, splitType, completionTypes);
createLgr(lgr, eclipseCase->eclipseCaseData()->mainGrid());
auto mainGrid = eclipseCase->eclipseCaseData()->mainGrid();
size_t lgrCellCount = lgr.cellCount();
for (auto lgr : lgrs)
activeCellInfo->addLgr(lgrCellCount);
if (fractureActiveCellInfo->reservoirActiveCellCount() > 0)
{
createLgr(lgr, eclipseCase->eclipseCaseData()->mainGrid());
size_t lgrCellCount = lgr.cellCount();
activeCellInfo->addLgr(lgrCellCount);
if (fractureActiveCellInfo->reservoirActiveCellCount() > 0)
{
fractureActiveCellInfo->addLgr(lgrCellCount);
}
fractureActiveCellInfo->addLgr(lgrCellCount);
}
mainGrid->calculateFaults(activeCellInfo, true);
}
catch (CreateLgrException& e)
{
RiaLogging::error(e.message);
intersectsExistingLgr = true;
}
mainGrid->calculateFaults(activeCellInfo, true);
}
RiuSelectionManager::instance()->deleteAllItems(RiuSelectionManager::RUI_APPLICATION_GLOBAL);
@@ -164,11 +165,11 @@ void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked)
}
}
if (intersectsExistingLgr)
if (intersectingOtherLgr)
{
QMessageBox::warning(nullptr,
"LGR cells intersected",
"At least one completion intersects with an LGR. No output for those completions produced");
"At least one completion intersects with an LGR. No LGR(s) for those cells are produced");
}
}
}
@@ -231,7 +232,8 @@ void RicCreateTemporaryLgrFeature::createLgr(const LgrInfo& lgrInfo, RigMainGrid
size_t mainI = lgrInfo.mainGridStartCell.i() + lgrI / lgrSizePerMainCell.i();
size_t mainCellIndex = mainGrid->cellIndexFromIJK(mainI, mainJ, mainK);
mainGrid->globalCellArray()[mainCellIndex].setSubGrid(localGrid);
auto mainGridCell = mainGrid->globalCellArray()[mainCellIndex];
mainGridCell.setSubGrid(localGrid);
RigCell& cell = mainGrid->globalCellArray()[cellStartIndex + gridLocalCellIndex];
cell.setGridLocalCellIndex(gridLocalCellIndex);