double_sellar.py¶

class
openmdao.test_suite.components.double_sellar.
DoubleSellar
(units=None, scaling=None, **kwargs)[source]¶ Bases:
openmdao.core.group.Group

add
(name, subsys, promotes=None)¶ Add a subsystem (deprecated version of <Group.add_subsystem>).
Parameters: name : str
Name of the subsystem being added
subsys : System
An instantiated, but notyetset up system object.
promotes : iter of str, optional
A list of variable names specifying which subsystem variables to ‘promote’ up to this group. This is for backwards compatibility with older versions of OpenMDAO.
Returns: System
The System that was passed in.

add_constraint
(name, lower=None, upper=None, equals=None, ref=None, ref0=None, adder=None, scaler=None, indices=None, linear=False, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None, simul_map=None)¶ Add a constraint variable to this system.
Parameters: name : string
Name of the response variable in the system.
lower : float or ndarray, optional
Lower boundary for the variable
upper : float or ndarray, optional
Upper boundary for the variable
equals : float or ndarray, optional
Equality constraint value for the variable
ref : float or ndarray, optional
Value of response variable that scales to 1.0 in the driver.
ref0 : float or ndarray, optional
Value of response variable that scales to 0.0 in the driver.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
indices : sequence of int, optional
If variable is an array, these indicate which entries are of interest for this particular response. These may be positive or negative integers.
linear : bool
Set to True if constraint is linear. Default is False.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the constraint variable.
simul_map : dict
Mapping of this response to each design variable where simultaneous derivs will be used. Each design variable entry is another dict keyed on color, and the values in the color dict are tuples of the form (resp_idxs, color_idxs).
Notes
The response can be scaled using ref and ref0. The argument
ref0
represents the physical value when the scaled value is 0. The argumentref
represents the physical value when the scaled value is 1.

add_design_var
(name, lower=None, upper=None, ref=None, ref0=None, indices=None, adder=None, scaler=None, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None)¶ Add a design variable to this system.
Parameters: name : string
Name of the design variable in the system.
lower : float or ndarray, optional
Lower boundary for the param
upper : upper or ndarray, optional
Upper boundary for the param
ref : float or ndarray, optional
Value of design var that scales to 1.0 in the driver.
ref0 : float or ndarray, optional
Value of design var that scales to 0.0 in the driver.
indices : iter of int, optional
If a param is an array, these indicate which entries are of interest for this particular design variable. These may be positive or negative integers.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the design variable.
Notes
The response can be scaled using ref and ref0. The argument
ref0
represents the physical value when the scaled value is 0. The argumentref
represents the physical value when the scaled value is 1.

add_objective
(name, ref=None, ref0=None, index=None, adder=None, scaler=None, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None, simul_map=None)¶ Add a response variable to this system.
Parameters: name : string
Name of the response variable in the system.
ref : float or ndarray, optional
Value of response variable that scales to 1.0 in the driver.
ref0 : float or ndarray, optional
Value of response variable that scales to 0.0 in the driver.
index : int, optional
If variable is an array, this indicates which entry is of interest for this particular response. This may be a positive or negative integer.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the objective variable.
simul_map : dict
Mapping of this response to each design variable where simultaneous derivs will be used. Each design variable entry is another dict keyed on color, and the values in the color dict are tuples of the form (resp_idxs, color_idxs).
Notes
The objective can be scaled using scaler and adder, where
\[x_{scaled} = scaler(x + adder)\]or through the use of ref/ref0, which map to scaler and adder through the equations:
\[ \begin{align}\begin{aligned}0 = scaler(ref_0 + adder)\\1 = scaler(ref + adder)\end{aligned}\end{align} \]which results in:
\[ \begin{align}\begin{aligned}adder = ref_0\\scaler = \frac{1}{ref + adder}\end{aligned}\end{align} \]

add_recorder
(recorder, recurse=False)¶ Add a recorder to the driver.
Parameters: recorder : <BaseRecorder>
A recorder instance.
recurse : boolean
Flag indicating if the recorder should be added to all the subsystems.

add_response
(name, type_, lower=None, upper=None, equals=None, ref=None, ref0=None, indices=None, index=None, adder=None, scaler=None, linear=False, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None, simul_map=None)¶ Add a response variable to this system.
The response can be scaled using ref and ref0. The argument
ref0
represents the physical value when the scaled value is 0. The argumentref
represents the physical value when the scaled value is 1.Parameters: name : string
Name of the response variable in the system.
type_ : string
The type of response. Supported values are ‘con’ and ‘obj’
lower : float or ndarray, optional
Lower boundary for the variable
upper : upper or ndarray, optional
Upper boundary for the variable
equals : equals or ndarray, optional
Equality constraint value for the variable
ref : float or ndarray, optional
Value of response variable that scales to 1.0 in the driver.
ref0 : upper or ndarray, optional
Value of response variable that scales to 0.0 in the driver.
indices : sequence of int, optional
If variable is an array, these indicate which entries are of interest for this particular response.
index : int, optional
If variable is an array, this indicates which entry is of interest for this particular response.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
linear : bool
Set to True if constraint is linear. Default is False.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the response variable.
simul_map : dict
Mapping of this response to each design variable where simultaneous derivs will be used. Each design variable entry is another dict keyed on color, and the values in the color dict are tuples of the form (resp_idxs, color_idxs).

add_subsystem
(name, subsys, promotes=None, promotes_inputs=None, promotes_outputs=None, min_procs=1, max_procs=None, proc_weight=1.0)¶ Add a subsystem.
Parameters: name : str
Name of the subsystem being added
subsys : <System>
An instantiated, but notyetset up system object.
promotes : iter of (str or tuple), optional
A list of variable names specifying which subsystem variables to ‘promote’ up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group.
promotes_inputs : iter of (str or tuple), optional
A list of input variable names specifying which subsystem input variables to ‘promote’ up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group.
promotes_outputs : iter of (str or tuple), optional
A list of output variable names specifying which subsystem output variables to ‘promote’ up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group.
min_procs : int
Minimum number of MPI processes usable by the subsystem. Defaults to 1.
max_procs : int or None
Maximum number of MPI processes usable by the subsystem. A value of None (the default) indicates there is no maximum limit.
proc_weight : float
Weight given to the subsystem when allocating available MPI processes to all subsystems. Default is 1.0.
Returns: <System>
the subsystem that was passed in. This is returned to enable users to instantiate and add a subsystem at the same time, and get the reference back.

approx_totals
(method='fd', **kwargs)¶ Approximate derivatives for a Group using the specified approximation method.
Parameters: method : str
The type of approximation that should be used. Valid options include: ‘fd’: Finite Difference, ‘cs’: Complex Step
**kwargs : dict
Keyword arguments for controlling the behavior of the approximation.

check_config
(logger)¶ Perform optional error checks.
Parameters: logger : object
The object that manages logging output.

compute_sys_graph
(comps_only=False)¶ Compute a dependency graph for subsystems in this group.
Variable connection information is stored in each edge of the system graph.
Parameters: comps_only : bool (False)
If True, return a graph of all components within this group or any of its descendants. No subgroups will be included. Otherwise, a graph containing only direct children (both Components and Groups) of this group will be returned.
Returns: DiGraph
A directed graph containing names of subsystems and their connections.

configure
()¶ Configure this group to assign children settings.
This method may optionally be overidden by your Group’s method.
You may only use this method to change settings on your children subsystems. This includes setting solvers in cases where you want to override the defaults.
You can assume that the full hierarchy below your level has been instantiated and has already called its own configure methods.
 Available attributes:
 name pathname comm metadata system hieararchy with attribute access

connect
(src_name, tgt_name, src_indices=None, flat_src_indices=None)¶ Connect source src_name to target tgt_name in this namespace.
Parameters: src_name : str
name of the source variable to connect
tgt_name : str or [str, ... ] or (str, ...)
name of the target variable(s) to connect
src_indices : int or list of ints or tuple of ints or int ndarray or Iterable or None
The global indices of the source variable to transfer data from. The shapes of the target and src_indices must match, and form of the entries within is determined by the value of ‘flat_src_indices’.
flat_src_indices : bool
If True, each entry of src_indices is assumed to be an index into the flattened source. Otherwise it must be a tuple or list of size equal to the number of dimensions of the source.

