system.py

Base class for all systems in OpenMDAO.

class openmdao.core.system.System[source]

Bases: object

Base class for systems in OpenMDAO. When building models, user should inherit from Group or Component

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 System.

Args:

out_stream : a file-like object, optional

Stream where report will be written.

clear_dparams()[source]

Zeros out the dparams (dp) vector.

fd_jacobian(params, unknowns, resids, step_size=None, form=None, step_type=None, total_derivs=False)[source]

Finite difference across all unknowns in this system w.r.t. all incoming params.

Args:

params : VecWrapper

VecWrapper containing parameters. (p)

unknowns : VecWrapper

VecWrapper containing outputs and states. (u)

resids : VecWrapper

VecWrapper containing residuals. (r)

step_size : float, optional

Override all other specifications of finite difference step size.

form : float, optional

Override all other specifications of form. Can be forward, backward, or central.

step_type : float, optional

Override all other specifications of step_type. Can be absolute or relative.

total_derivs : bool, optional

Set to true to calculate total derivatives. Otherwise, partial derivatives are returned.

Returns:

dict

Dictionary whose keys are tuples of the form (‘unknown’, ‘param’) and whose values are ndarrays containing the derivative for that tuple pair.

get_req_procs()[source]
Returns:

tuple

A tuple of the form (min_procs, max_procs), indicating the min and max processors usable by this System.

is_active()[source]
Returns:

bool

If running under MPI, returns True if this System has a valid communicator. Always returns True if not running under MPI.

solve_linear(dumat, drmat, vois, mode=None)[source]

Single linear solution applied to whatever input is sitting in the rhs vector.

Args:

dumat : dict of VecWrappers

In forward mode, each VecWrapper contains the incoming vector for the states. There is one vector per quantity of interest for this problem. In reverse mode, it contains the outgoing vector for the states. (du)

drmat : dict of VecWrappers

VecWrapper containing either the outgoing result in forward mode or the incoming vector in reverse mode. There is one vector per quantity of interest for this problem. (dr)

vois : list of strings

List of all quantities of interest to key into the mats.

mode : string

Derivative mode, can be ‘fwd’ or ‘rev’, but generally should be called without mode so that the user can set the mode in this system’s ln_solver.options.

subsystems(local=False, recurse=False, include_self=False)[source]

Returns an iterator over subsystems. For System, this is an empty list.

Args:

local : bool, optional

If True, only return those Components that are local. Default is False.

recurse : bool, optional

If True, return all Components in the system tree, subject to the value of the local arg. Default is False.

typ : type, optional

If a class is specified here, only those subsystems that are instances of that type will be returned. Default type is System.

include_self : bool, optional

If True, yield self before iterating over subsystems, assuming type of self is appropriate. Default is False.

Returns:

iterator

Iterator over subsystems.