Multidisciplinary coupling graph

from gemseo.api import generate_n2_plot
from gemseo.core.discipline import MDODiscipline
from numpy import ones

Create the disciplines

descriptions = {
    "A": ([f"a{i}" for i in range(500)], ["b"]),
    "B": (["c"], [f"a{i}" for i in range(500)] + ["n"]),
    "C": (["b", "d"], ["c", "e"]),
    "D": (["f"], ["d", "g"]),
    "E": (["e"], ["f", "h", "o"]),
    "F": (["g", "j"], ["i"]),
    "G": (["i", "h"], ["k", "l"]),
    "H": (["k", "m"], ["j"]),
    "I": (["l"], ["m", "w"]),
    "J": (["n", "o"], ["p", "q"]),
    "K": (["y"], ["x"]),
    "L": (["w", "x"], ["y", "z"]),
    "M": (["p", "s"], ["r"]),
    "N": (["r"], ["t", "u"]),
    "O": (["q", "t"], ["s", "v"]),
    "P": (["u", "v", "z"], []),
}
disciplines = []
data = ones(1)
for discipline_name, (inputs, outputs) in descriptions.items():
    inputs = {name: data for name in inputs}
    outputs = {name: data for name in outputs}
    discipline = MDODiscipline(discipline_name)
    discipline.input_grammar.update_from_data({name: data for name in inputs})
    discipline.output_grammar.update_from_data({name: data for name in outputs})
    disciplines.append(discipline)

Generate the N2 chart

We do not want to save the N2 chart as a PNG or a PDF file, but open a browser, display it and handle it.

generate_n2_plot(disciplines, save=False, open_browser=True)

Click here to see the rendering.

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

Gallery generated by Sphinx-Gallery