get_constraints
(recurse=True)¶ Get the Constraint settings from this system.
Retrieve the constraint settings for the current system as a dict, keyed by variable name.
Parameters: recurse : bool, optional
If True, recurse through the subsystems and return the path of all constraints relative to the this system.
Returns: dict
The constraints defined in the current system.

get_design_vars
(recurse=True, get_sizes=True)¶ Get the DesignVariable settings from this system.
Retrieve all design variable settings from the system and, if recurse is True, all of its subsystems.
Parameters: recurse : bool
If True, recurse through the subsystems and return the path of all design vars relative to the this system.
get_sizes : bool, optional
If True, compute the size of each response.
Returns: dict
The design variables defined in the current system and, if recurse=True, its subsystems.

get_linear_vectors
(vec_name='linear')¶ Return the linear inputs, outputs, and residuals vectors.
Parameters: vec_name : str
Name of the linear righthandside vector. The default is ‘linear’.
Returns: (inputs, outputs, residuals) : tuple of <Vector> instances
Yields the inputs, outputs, and residuals linear vectors for vec_name.

get_nonlinear_vectors
()¶ Return the inputs, outputs, and residuals vectors.
Returns: (inputs, outputs, residuals) : tuple of <Vector> instances
Yields the inputs, outputs, and residuals nonlinear vectors.

get_objectives
(recurse=True)¶ Get the Objective settings from this system.
Retrieve all objectives settings from the system as a dict, keyed by variable name.
Parameters: recurse : bool, optional
If True, recurse through the subsystems and return the path of all objective relative to the this system.
Returns: dict
The objectives defined in the current system.

get_responses
(recurse=True, get_sizes=True)¶ Get the response variable settings from this system.
Retrieve all response variable settings from the system as a dict, keyed by variable name.
Parameters: recurse : bool, optional
If True, recurse through the subsystems and return the path of all responses relative to the this system.
get_sizes : bool, optional
If True, compute the size of each response.
Returns: dict
The responses defined in the current system and, if recurse=True, its subsystems.

initialize
()¶ Perform any onetime initialization run at instantiation.

is_active
()¶ Determine if the system is active on this rank.
Returns: bool
If running under MPI, returns True if this System has a valid communicator. Always returns True if not running under MPI.

jacobian
¶ Get the Jacobian object assigned to this system (or None if unassigned).

jacobian_context
(*args, **kwds)¶ Context manager that yields the Jacobian assigned to this system in this system’s context.

linear_solver
¶ Get the linear solver for this system.

list_inputs
(values=True, units=False, hierarchical=True, print_arrays=False, out_stream=<object object>)¶ Return and optionally log a list of input names and other optional information.
If the model is parallel, only the local variables are returned to the process. Also optionally logs the information to a user defined output stream. If the model is parallel, the rank 0 process logs information about all variables across all processes.
Parameters: values : bool, optional
When True, display/return input values. Default is True.
units : bool, optional
When True, display/return units. Default is False.
hierarchical : bool, optional
When True, human readable output shows variables in hierarchical format.
print_arrays : bool, optional
When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False.
out_stream : filelike object
Where to send human readable output. Default is sys.stdout. Set to None to suppress.
Returns: list
list of input names and other optional information about those inputs

list_outputs
(explicit=True, implicit=True, values=True, residuals=False, residuals_tol=None, units=False, shape=False, bounds=False, scaling=False, hierarchical=True, print_arrays=False, out_stream=<object object>)¶ Return and optionally log a list of output names and other optional information.
If the model is parallel, only the local variables are returned to the process. Also optionally logs the information to a user defined output stream. If the model is parallel, the rank 0 process logs information about all variables across all processes.
Parameters: explicit : bool, optional
include outputs from explicit components. Default is True.
implicit : bool, optional
include outputs from implicit components. Default is True.
values : bool, optional
When True, display/return output values. Default is True.
residuals : bool, optional
When True, display/return residual values. Default is False.
residuals_tol : float, optional
If set, limits the output of list_outputs to only variables where the norm of the resids array is greater than the given ‘residuals_tol’. Default is None.
units : bool, optional
When True, display/return units. Default is False.
shape : bool, optional
When True, display/return the shape of the value. Default is False.
bounds : bool, optional
When True, display/return bounds (lower and upper). Default is False.
scaling : bool, optional
When True, display/return scaling (ref, ref0, and res_ref). Default is False.
hierarchical : bool, optional
When True, human readable output shows variables in hierarchical format.
print_arrays : bool, optional
When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False.
out_stream : filelike
Where to send human readable output. Default is sys.stdout. Set to None to suppress.
Returns: list
list of output names and other optional information about those outputs

ln_solver
¶ Get the linear solver for this system.

nl_solver
¶ Get the nonlinear solver for this system.

nonlinear_solver
¶ Get the nonlinear solver for this system.

reconfigure
()¶ Perform reconfiguration.
Returns: bool
If True, reconfiguration is to be performed.

record_iteration
()¶ Record an iteration of the current System.

resetup
(setup_mode='full')¶ Public wrapper for _setup that reconfigures after an initial setup has been performed.
Parameters: setup_mode : str
Must be one of ‘full’, ‘reconf’, or ‘update’.

run_apply_linear
(vec_names, mode, scope_out=None, scope_in=None)¶ Compute jacvec product.
This calls _apply_linear, but with the model assumed to be in an unscaled state.
Parameters: vec_names : [str, ...]
list of names of the righthandside vectors.
mode : str
‘fwd’ or ‘rev’.
scope_out : set or None
Set of absolute output names in the scope of this matvec product. If None, all are in the scope.
scope_in : set or None
Set of absolute input names in the scope of this matvec product. If None, all are in the scope.

run_apply_nonlinear
()¶ Compute residuals.
This calls _apply_nonlinear, but with the model assumed to be in an unscaled state.

run_linearize
(do_nl=True, do_ln=True)¶ Compute jacobian / factorization.
This calls _linearize, but with the model assumed to be in an unscaled state.
Parameters: do_nl : boolean
Flag indicating if the nonlinear solver should be linearized.
do_ln : boolean
Flag indicating if the linear solver should be linearized.

run_solve_linear
(vec_names, mode)¶ Apply inverse jac product.
This calls _solve_linear, but with the model assumed to be in an unscaled state.
Parameters: vec_names : [str, ...]
list of names of the righthandside vectors.
mode : str
‘fwd’ or ‘rev’.
Returns: boolean
Failure flag; True if failed to converge, False is successful.
float
relative error.
float
absolute error.

run_solve_nonlinear
()¶ Compute outputs.
This calls _solve_nonlinear, but with the model assumed to be in an unscaled state.
Returns: boolean
Failure flag; True if failed to converge, False is successful.
float
relative error.
float
absolute error.

set_initial_values
()¶ Set all input and output variables to their declared initial values.

set_order
(new_order)¶ Specify a new execution order for this system.
Parameters: new_order : list of str
List of system names in desired new execution order.

setup
()¶ Build this group.
This method should be overidden by your Group’s method.
You may call ‘add_subsystem’ to add systems to this group. You may also issue connections, and set the linear and nonlinear solvers for this group level. You cannot safely change anything on children systems; use the ‘configure’ method instead.
 Available attributes:
 name pathname comm metadata

system_iter
(include_self=False, recurse=True, typ=None)¶ Yield a generator of local subsystems of this system.
Parameters: include_self : bool
If True, include this system in the iteration.
recurse : bool
If True, iterate over the whole tree under this system.
typ : type
If not None, only yield Systems that match that are instances of the given type.


class
openmdao.test_suite.components.double_sellar.
DoubleSellarImplicit
(units=None, scaling=None, **kwargs)[source]¶ Bases:
openmdao.core.group.Group

