Gauss-Seidel MDA

from __future__ import absolute_import, division, unicode_literals

from future import standard_library

from gemseo.api import configure_logger, create_discipline, create_mda



Define a way to display results

def display_result(res, mda_name):
    Display coupling and output variables in logger
    @param res: result (dict) of MDA
    @param mda_name: name of the current MDA
    # names of the coupling variables
    coupling_names = [
    for coupling_var in coupling_names:
            "{}, coupling variable {}: {}".format(
                mda_name, coupling_var, res[coupling_var]

    # names of the output variables
    output_names = ["y_1", "y_2", "y_3", "y_4", "g_1", "g_2", "g_3"]
    for output_var in output_names:
            "{}, output variable {}: {}".format(mda_name, output_var, res[output_var]),

Create, execute and post-process MDA

We do not need to specify the inputs, the default inputs of the MDA will be used and computed from the Default inputs of the disciplines

disciplines = create_discipline(
mda = create_mda("MDAGaussSeidel", disciplines)
res = mda.execute()
    n_iterations=10, logscale=[1e-8, 10.0], show=True, save=False, figsize=(10, 4)
MDAGaussSeidel: residual plot


MDAGaussSeidel, coupling variable y_11: [0.15591864]
MDAGaussSeidel, coupling variable y_12: [5.06070636e+04 9.50000000e-01]
MDAGaussSeidel, coupling variable y_14: [50607.06364014  7306.20262124]
MDAGaussSeidel, coupling variable y_21: [50607.06364014]
MDAGaussSeidel, coupling variable y_23: [12194.40917865]
MDAGaussSeidel, coupling variable y_24: [4.15002178]
MDAGaussSeidel, coupling variable y_31: [6354.40199361]
MDAGaussSeidel, coupling variable y_32: [0.50280211]
MDAGaussSeidel, coupling variable y_34: [1.10754577]
MDAGaussSeidel, output variable y_1: [5.06070636e+04 7.30620262e+03 9.50000000e-01]
MDAGaussSeidel, output variable y_2: [5.06070636e+04 1.21944092e+04 4.15002178e+00]
MDAGaussSeidel, output variable y_3: [1.10754577e+00 6.35440199e+03 5.02802105e-01]
MDAGaussSeidel, output variable y_4: [535.7821319]
MDAGaussSeidel, output variable g_1: [ 0.035      -0.00666667 -0.0275     -0.04       -0.04833333 -0.09
 -0.15      ]
MDAGaussSeidel, output variable g_2: [-0.04]
MDAGaussSeidel, output variable g_3: [-0.99719789 -0.00280211  0.16206032 -0.02      ]

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

Gallery generated by Sphinx-Gallery