In this example, we will discover the different functions of the API related to MDAs, which are the GEMSEO’ objects dedicated to the feasibility of the multidisciplinary coupling. All classes implementing MDAs inherit from MDA which is an abstract class.

from __future__ import division, unicode_literals

from gemseo.api import (



<RootLogger root (INFO)>

Get available MDA

The get_available_mdas() function returns the list of MDAs available in GEMSEO or in external modules



['GSNewtonMDA', 'MDAChain', 'MDAGaussSeidel', 'MDAJacobi', 'MDANewtonRaphson', 'MDAQuasiNewton', 'MDARoot', 'MDASequential']

Get MDA options schema

For a given MDA algorithm, e.g. "MDAGaussSeidel", we can get the options; e.g.



{'$schema': '', 'type': 'object', 'properties': {'name': {'description': 'The name to be given to the MDA. If None, use the name of the class.', 'type': 'null'}, 'max_mda_iter': {'description': 'The maximum iterations number for the MDA algorithm.', 'type': 'integer'}, 'grammar_type': {'description': 'The type of the input and output grammars, either :attr:`JSON_GRAMMAR_TYPE` or :attr:`SIMPLE_GRAMMAR_TYPE`.', 'type': 'string'}, 'tolerance': {'description': 'The tolerance of the iterative direct coupling solver; the norm of the current residuals divided by initial residuals norm shall be lower than the tolerance to stop iterating.', 'type': 'number'}, 'linear_solver_tolerance': {'description': 'The tolerance of the linear solver in the adjoint equation.', 'type': 'number'}, 'warm_start': {'description': 'Whether the second iteration and ongoing start from the previous coupling solution.', 'type': 'boolean'}, 'use_lu_fact': {'description': 'Whether to store a LU factorization of the matrix when using adjoint/forward differentiation. to solve faster multiple RHS problem.', 'type': 'boolean'}, 'over_relax_factor': {'description': 'The relaxation coefficient, used to make the method more robust, if ``0<over_relax_factor<1`` or faster if ``1<over_relax_factor<=2``. If ``over_relax_factor =1.``, it is deactivated.', 'type': 'number'}, 'coupling_structure': {'description': 'The coupling structure to be used by the MDA. If None, it is created from `disciplines`.', 'type': 'null'}, 'log_convergence': {'description': 'Whether to log the MDA convergence, expressed in terms of normed residuals.', 'type': 'boolean'}, 'linear_solver': {'description': 'The name of the linear solver.', 'type': 'string'}, 'linear_solver_options': {'description': 'The options passed to the linear solver factory.', 'type': 'null'}}, 'required': ['grammar_type', 'linear_solver', 'linear_solver_tolerance', 'log_convergence', 'max_mda_iter', 'over_relax_factor', 'tolerance', 'use_lu_fact', 'warm_start']}

Create an MDA

The API function create_mda() can be used to create a scenario:

disciplines = create_discipline(["Sellar1", "Sellar2"])
mda = create_mda("MDAGaussSeidel", disciplines)
output_data = mda.execute()


{'x_local': array([0.+0.j]), 'x_shared': array([1.+0.j, 0.+0.j]), 'y_2': array([1.79999995+0.j]), 'y_1': array([0.79999995+0.j])}

Total running time of the script: ( 0 minutes 0.016 seconds)

Gallery generated by Sphinx-Gallery