add
(name, subsys, promotes=None)¶ Add a subsystem (deprecated version of <Group.add_subsystem>).
Parameters: name : str
Name of the subsystem being added
subsys : System
An instantiated, but notyetset up system object.
promotes : iter of str, optional
A list of variable names specifying which subsystem variables to ‘promote’ up to this group. This is for backwards compatibility with older versions of OpenMDAO.
Returns: System
The System that was passed in.

add_constraint
(name, lower=None, upper=None, equals=None, ref=None, ref0=None, adder=None, scaler=None, indices=None, linear=False, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None, simul_map=None)¶ Add a constraint variable to this system.
Parameters: name : string
Name of the response variable in the system.
lower : float or ndarray, optional
Lower boundary for the variable
upper : float or ndarray, optional
Upper boundary for the variable
equals : float or ndarray, optional
Equality constraint value for the variable
ref : float or ndarray, optional
Value of response variable that scales to 1.0 in the driver.
ref0 : float or ndarray, optional
Value of response variable that scales to 0.0 in the driver.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
indices : sequence of int, optional
If variable is an array, these indicate which entries are of interest for this particular response. These may be positive or negative integers.
linear : bool
Set to True if constraint is linear. Default is False.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the constraint variable.
simul_map : dict
Mapping of this response to each design variable where simultaneous derivs will be used. Each design variable entry is another dict keyed on color, and the values in the color dict are tuples of the form (resp_idxs, color_idxs).
Notes
The response can be scaled using ref and ref0. The argument
ref0
represents the physical value when the scaled value is 0. The argumentref
represents the physical value when the scaled value is 1.

add_design_var
(name, lower=None, upper=None, ref=None, ref0=None, indices=None, adder=None, scaler=None, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None)¶ Add a design variable to this system.
Parameters: name : string
Name of the design variable in the system.
lower : float or ndarray, optional
Lower boundary for the param
upper : upper or ndarray, optional
Upper boundary for the param
ref : float or ndarray, optional
Value of design var that scales to 1.0 in the driver.
ref0 : float or ndarray, optional
Value of design var that scales to 0.0 in the driver.
indices : iter of int, optional
If a param is an array, these indicate which entries are of interest for this particular design variable. These may be positive or negative integers.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the design variable.
Notes
The response can be scaled using ref and ref0. The argument
ref0
represents the physical value when the scaled value is 0. The argumentref
represents the physical value when the scaled value is 1.

add_objective
(name, ref=None, ref0=None, index=None, adder=None, scaler=None, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None, simul_map=None)¶ Add a response variable to this system.
Parameters: name : string
Name of the response variable in the system.
ref : float or ndarray, optional
Value of response variable that scales to 1.0 in the driver.
ref0 : float or ndarray, optional
Value of response variable that scales to 0.0 in the driver.
index : int, optional
If variable is an array, this indicates which entry is of interest for this particular response. This may be a positive or negative integer.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the objective variable.
simul_map : dict
Mapping of this response to each design variable where simultaneous derivs will be used. Each design variable entry is another dict keyed on color, and the values in the color dict are tuples of the form (resp_idxs, color_idxs).
Notes
The objective can be scaled using scaler and adder, where
\[x_{scaled} = scaler(x + adder)\]or through the use of ref/ref0, which map to scaler and adder through the equations:
\[ \begin{align}\begin{aligned}0 = scaler(ref_0 + adder)\\1 = scaler(ref + adder)\end{aligned}\end{align} \]which results in:
\[ \begin{align}\begin{aligned}adder = ref_0\\scaler = \frac{1}{ref + adder}\end{aligned}\end{align} \]

add_recorder
(recorder, recurse=False)¶ Add a recorder to the driver.
Parameters: recorder : <BaseRecorder>
A recorder instance.
recurse : boolean
Flag indicating if the recorder should be added to all the subsystems.

add_response
(name, type_, lower=None, upper=None, equals=None, ref=None, ref0=None, indices=None, index=None, adder=None, scaler=None, linear=False, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None, simul_map=None)¶ Add a response variable to this system.
The response can be scaled using ref and ref0. The argument
ref0
represents the physical value when the scaled value is 0. The argumentref
represents the physical value when the scaled value is 1.Parameters: name : string
Name of the response variable in the system.
type_ : string
The type of response. Supported values are ‘con’ and ‘obj’
lower : float or ndarray, optional
Lower boundary for the variable
upper : upper or ndarray, optional
Upper boundary for the variable
equals : equals or ndarray, optional
Equality constraint value for the variable
ref : float or ndarray, optional
Value of response variable that scales to 1.0 in the driver.
ref0 : upper or ndarray, optional
Value of response variable that scales to 0.0 in the driver.
indices : sequence of int, optional
If variable is an array, these indicate which entries are of interest for this particular response.
index : int, optional
If variable is an array, this indicates which entry is of interest for this particular response.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
linear : bool
Set to True if constraint is linear. Default is False.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the response variable.
simul_map : dict
Mapping of this response to each design variable where simultaneous derivs will be used. Each design variable entry is another dict keyed on color, and the values in the color dict are tuples of the form (resp_idxs, color_idxs).

add_subsystem
(name, subsys, promotes=None, promotes_inputs=None, promotes_outputs=None, min_procs=1, max_procs=None, proc_weight=1.0)¶ Add a subsystem.
Parameters: name : str
Name of the subsystem being added
subsys : <System>
An instantiated, but notyetset up system object.
promotes : iter of (str or tuple), optional
A list of variable names specifying which subsystem variables to ‘promote’ up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group.
promotes_inputs : iter of (str or tuple), optional
A list of input variable names specifying which subsystem input variables to ‘promote’ up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group.
promotes_outputs : iter of (str or tuple), optional
A list of output variable names specifying which subsystem output variables to ‘promote’ up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group.
min_procs : int
Minimum number of MPI processes usable by the subsystem. Defaults to 1.
max_procs : int or None
Maximum number of MPI processes usable by the subsystem. A value of None (the default) indicates there is no maximum limit.
proc_weight : float
Weight given to the subsystem when allocating available MPI processes to all subsystems. Default is 1.0.
Returns: <System>
the subsystem that was passed in. This is returned to enable users to instantiate and add a subsystem at the same time, and get the reference back.

approx_totals
(method='fd', **kwargs)¶ Approximate derivatives for a Group using the specified approximation method.
Parameters: method : str
The type of approximation that should be used. Valid options include: ‘fd’: Finite Difference, ‘cs’: Complex Step
**kwargs : dict
Keyword arguments for controlling the behavior of the approximation.

check_config
(logger)¶ Perform optional error checks.
Parameters: logger : object
The object that manages logging output.

compute_sys_graph
(comps_only=False)¶ Compute a dependency graph for subsystems in this group.
Variable connection information is stored in each edge of the system graph.
Parameters: comps_only : bool (False)
If True, return a graph of all components within this group or any of its descendants. No subgroups will be included. Otherwise, a graph containing only direct children (both Components and Groups) of this group will be returned.
Returns: DiGraph
A directed graph containing names of subsystems and their connections.

configure
()¶ Configure this group to assign children settings.
This method may optionally be overidden by your Group’s method.
You may only use this method to change settings on your children subsystems. This includes setting solvers in cases where you want to override the defaults.
You can assume that the full hierarchy below your level has been instantiated and has already called its own configure methods.
 Available attributes:
 name pathname comm metadata system hieararchy with attribute access

connect
(src_name, tgt_name, src_indices=None, flat_src_indices=None)¶ Connect source src_name to target tgt_name in this namespace.
Parameters: src_name : str
name of the source variable to connect
tgt_name : str or [str, ... ] or (str, ...)
name of the target variable(s) to connect
src_indices : int or list of ints or tuple of ints or int ndarray or Iterable or None
The global indices of the source variable to transfer data from. The shapes of the target and src_indices must match, and form of the entries within is determined by the value of ‘flat_src_indices’.
flat_src_indices : bool
If True, each entry of src_indices is assumed to be an index into the flattened source. Otherwise it must be a tuple or list of size equal to the number of dimensions of the source.

