gemseo / core

coupling_structure module

Coupled problem analysis, weak/strong coupling computation using graphs

class gemseo.core.coupling_structure.DependencyGraph(disciplines)[source]

Bases: object

Constructs a graph of dependency between the disciplines, and generate a sequence of execution (including strongly coupled disciplines, sequential tasks, parallel tasks).

Constructor

Parameters

disciplines – list of disciplines

export_initial_graph(file_path)[source]

Exports a visualization of the initial graph.

Parameters

file_path – file path of the generated file

export_reduced_graph(file_path)[source]

Exports a visualization of the reduced graph.

Parameters

file_path – the file_path of the generated file

get_disciplines_couplings()[source]

Returns couplings between disciplines as a list of 3-uples (from_disc, to_disc, variables names set).

class gemseo.core.coupling_structure.MDOCouplingStructure(disciplines)[source]

Bases: object

Structure of the couplings between disciplines The methods of this class include the computation of weak, strong or all couplings.

Constructor

Parameters

disciplines – list of MDO disciplines that possibly exchange coupling variables

find_discipline(output)[source]

Finds which discipline produces a given output.

Parameters

output – the name of the output

Returns

the discipline if it is found, otherwise raise an exception

get_all_couplings()[source]

Computes all coupling variables, weak or strong :returns: the list of coupling variables names

input_couplings(discipline)[source]

Computes all input coupling variables of a discipline.

Parameters

discipline – the discipline

Returns

the list of input coupling variables names

static is_self_coupled(discipline)[source]

Tests if the discipline is self coupled ie if one of its outputs is also an input

Parameters

discipline – the discipline

Returns

a boolean

output_couplings(discipline, strong=True)[source]

Computes the output coupling variables of a discipline.

Parameters

discipline – the discipline

Returns

the list of output coupling variables names

plot_n2_chart(file_path='n2.pdf', show_data_names=True, save=True, show=False, figsize=(15, 10))[source]

Generates a N2 plot for the disciplines list.

Parameters
  • file_path – file path of the figure

  • show_data_names – if true, the names of the coupling data is shown otherwise, circles are drawn, which size depend on the number of coupling names

  • save – if True, saved the figure to file_path

  • show – if True, shows the plot

strong_couplings()[source]

Determines the strong couplings = outputs of the strongly coupled disciplines that are also inputs of the strongly coupled disciplines.

strongly_coupled_disciplines()[source]

Determines the strongly coupled disciplines, that is the disciplines that occur in (possibly different) MDAs.

weak_couplings()[source]

Determines the weak couplings = outputs of the weakly coupled disciplines.

weakly_coupled_disciplines()[source]

Determines the weakly coupled disciplines, that is the disciplines that do not occur in MDAs.