mufem.ModelManager

class mufem.ModelManager

Bases: pybind11_object

Manages all models used in the simulation lifecycle, including initialization, iteration, finalization, and residual tracking.

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

add_model(self, model)

Add a model to the ModelManager.

get_model(self, model_name)

Get a model by name.

get_residuals(self, model_name)

Get the residuals associated with a model.

initialize(self)

Initialize all registered models.

list_models(self)

List all registered model names.

add_model(self: mufem.ModelManager, model: mufem.ModelTrait) None

Add a model to the ModelManager.

Parameters:

model (ModelTrait) – The model to add.

get_model(self: mufem.ModelManager, model_name: str) mufem.ModelTrait

Get a model by name.

Parameters:

model_name (str) – Name of the model.

Returns:

The model instance (actual derived type is preserved).

Return type:

ModelTrait

get_residuals(self: mufem.ModelManager, model_name: str) List[float | None]

Get the residuals associated with a model.

Parameters:

model_name (str) – The name of the model.

Returns:

The residuals of the model, if available.

Return type:

List[Optional[float]]

initialize(self: mufem.ModelManager) None

Initialize all registered models.

list_models(self: mufem.ModelManager) List[str]

List all registered model names.

Returns:

Names of the registered models in the simulation.

Return type:

List[str]