#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

@ -91,24 +91,20 @@ void RicfExportLgrForCompletions::execute()
}
caf::VecIjk lgrCellCounts(m_refinementI, m_refinementJ, m_refinementK);
bool lgrIntersected = false;
bool intersectingOtherLgrs = false;
for (const auto wellPath : wellPaths)
{
if (wellPath)
{
try
{
feature->exportLgrsForWellPath(exportFolder, wellPath, eclipseCase, m_timeStep, lgrCellCounts, m_splitType(),
{RigCompletionData::PERFORATION, RigCompletionData::FRACTURE, RigCompletionData::FISHBONES});
}
catch(CreateLgrException e)
{
lgrIntersected = true;
}
bool intersectingLgrs = false;
feature->exportLgrsForWellPath(exportFolder, wellPath, eclipseCase, m_timeStep, lgrCellCounts, m_splitType(),
{RigCompletionData::PERFORATION, RigCompletionData::FRACTURE, RigCompletionData::FISHBONES}, &intersectingLgrs);
if (intersectingLgrs) intersectingOtherLgrs = true;
}
}
if (lgrIntersected)
if (intersectingOtherLgrs)
{
RiaLogging::error("exportLgrForCompletions: At least one completion intersects with an LGR. No output for those completions produced");
}

View File

