MCPcopy Create free account
hub / github.com/boutproject/BOUT-dev / solve

Method solve

src/solver/solver.cxx:495–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493 **************************************************************************/
494
495int Solver::solve(int nout, BoutReal timestep) {
496
497 Options& globaloptions = Options::root(); // Default from global options
498
499 if (nout < 0) {
500 nout = number_output_steps;
501 timestep = output_timestep;
502 } else {
503 number_output_steps = nout;
504 output_timestep = timestep;
505 }
506
507 finaliseMonitorPeriods(nout, timestep);
508
509 output_progress.write(
510 _("Solver running for {:d} outputs with output timestep of {:e}\n"), nout,
511 timestep);
512 if (default_monitor_period > 1) {
513 output_progress.write(
514 _("Solver running for {:d} outputs with monitor timestep of {:e}\n"),
515 nout / default_monitor_period, timestep * default_monitor_period);
516 }
517
518 // Initialise
519 if (init()) {
520 throw BoutException(_("Failed to initialise solver-> Aborting\n"));
521 }
522
523 // Set the run ID
524 run_restart_from = run_id; // Restarting from the previous run ID
525 run_id = createRunID();
526
527 // Put the run ID into the options tree
528 // Forcing in case the value has been previously set
529 Options::root()["run"]["run_id"].force(run_id, "Output");
530 Options::root()["run"]["run_restart_from"].force(run_restart_from, "Output");
531
532 /// Run the solver
533 output_info.write(_("Running simulation\n\n"));
534 output_info.write("Run ID: {:s}\n", run_id);
535 if (run_restart_from != default_run_id) {
536 output_info.write("Restarting from ID: {:s}\n", run_restart_from);
537 }
538
539 time_t start_time = time(nullptr);
540 output_progress.write(_("\nRun started at : {:s}\n"), toString(start_time));
541
542 Timer timer("run"); // Start timer
543
544 const bool restart =
545 globaloptions["restart"].doc("Load state from restart files?").withDefault(false);
546
547 const bool append =
548 globaloptions["append"]
549 .doc("Add new outputs to the end of existing files? If false, overwrite files.")
550 .withDefault(false);
551 const bool dump_on_restart = globaloptions["dump_on_restart"]
552 .doc("Write initial state as time point 0?")

Callers 15

gyroPade0Function · 0.45
gyroPade1Function · 0.45
divHeatFluxMethod · 0.45
TEST_PFunction · 0.45
TEST_PFunction · 0.45
TEST_FFunction · 0.45
TESTFunction · 0.45
rhsMethod · 0.45
rhsMethod · 0.45
initMethod · 0.45
rhsMethod · 0.45
mainFunction · 0.45

Calls 4

checkForUnusedOptionsFunction · 0.85
toStringFunction · 0.50
runFunction · 0.50
writeMethod · 0.45

Tested by 15

TEST_PFunction · 0.36
TEST_PFunction · 0.36
TEST_FFunction · 0.36
TESTFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
check_laplaceFunction · 0.36
mainFunction · 0.36
initMethod · 0.36
mainFunction · 0.36