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.
Options: fd_options[‘force_fd’] : bool(False)
Set to True to finite difference this system.
fd_options[‘form’] : str(‘forward’)
Finite difference mode. (forward, backward, central) You can also set to ‘complex_step’ to peform the complex step method if your components support it.
fd_options[‘step_size’] : float(1e-06)
Default finite difference stepsize
fd_options[‘step_type’] : str(‘absolute’)
Set to absolute, relative
-
add_output
(name, val=<object object>, training_data=None, **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.
training_data : float or ndarray
training data for this variable. Optional, can be set by the problem later.
-
add_param
(name, val=<object object>, training_data=None, **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.
training_data : float or ndarray
training data for this variable. Optional, can be set by the problem later.
-
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
-
linearize
(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)
-