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()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_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.
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#- 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.