gemseo.mda.mda_chain module#
An advanced MDA splitting algorithm based on graphs.
- class MDAChain(disciplines, settings_model=None, **settings)[source]#
Bases:
BaseMDA
A chain of MDAs.
The execution sequence is provided by the
DependencyGraph
.Initialize self. See help(type(self)) for accurate signature.
- Parameters:
disciplines (Sequence[Discipline]) -- The disciplines from which to compute the MDA.
settings_model (MDAChain_Settings | None) -- The MDA settings as a Pydantic model. If
None
, use**settings
.**settings (Any) -- The MDA settings. These arguments are ignored when
settings_model
is notNone
.
- Settings#
The pydantic model for the settings.
alias of
MDAChain_Settings
- add_differentiated_inputs(input_names=())[source]#
Add the inputs with respect to which to differentiate the outputs.
The inputs that do not represent continuous numbers are filtered out.
- Parameters:
input_names (Iterable[str]) --
The input variables with respect to which to differentiate the outputs. If empty, use all the inputs.
By default it is set to ().
- Raises:
ValueError -- When an input name is not the name of a discipline input.
- Return type:
None
- add_differentiated_outputs(output_names=())[source]#
Add the outputs to be differentiated.
The outputs that do not represent continuous numbers are filtered out.
- Parameters:
output_names (Iterable[str]) --
The outputs to be differentiated. If empty, use all the outputs.
By default it is set to ().
- Raises:
ValueError -- When an output name is not the name of a discipline output.
- Return type:
None
- execute(input_data=mappingproxy({}))[source]#
Execute the discipline, i.e. compute output data from input data.
If
virtual_execution
isTrue
, this method returns thedefault_output_data
. Otherwise, it calls the_run()
method performing the true execution and returns the corresponding output data. This_run()
method must be implemented in subclasses.- Parameters:
input_data (StrKeyMapping) --
The input data. Complete this dictionary with the
default_input_data
.By default it is set to {}.
- Returns:
The input and output data.
- Return type:
- plot_residual_history(show=False, save=True, n_iterations=None, logscale=(), filename='', fig_size=(50.0, 10.0))[source]#
Generate a plot of the residual history.
The first iteration of each new execution is marked with a red dot.
- Parameters:
show (bool) --
Whether to display the plot on screen.
By default it is set to False.
save (bool) --
Whether to save the plot as a PDF file.
By default it is set to True.
n_iterations (int | None) -- The number of iterations on the x axis. If
None
, use all the iterations.The limits of the y axis. If empty, do not change the limits of the y axis.
By default it is set to ().
filename (Path | str) --
The name of the file to save the figure. If empty, use "{mda.name}_residual_history.pdf".
By default it is set to "".
fig_size (FigSizeType) --
The width and height of the figure in inches, e.g. (w, h).
By default it is set to (50.0, 10.0).
- Returns:
The figure, to be customized if not closed.
- Return type:
None
- inner_mdas: list[BaseMDASolver]#
The ordered MDAs.
- property scaling: ResidualScaling#
The scaling method applied to MDA residuals for convergence monitoring.
- settings: MDAChain_Settings#
The settings of the MDA