Added ability to filter out completions in inactive cells.
This commit is contained in:
parent
40fd922b6e
commit
3a590a0cab
@ -24,6 +24,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Completion.hpp>
|
||||
|
||||
namespace Opm {
|
||||
class EclipseGrid;
|
||||
|
||||
class CompletionSet {
|
||||
public:
|
||||
@ -40,7 +41,7 @@ namespace Opm {
|
||||
|
||||
const_iterator begin() const { return this->m_completions.begin(); }
|
||||
const_iterator end() const { return this->m_completions.end(); }
|
||||
|
||||
void filter(const EclipseGrid& grid);
|
||||
bool allCompletionsShut() const;
|
||||
/// Order completions irrespective of input order.
|
||||
/// The algorithm used is the following:
|
||||
|
@ -111,6 +111,11 @@ namespace Opm
|
||||
const MessageContainer& getMessageContainer() const;
|
||||
MessageContainer& getMessageContainer();
|
||||
|
||||
/*
|
||||
Will remove all completions which are connected to cell which is not
|
||||
active. Will scan through all wells and all timesteps.
|
||||
*/
|
||||
void filterCompletions(const EclipseGrid& grid);
|
||||
|
||||
private:
|
||||
TimeMap m_timeMap;
|
||||
|
@ -46,6 +46,7 @@ namespace Opm {
|
||||
class Segment;
|
||||
class SegmentSet;
|
||||
class TimeMap;
|
||||
class EclipseGrid;
|
||||
|
||||
class Well {
|
||||
public:
|
||||
@ -164,6 +165,12 @@ namespace Opm {
|
||||
const Events& getEvents() const;
|
||||
void addEvent(ScheduleEvents::Events event, size_t reportStep);
|
||||
bool hasEvent(uint64_t eventMask, size_t reportStep) const;
|
||||
|
||||
/*
|
||||
Will remove all completions which are attached to inactive cells. Will
|
||||
scan through all timesteps.
|
||||
*/
|
||||
void filterCompletions(const EclipseGrid& grid);
|
||||
private:
|
||||
size_t m_creationTimeStep;
|
||||
std::string m_name;
|
||||
|
@ -147,4 +147,11 @@ namespace Opm {
|
||||
return !( *this == rhs );
|
||||
}
|
||||
|
||||
|
||||
void CompletionSet::filter(const EclipseGrid& grid) {
|
||||
auto new_end = std::remove_if(m_completions.begin(),
|
||||
m_completions.end(),
|
||||
[&grid](const Completion& c) { return !grid.cellActive(c.getI(), c.getJ(), c.getK()); });
|
||||
m_completions.erase(new_end, m_completions.end());
|
||||
}
|
||||
}
|
||||
|
@ -1681,4 +1681,11 @@ namespace Opm {
|
||||
this->updateWellStatus( well, timestep, WellCommon::StatusEnum::SHUT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Schedule::filterCompletions(const EclipseGrid& grid) {
|
||||
for (auto& well : this->m_wells)
|
||||
well.filterCompletions(grid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -574,4 +574,14 @@ namespace Opm {
|
||||
bool Well::hasEvent(uint64_t eventMask, size_t reportStep) const {
|
||||
return this->events.hasEvent( eventMask , reportStep );
|
||||
}
|
||||
|
||||
|
||||
void Well::filterCompletions(const EclipseGrid& grid) {
|
||||
/*
|
||||
The m_completions member variable is DynamicState<CompletionSet>
|
||||
instance, hence this for loop is over all timesteps.
|
||||
*/
|
||||
for (auto& completions : m_completions)
|
||||
completions.filter(grid);
|
||||
}
|
||||
}
|
||||
|
@ -2222,3 +2222,26 @@ BOOST_AUTO_TEST_CASE(historic_BHP_and_THP) {
|
||||
BOOST_CHECK_CLOSE( 0.0 * 1e5, pro1.BHPH, 1e-5 );
|
||||
BOOST_CHECK_CLOSE( 0.0 * 1e5, pro1.THPH, 1e-5 );
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(FilterCompletions) {
|
||||
EclipseGrid grid1(10,10,10);
|
||||
std::vector<int> actnum(1000,1);
|
||||
auto deck = createDeckWithWellsAndCompletionData();
|
||||
TableManager table ( deck );
|
||||
Eclipse3DProperties eclipseProperties ( deck , table, grid1);
|
||||
Schedule schedule(deck, grid1 , eclipseProperties, Phases(true, true, true) , ParseContext() );
|
||||
const auto& well = schedule.getWell("OP_1");
|
||||
const auto& c1_1 = well->getCompletions(1);
|
||||
const auto& c1_3 = well->getCompletions(3);
|
||||
BOOST_CHECK_EQUAL(2, c1_1.size());
|
||||
BOOST_CHECK_EQUAL(9, c1_3.size());
|
||||
actnum[grid1.getGlobalIndex(8,8,1)] = 0;
|
||||
{
|
||||
EclipseGrid grid2(grid1, actnum);
|
||||
schedule.filterCompletions(grid2);
|
||||
BOOST_CHECK_EQUAL(1, c1_1.size());
|
||||
BOOST_CHECK_EQUAL(8, c1_3.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user