mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #2735 from hakonhagland/python_step2
Implements a Python step() method.
This commit is contained in:
commit
68add695fe
@ -326,6 +326,13 @@ namespace Opm
|
|||||||
return execute_(&FlowMainEbos::runSimulatorInit, /*cleanup=*/false);
|
return execute_(&FlowMainEbos::runSimulatorInit, /*cleanup=*/false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns true unless "EXIT" was encountered in the schedule
|
||||||
|
// section of the input datafile.
|
||||||
|
int executeStep()
|
||||||
|
{
|
||||||
|
return simulator_->runStep(*simtimer_);
|
||||||
|
}
|
||||||
|
|
||||||
// Print an ASCII-art header to the PRT and DEBUG files.
|
// Print an ASCII-art header to the PRT and DEBUG files.
|
||||||
// \return Whether unkown keywords were seen during parsing.
|
// \return Whether unkown keywords were seen during parsing.
|
||||||
static void printPRTHeader(bool output_cout)
|
static void printPRTHeader(bool output_cout)
|
||||||
|
@ -34,6 +34,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
BlackOilSimulator( const std::string &deckFilename);
|
BlackOilSimulator( const std::string &deckFilename);
|
||||||
int run();
|
int run();
|
||||||
|
int step();
|
||||||
int step_init();
|
int step_init();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -28,6 +28,14 @@ int BlackOilSimulator::run()
|
|||||||
return mainObject.runDynamic();
|
return mainObject.runDynamic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int BlackOilSimulator::step()
|
||||||
|
{
|
||||||
|
if (!hasRunInit_) {
|
||||||
|
throw std::logic_error("step() called before step_init()");
|
||||||
|
}
|
||||||
|
return mainEbos_->executeStep();
|
||||||
|
}
|
||||||
|
|
||||||
int BlackOilSimulator::step_init()
|
int BlackOilSimulator::step_init()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -56,5 +64,6 @@ PYBIND11_MODULE(simulators, m)
|
|||||||
py::class_<Opm::Pybind::BlackOilSimulator>(m, "BlackOilSimulator")
|
py::class_<Opm::Pybind::BlackOilSimulator>(m, "BlackOilSimulator")
|
||||||
.def(py::init< const std::string& >())
|
.def(py::init< const std::string& >())
|
||||||
.def("run", &Opm::Pybind::BlackOilSimulator::run)
|
.def("run", &Opm::Pybind::BlackOilSimulator::run)
|
||||||
|
.def("step", &Opm::Pybind::BlackOilSimulator::step)
|
||||||
.def("step_init", &Opm::Pybind::BlackOilSimulator::step_init);
|
.def("step_init", &Opm::Pybind::BlackOilSimulator::step_init);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user