mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2969 Fracture truncations : Add containment tools
This commit is contained in:
parent
54f5ab66b4
commit
61a7d5c7ba
@ -12,6 +12,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellPathCompletions.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEllipseFractureTemplate.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFracture.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureContainment.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureContainmentTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureExportSettings.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureTemplate.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureTemplateCollection.h
|
||||
@ -37,6 +38,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellPathCompletions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEllipseFractureTemplate.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFracture.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureContainment.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureContainmentTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureExportSettings.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureTemplate.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureTemplateCollection.cpp
|
||||
|
@ -0,0 +1,149 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 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 "RimFractureContainmentTools.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFault.h"
|
||||
#include "RigHexIntersectionTools.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFracture.h"
|
||||
|
||||
#include "cvfStructGrid.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureContainmentTools::appendNeighborCellForFace(const std::set<size_t>& allFracturedCells,
|
||||
const RigMainGrid* mainGrid,
|
||||
size_t currentCell,
|
||||
cvf::StructGridInterface::FaceType face,
|
||||
std::set<size_t>& connectedCells)
|
||||
{
|
||||
size_t anchorI, anchorJ, anchorK;
|
||||
mainGrid->ijkFromCellIndex(currentCell, &anchorI, &anchorJ, &anchorK);
|
||||
|
||||
size_t candidate;
|
||||
if (mainGrid->cellIJKNeighbor(anchorI, anchorJ, anchorK, face, &candidate))
|
||||
{
|
||||
if (std::find(allFracturedCells.begin(), allFracturedCells.end(), candidate) != allFracturedCells.end())
|
||||
{
|
||||
if (std::find(connectedCells.begin(), connectedCells.end(), candidate) == connectedCells.end())
|
||||
{
|
||||
connectedCells.insert(candidate);
|
||||
|
||||
appendNeighborCells(allFracturedCells, mainGrid, candidate, connectedCells);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureContainmentTools::checkFaultAndAppendNeighborCell(const std::set<size_t>& allFracturedCells,
|
||||
const RigMainGrid* mainGrid,
|
||||
size_t currentCell,
|
||||
cvf::StructGridInterface::FaceType face,
|
||||
std::set<size_t>& connectedCells)
|
||||
{
|
||||
const RigFault* fault = mainGrid->findFaultFromCellIndexAndCellFace(currentCell, face);
|
||||
if (fault) return;
|
||||
|
||||
appendNeighborCellForFace(allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::NEG_I, connectedCells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureContainmentTools::appendNeighborCells(const std::set<size_t>& allFracturedCells,
|
||||
const RigMainGrid* mainGrid,
|
||||
size_t currentCell,
|
||||
std::set<size_t>& connectedCells)
|
||||
{
|
||||
// Stop at faults in IJ directions
|
||||
checkFaultAndAppendNeighborCell(allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::NEG_I, connectedCells);
|
||||
checkFaultAndAppendNeighborCell(allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::POS_I, connectedCells);
|
||||
checkFaultAndAppendNeighborCell(allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::NEG_J, connectedCells);
|
||||
checkFaultAndAppendNeighborCell(allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::POS_J, connectedCells);
|
||||
|
||||
// Append cells without fault check in K direction
|
||||
appendNeighborCellForFace(allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::NEG_K, connectedCells);
|
||||
appendNeighborCellForFace(allFracturedCells, mainGrid, currentCell, cvf::StructGridInterface::POS_K, connectedCells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<size_t> RimFractureContainmentTools::fracturedCellsTruncatedByFaults(const RimEclipseView* eclipseView,
|
||||
RimFracture* fracture)
|
||||
{
|
||||
std::set<size_t> fracturedCellsContainedByFaults;
|
||||
|
||||
auto mainGrid = eclipseView->mainGrid();
|
||||
auto activeCellInfo = eclipseView->currentActiveCellInfo();
|
||||
|
||||
if (mainGrid && activeCellInfo)
|
||||
{
|
||||
std::set<size_t> allFracturedCells = getFracturedCells(mainGrid, activeCellInfo, fracture);
|
||||
|
||||
size_t anchorCellGlobalIndex = fracture->findAnchorEclipseCell(mainGrid);
|
||||
|
||||
appendNeighborCells(allFracturedCells, mainGrid, anchorCellGlobalIndex, fracturedCellsContainedByFaults);
|
||||
}
|
||||
|
||||
return fracturedCellsContainedByFaults;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<size_t> RimFractureContainmentTools::getFracturedCells(const RigMainGrid* mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
RimFracture* fracture)
|
||||
{
|
||||
std::set<size_t> eclipseCellIndices;
|
||||
|
||||
{
|
||||
const auto indicesToPotentiallyFracturedCells = fracture->getPotentiallyFracturedCells(mainGrid);
|
||||
|
||||
for (const auto& globalCellIndex : indicesToPotentiallyFracturedCells)
|
||||
{
|
||||
if (activeCellInfo && !activeCellInfo->isActive(globalCellIndex)) continue;
|
||||
|
||||
std::array<cvf::Vec3d, 8> hexCorners;
|
||||
mainGrid->cellCornerVertices(globalCellIndex, hexCorners.data());
|
||||
std::vector<std::vector<cvf::Vec3d>> planeCellPolygons;
|
||||
|
||||
bool isPlanIntersected =
|
||||
RigHexIntersectionTools::planeHexIntersectionPolygons(hexCorners, fracture->transformMatrix(), planeCellPolygons);
|
||||
if (isPlanIntersected || !planeCellPolygons.empty())
|
||||
{
|
||||
eclipseCellIndices.insert(globalCellIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return eclipseCellIndices;
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfStructGrid.h"
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
class RigMainGrid;
|
||||
class RigActiveCellInfo;
|
||||
class RimFracture;
|
||||
class RimEclipseView;
|
||||
|
||||
class RimFractureContainmentTools
|
||||
{
|
||||
public:
|
||||
static std::set<size_t> fracturedCellsTruncatedByFaults(const RimEclipseView* eclipseView, RimFracture* fracture);
|
||||
|
||||
private:
|
||||
// TODO: Try to change RimStimPlanFractureTemplate::fractureTriangleGeometry to be able to use const RimFracture
|
||||
static std::set<size_t>
|
||||
getFracturedCells(const RigMainGrid* mainGrid, const RigActiveCellInfo* activeCellInfo, RimFracture* fracture);
|
||||
|
||||
static void appendNeighborCellForFace(const std::set<size_t>& allFracturedCells,
|
||||
const RigMainGrid* mainGrid,
|
||||
size_t currentCell,
|
||||
cvf::StructGridInterface::FaceType face,
|
||||
std::set<size_t>& connectedCells);
|
||||
|
||||
static void checkFaultAndAppendNeighborCell(const std::set<size_t>& allFracturedCells,
|
||||
const RigMainGrid* mainGrid,
|
||||
size_t currentCell,
|
||||
cvf::StructGridInterface::FaceType face,
|
||||
std::set<size_t>& connectedCells);
|
||||
|
||||
static void appendNeighborCells(const std::set<size_t>& allFracturedCells,
|
||||
const RigMainGrid* mainGrid,
|
||||
size_t currentCell,
|
||||
std::set<size_t>& connectedCells);
|
||||
};
|
Loading…
Reference in New Issue
Block a user