get_constraints
(recurse=True)¶ Get the Constraint settings from this system.
Retrieve the constraint settings for the current system as a dict, keyed by variable name.
Parameters: recurse : bool, optional
If True, recurse through the subsystems and return the path of all constraints relative to the this system.
Returns: dict
The constraints defined in the current system.

get_design_vars
(recurse=True, get_sizes=True)¶ Get the DesignVariable settings from this system.
Retrieve all design variable settings from the system and, if recurse is True, all of its subsystems.
Parameters: recurse : bool
If True, recurse through the subsystems and return the path of all design vars relative to the this system.
get_sizes : bool, optional
If True, compute the size of each response.
Returns: dict
The design variables defined in the current system and, if recurse=True, its subsystems.

get_linear_vectors
(vec_name='linear')¶ Return the linear inputs, outputs, and residuals vectors.
Parameters: vec_name : str
Name of the linear righthandside vector. The default is ‘linear’.
Returns: (inputs, outputs, residuals) : tuple of <Vector> instances
Yields the inputs, outputs, and residuals linear vectors for vec_name.

get_nonlinear_vectors
()¶ Return the inputs, outputs, and residuals vectors.
Returns: (inputs, outputs, residuals) : tuple of <Vector> instances
Yields the inputs, outputs, and residuals nonlinear vectors.

get_objectives
(recurse=True)¶ Get the Objective settings from this system.
Retrieve all objectives settings from the system as a dict, keyed by variable name.
Parameters: recurse : bool, optional
If True, recurse through the subsystems and return the path of all objective relative to the this system.
Returns: dict
The objectives defined in the current system.

get_responses
(recurse=True, get_sizes=True)¶ Get the response variable settings from this system.
Retrieve all response variable settings from the system as a dict, keyed by variable name.
Parameters: recurse : bool, optional
If True, recurse through the subsystems and return the path of all responses relative to the this system.
get_sizes : bool, optional
If True, compute the size of each response.
Returns: dict
The responses defined in the current system and, if recurse=True, its subsystems.

initialize
()¶ Perform any onetime initialization run at instantiation.

is_active
()¶ Determine if the system is active on this rank.
Returns: bool
If running under MPI, returns True if this System has a valid communicator. Always returns True if not running under MPI.

jacobian
¶ Get the Jacobian object assigned to this system (or None if unassigned).

jacobian_context
(*args, **kwds)¶ Context manager that yields the Jacobian assigned to this system in this system’s context.

linear_solver
¶ Get the linear solver for this system.

list_inputs
(values=True, units=False, hierarchical=True, print_arrays=False, out_stream=<object object>)¶ Return and optionally log a list of input names and other optional information.
If the model is parallel, only the local variables are returned to the process. Also optionally logs the information to a user defined output stream. If the model is parallel, the rank 0 process logs information about all variables across all processes.
Parameters: values : bool, optional
When True, display/return input values. Default is True.
units : bool, optional
When True, display/return units. Default is False.
hierarchical : bool, optional
When True, human readable output shows variables in hierarchical format.
print_arrays : bool, optional
When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False.
out_stream : filelike object
Where to send human readable output. Default is sys.stdout. Set to None to suppress.
Returns: list
list of input names and other optional information about those inputs

list_outputs
(explicit=True, implicit=True, values=True, residuals=False, residuals_tol=None, units=False, shape=False, bounds=False, scaling=False, hierarchical=True, print_arrays=False, out_stream=<object object>)¶ Return and optionally log a list of output names and other optional information.
If the model is parallel, only the local variables are returned to the process. Also optionally logs the information to a user defined output stream. If the model is parallel, the rank 0 process logs information about all variables across all processes.
Parameters: explicit : bool, optional
include outputs from explicit components. Default is True.
implicit : bool, optional
include outputs from implicit components. Default is True.
values : bool, optional
When True, display/return output values. Default is True.
residuals : bool, optional
When True, display/return residual values. Default is False.
residuals_tol : float, optional
If set, limits the output of list_outputs to only variables where the norm of the resids array is greater than the given ‘residuals_tol’. Default is None.
units : bool, optional
When True, display/return units. Default is False.
shape : bool, optional
When True, display/return the shape of the value. Default is False.
bounds : bool, optional
When True, display/return bounds (lower and upper). Default is False.
scaling : bool, optional
When True, display/return scaling (ref, ref0, and res_ref). Default is False.
hierarchical : bool, optional
When True, human readable output shows variables in hierarchical format.
print_arrays : bool, optional
When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False.
out_stream : filelike
Where to send human readable output. Default is sys.stdout. Set to None to suppress.
Returns: list
list of output names and other optional information about those outputs

ln_solver
¶ Get the linear solver for this system.

nl_solver
¶ Get the nonlinear solver for this system.

nonlinear_solver
¶ Get the nonlinear solver for this system.

reconfigure
()¶ Perform reconfiguration.
Returns: bool
If True, reconfiguration is to be performed.

record_iteration
()¶ Record an iteration of the current System.

resetup
(setup_mode='full')¶ Public wrapper for _setup that reconfigures after an initial setup has been performed.
Parameters: setup_mode : str
Must be one of ‘full’, ‘reconf’, or ‘update’.

run_apply_linear
(vec_names, mode, scope_out=None, scope_in=None)¶ Compute jacvec product.
This calls _apply_linear, but with the model assumed to be in an unscaled state.
Parameters: vec_names : [str, ...]
list of names of the righthandside vectors.
mode : str
‘fwd’ or ‘rev’.
scope_out : set or None
Set of absolute output names in the scope of this matvec product. If None, all are in the scope.
scope_in : set or None
Set of absolute input names in the scope of this matvec product. If None, all are in the scope.

run_apply_nonlinear
()¶ Compute residuals.
This calls _apply_nonlinear, but with the model assumed to be in an unscaled state.

run_linearize
(do_nl=True, do_ln=True)¶ Compute jacobian / factorization.
This calls _linearize, but with the model assumed to be in an unscaled state.
Parameters: do_nl : boolean
Flag indicating if the nonlinear solver should be linearized.
do_ln : boolean
Flag indicating if the linear solver should be linearized.

run_solve_linear
(vec_names, mode)¶ Apply inverse jac product.
This calls _solve_linear, but with the model assumed to be in an unscaled state.
Parameters: vec_names : [str, ...]
list of names of the righthandside vectors.
mode : str
‘fwd’ or ‘rev’.
Returns: boolean
Failure flag; True if failed to converge, False is successful.
float
relative error.
float
absolute error.

run_solve_nonlinear
()¶ Compute outputs.
This calls _solve_nonlinear, but with the model assumed to be in an unscaled state.
Returns: boolean
Failure flag; True if failed to converge, False is successful.
float
relative error.
float
absolute error.

set_initial_values
()¶ Set all input and output variables to their declared initial values.

set_order
(new_order)¶ Specify a new execution order for this system.
Parameters: new_order : list of str
List of system names in desired new execution order.

setup
()¶ Build this group.
This method should be overidden by your Group’s method.
You may call ‘add_subsystem’ to add systems to this group. You may also issue connections, and set the linear and nonlinear solvers for this group level. You cannot safely change anything on children systems; use the ‘configure’ method instead.
 Available attributes:
 name pathname comm metadata

system_iter
(include_self=False, recurse=True, typ=None)¶ Yield a generator of local subsystems of this system.
Parameters: include_self : bool
If True, include this system in the iteration.
recurse : bool
If True, iterate over the whole tree under this system.
typ : type
If not None, only yield Systems that match that are instances of the given type.


class
openmdao.test_suite.components.double_sellar.
SubSellar
(units=None, scaling=None, **kwargs)[source]¶ Bases:
openmdao.core.group.Group

