mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Implement Python step() method.
The Python step() method advances the simulator one report step. Before calling step() for the first time, step_init() must have been called.
This commit is contained in:
parent
f94f6dcbb0
commit
8e4f748372
@ -252,7 +252,13 @@ namespace Opm
|
||||
int executeInitStep(int argc, char** argv, bool outputCout, bool outputToFiles)
|
||||
{
|
||||
return execute_(argc, argv, outputCout, outputToFiles,
|
||||
&FlowMainEbos::runSimulatorInit);
|
||||
&FlowMainEbos::runSimulatorInit, /*cleanup=*/false);
|
||||
}
|
||||
|
||||
int executeStep()
|
||||
{
|
||||
simulator_->runStep(*simtimer_);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
// Print an ASCII-art header to the PRT and DEBUG files.
|
||||
@ -342,9 +348,9 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
|
||||
void executeCleanup_(bool output_to_files) {
|
||||
void executeCleanup_(bool outputToFiles) {
|
||||
// clean up
|
||||
mergeParallelLogFiles(output_to_files);
|
||||
mergeParallelLogFiles(outputToFiles);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -295,6 +295,14 @@ public:
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
int step()
|
||||
{
|
||||
if (!hasRunInit_) {
|
||||
throw std::logic_error("step() called before step_init()");
|
||||
}
|
||||
return mainfunc_->executeStep();
|
||||
}
|
||||
private:
|
||||
|
||||
bool prepareRun_()
|
||||
@ -472,5 +480,6 @@ PYBIND11_MODULE(simulators, m)
|
||||
.def("set_eclipse_state", &BlackOilSimulator::setEclipseState)
|
||||
.def("set_schedule", &BlackOilSimulator::setSchedule)
|
||||
.def("set_summary_config", &BlackOilSimulator::setSummaryConfig)
|
||||
.def("step", &BlackOilSimulator::step)
|
||||
.def("step_init", &BlackOilSimulator::step_init);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user