shamrock.utils.SimulationRunner.SimulationRunner#

class shamrock.utils.SimulationRunner.SimulationRunner(model)#

Bases: object

SimulationRunner is a base class to declare a simulation with setup & callbacks.

A derived class must define: - t_end: float = <end time of the simulation> - a setup (any function decorated with @simulation_setup)

And can define callbacks (any function decorated with @callback):

< call every tsim = i * time_step > - @callback(time_step=1.0)

def analysis(self, icallback):

rank_0_print(“analysis”)

< call when tsim = dt_stop, niter_max is reached or walltime_step is reached > - @callback(time_step=dt_stop, niter_max=1000, walltime_step=30*60)

def do_checkpoint(self, icheckpoint):

self.dump_helper.dump(icheckpoint)

Note that for the last one that this reset the counters until next callback. The trigger conditions are inclusive and reset the counters for all triggers of that callback.

Methods

do_checkpoint

evolve_until

goto_run_next_callback

restore_from_checkpoint

run

run_setup

trigger_and_advance_callbacks

Attributes

cur_iter_count

cur_t

dump_prefix

t_end