add
(name, subsys, promotes=None)¶ Add a subsystem (deprecated version of <Group.add_subsystem>).
Parameters: name : str
Name of the subsystem being added
subsys : System
An instantiated, but notyetset up system object.
promotes : iter of str, optional
A list of variable names specifying which subsystem variables to ‘promote’ up to this group. This is for backwards compatibility with older versions of OpenMDAO.
Returns: System
The System that was passed in.

add_constraint
(name, lower=None, upper=None, equals=None, ref=None, ref0=None, adder=None, scaler=None, indices=None, linear=False, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None, simul_map=None)¶ Add a constraint variable to this system.
Parameters: name : string
Name of the response variable in the system.
lower : float or ndarray, optional
Lower boundary for the variable
upper : float or ndarray, optional
Upper boundary for the variable
equals : float or ndarray, optional
Equality constraint value for the variable
ref : float or ndarray, optional
Value of response variable that scales to 1.0 in the driver.
ref0 : float or ndarray, optional
Value of response variable that scales to 0.0 in the driver.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
indices : sequence of int, optional
If variable is an array, these indicate which entries are of interest for this particular response. These may be positive or negative integers.
linear : bool
Set to True if constraint is linear. Default is False.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the constraint variable.
simul_map : dict
Mapping of this response to each design variable where simultaneous derivs will be used. Each design variable entry is another dict keyed on color, and the values in the color dict are tuples of the form (resp_idxs, color_idxs).
Notes
The response can be scaled using ref and ref0. The argument
ref0
represents the physical value when the scaled value is 0. The argumentref
represents the physical value when the scaled value is 1.

add_design_var
(name, lower=None, upper=None, ref=None, ref0=None, indices=None, adder=None, scaler=None, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None)¶ Add a design variable to this system.
Parameters: name : string
Name of the design variable in the system.
lower : float or ndarray, optional
Lower boundary for the param
upper : upper or ndarray, optional
Upper boundary for the param
ref : float or ndarray, optional
Value of design var that scales to 1.0 in the driver.
ref0 : float or ndarray, optional
Value of design var that scales to 0.0 in the driver.
indices : iter of int, optional
If a param is an array, these indicate which entries are of interest for this particular design variable. These may be positive or negative integers.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the design variable.
Notes
The response can be scaled using ref and ref0. The argument
ref0
represents the physical value when the scaled value is 0. The argumentref
represents the physical value when the scaled value is 1.

add_objective
(name, ref=None, ref0=None, index=None, adder=None, scaler=None, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None, simul_map=None)¶ Add a response variable to this system.
Parameters: name : string
Name of the response variable in the system.
ref : float or ndarray, optional
Value of response variable that scales to 1.0 in the driver.
ref0 : float or ndarray, optional
Value of response variable that scales to 0.0 in the driver.
index : int, optional
If variable is an array, this indicates which entry is of interest for this particular response. This may be a positive or negative integer.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the objective variable.
simul_map : dict
Mapping of this response to each design variable where simultaneous derivs will be used. Each design variable entry is another dict keyed on color, and the values in the color dict are tuples of the form (resp_idxs, color_idxs).
Notes
The objective can be scaled using scaler and adder, where
\[x_{scaled} = scaler(x + adder)\]or through the use of ref/ref0, which map to scaler and adder through the equations:
\[ \begin{align}\begin{aligned}0 = scaler(ref_0 + adder)\\1 = scaler(ref + adder)\end{aligned}\end{align} \]which results in:
\[ \begin{align}\begin{aligned}adder = ref_0\\scaler = \frac{1}{ref + adder}\end{aligned}\end{align} \]

add_recorder
(recorder, recurse=False)¶ Add a recorder to the driver.
Parameters: recorder : <BaseRecorder>
A recorder instance.
recurse : boolean
Flag indicating if the recorder should be added to all the subsystems.

add_response
(name, type_, lower=None, upper=None, equals=None, ref=None, ref0=None, indices=None, index=None, adder=None, scaler=None, linear=False, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None, simul_map=None)¶ Add a response variable to this system.
The response can be scaled using ref and ref0. The argument
ref0
represents the physical value when the scaled value is 0. The argumentref
represents the physical value when the scaled value is 1.Parameters: name : string
Name of the response variable in the system.
type_ : string
The type of response. Supported values are ‘con’ and ‘obj’
lower : float or ndarray, optional
Lower boundary for the variable
upper : upper or ndarray, optional
Upper boundary for the variable
equals : equals or ndarray, optional
Equality constraint value for the variable
ref : float or ndarray, optional
Value of response variable that scales to 1.0 in the driver.
ref0 : upper or ndarray, optional
Value of response variable that scales to 0.0 in the driver.
indices : sequence of int, optional
If variable is an array, these indicate which entries are of interest for this particular response.
index : int, optional
If variable is an array, this indicates which entry is of interest for this particular response.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
linear : bool
Set to True if constraint is linear. Default is False.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the response variable.
simul_map : dict
Mapping of this response to each design variable where simultaneous derivs will be used. Each design variable entry is another dict keyed on color, and the values in the color dict are tuples of the form (resp_idxs, color_idxs).

add_subsystem
(name, subsys, promotes=None, promotes_inputs=None, promotes_outputs=None, min_procs=1, max_procs=None, proc_weight=1.0)¶ Add a subsystem.
Parameters: name : str
Name of the subsystem being added
subsys : <System>
An instantiated, but notyetset up system object.
promotes : iter of (str or tuple), optional
A list of variable names specifying which subsystem variables to ‘promote’ up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group.
promotes_inputs : iter of (str or tuple), optional
A list of input variable names specifying which subsystem input variables to ‘promote’ up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group.
promotes_outputs : iter of (str or tuple), optional
A list of output variable names specifying which subsystem output variables to ‘promote’ up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group.
min_procs : int
Minimum number of MPI processes usable by the subsystem. Defaults to 1.
max_procs : int or None
Maximum number of MPI processes usable by the subsystem. A value of None (the default) indicates there is no maximum limit.
proc_weight : float
Weight given to the subsystem when allocating available MPI processes to all subsystems. Default is 1.0.
Returns: <System>
the subsystem that was passed in. This is returned to enable users to instantiate and add a subsystem at the same time, and get the reference back.

approx_totals
(method='fd', **kwargs)¶ Approximate derivatives for a Group using the specified approximation method.
Parameters: method : str
The type of approximation that should be used. Valid options include: ‘fd’: Finite Difference, ‘cs’: Complex Step
**kwargs : dict
Keyword arguments for controlling the behavior of the approximation.

check_config
(logger)¶ Perform optional error checks.
Parameters: logger : object
The object that manages logging output.

compute_sys_graph
(comps_only=False)¶ Compute a dependency graph for subsystems in this group.
Variable connection information is stored in each edge of the system graph.
Parameters: comps_only : bool (False)
If True, return a graph of all components within this group or any of its descendants. No subgroups will be included. Otherwise, a graph containing only direct children (both Components and Groups) of this group will be returned.
Returns: DiGraph
A directed graph containing names of subsystems and their connections.

configure
()¶ Configure this group to assign children settings.
This method may optionally be overidden by your Group’s method.
You may only use this method to change settings on your children subsystems. This includes setting solvers in cases where you want to override the defaults.
You can assume that the full hierarchy below your level has been instantiated and has already called its own configure methods.
 Available attributes:
 name pathname comm metadata system hieararchy with attribute access

connect
(src_name, tgt_name, src_indices=None, flat_src_indices=None)¶ Connect source src_name to target tgt_name in this namespace.
Parameters: src_name : str
name of the source variable to connect
tgt_name : str or [str, ... ] or (str, ...)
name of the target variable(s) to connect
src_indices : int or list of ints or tuple of ints or int ndarray or Iterable or None
The global indices of the source variable to transfer data from. The shapes of the target and src_indices must match, and form of the entries within is determined by the value of ‘flat_src_indices’.
flat_src_indices : bool
If True, each entry of src_indices is assumed to be an index into the flattened source. Otherwise it must be a tuple or list of size equal to the number of dimensions of the source.

