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.
-
fd_jacobian
(params, unknowns, resids, total_derivs=False, fd_params=None, fd_unknowns=None, poi_indices=None, qoi_indices=None)[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)
total_derivs : bool, optional
Set to true to calculate total derivatives. Otherwise, partial derivatives are returned.
fd_params : list of strings, optional
List of parameter name strings with respect to which derivatives are desired. This is used by problem to limit the derivatives that are taken.
fd_unknowns : list of strings, optional
List of output or state name strings for derivatives to be calculated. This is used by problem to limit the derivatives that are taken.
poi_indices: dict of list of integers, optional
This is a dict that contains the index values for each parameter of interest, so that we only finite difference those indices.
qoi_indices: dict of list of integers, optional
This is a dict that contains the index values for each quantity of interest, so that the finite difference is returned only for those indices.
Returns: dict
Dictionary whose keys are tuples of the form (‘unknown’, ‘param’) and whose values are ndarrays containing the derivative for that tuple pair.
-
generate_docstring
()[source]¶ Generates a numpy-style docstring for a user-created System class.
Returns: docstring : str
string that contains a basic numpy docstring.
-
get_combined_jac
(J)[source]¶ Take a J dict that’s distributed, i.e., has different values across different MPI processes, and return a dict that contains all of the values from all of the processes. If values are duplicated, use the value from the lowest rank process. Note that J has a nested dict structure.
Args: J : dict
Local Jacobian
Returns: dict
Local gathered Jacobian
-
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.
-