Use ActiveGridCells when filtering connections.

This commit is contained in:
Markus Blatt
2019-12-10 11:46:49 +01:00
parent 36e1ef69ef
commit a1471c80b5
8 changed files with 18 additions and 9 deletions

View File

@@ -257,6 +257,7 @@ if(ENABLE_ECL_OUTPUT)
endif()
list (APPEND TEST_SOURCE_FILES
tests/test_ActiveGridCells.cpp
tests/test_calculateCellVol.cpp
tests/test_cmp.cpp
tests/test_cubic.cpp

View File

@@ -45,6 +45,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/Actions.hpp>
#include <opm/common/utility/ActiveGridCells.hpp>
/*
The DynamicState<std::shared_ptr<T>> pattern: The quantities in the Schedule
@@ -220,7 +221,7 @@ namespace Opm
Will remove all completions which are connected to cell which is not
active. Will scan through all wells and all timesteps.
*/
void filterConnections(const EclipseGrid& grid);
void filterConnections(const ActiveGridCells& grid);
size_t size() const;
void applyAction(size_t reportStep, const Action::ActionX& action, const Action::Result& result);

View File

@@ -35,6 +35,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
#include <opm/common/utility/ActiveGridCells.hpp>
namespace Opm {
@@ -430,7 +431,7 @@ public:
bool handleCOMPLUMP(const DeckRecord& record);
bool handleWPIMULT(const DeckRecord& record);
void filterConnections(const EclipseGrid& grid);
void filterConnections(const ActiveGridCells& grid);
void switchToInjector();
void switchToProducer();
ProductionControls productionControls(const SummaryState& st) const;

View File

@@ -23,6 +23,8 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/common/utility/ActiveGridCells.hpp>
namespace Opm {
class EclipseGrid;
class Eclipse3DProperties;
@@ -63,7 +65,7 @@ namespace Opm {
const_iterator begin() const { return this->m_connections.begin(); }
const_iterator end() const { return this->m_connections.end(); }
void filter(const EclipseGrid& grid);
void filter(const ActiveGridCells& grid);
bool allConnectionsShut() const;
/// Order connections irrespective of input order.
/// The algorithm used is the following:

View File

@@ -2600,7 +2600,7 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c
}
void Schedule::filterConnections(const EclipseGrid& grid) {
void Schedule::filterConnections(const ActiveGridCells& grid) {
for (auto& dynamic_pair : this->wells_static) {
auto& dynamic_state = dynamic_pair.second;
for (auto& well_pair : dynamic_state.unique()) {

View File

@@ -25,7 +25,6 @@
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp>
#include <fnmatch.h>
namespace Opm {
@@ -651,7 +650,7 @@ bool Well::updateWSEGSICD(const std::vector<std::pair<int, SpiralICD> >& sicd_pa
return false;
}
void Well::filterConnections(const EclipseGrid& grid) {
void Well::filterConnections(const ActiveGridCells& grid) {
this->connections->filter(grid);
}

View File

@@ -491,7 +491,7 @@ inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction
}
void WellConnections::filter(const EclipseGrid& grid) {
void WellConnections::filter(const ActiveGridCells& grid) {
auto new_end = std::remove_if(m_connections.begin(),
m_connections.end(),
[&grid](const Connection& c) { return !grid.cellActive(c.getI(), c.getJ(), c.getK()); });

View File

@@ -2992,8 +2992,13 @@ BOOST_AUTO_TEST_CASE(FilterCompletions2) {
}
actnum[grid1.getGlobalIndex(8,8,1)] = 0;
{
EclipseGrid grid2(grid1, actnum);
schedule.filterConnections(grid2);
std::vector<int> globalCell(grid1.getNumActive());
for(std::size_t i = 0; i < grid1.getNumActive(); ++i)
if (actnum[grid1.getGlobalIndex(i)])
globalCell[i] = grid1.getGlobalIndex(i);
ActiveGridCells active(grid1.getNXYZ(), globalCell.data(),
grid1.getNumActive());
schedule.filterConnections(active);
const auto& c1_1 = schedule.getWell("OP_1", 1).getConnections();
const auto& c1_3 = schedule.getWell("OP_1", 3).getConnections();