meta_model.py

Metamodel provides basic Meta Modeling capability.

class openmdao.components.meta_model.MetaModel[source]

Bases: openmdao.core.component.Component

Class that creates a reduced order model for outputs from parameters. Each output may have it’s own surrogate model. Training inputs and outputs are automatically created with ‘train:’ prepended to the corresponding parameter/output name.

For a Float variable, the training data is an array of length m.

add_output(name, val=<object object>, **kwargs)[source]

Add an output to this component and a corresponding training output.

Args:

name : string

Name of the variable output.

val : float or ndarray

Initial value for the output. While the value is overwritten during execution, it is useful for infering size.

add_param(name, val=<object object>, **kwargs)[source]

Add a param input to this component and a corresponding training parameter.

Args:

name : string

Name of the input.

val : float or ndarray or object

Initial value for the input.

check_setup(out_stream=<open file '<stdout>', mode 'w'>)[source]

Write a report to the given stream indicating any potential problems found with the current configuration of this MetaModel.

Args:out_stream : a file-like object, optional
jacobian(params, unknowns, resids)[source]
Returns the Jacobian as a dictionary whose keys are tuples of the form
(‘unknown’, ‘param’) and whose values are ndarrays.
Args:

params : VecWrapper

VecWrapper containing parameters. (p)

unknowns : VecWrapper

VecWrapper containing outputs and states. (u)

resids : VecWrapper

VecWrapper containing residuals. (r)

Returns:

dict

Dictionary whose keys are tuples of the form (‘unknown’, ‘param’) and whose values are ndarrays.

solve_nonlinear(params, unknowns, resids)[source]

Predict outputs. If the training flag is set, train the metamodel first.

Args:

params : VecWrapper, optional

VecWrapper containing parameters. (p)

unknowns : VecWrapper, optional

VecWrapper containing outputs and states. (u)

resids : VecWrapper, optional

VecWrapper containing residuals. (r)