AdamBashforth#

class fridom.framework.time_steppers.AdamBashforth(dt=1, order: int = 3, eps=0.01)[source]#

Bases: TimeStepper

Adam Bashforth time stepping up to 4th order.

Parameters#

dtfloat

Time step size. (default 0.01)

orderint

Order of the time stepping. (default 3, max 4)

epsfloat

2nd order bashforth correction. (default 0.01)

Description#

The Adam Bashforth time stepping scheme is a multi-step explicit time stepping scheme. It solves a given PDE

\[\partial_t \boldsymbol{z} = \boldsymbol{F}(\boldsymbol{z}, t)\]

by using the following scheme of order \(n\)

\[\boldsymbol{z}^{n+1} = \boldsymbol{z}^n + \Delta t \sum_{j=0}^{n-1} \alpha_j \boldsymbol{F}(\boldsymbol{z}^{n-j}, t^{n-j})\]

where \(\alpha_i\) are the Adam Bashforth coefficients, \(\Delta t\) is the time step size, \(\boldsymbol{z}^j\) is the state at time \(t^j = t_0 + j \Delta t\). The coefficients for orders 1 to 4 are given in the table below.

Order

\(\alpha_1\)

\(\alpha_2\)

\(\alpha_3\)

\(\alpha_4\)

1

1

2

3/2 + epsilon

-1/2 - epsilon

3

23/12

-4/3

5/12

4

55/24

-59/24

37/24

-3/8

Stability Analysis#

Let \(\lambda\) be the eigenvalues of the right-hand side of the PDE, e.g:

\[\partial_t \boldsymbol{z} = \boldsymbol{F}(\boldsymbol{z}, t) = -i \lambda \boldsymbol{z}\]

Inserting this into the Adam Bashforth scheme gives:

\[\boldsymbol{z}^{n+1} = \sum_{j=0}^{n-1} c_j \boldsymbol{z}^{n-j}\]

where

\[\begin{split}c_j = \begin{cases} 1 - i \Delta t \lambda & \text{if } j = 0 \\ -i \Delta t \lambda & \text{if } j > 0 \end{cases}\end{split}\]

We now insert the Ansatz:

\[\boldsymbol{z}^n = \boldsymbol{z}_0 e^{-i \omega n \Delta t} = \boldsymbol{z}_0 x^n\]

with \(x = e^{-i \omega \Delta t}\). This yields a polynomial equation for \(x\):

\[x^{n+1} = \sum_{j=0}^{n-1} c_j x^{n-j}\]

Finally, we find the eigenvalues of the time stepping scheme by solving the polynomial equation for \(x\) numerically and taking the logarithm:

\[\omega = -i \log(x) / \Delta t\]
__init__(dt=1, order: int = 3, eps=0.01)[source]#

Methods

__init__([dt, order, eps])

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 time stepper.

update_coeff_AB()

Upward ramping of Adam-Bashforth coefficients after restart.

update_pointer()

Update pointer for Adam-Bashforth time stepping.

update_tendency()

Attributes

diff_module

The differentiation module to be used by this module.

dt

Time step size.

dz

Returns a pointer on the current tendency term.

grid

The grid of the model settings

info

Return a dictionary with information about the time stepper.

interp_module

The interpolation module to be used by this module.

mset

The model settings

name

required_halo

name = 'Adam Bashforth'#
setup(mset: ModelSettingsBase) None[source]#

Start the module

Description#

This method is called by the ModelSettings.setup() and sets the ModelSettings as well as the differentiation and interpolation modules.

reset()[source]#

Stop and start the module.

update(mz: ModelState)[source]#

Update the time stepper.

update_tendency()[source]#
update_pointer() None[source]#

Update pointer for Adam-Bashforth time stepping.

update_coeff_AB() None[source]#

Upward ramping of Adam-Bashforth coefficients after restart.

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 dt: timedelta64#

Time step size.

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 dz#

Returns a pointer on the current tendency term.