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) None[source]#

Methods

__init__([name, module_list])

add_module(module)

Add a module to the end of the module list.

disable()

Disable the module.

enable()

Enable the module.

get(name)

Get a module by name.

is_enabled()

Whether the module is enabled or not.

reset()

Reset all modules.

setup(mset[, setup_mode])

Set all modules up.

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.

is_setup

Whether the module is set up.

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, setup_mode: Literal['default', 'forced'] = 'default') None[source]#

Set all modules up.

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: 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: str) list[Module][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.