mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-11-02 20:30:55 -06:00
Stop simulating if the schedule has set an exit condition.
The program will return the value set in the EXIT keyword.
This commit is contained in:
1 parent
88525f7c39
commit
a1091bd718
4 files changed
+15
-5
No files matched your search
@@ -258,12 +258,12 @@ namespace Opm
|
||||
createSimulator();
|
||||
|
||||
// do the actual work
|
||||
runSimulator(output_cout);
|
||||
int retval = runSimulator(output_cout);
|
||||
|
||||
// clean up
|
||||
mergeParallelLogFiles(output_to_files);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return retval;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::ostringstream message;
|
||||
@@ -463,7 +463,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
// Run the simulator.
|
||||
void runSimulator(bool output_cout)
|
||||
int runSimulator(bool output_cout)
|
||||
{
|
||||
const auto& schedule = this->schedule();
|
||||
const auto& timeMap = schedule.getTimeMap();
|
||||
@@ -508,12 +508,12 @@ namespace Opm
|
||||
successReport.reportFullyImplicit(ss, &failureReport);
|
||||
OpmLog::info(ss.str());
|
||||
}
|
||||
|
||||
return successReport.exit_status;
|
||||
} else {
|
||||
if (output_cout) {
|
||||
std::cout << "\n\n================ Simulation turned off ===============\n" << std::flush;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -164,6 +164,14 @@ public:
|
||||
|
||||
// Main simulation loop.
|
||||
while (!timer.done()) {
|
||||
if (schedule().exitStatus().has_value()) {
|
||||
if (terminalOutput_) {
|
||||
OpmLog::info("Stopping simulation since EXIT was triggered by an action keyword.");
|
||||
}
|
||||
report.exit_status = schedule().exitStatus().value();
|
||||
break;
|
||||
}
|
||||
|
||||
// Report timestep.
|
||||
if (terminalOutput_) {
|
||||
std::ostringstream ss;
|
||||
|
||||
Reference in new issue
Block a user