TimeStepper#
- class fridom.framework.time_steppers.time_stepper.TimeStepper[source]#
Bases:
ModuleBase class for all time steppers.
Description#
Required methods: 1. __init__(self, …) -> None: The constructor only takes keyword argument which are stored as attributes. Always call the parent constructor with super().__init__(name, **kwargs). 2. update(self, mz: ModelState) -> None: This method is called by the model at each time step. It should update the model state mz to the next time level. Make sure to wrap the method with the @update_module decorator from the Module class.
Optional methods: 1. start(self) -> None: This method is called by the model before the time stepping starts. It can be used to initialize variables or allocate memory. Make sure to wrap the method with the @start_module decorator from the Module class. 2. stop(self) -> None: This method is called by the model after the time stepping has finished. It can be used to deallocate memory or clean up. Make sure to wrap the method with the @stop_module decorator from the Module class.
Methods
__init__()disable()Enabling the module means that it will be executed at each time step.
enable()Enabling the module means that it will be executed at each time step.
is_enabled()Return whether the module is enabled or not.
reset()Stop and start the module.
setup(mset)Start the module
start()Start the module
stop()Stop the module
time_discretization_effect(omega)Compute the time discretization effect on a frequency.
update(mz)Update the module
Attributes
diff_moduleThe differentiation module to be used by this module.
Time step size.
gridThe grid of the model settings
Return a dictionary with information about the time stepper.
interp_moduleThe interpolation module to be used by this module.
msetThe model settings
required_haloExamples using
fridom.framework.time_steppers.TimeStepper#- name = 'Time Stepper'#
- time_discretization_effect(omega: ndarray) ndarray[source]#
Compute the time discretization effect on a frequency.
Parameters#
- omegandarray | float | complex
The frequency of the wave.
Returns#
- ndarray
The frequency of the wave including the time discretization effect.
- property info: dict#
Return a dictionary with information about the time stepper.
Description#
This method should be overridden by the child class to return a dictionary with information about the time stepper. This information is used to print the time stepper in the __repr__ method.
- property dt: timedelta64#
Time step size.