get_constraints
(recurse=True)¶ Get the Constraint settings from this system.
Retrieve the constraint settings for the current system as a dict, keyed by variable name.
Parameters: recurse : bool, optional
If True, recurse through the subsystems and return the path of all constraints relative to the this system.
Returns: dict
The constraints defined in the current system.

get_design_vars
(recurse=True, get_sizes=True)¶ Get the DesignVariable settings from this system.
Retrieve all design variable settings from the system and, if recurse is True, all of its subsystems.
Parameters: recurse : bool
If True, recurse through the subsystems and return the path of all design vars relative to the this system.
get_sizes : bool, optional
If True, compute the size of each response.
Returns: dict
The design variables defined in the current system and, if recurse=True, its subsystems.

get_linear_vectors
(vec_name='linear')¶ Return the linear inputs, outputs, and residuals vectors.
Parameters: vec_name : str
Name of the linear righthandside vector. The default is ‘linear’.
Returns: (inputs, outputs, residuals) : tuple of <Vector> instances
Yields the inputs, outputs, and residuals linear vectors for vec_name.

get_nonlinear_vectors
()¶ Return the inputs, outputs, and residuals vectors.
Returns: (inputs, outputs, residuals) : tuple of <Vector> instances
Yields the inputs, outputs, and residuals nonlinear vectors.

get_objectives
(recurse=True)¶ Get the Objective settings from this system.
Retrieve all objectives settings from the system as a dict, keyed by variable name.
Parameters: recurse : bool, optional
If True, recurse through the subsystems and return the path of all objective relative to the this system.
Returns: dict
The objectives defined in the current system.

get_responses
(recurse=True, get_sizes=True)¶ Get the response variable settings from this system.
Retrieve all response variable settings from the system as a dict, keyed by variable name.
Parameters: recurse : bool, optional
If True, recurse through the subsystems and return the path of all responses relative to the this system.
get_sizes : bool, optional
If True, compute the size of each response.
Returns: dict
The responses defined in the current system and, if recurse=True, its subsystems.

initialize
()¶ Perform any onetime initialization run at instantiation.

is_active
()¶ Determine if the system is active on this rank.
Returns: bool
If running under MPI, returns True if this System has a valid communicator. Always returns True if not running under MPI.

jacobian
¶ Get the Jacobian object assigned to this system (or None if unassigned).

jacobian_context
(*args, **kwds)¶ Context manager that yields the Jacobian assigned to this system in this system’s context.

linear_solver
¶ Get the linear solver for this system.

list_inputs
(values=True, units=False, hierarchical=True, print_arrays=False, out_stream=<object object>)¶ Return and optionally log a list of input names and other optional information.
If the model is parallel, only the local variables are returned to the process. Also optionally logs the information to a user defined output stream. If the model is parallel, the rank 0 process logs information about all variables across all processes.
Parameters: values : bool, optional
When True, display/return input values. Default is True.
units : bool, optional
When True, display/return units. Default is False.
hierarchical : bool, optional
When True, human readable output shows variables in hierarchical format.
print_arrays : bool, optional
When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False.
out_stream : filelike object
Where to send human readable output. Default is sys.stdout. Set to None to suppress.
Returns: list
list of input names and other optional information about those inputs

list_outputs
(explicit=True, implicit=True, values=True, residuals=False, residuals_tol=None, units=False, shape=False, bounds=False, scaling=False, hierarchical=True, print_arrays=False, out_stream=<object object>)¶ Return and optionally log a list of output names and other optional information.
If the model is parallel, only the local variables are returned to the process. Also optionally logs the information to a user defined output stream. If the model is parallel, the rank 0 process logs information about all variables across all processes.
Parameters: explicit : bool, optional
include outputs from explicit components. Default is True.
implicit : bool, optional
include outputs from implicit components. Default is True.
values : bool, optional
When True, display/return output values. Default is True.
residuals : bool, optional
When True, display/return residual values. Default is False.
residuals_tol : float, optional
If set, limits the output of list_outputs to only variables where the norm of the resids array is greater than the given ‘residuals_tol’. Default is None.
units : bool, optional
When True, display/return units. Default is False.
shape : bool, optional
When True, display/return the shape of the value. Default is False.
bounds : bool, optional
When True, display/return bounds (lower and upper). Default is False.
scaling : bool, optional
When True, display/return scaling (ref, ref0, and res_ref). Default is False.
hierarchical : bool, optional
When True, human readable output shows variables in hierarchical format.
print_arrays : bool, optional
When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False.
out_stream : filelike
Where to send human readable output. Default is sys.stdout. Set to None to suppress.
Returns: list
list of output names and other optional information about those outputs

ln_solver
¶ Get the linear solver for this system.

nl_solver
¶ Get the nonlinear solver for this system.

nonlinear_solver
¶ Get the nonlinear solver for this system.

reconfigure
()¶ Perform reconfiguration.
Returns: bool
If True, reconfiguration is to be performed.

record_iteration
()¶ Record an iteration of the current System.

resetup
(setup_mode='full')¶ Public wrapper for _setup that reconfigures after an initial setup has been performed.
Parameters: setup_mode : str
Must be one of ‘full’, ‘reconf’, or ‘update’.

run_apply_linear
(vec_names, mode, scope_out=None, scope_in=None)¶ Compute jacvec product.
This calls _apply_linear, but with the model assumed to be in an unscaled state.
Parameters: vec_names : [str, ...]
list of names of the righthandside vectors.
mode : str
‘fwd’ or ‘rev’.
scope_out : set or None
Set of absolute output names in the scope of this matvec product. If None, all are in the scope.
scope_in : set or None
Set of absolute input names in the scope of this matvec product. If None, all are in the scope.

run_apply_nonlinear
()¶ Compute residuals.
This calls _apply_nonlinear, but with the model assumed to be in an unscaled state.

run_linearize
(do_nl=True, do_ln=True)¶ Compute jacobian / factorization.
This calls _linearize, but with the model assumed to be in an unscaled state.
Parameters: do_nl : boolean
Flag indicating if the nonlinear solver should be linearized.
do_ln : boolean
Flag indicating if the linear solver should be linearized.

run_solve_linear
(vec_names, mode)¶ Apply inverse jac product.
This calls _solve_linear, but with the model assumed to be in an unscaled state.
Parameters: vec_names : [str, ...]
list of names of the righthandside vectors.
mode : str
‘fwd’ or ‘rev’.
Returns: boolean
Failure flag; True if failed to converge, False is successful.
float
relative error.
float
absolute error.

run_solve_nonlinear
()¶ Compute outputs.
This calls _solve_nonlinear, but with the model assumed to be in an unscaled state.
Returns: boolean
Failure flag; True if failed to converge, False is successful.
float
relative error.
float
absolute error.

set_initial_values
()¶ Set all input and output variables to their declared initial values.

set_order
(new_order)¶ Specify a new execution order for this system.
Parameters: new_order : list of str
List of system names in desired new execution order.

setup
()¶ Build this group.
This method should be overidden by your Group’s method.
You may call ‘add_subsystem’ to add systems to this group. You may also issue connections, and set the linear and nonlinear solvers for this group level. You cannot safely change anything on children systems; use the ‘configure’ method instead.
 Available attributes:
 name pathname comm metadata

system_iter
(include_self=False, recurse=True, typ=None)¶ Yield a generator of local subsystems of this system.
Parameters: include_self : bool
If True, include this system in the iteration.
recurse : bool
If True, iterate over the whole tree under this system.
typ : type
If not None, only yield Systems that match that are instances of the given type.


class
openmdao.test_suite.components.double_sellar.
SubSellarImplicit
(units=None, scaling=None, **kwargs)[source]¶ Bases:
openmdao.core.group.Group

add
(name, subsys, promotes=None)¶ Add a subsystem (deprecated version of <Group.add_subsystem>).
Parameters: name : str
Name of the subsystem being added
subsys : System
An instantiated, but notyetset up system object.
promotes : iter of str, optional
A list of variable names specifying which subsystem variables to ‘promote’ up to this group. This is for backwards compatibility with older versions of OpenMDAO.
Returns: System
The System that was passed in.

