Model#

class fridom.framework.model.Model(mset: ModelSettingsBase)[source]#

Bases: object

Base class for the model.

Attributes:

mset (ModelSettings) : Model settings. grid (Grid) : Grid. z (State) : State variable. dz_list (list) : List of tendency terms (for time stepping). pointer (np.ndarray) : Pointer for time stepping. coeff_AB (np.ndarray) : Adam-Bashforth coefficients. timer (TimingModule) : Timer. it (int) : Iteration counter. time (float) : Model time. dz (State) : Current tendency term.

Methods:

run() : Run the model for a given number of steps. step() : Perform one time step. reset() : Reset the model (pointers, tendencies)

__init__(mset: ModelSettingsBase) None[source]#

Constructor.

Methods

__init__(mset)

Constructor.

load(file)

reset()

Reset the model (pointers, tendencies).

restart()

run([steps, runlen, start_time, end_time, ...])

Run the model

save(file)

start()

Prepare the model for running.

step()

Update the model state by one time step.

stop()

Finish the model run.

Attributes

z

Returns the current state variable.

Examples using fridom.framework.Model#

Barotropic Jet

Barotropic Jet

Reflecting Wave Package

Reflecting Wave Package

Internal Gravity Wave Maker

Internal Gravity Wave Maker

Convection and Closures

Convection and Closures

Multiple Wave Makers

Multiple Wave Makers

Rayleigh-Taylor Instability

Rayleigh-Taylor Instability

Rayleigh-Bénard Convection

Rayleigh-Bénard Convection

Single Internal Wave

Single Internal Wave

Dancing Eddies

Dancing Eddies

Symmetric Instability

Symmetric Instability

Tracers and Eddies

Tracers and Eddies

Barotropic Instability

Barotropic Instability
start()[source]#

Prepare the model for running.

stop()[source]#

Finish the model run.

reset() None[source]#

Reset the model (pointers, tendencies).

run(steps: int | None = None, runlen: timedelta64 | float | int | None = None, start_time: datetime64 | float | int = 0, end_time: datetime64 | float | int | None = None, progress_bar=True) None[source]#

Run the model

Parameters#

stepsint (default: None)

Number of steps to run.

runlennp.timedelta64 | float | int (default: None)

Length of the run.

start_timenp.datetime64 | float | int (default: 0)

Start time of the run.

end_timenp.datetime64 | float | int (default: None)

End time of the run.

progress_barbool (default: True)

Show progress bar.

Raises#

ValueError

Only one of steps, runlen or end_time can be given.

step() None[source]#

Update the model state by one time step.

restart() None[source]#
property z#

Returns the current state variable.

load(file: str) None[source]#
save(file: str) None[source]#