#3650 Temp LGR. Process all affected wells in the same operation

This commit is contained in:
Bjørn Erik Jensen 2018-11-09 13:05:20 +01:00
parent 12e8c3b9b2
commit b1e9841964
6 changed files with 165 additions and 152 deletions

View File

@ -101,30 +101,22 @@ void RicfCreateLgrForCompletions::execute()
RicExportLgrFeature::resetLgrNaming();
caf::VecIjk lgrCellCounts(m_refinementI, m_refinementJ, m_refinementK);
QStringList wellsWithIntersectingLgrs;
for (const auto wellPath : wellPaths)
{
if (wellPath)
{
bool intersectingLgrs = false;
feature->createLgrsForWellPath(
wellPath,
eclipseCase,
m_timeStep,
lgrCellCounts,
m_splitType(),
{RigCompletionData::PERFORATION, RigCompletionData::FRACTURE, RigCompletionData::FISHBONES},
&intersectingLgrs);
QStringList wellsIntersectingOtherLgrs;
if (intersectingLgrs) wellsWithIntersectingLgrs.push_back(wellPath->name());
}
}
feature->createLgrsForWellPaths(
wellPaths,
eclipseCase,
m_timeStep,
lgrCellCounts,
m_splitType(),
{RigCompletionData::PERFORATION, RigCompletionData::FRACTURE, RigCompletionData::FISHBONES},
&wellsIntersectingOtherLgrs);
feature->updateViews(eclipseCase);
if (!wellsWithIntersectingLgrs.empty())
if (!wellsIntersectingOtherLgrs.empty())
{
auto wellsList = wellsWithIntersectingLgrs.join(", ");
auto wellsList = wellsIntersectingOtherLgrs.join(", ");
RiaLogging::error(
"createLgrForCompletions: No LGRs created for some wells due to existing intersecting LGR(s).Affected wells : " +
wellsList);

View File

@ -94,24 +94,14 @@ void RicfExportLgrForCompletions::execute()
}
caf::VecIjk lgrCellCounts(m_refinementI, m_refinementJ, m_refinementK);
QStringList wellsWithIntersectingLgrs;
QStringList wellsIntersectingOtherLgrs;
feature->resetLgrNaming();
for (const auto wellPath : wellPaths)
{
if (wellPath)
{
bool intersectingLgrs = false;
feature->exportLgrsForWellPath(exportFolder, wellPath, eclipseCase, m_timeStep, lgrCellCounts, m_splitType(),
{RigCompletionData::PERFORATION, RigCompletionData::FRACTURE, RigCompletionData::FISHBONES}, &intersectingLgrs);
if (intersectingLgrs) wellsWithIntersectingLgrs.push_back(wellPath->name());
}
}
feature->exportLgrsForWellPaths(exportFolder, wellPaths, eclipseCase, m_timeStep, lgrCellCounts, m_splitType(),
{RigCompletionData::PERFORATION, RigCompletionData::FRACTURE, RigCompletionData::FISHBONES}, &wellsIntersectingOtherLgrs);
if (!wellsWithIntersectingLgrs.empty())
if (!wellsIntersectingOtherLgrs.empty())
{
auto wellsList = wellsWithIntersectingLgrs.join(", ");
auto wellsList = wellsIntersectingOtherLgrs.join(", ");
RiaLogging::error("exportLgrForCompletions: No export for some wells due to existing intersecting LGR(s).Affected wells : " + wellsList);
}
}

View File

