subproblem.py

class openmdao.components.subproblem.SubProblem(problem, params=(), unknowns=())[source]

Bases: openmdao.core.component.Component

A Component that wraps a sub-Problem.

Args:

problem : Problem

The Problem to be wrapped by this component.

params : iter of str

Names of variables that are to be visible as parameters to this component. Note that these are allowed to be unknowns in the sub-problem.

unknowns : iter of str

Names of variables that are to be visible as unknowns in this component.

add_output(name, **kwargs)[source]
add_param(name, **kwargs)[source]
add_state(name, **kwargs)[source]
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.

cleanup()[source]

Clean up resources prior to exit.

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.

linearize(params, unknowns, resids)[source]

Returns Jacobian. J is a dictionary whose keys are tuples of the form (‘unknown’, ‘param’) and whose values are ndarrays.

Args:

params : VecWrapper

VecWrapper containing parameters. (p)

unknowns : VecWrapper

VecWrapper containing outputs and states. (u)

resids : VecWrapper

VecWrapper containing residuals. (r)

Returns:

dict

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

solve_nonlinear(params, unknowns, resids)[source]

Sets params into the sub-problem, runs the sub-problem, and updates our unknowns with values from the sub-problem.

Args:

params : VecWrapper

VecWrapper containing parameters. (p)

unknowns : VecWrapper

VecWrapper containing outputs and states. (u)

resids : VecWrapper

VecWrapper containing residuals. (r)