add_constraint
(name, lower=None, upper=None, equals=None, ref=None, ref0=None, adder=None, scaler=None, indices=None, linear=False, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None, simul_map=None)¶ Add a constraint variable to this system.
Parameters: name : string
Name of the response variable in the system.
lower : float or ndarray, optional
Lower boundary for the variable
upper : float or ndarray, optional
Upper boundary for the variable
equals : float or ndarray, optional
Equality constraint value for the variable
ref : float or ndarray, optional
Value of response variable that scales to 1.0 in the driver.
ref0 : float or ndarray, optional
Value of response variable that scales to 0.0 in the driver.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
indices : sequence of int, optional
If variable is an array, these indicate which entries are of interest for this particular response. These may be positive or negative integers.
linear : bool
Set to True if constraint is linear. Default is False.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the constraint variable.
simul_map : dict
Mapping of this response to each design variable where simultaneous derivs will be used. Each design variable entry is another dict keyed on color, and the values in the color dict are tuples of the form (resp_idxs, color_idxs).
Notes
The response can be scaled using ref and ref0. The argument
ref0
represents the physical value when the scaled value is 0. The argumentref
represents the physical value when the scaled value is 1.

add_design_var
(name, lower=None, upper=None, ref=None, ref0=None, indices=None, adder=None, scaler=None, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None)¶ Add a design variable to this system.
Parameters: name : string
Name of the design variable in the system.
lower : float or ndarray, optional
Lower boundary for the param
upper : upper or ndarray, optional
Upper boundary for the param
ref : float or ndarray, optional
Value of design var that scales to 1.0 in the driver.
ref0 : float or ndarray, optional
Value of design var that scales to 0.0 in the driver.
indices : iter of int, optional
If a param is an array, these indicate which entries are of interest for this particular design variable. These may be positive or negative integers.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the design variable.
Notes
The response can be scaled using ref and ref0. The argument
ref0
represents the physical value when the scaled value is 0. The argumentref
represents the physical value when the scaled value is 1.

add_objective
(name, ref=None, ref0=None, index=None, adder=None, scaler=None, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None, simul_map=None)¶ Add a response variable to this system.
Parameters: name : string
Name of the response variable in the system.
ref : float or ndarray, optional
Value of response variable that scales to 1.0 in the driver.
ref0 : float or ndarray, optional
Value of response variable that scales to 0.0 in the driver.
index : int, optional
If variable is an array, this indicates which entry is of interest for this particular response. This may be a positive or negative integer.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the objective variable.
simul_map : dict
Mapping of this response to each design variable where simultaneous derivs will be used. Each design variable entry is another dict keyed on color, and the values in the color dict are tuples of the form (resp_idxs, color_idxs).
Notes
The objective can be scaled using scaler and adder, where
\[x_{scaled} = scaler(x + adder)\]or through the use of ref/ref0, which map to scaler and adder through the equations:
\[ \begin{align}\begin{aligned}0 = scaler(ref_0 + adder)\\1 = scaler(ref + adder)\end{aligned}\end{align} \]which results in:
\[ \begin{align}\begin{aligned}adder = ref_0\\scaler = \frac{1}{ref + adder}\end{aligned}\end{align} \]

add_recorder
(recorder, recurse=False)¶ Add a recorder to the driver.
Parameters: recorder : <BaseRecorder>
A recorder instance.
recurse : boolean
Flag indicating if the recorder should be added to all the subsystems.

add_response
(name, type_, lower=None, upper=None, equals=None, ref=None, ref0=None, indices=None, index=None, adder=None, scaler=None, linear=False, parallel_deriv_color=None, vectorize_derivs=False, simul_coloring=None, simul_map=None)¶ Add a response variable to this system.
The response can be scaled using ref and ref0. The argument
ref0
represents the physical value when the scaled value is 0. The argumentref
represents the physical value when the scaled value is 1.Parameters: name : string
Name of the response variable in the system.
type_ : string
The type of response. Supported values are ‘con’ and ‘obj’
lower : float or ndarray, optional
Lower boundary for the variable
upper : upper or ndarray, optional
Upper boundary for the variable
equals : equals or ndarray, optional
Equality constraint value for the variable
ref : float or ndarray, optional
Value of response variable that scales to 1.0 in the driver.
ref0 : upper or ndarray, optional
Value of response variable that scales to 0.0 in the driver.
indices : sequence of int, optional
If variable is an array, these indicate which entries are of interest for this particular response.
index : int, optional
If variable is an array, this indicates which entry is of interest for this particular response.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
linear : bool
Set to True if constraint is linear. Default is False.
parallel_deriv_color : string
If specified, this design var will be grouped for parallel derivative calculations with other variables sharing the same parallel_deriv_color.
vectorize_derivs : bool
If True, vectorize derivative calculations.
simul_coloring : ndarray or list of int
An array or list of integer color values. Must match the size of the response variable.
simul_map : dict
Mapping of this response to each design variable where simultaneous derivs will be used. Each design variable entry is another dict keyed on color, and the values in the color dict are tuples of the form (resp_idxs, color_idxs).

add_subsystem
(name, subsys, promotes=None, promotes_inputs=None, promotes_outputs=None, min_procs=1, max_procs=None, proc_weight=1.0)¶ Add a subsystem.
Parameters: name : str
Name of the subsystem being added
subsys : <System>
An instantiated, but notyetset up system object.
promotes : iter of (str or tuple), optional
A list of variable names specifying which subsystem variables to ‘promote’ up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group.
promotes_inputs : iter of (str or tuple), optional
A list of input variable names specifying which subsystem input variables to ‘promote’ up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group.
promotes_outputs : iter of (str or tuple), optional
A list of output variable names specifying which subsystem output variables to ‘promote’ up to this group. If an entry is a tuple of the form (old_name, new_name), this will rename the variable in the parent group.
min_procs : int
Minimum number of MPI processes usable by the subsystem. Defaults to 1.
max_procs : int or None
Maximum number of MPI processes usable by the subsystem. A value of None (the default) indicates there is no maximum limit.
proc_weight : float
Weight given to the subsystem when allocating available MPI processes to all subsystems. Default is 1.0.
Returns: <System>
the subsystem that was passed in. This is returned to enable users to instantiate and add a subsystem at the same time, and get the reference back.

approx_totals
(method='fd', **kwargs)¶ Approximate derivatives for a Group using the specified approximation method.
Parameters: method : str
The type of approximation that should be used. Valid options include: ‘fd’: Finite Difference, ‘cs’: Complex Step
**kwargs : dict
Keyword arguments for controlling the behavior of the approximation.

check_config
(logger)¶ Perform optional error checks.
Parameters: logger : object
The object that manages logging output.

compute_sys_graph
(comps_only=False)¶ Compute a dependency graph for subsystems in this group.
Variable connection information is stored in each edge of the system graph.
Parameters: comps_only : bool (False)
If True, return a graph of all components within this group or any of its descendants. No subgroups will be included. Otherwise, a graph containing only direct children (both Components and Groups) of this group will be returned.
Returns: DiGraph
A directed graph containing names of subsystems and their connections.

configure
()¶ Configure this group to assign children settings.
This method may optionally be overidden by your Group’s method.
You may only use this method to change settings on your children subsystems. This includes setting solvers in cases where you want to override the defaults.
You can assume that the full hierarchy below your level has been instantiated and has already called its own configure methods.
 Available attributes:
 name pathname comm metadata system hieararchy with attribute access

connect
(src_name, tgt_name, src_indices=None, flat_src_indices=None)¶ Connect source src_name to target tgt_name in this namespace.
Parameters: src_name : str
name of the source variable to connect
tgt_name : str or [str, ... ] or (str, ...)
name of the target variable(s) to connect
src_indices : int or list of ints or tuple of ints or int ndarray or Iterable or None
The global indices of the source variable to transfer data from. The shapes of the target and src_indices must match, and form of the entries within is determined by the value of ‘flat_src_indices’.
flat_src_indices : bool
If True, each entry of src_indices is assumed to be an index into the flattened source. Otherwise it must be a tuple or list of size equal to the number of dimensions of the source.

