ModuleContainer#

class fridom.framework.modules.module_container.ModuleContainer(name: str = 'Module Container', module_list: list | None = None)[source]#

Bases: Module

A module container that can hold multiple modules.

Description#

A module container holds a list of modules and is a module itself. It can start, stop, and update all the modules it contains.

Parameters#

namestr

Name of the module container.

module_listlist

A list of modules to be added to the container.

__init__(name: str = 'Module Container', module_list: list | None = None)[source]#

Methods

__init__([name, module_list])

add_module(module)

Add a module to the end of the module list.

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.

get(name)

Get a module by name.

is_enabled()

Return whether the module is enabled or not.

reset()

Reset all modules.

setup(mset)

Setup all modules.

start()

Start all modules.

stop()

Stop all modules.

update(mz)

Update all modules.

Attributes

diff_module

The differentiation module to be used by this module.

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.

mpi_available

Whether all modules are available in MPI mode.

mset

The model settings

name

required_halo

The maximum required halo points of all modules.

Examples using fridom.framework.modules.ModuleContainer#

Convection and Closures

Convection and Closures
setup(mset: ModelSettingsBase) None[source]#

Setup all modules.

start() None[source]#

Start all modules.

stop() None[source]#

Stop all modules.

reset() None[source]#

Reset all modules.

update(mz: ModelState) ModelState[source]#

Update all modules.

add_module(module) None[source]#

Add a module to the end of the module list.

Parameters#

moduleModule

The module to be added to the list.

get(name) list[source]#

Get a module by name.

Parameters#

namestr

Name of the module.

Returns#

list[Module]

List of modules with the given name. If no module is found, an empty list is returned. If multiple modules are found, all of them are returned.

property required_halo: int#

The maximum required halo points of all modules.

property mpi_available: bool#

Whether all modules are available in MPI mode.