gemseo.problems.mdo.sellar.utils module#

Utils for the customizable Sellar MDO problem.

class DataConverterFor2DArray(grammar)[source]#

Bases: JSONGrammarDataConverter

A data converter where x_shared is not a ndarray.

Parameters:

grammar (T) -- The grammar providing the data types used for the conversions.

convert_array_to_value(name, array_)[source]#

Convert a NumPy array to a data value.

Parameters:
  • name (str) -- The data name.

  • array -- The NumPy array to convert.

  • array_ (Any)

Returns:

The data value.

Return type:

Any

convert_value_to_array(name, value)[source]#

Convert a data value to a NumPy array.

Parameters:
  • name (str) -- The data name.

  • value (Any) -- The data value.

Returns:

The NumPy array.

Return type:

ndarray

get_initial_data(names=(), n=1)[source]#

Generate an initial solution for the MDO problem.

Parameters:
  • names (Iterable[str]) --

    The names of the discipline inputs.

    By default it is set to ().

  • n (int) --

    The size of the local design variables and coupling variables

    By default it is set to 1.

Returns:

The default values of the discipline inputs.

Return type:

dict[str, RealArray]

get_y_opt(mda)[source]#

Return the optimal y array.

Parameters:

mda (BaseMDA) -- The mda.

Returns:

The optimal y array.

Return type:

ndarray

set_data_converter()[source]#

Set the data converter according to whether 2D array shall be used.

Return type:

None