@ -89,21 +89,6 @@ std::vector<RigCompletionData> filterCompletionsOnType(const std::vector<RigComp
return filtered;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
//bool completionIncluded(const caf::PdmObject* object,
// RicExportLgrUi::CompletionType includedCompletionTypes)
//{
// if (dynamic_cast<const RimPerforationInterval*>(object) && (includedCompletionTypes & RicExportLgrUi::CT_PERFORATION))
// return true;
// else if (dynamic_cast<const RimFracture*>(object) && (includedCompletionTypes & RicExportLgrUi::CT_FRACTURE))
// return true;
// else if (dynamic_cast<const RimFishbonesMultipleSubs*>(object) && (includedCompletionTypes & RicExportLgrUi::CT_FISHBONE))
// return true;
// return false;
//}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -272,33 +257,28 @@ void RicExportLgrFeature::exportLgrsForWellPath(const QString& export
size_t timeStep,
caf::VecIjk lgrCellCounts,
RicExportLgrUi::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes)
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* intersectingOtherLgrs)
{
std::vector<LgrInfo> lgrs;
try
{
lgrs = buildLgrsForWellPath(wellPath,
eclipseCase,
timeStep,
lgrCellCounts,
splitType,
completionTypes);
lgrs = buildLgrsForWellPath(wellPath,
eclipseCase,
timeStep,
lgrCellCounts,
splitType,
completionTypes,
intersectingOtherLgrs);
// Export
QFile file;
QString fileName = caf::Utils::makeValidFileBasename(QString("LGR_%1").arg(wellPath->name())) + ".dat";
openFileForExport(exportFolder, fileName, &file);
QTextStream stream(&file);
stream.setRealNumberNotation(QTextStream::FixedNotation);
stream.setRealNumberPrecision(2);
exportLgrs(stream, lgrs);
file.close();
}
catch (CreateLgrException e)
{
throw;
}
// Export
QFile file;
QString fileName = caf::Utils::makeValidFileBasename(QString("LGR_%1").arg(wellPath->name())) + ".dat";
openFileForExport(exportFolder, fileName, &file);
QTextStream stream(&file);
stream.setRealNumberNotation(QTextStream::FixedNotation);
stream.setRealNumberPrecision(2);
exportLgrs(stream, lgrs);
file.close();
}
//--------------------------------------------------------------------------------------------------
@ -309,55 +289,33 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPath(RimWellPath*
size_t timeStep,
caf::VecIjk lgrCellCounts,
RicExportLgrUi::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes)
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* intersectingOtherLgrs)
{
std::vector<LgrInfo> lgrs;
bool intersectsWithExistingLgr = false;
if (splitType == RicExportLgrUi::LGR_PER_CELL)
{
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep, completionTypes);
if (containsAnyNonMainGridCells(intersectingCells))
{
intersectsWithExistingLgr = true;
}
else
{
lgrs = buildLgrsPerMainCell(eclipseCase, intersectingCells, lgrCellCounts);
}
*intersectingOtherLgrs = containsAnyNonMainGridCells(intersectingCells);
lgrs = buildLgrsPerMainCell(eclipseCase, intersectingCells, lgrCellCounts);
}
else if (splitType == RicExportLgrUi::LGR_PER_COMPLETION)
{
auto intersectingCells = cellsIntersectingCompletions_PerCompletion(eclipseCase, wellPath, timeStep, completionTypes);
if (containsAnyNonMainGridCells(intersectingCells))
{
intersectsWithExistingLgr = true;
}
else
{
lgrs = buildLgrsPerCompletion(eclipseCase, intersectingCells, lgrCellCounts);
}
*intersectingOtherLgrs = containsAnyNonMainGridCells(intersectingCells);
lgrs = buildLgrsPerCompletion(eclipseCase, intersectingCells, lgrCellCounts);
}
else if (splitType == RicExportLgrUi::LGR_PER_WELL)
{
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep, completionTypes);
if (containsAnyNonMainGridCells(intersectingCells))
{
intersectsWithExistingLgr = true;
}
else
{
int lgrId = firstAvailableLgrId(eclipseCase->mainGrid());
lgrs.push_back(buildLgr(lgrId, eclipseCase, intersectingCells, lgrCellCounts));
}
}
*intersectingOtherLgrs = containsAnyNonMainGridCells(intersectingCells);
if (intersectsWithExistingLgr)
{
throw CreateLgrException("At least one completion intersects with an existing LGR");
int lgrId = firstAvailableLgrId(eclipseCase->mainGrid());
lgrs.push_back(buildLgr(lgrId, eclipseCase, intersectingCells, lgrCellCounts));
}
return lgrs;
}
@ -479,6 +437,8 @@ std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
// This loop assumes that cells are ordered downwards along well path
for (auto intCell : intCells)
{
if (!intCell.first.isMainGridCell()) continue;
auto filteredCompletions = filterCompletionsOnType(intCell.second, completionTypes);
if (filteredCompletions.empty()) continue;
@ -537,20 +497,23 @@ void RicExportLgrFeature::onActionTriggered(bool isChecked)
auto lgrCellCounts = dialogData->lgrCellCount();
size_t timeStep = dialogData->timeStep();
bool intersectsExistingLgr = false;
bool intersectingOtherLgrs = false;
for (const auto& wellPath : wellPaths)
{
try
{
exportLgrsForWellPath(dialogData->exportFolder(), wellPath, eclipseCase, timeStep, lgrCellCounts, dialogData->splitType(), dialogData->completionTypes());
}
catch (CreateLgrException e)
{
intersectsExistingLgr = true;
}
bool intersectingLgrs = false;
exportLgrsForWellPath(dialogData->exportFolder(),
wellPath,
eclipseCase,
timeStep,
lgrCellCounts,
dialogData->splitType(),
dialogData->completionTypes(),
&intersectingLgrs);
if (intersectingLgrs) intersectingOtherLgrs = true;
}
if (intersectsExistingLgr)
if (intersectingOtherLgrs)
{
QMessageBox::warning(nullptr,
"LGR cells intersected",

View File

@ -35,18 +35,6 @@ class RimWellPath;
class QFile;
class QTextStream;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class CreateLgrException
{
public:
CreateLgrException(const QString& message)
: message(message)
{
}
QString message;
};
//==================================================================================================
///
@ -150,14 +138,16 @@ class RicExportLgrFeature : public caf::CmdFeature
size_t timeStep,
caf::VecIjk lgrCellCounts,
RicExportLgrUi::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes);
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* intersectingOtherLgrs);
static std::vector<LgrInfo> buildLgrsForWellPath(RimWellPath* wellPath,
RimEclipseCase* eclipseCase,
size_t timeStep,
caf::VecIjk lgrCellCounts,
RicExportLgrUi::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes);
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* intersectingOtherLgrs);
static std::vector<RimWellPath*> selectedWellPaths();

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);

