ModuleContainer#
- class fridom.framework.modules.module_container.ModuleContainer(name: str = 'Module Container', module_list: list | None = None)[source]#
Bases:
ModuleA 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.
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_moduleThe differentiation module to be used by this module.
gridThe grid of the model settings.
infoReturn a dictionary with information about the time stepper.
interp_moduleThe interpolation module to be used by this module.
is_setupWhether the module is set up.
Whether all modules are available in MPI mode.
msetThe model settings.
nameThe maximum required halo points of all modules.
Examples using
fridom.framework.modules.ModuleContainer#- setup(mset: ModelSettingsBase, setup_mode: Literal['default', 'forced'] = 'default') None[source]#
Set all modules up.
- 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.