get_constraints
(recurse=True)¶ Get the Constraint settings from this system.
Retrieve the constraint settings for the current system as a dict, keyed by variable name.
Parameters: recurse : bool, optional
If True, recurse through the subsystems and return the path of all constraints relative to the this system.
Returns: dict
The constraints defined in the current system.

get_design_vars
(recurse=True, get_sizes=True)¶ Get the DesignVariable settings from this system.
Retrieve all design variable settings from the system and, if recurse is True, all of its subsystems.
Parameters: recurse : bool
If True, recurse through the subsystems and return the path of all design vars relative to the this system.
get_sizes : bool, optional
If True, compute the size of each response.
Returns: dict
The design variables defined in the current system and, if recurse=True, its subsystems.

get_linear_vectors
(vec_name='linear')¶ Return the linear inputs, outputs, and residuals vectors.
Parameters: vec_name : str
Name of the linear righthandside vector. The default is ‘linear’.
Returns: (inputs, outputs, residuals) : tuple of <Vector> instances
Yields the inputs, outputs, and residuals linear vectors for vec_name.

get_nonlinear_vectors
()¶ Return the inputs, outputs, and residuals vectors.
Returns: (inputs, outputs, residuals) : tuple of <Vector> instances
Yields the inputs, outputs, and residuals nonlinear vectors.

get_objectives
(recurse=True)¶ Get the Objective settings from this system.
Retrieve all objectives settings from the system as a dict, keyed by variable name.
Parameters: recurse : bool, optional
If True, recurse through the subsystems and return the path of all objective relative to the this system.
Returns: dict
The objectives defined in the current system.

get_responses
(recurse=True, get_sizes=True)¶ Get the response variable settings from this system.
Retrieve all response variable settings from the system as a dict, keyed by variable name.
Parameters: recurse : bool, optional
If True, recurse through the subsystems and return the path of all responses relative to the this system.
get_sizes : bool, optional
If True, compute the size of each response.
Returns: dict
The responses defined in the current system and, if recurse=True, its subsystems.

initialize
()¶ Perform any onetime initialization run at instantiation.

is_active
()¶ Determine if the system is active on this rank.
Returns: bool
If running under MPI, returns True if this System has a valid communicator. Always returns True if not running under MPI.

jacobian
¶ Get the Jacobian object assigned to this system (or None if unassigned).

jacobian_context
(*args, **kwds)¶ Context manager that yields the Jacobian assigned to this system in this system’s context.

linear_solver
¶ Get the linear solver for this system.

list_inputs
(values=True, units=False, hierarchical=True, print_arrays=False, out_stream=<object object>)¶ Return and optionally log a list of input names and other optional information.
If the model is parallel, only the local variables are returned to the process. Also optionally logs the information to a user defined output stream. If the model is parallel, the rank 0 process logs information about all variables across all processes.
Parameters: values : bool, optional
When True, display/return input values. Default is True.
units : bool, optional
When True, display/return units. Default is False.
hierarchical : bool, optional
When True, human readable output shows variables in hierarchical format.
print_arrays : bool, optional
When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False.
out_stream : filelike object
Where to send human readable output. Default is sys.stdout. Set to None to suppress.
Returns: list
list of input names and other optional information about those inputs

list_outputs
(explicit=True, implicit=True, values=True, residuals=False, residuals_tol=None, units=False, shape=False, bounds=False, scaling=False, hierarchical=True, print_arrays=False, out_stream=<object object>)¶ Return and optionally log a list of output names and other optional information.
If the model is parallel, only the local variables are returned to the process. Also optionally logs the information to a user defined output stream. If the model is parallel, the rank 0 process logs information about all variables across all processes.
Parameters: explicit : bool, optional
include outputs from explicit components. Default is True.
implicit : bool, optional
include outputs from implicit components. Default is True.
values : bool, optional
When True, display/return output values. Default is True.
residuals : bool, optional
When True, display/return residual values. Default is False.
residuals_tol : float, optional
If set, limits the output of list_outputs to only variables where the norm of the resids array is greater than the given ‘residuals_tol’. Default is None.
units : bool, optional
When True, display/return units. Default is False.
shape : bool, optional
When True, display/return the shape of the value. Default is False.
bounds : bool, optional
When True, display/return bounds (lower and upper). Default is False.
scaling : bool, optional
When True, display/return scaling (ref, ref0, and res_ref). Default is False.
hierarchical : bool, optional
When True, human readable output shows variables in hierarchical format.
print_arrays : bool, optional
When False, in the columnar display, just display norm of any ndarrays with size > 1. The norm is surrounded by vertical bars to indicate that it is a norm. When True, also display full values of the ndarray below the row. Format is affected by the values set with numpy.set_printoptions Default is False.
out_stream : filelike
Where to send human readable output. Default is sys.stdout. Set to None to suppress.
Returns: list
list of output names and other optional information about those outputs

ln_solver
¶ Get the linear solver for this system.

nl_solver
¶ Get the nonlinear solver for this system.

nonlinear_solver
¶ Get the nonlinear solver for this system.

reconfigure
()¶ Perform reconfiguration.
Returns: bool
If True, reconfiguration is to be performed.

record_iteration
()¶ Record an iteration of the current System.

resetup
(setup_mode='full')¶ Public wrapper for _setup that reconfigures after an initial setup has been performed.
Parameters: setup_mode : str
Must be one of ‘full’, ‘reconf’, or ‘update’.

run_apply_linear
(vec_names, mode, scope_out=None, scope_in=None)¶ Compute jacvec product.
This calls _apply_linear, but with the model assumed to be in an unscaled state.
Parameters: vec_names : [str, ...]
list of names of the righthandside vectors.
mode : str
‘fwd’ or ‘rev’.
scope_out : set or None
Set of absolute output names in the scope of this matvec product. If None, all are in the scope.
scope_in : set or None
Set of absolute input names in the scope of this matvec product. If None, all are in the scope.

run_apply_nonlinear
()¶ Compute residuals.
This calls _apply_nonlinear, but with the model assumed to be in an unscaled state.

run_linearize
(do_nl=True, do_ln=True)¶ Compute jacobian / factorization.
This calls _linearize, but with the model assumed to be in an unscaled state.
Parameters: do_nl : boolean
Flag indicating if the nonlinear solver should be linearized.
do_ln : boolean
Flag indicating if the linear solver should be linearized.

run_solve_linear
(vec_names, mode)¶ Apply inverse jac product.
This calls _solve_linear, but with the model assumed to be in an unscaled state.
Parameters: vec_names : [str, ...]
list of names of the righthandside vectors.
mode : str
‘fwd’ or ‘rev’.
Returns: boolean
Failure flag; True if failed to converge, False is successful.
float
relative error.
float
absolute error.

run_solve_nonlinear
()¶ Compute outputs.
This calls _solve_nonlinear, but with the model assumed to be in an unscaled state.
Returns: boolean
Failure flag; True if failed to converge, False is successful.
float
relative error.
float
absolute error.

set_initial_values
()¶ Set all input and output variables to their declared initial values.

set_order
(new_order)¶ Specify a new execution order for this system.
Parameters: new_order : list of str
List of system names in desired new execution order.

setup
()¶ Build this group.
This method should be overidden by your Group’s method.
You may call ‘add_subsystem’ to add systems to this group. You may also issue connections, and set the linear and nonlinear solvers for this group level. You cannot safely change anything on children systems; use the ‘configure’ method instead.
 Available attributes:
 name pathname comm metadata

system_iter
(include_self=False, recurse=True, typ=None)¶ Yield a generator of local subsystems of this system.
Parameters: include_self : bool
If True, include this system in the iteration.
recurse : bool
If True, iterate over the whole tree under this system.
typ : type
If not None, only yield Systems that match that are instances of the given type.