View File

@ -0,0 +1,361 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicCreateTemporaryLgrFeature.h"
#include "RiaApplication.h"
#include "RiaCompletionTypeCalculationScheduler.h"
#include "RiaLogging.h"
#include "CompletionExportCommands/RicWellPathExportCompletionDataFeature.h"
#include "ExportCommands/RicExportLgrFeature.h"
#include "ExportCommands/RicExportLgrUi.h"
#include "RifEclipseDataTableFormatter.h"
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigCell.h"
#include "RigCellGeometryTools.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"
#include "RigVirtualPerforationTransmissibilities.h"
#include "RimDialogData.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPathCompletions.h"
#include "RiuPlotMainWindow.h"
#include "RiuSelectionManager.h"
#include <QAction>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include <QTextStream>
#include <cafPdmUiPropertyViewDialog.h>
#include <cafSelectionManager.h>
#include <cafSelectionManagerTools.h>
#include <cafUtils.h>
#include <cafVecIjk.h>
#include <algorithm>
#include <limits>
CAF_CMD_SOURCE_INIT(RicCreateTemporaryLgrFeature, "RicCreateTemporaryLgrFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateTemporaryLgrFeature::isCommandEnabled()
{
std::vector<RimWellPathCompletions*> completions = caf::selectedObjectsByTypeStrict<RimWellPathCompletions*>();
std::vector<RimWellPath*> wellPaths = caf::selectedObjectsByTypeStrict<RimWellPath*>();
return !completions.empty() || !wellPaths.empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked)
{
std::vector<RimWellPath*> wellPaths = RicExportLgrFeature::selectedWellPaths();
if (wellPaths.empty()) return;
QString dialogTitle = "Create Temporary LGR";
RimEclipseCase* defaultEclipseCase = nullptr;
int defaultTimeStep = 0;
auto activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeGridView());
if (activeView)
{
defaultEclipseCase = activeView->eclipseCase();
defaultTimeStep = activeView->currentTimeStep();
}
auto dialogData = RicExportLgrFeature::openDialog(dialogTitle, defaultEclipseCase, defaultTimeStep, true);
if (dialogData)
{
auto eclipseCase = dialogData->caseToApply();
auto lgrCellCounts = dialogData->lgrCellCount();
size_t timeStep = dialogData->timeStep();
auto splitType = dialogData->splitType();
auto completionTypes = dialogData->completionTypes();
auto eclipseCaseData = eclipseCase->eclipseCaseData();
RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo(RiaDefines::MATRIX_MODEL);
RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo(RiaDefines::FRACTURE_MODEL);
bool intersectingOtherLgr = false;
for (const auto& wellPath : wellPaths)
{
<<<<<<< HEAD
try
{
std::vector<LgrInfo> lgrs = RicExportLgrFeature::buildLgrsForWellPath(
wellPath, eclipseCase, timeStep, lgrCellCounts, splitType, completionTypes);
=======
std::vector<LgrInfo> lgrs;
bool intersectingLgrs = false;
lgrs = RicExportLgrFeature::buildLgrsForWellPath(wellPath,
eclipseCase,
timeStep,
lgrCellCounts,
splitType,
completionTypes,
&intersectingLgrs);
>>>>>>> TEMP
if (intersectingLgrs) intersectingOtherLgr = true;
auto mainGrid = eclipseCase->eclipseCaseData()->mainGrid();
for (auto lgr : lgrs)
{
createLgr(lgr, eclipseCase->eclipseCaseData()->mainGrid());
size_t lgrCellCount = lgr.cellCount();
<<<<<<< HEAD
mainGrid->calculateFaults(activeCellInfo, true);
}
catch (CreateLgrException& e)
{
RiaLogging::error(e.message);
intersectsExistingLgr = true;
=======
activeCellInfo->addLgr(lgrCellCount);
if (fractureActiveCellInfo->reservoirActiveCellCount() > 0)
{
fractureActiveCellInfo->addLgr(lgrCellCount);
}
>>>>>>> TEMP
}
mainGrid->calculateFaults(activeCellInfo, true);
}
RiuSelectionManager::instance()->deleteAllItems(RiuSelectionManager::RUI_APPLICATION_GLOBAL);
RiuSelectionManager::instance()->deleteAllItems(RiuSelectionManager::RUI_TEMPORARY);
caf::SelectionManager::instance()->clearAll();
deleteAllCachedData(eclipseCase);
RiaApplication::instance()->project()->mainPlotCollection()->deleteAllCachedData();
computeCachedData(eclipseCase);
RiaApplication::instance()->project()->mainPlotCollection()->wellLogPlotCollection()->reloadAllPlots();
for (const auto& v : eclipseCase->views())
{
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(v);
if (eclipseView)
{
eclipseView->scheduleReservoirGridGeometryRegen();
eclipseView->loadDataAndUpdate();
}
}
if (intersectingOtherLgr)
{
QMessageBox::warning(nullptr,
"LGR cells intersected",
"At least one completion intersects with an LGR. No LGR(s) for those cells are produced");
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateTemporaryLgrFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Create Temporary LGR");
}
//--------------------------------------------------------------------------------------------------
/// Todo: Guarding, caching LGR corner nodes calculations
//--------------------------------------------------------------------------------------------------
void RicCreateTemporaryLgrFeature::createLgr(const LgrInfo& lgrInfo, RigMainGrid* mainGrid)
{
auto app = RiaApplication::instance();
auto eclipseView = dynamic_cast<RimEclipseView*>(app->activeReservoirView());
if (!eclipseView) return;
int lgrId = lgrInfo.id;
size_t totalCellCount = mainGrid->globalCellArray().size();
size_t lgrCellCount = lgrInfo.cellCount();
// Create local grid and set properties
RigLocalGrid* localGrid = new RigLocalGrid(mainGrid);
localGrid->setAsTempGrid(true);
localGrid->setGridId(lgrId);
localGrid->setIndexToStartOfCells(totalCellCount);
localGrid->setGridName(lgrInfo.name.toStdString());
localGrid->setGridPointDimensions(cvf::Vec3st(lgrInfo.sizes.i() + 1, lgrInfo.sizes.j() + 1, lgrInfo.sizes.k() + 1));
mainGrid->addLocalGrid(localGrid);
size_t cellStartIndex = mainGrid->globalCellArray().size();
size_t nodeStartIndex = mainGrid->nodes().size();
// Resize global cell and node arrays
{
RigCell defaultCell;
defaultCell.setHostGrid(localGrid);
mainGrid->globalCellArray().resize(cellStartIndex + lgrCellCount, defaultCell);
mainGrid->nodes().resize(nodeStartIndex + lgrCellCount * 8, cvf::Vec3d(0, 0, 0));
}
auto lgrSizePerMainCell = lgrInfo.sizesPerMainGridCell();
size_t gridLocalCellIndex = 0;
// Loop through all new LGR cells
for (size_t lgrK = 0; lgrK < lgrInfo.sizes.k(); lgrK++)
{
size_t mainK = lgrInfo.mainGridStartCell.k() + lgrK / lgrSizePerMainCell.k();
for (size_t lgrJ = 0; lgrJ < lgrInfo.sizes.j(); lgrJ++)
{
size_t mainJ = lgrInfo.mainGridStartCell.j() + lgrJ / lgrSizePerMainCell.j();
for (size_t lgrI = 0; lgrI < lgrInfo.sizes.i(); lgrI++, gridLocalCellIndex++)
{
size_t mainI = lgrInfo.mainGridStartCell.i() + lgrI / lgrSizePerMainCell.i();
size_t mainCellIndex = mainGrid->cellIndexFromIJK(mainI, mainJ, mainK);
auto mainGridCell = mainGrid->globalCellArray()[mainCellIndex];
if (mainGridCell.subGrid())
{
continue;
}
mainGridCell.setSubGrid(localGrid);
RigCell& cell = mainGrid->globalCellArray()[cellStartIndex + gridLocalCellIndex];
cell.setGridLocalCellIndex(gridLocalCellIndex);
cell.setParentCellIndex(mainCellIndex);
// Corner coordinates
{
size_t cIdx;
std::array<cvf::Vec3d, 8> vertices;
mainGrid->cellCornerVertices(mainCellIndex, vertices.data());
auto cellCounts = lgrInfo.sizesPerMainGridCell();
auto lgrCoords =
RigCellGeometryTools::createHexCornerCoords(vertices, cellCounts.i(), cellCounts.j(), cellCounts.k());
size_t subI = lgrI % lgrSizePerMainCell.i();
size_t subJ = lgrJ % lgrSizePerMainCell.j();
size_t subK = lgrK % lgrSizePerMainCell.k();
size_t subIndex =
subI + subJ * lgrSizePerMainCell.i() + subK * lgrSizePerMainCell.i() * lgrSizePerMainCell.j();
for (cIdx = 0; cIdx < 8; ++cIdx)
{
auto& node = mainGrid->nodes()[nodeStartIndex + gridLocalCellIndex * 8 + cIdx];
node.set(lgrCoords[subIndex * 8 + cIdx]);
cell.cornerIndices()[cIdx] = nodeStartIndex + gridLocalCellIndex * 8 + cIdx;
}
}
}
}
}
localGrid->setParentGrid(mainGrid);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateTemporaryLgrFeature::deleteAllCachedData(RimEclipseCase* eclipseCase)
{
if (eclipseCase)
{
RigCaseCellResultsData* cellResultsDataMatrix = eclipseCase->results(RiaDefines::MATRIX_MODEL);
if (cellResultsDataMatrix)
{
cellResultsDataMatrix->freeAllocatedResultsData();
}
RigCaseCellResultsData* cellResultsDataFracture = eclipseCase->results(RiaDefines::FRACTURE_MODEL);
if (cellResultsDataFracture)
{
cellResultsDataFracture->freeAllocatedResultsData();
}
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
if (eclipseCaseData)
{
eclipseCaseData->clearWellCellsInGridCache();
eclipseCaseData->setVirtualPerforationTransmissibilities(nullptr);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateTemporaryLgrFeature::computeCachedData(RimEclipseCase* eclipseCase)
{
if (eclipseCase)
{
RigCaseCellResultsData* cellResultsDataMatrix = eclipseCase->results(RiaDefines::MATRIX_MODEL);
RigCaseCellResultsData* cellResultsDataFracture = eclipseCase->results(RiaDefines::FRACTURE_MODEL);
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
if (eclipseCaseData)
{
eclipseCaseData->mainGrid()->computeCachedData();
eclipseCaseData->computeActiveCellBoundingBoxes();
}
if (cellResultsDataMatrix)
{
cellResultsDataMatrix->computeDepthRelatedResults();
}
if (cellResultsDataFracture)
{
cellResultsDataFracture->computeDepthRelatedResults();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateTemporaryLgrFeature::containsAnyNonMainGridCells(const std::vector<RigCompletionDataGridCell>& cells)
{
return std::find_if(cells.begin(), cells.end(), [](const RigCompletionDataGridCell& cell) {
return !cell.isMainGridCell();
}) != cells.end();
}

View File

@ -28,6 +28,7 @@
class LgrInfo;
class RigMainGrid;
class RigCell;
class RimEclipseCase;
class RimSimWellInView;
class RimWellPath;

View File

@ -2526,6 +2526,7 @@ void RigCaseCellResultsData::assignValuesToTemporaryLgrs(const QString& re
return;
}
bool invalidCellsDetected = false;
for (size_t gridIdx = 0; gridIdx < m_ownerMainGrid->gridCount(); gridIdx++)
{
const auto& grid = m_ownerMainGrid->gridByIndex(gridIdx);
@ -2549,9 +2550,14 @@ void RigCaseCellResultsData::assignValuesToTemporaryLgrs(const QString& re
}
else
{
RiaLogging::warning("Detected invalid/undefined cells when assigning result values to temporary LGRs");
invalidCellsDetected = true;
}
}
}
}
if (invalidCellsDetected)
{
RiaLogging::warning("Detected invalid/undefined cells when assigning result values to temporary LGRs");
}
}