Add Schedule::xxx_well() for well status manipulations from Python
This commit is contained in:
parent
aa9bab75d9
commit
67f95e8548
@ -210,6 +210,9 @@ namespace Opm
|
||||
const Well& getWellatEnd(const std::string& well_name) const;
|
||||
std::vector<Well> getWells(size_t timeStep) const;
|
||||
std::vector<Well> getWellsatEnd() const;
|
||||
void shut_well(const std::string& well_name, std::size_t report_step);
|
||||
void stop_well(const std::string& well_name, std::size_t report_step);
|
||||
void open_well(const std::string& well_name, std::size_t report_step);
|
||||
|
||||
std::vector<const Group*> getChildGroups2(const std::string& group_name, size_t timeStep) const;
|
||||
std::vector<Well> getChildWells2(const std::string& group_name, size_t timeStep) const;
|
||||
|
@ -96,6 +96,9 @@ void python::common::export_Schedule(py::module& module) {
|
||||
.def_property_readonly( "start", &get_start_time )
|
||||
.def_property_readonly( "end", &get_end_time )
|
||||
.def_property_readonly( "timesteps", &get_timesteps )
|
||||
.def( "shut_well", &Schedule::shut_well)
|
||||
.def( "open_well", &Schedule::open_well)
|
||||
.def( "stop_well", &Schedule::stop_well)
|
||||
.def( "get_wells", &Schedule::getWells)
|
||||
.def( "get_well", &get_well)
|
||||
.def( "__contains__", &has_well )
|
||||
|
@ -57,6 +57,17 @@ class TestSchedule(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
self.sch.group('foo', 0)
|
||||
|
||||
def test_open_shut(self):
|
||||
deck = Parser().parse(test_path('spe3/SPE3CASE1.DATA'))
|
||||
state = EclipseState(deck)
|
||||
sch = Schedule( deck, state )
|
||||
prod = sch.get_well("PROD", 1)
|
||||
self.assertEqual(prod.status(), "OPEN")
|
||||
|
||||
sch.shut_well("PROD", 10)
|
||||
prod = sch.get_well("PROD", 10)
|
||||
self.assertEqual(prod.status(), "SHUT")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
@ -917,6 +917,18 @@ namespace {
|
||||
}
|
||||
|
||||
|
||||
void Schedule::shut_well(const std::string& well_name, std::size_t report_step) {
|
||||
this->updateWellStatus(well_name, report_step, Well::Status::SHUT );
|
||||
}
|
||||
|
||||
void Schedule::open_well(const std::string& well_name, std::size_t report_step) {
|
||||
this->updateWellStatus(well_name, report_step, Well::Status::OPEN );
|
||||
}
|
||||
|
||||
void Schedule::stop_well(const std::string& well_name, std::size_t report_step) {
|
||||
this->updateWellStatus(well_name, report_step, Well::Status::STOP );
|
||||
}
|
||||
|
||||
void Schedule::updateWell(std::shared_ptr<Well> well, size_t reportStep) {
|
||||
auto& dynamic_state = this->wells_static.at(well->name());
|
||||
dynamic_state.update(reportStep, well);
|
||||
@ -2062,7 +2074,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Schedule::handleWSEGVALV( const DeckKeyword& keyword, size_t currentStep) {
|
||||
const std::map<std::string, std::vector<std::pair<int, Valve> > > valves = Valve::fromWSEGVALV(keyword);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user