@ -120,7 +120,7 @@ public:
private:
std::map<RigCompletionData::CompletionType, std::pair<QString, int>> m_counters;
} lgrNameFactory;
};
//--------------------------------------------------------------------------------------------------
// Internal function
@ -307,28 +307,31 @@ void RicExportLgrFeature::writeLgrs(QTextStream& stream, const std::vector<LgrIn
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportLgrFeature::exportLgrsForWellPath(const QString& exportFolder,
RimWellPath* wellPath,
RimEclipseCase* eclipseCase,
size_t timeStep,
caf::VecIjk lgrCellCounts,
Lgr::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* intersectingOtherLgrs)
void RicExportLgrFeature::exportLgrsForWellPaths(const QString& exportFolder,
std::vector<RimWellPath*> wellPaths,
RimEclipseCase* eclipseCase,
size_t timeStep,
caf::VecIjk lgrCellCounts,
Lgr::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes,
QStringList* wellsIntersectingOtherLgrs)
{
std::vector<LgrInfo> lgrs;
lgrs = buildLgrsForWellPath(wellPath,
eclipseCase,
timeStep,
lgrCellCounts,
splitType,
completionTypes,
intersectingOtherLgrs);
lgrs = buildLgrsForWellPaths(wellPaths,
eclipseCase,
timeStep,
lgrCellCounts,
splitType,
completionTypes,
wellsIntersectingOtherLgrs);
if (!*intersectingOtherLgrs && !lgrs.empty())
for (const auto& wellPath : wellPaths)
{
exportLgrs(exportFolder, wellPath->name(), lgrs);
if (!lgrs.empty())
{
exportLgrs(exportFolder, wellPath->name(), lgrs);
}
}
}
@ -354,33 +357,45 @@ void RicExportLgrFeature::exportLgrs(const QString& exportFolder, const QString&
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPath(RimWellPath* wellPath,
RimEclipseCase* eclipseCase,
size_t timeStep,
caf::VecIjk lgrCellCounts,
Lgr::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* intersectingOtherLgrs)
std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPaths(std::vector<RimWellPath*> wellPaths,
RimEclipseCase* eclipseCase,
size_t timeStep,
caf::VecIjk lgrCellCounts,
Lgr::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes,
QStringList* wellsIntersectingOtherLgrs)
{
std::vector<LgrInfo> lgrs;
LgrNameFactory lgrNameFactory;
if (splitType == Lgr::LGR_PER_CELL)
{
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep, completionTypes, intersectingOtherLgrs);
lgrs = buildLgrsPerMainCell(eclipseCase, wellPath, intersectingCells, lgrCellCounts);
}
else if (splitType == Lgr::LGR_PER_COMPLETION)
{
auto intersectingCells = cellsIntersectingCompletions_PerCompletion(eclipseCase, wellPath, timeStep, completionTypes, intersectingOtherLgrs);
lgrs = buildLgrsPerCompletion(eclipseCase, wellPath, intersectingCells, lgrCellCounts);
}
else if (splitType == Lgr::LGR_PER_WELL)
{
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep, completionTypes, intersectingOtherLgrs);
wellsIntersectingOtherLgrs->clear();
int lgrId = firstAvailableLgrId(eclipseCase->mainGrid());
auto lgrName = lgrNameFactory.newName("WELL", lgrId);
lgrs.push_back(buildLgr(lgrId, lgrName, eclipseCase, wellPath, intersectingCells, lgrCellCounts));
for (const auto& wellPath : wellPaths)
{
bool isIntersectingOtherLgrs = false;
std::vector<LgrInfo> newLgrs;
if (splitType == Lgr::LGR_PER_CELL)
{
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep, completionTypes, &isIntersectingOtherLgrs);
newLgrs = buildLgrsPerMainCell(eclipseCase, wellPath, intersectingCells, lgrCellCounts, lgrNameFactory);
}
else if (splitType == Lgr::LGR_PER_COMPLETION)
{
auto intersectingCells = cellsIntersectingCompletions_PerCompletion_old(eclipseCase, wellPath, timeStep, completionTypes, &isIntersectingOtherLgrs);
newLgrs = buildLgrsPerCompletion(eclipseCase, wellPath, intersectingCells, lgrCellCounts, lgrNameFactory);
}
else if (splitType == Lgr::LGR_PER_WELL)
{
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep, completionTypes, &isIntersectingOtherLgrs);
int lgrId = firstAvailableLgrId(eclipseCase->mainGrid());
auto lgrName = lgrNameFactory.newName("WELL", lgrId);
newLgrs.push_back(buildLgr(lgrId, lgrName, eclipseCase, wellPath, intersectingCells, lgrCellCounts));
}
lgrs.insert(lgrs.end(), newLgrs.begin(), newLgrs.end());
if (isIntersectingOtherLgrs) wellsIntersectingOtherLgrs->push_back(wellPath->name());
}
return lgrs;
}
@ -391,7 +406,8 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsForWellPath(RimWellPath*
std::vector<LgrInfo> RicExportLgrFeature::buildLgrsPerMainCell(RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
const std::vector<RigCompletionDataGridCell>& intersectingCells,
const caf::VecIjk& lgrSizes)
const caf::VecIjk& lgrSizes,
LgrNameFactory& lgrNameFactory)
{
std::vector<LgrInfo> lgrs;
@ -411,7 +427,8 @@ std::vector<LgrInfo> RicExportLgrFeature::buildLgrsPerCompletion(
RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
const std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>& completionInfo,
const caf::VecIjk& lgrSizesPerMainGridCell)
const caf::VecIjk& lgrSizesPerMainGridCell,
LgrNameFactory& lgrNameFactory)
{
std::vector<LgrInfo> lgrs;
@ -603,7 +620,7 @@ std::vector<std::pair<RigCompletionDataGridCell, std::vector<RigCompletionData>>
///
//--------------------------------------------------------------------------------------------------
std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
RicExportLgrFeature::cellsIntersectingCompletions_PerCompletion(RimEclipseCase* eclipseCase,
RicExportLgrFeature::cellsIntersectingCompletions_PerCompletion_old(RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
size_t timeStep,
const std::set<RigCompletionData::CompletionType>& completionTypes,
@ -656,6 +673,34 @@ std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
return completionToCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>> RicExportLgrFeature::cellsIntersectingCompletions_PerCompletion(
RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
size_t timeStep,
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* isIntersectingOtherLgrs)
{
std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>> completionToCells;
*isIntersectingOtherLgrs = false;
auto completions = eclipseCase->computeAndGetVirtualPerforationTransmissibilities();
if (completions)
{
const auto& intCells = completions->multipleCompletionsPerEclipseCell(wellPath, timeStep);
const auto& fractures = wellPath->fractureCollection()->allFractures();
const auto& fishbones = wellPath->fishbonesCollection()->allFishbonesSubs();
const auto& perforations = wellPath->perforationIntervalCollection()->perforations();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -693,25 +738,20 @@ void RicExportLgrFeature::onActionTriggered(bool isChecked)
auto lgrCellCounts = dialogData->lgrCellCount();
size_t timeStep = dialogData->timeStep();
QStringList wellsWithIntersectingLgrs;
for (const auto& wellPath : wellPaths)
{
bool intersectingLgrs = false;
exportLgrsForWellPath(dialogData->exportFolder(),
wellPath,
eclipseCase,
timeStep,
lgrCellCounts,
dialogData->splitType(),
dialogData->completionTypes(),
&intersectingLgrs);
QStringList wellsIntersectingOtherLgrs;
bool intersectingLgrs = false;
exportLgrsForWellPaths(dialogData->exportFolder(),
wellPaths,
eclipseCase,
timeStep,
lgrCellCounts,
dialogData->splitType(),
dialogData->completionTypes(),
&wellsIntersectingOtherLgrs);
if (intersectingLgrs) wellsWithIntersectingLgrs.push_back(wellPath->name());
}
if (!wellsWithIntersectingLgrs.empty())
if (!wellsIntersectingOtherLgrs.empty())
{
auto wellsList = wellsWithIntersectingLgrs.join(", ");
auto wellsList = wellsIntersectingOtherLgrs.join(", ");
QMessageBox::warning(nullptr,
"LGR cells intersected",
"No export for some wells due to existing intersecting LGR(s). Affected wells: " + wellsList);
@ -807,14 +847,6 @@ std::map<QString /*wellName*/, std::vector<LgrInfo>> RicExportLgrFeature::create
return lgrInfosPerWell;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportLgrFeature::resetLgrNaming()
{
lgrNameFactory.resetNumbering();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -29,6 +29,7 @@
#include <limits>
#include <memory>
class LgrNameFactory;
class RigMainGrid;
class RimEclipseCase;
class RimSimWellInView;
@ -140,33 +141,31 @@ class RicExportLgrFeature : public caf::CmdFeature
int defaultTimeStep = 0,
bool hideExportFolderField = false);
static bool openFileForExport(const QString& folderName, const QString& fileName, QFile* exportFile);
static void exportLgrsForWellPath(const QString& exportFolder,
RimWellPath* wellPath,
static void exportLgrsForWellPaths(const QString& exportFolder,
std::vector<RimWellPath*> wellPaths,
RimEclipseCase* eclipseCase,
size_t timeStep,
caf::VecIjk lgrCellCounts,
Lgr::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* intersectingOtherLgrs);
QStringList* wellsIntersectingOtherLgrs);
static void exportLgrs(const QString& exportFolder,
const QString& wellName,
const std::vector<LgrInfo>& lgrInfos);
static std::vector<LgrInfo> buildLgrsForWellPath(RimWellPath* wellPath,
RimEclipseCase* eclipseCase,
size_t timeStep,
caf::VecIjk lgrCellCounts,
Lgr::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* intersectingOtherLgrs);
static std::vector<LgrInfo> buildLgrsForWellPaths(std::vector<RimWellPath*> wellPaths,
RimEclipseCase* eclipseCase,
size_t timeStep,
caf::VecIjk lgrCellCounts,
Lgr::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes,
QStringList* wellsIntersectingOtherLgrs);
static std::vector<RimWellPath*> selectedWellPaths();
static std::map<QString /*wellName*/, std::vector<LgrInfo>> createLgrInfoListForTemporaryLgrs(const RigMainGrid* mainGrid);
static void resetLgrNaming();
protected:
bool isCommandEnabled() override;
void onActionTriggered(bool isChecked) override;
@ -178,12 +177,14 @@ private:
static std::vector<LgrInfo> buildLgrsPerMainCell(RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
const std::vector<RigCompletionDataGridCell>& intersectingCells,
const caf::VecIjk& lgrSizes);
const caf::VecIjk& lgrSizes,
LgrNameFactory& lgrNameFactory);
static std::vector<LgrInfo>
buildLgrsPerCompletion(RimEclipseCase* eclipseCase,
RimWellPath* wellPath,
const std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>& completionInfo,
const caf::VecIjk& lgrSizesPerMainGridCell);
const caf::VecIjk& lgrSizesPerMainGridCell,
LgrNameFactory& lgrNameFactory);
static LgrInfo buildLgr(int lgrId,
const QString& lgrName,
RimEclipseCase* eclipseCase,
@ -197,11 +198,18 @@ private:
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* isIntersectingOtherLgrs);
static std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
cellsIntersectingCompletions_PerCompletion(RimEclipseCase* eclipseCase,
cellsIntersectingCompletions_PerCompletion_old(RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
size_t timeStep,
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* isIntersectingOtherLgrs);
static std::map<CompletionInfo, std::vector<RigCompletionDataGridCell>>
cellsIntersectingCompletions_PerCompletion(RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
size_t timeStep,
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* isIntersectingOtherLgrs);
static int firstAvailableLgrId(const RigMainGrid* mainGrid);
};

View File

@ -75,23 +75,20 @@ CAF_CMD_SOURCE_INIT(RicCreateTemporaryLgrFeature, "RicCreateTemporaryLgrFeature"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateTemporaryLgrFeature::createLgrsForWellPath(RimWellPath* wellPath,
RimEclipseCase* eclipseCase,
size_t timeStep,
caf::VecIjk lgrCellCounts,
Lgr::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* intersectingOtherLgrs)
void RicCreateTemporaryLgrFeature::createLgrsForWellPaths(std::vector<RimWellPath*> wellPaths,
RimEclipseCase* eclipseCase,
size_t timeStep,
caf::VecIjk lgrCellCounts,
Lgr::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes,
QStringList* wellsIntersectingOtherLgrs)
{
auto eclipseCaseData = eclipseCase->eclipseCaseData();
RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo(RiaDefines::MATRIX_MODEL);
RigActiveCellInfo* fractureActiveCellInfo = eclipseCaseData->activeCellInfo(RiaDefines::FRACTURE_MODEL);
bool intersectingLgrs = false;
auto lgrs = RicExportLgrFeature::buildLgrsForWellPath(
wellPath, eclipseCase, timeStep, lgrCellCounts, splitType, completionTypes, &intersectingLgrs);
if (intersectingLgrs) *intersectingOtherLgrs = true;
auto lgrs = RicExportLgrFeature::buildLgrsForWellPaths(
wellPaths, eclipseCase, timeStep, lgrCellCounts, splitType, completionTypes, wellsIntersectingOtherLgrs);
for (const auto& lgr : lgrs)
{
@ -174,25 +171,19 @@ void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked)
RicDeleteTemporaryLgrsFeature::deleteAllTemporaryLgrs(eclipseCase);
RicExportLgrFeature::resetLgrNaming();
bool intersectingOtherLgrs = false;
for (const auto& wellPath : wellPaths)
{
bool intersectingLgrs = false;
createLgrsForWellPath(wellPath,
eclipseCase,
timeStep,
lgrCellCounts,
splitType,
completionTypes,
&intersectingLgrs);
QStringList wellsIntersectingOtherLgrs;
if (intersectingLgrs) intersectingOtherLgrs = true;
}
createLgrsForWellPaths(wellPaths,
eclipseCase,
timeStep,
lgrCellCounts,
splitType,
completionTypes,
&wellsIntersectingOtherLgrs);
updateViews(eclipseCase);
if (intersectingOtherLgrs)
if (!wellsIntersectingOtherLgrs.empty())
{
QMessageBox::warning(nullptr,
"LGR cells intersected",

View File

@ -46,13 +46,13 @@ class RicCreateTemporaryLgrFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT;
public:
void createLgrsForWellPath(RimWellPath* wellPath,
RimEclipseCase* eclipseCase,
size_t timeStep,
caf::VecIjk lgrCellCounts,
Lgr::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes,
bool* intersectingOtherLgrs);
void createLgrsForWellPaths(std::vector<RimWellPath*> wellPaths,
RimEclipseCase* eclipseCase,
size_t timeStep,
caf::VecIjk lgrCellCounts,
Lgr::SplitType splitType,
const std::set<RigCompletionData::CompletionType>& completionTypes,
QStringList* wellsIntersectingOtherLgrs);
void updateViews(RimEclipseCase* eclipseCase);