external_code.py

class openmdao.components.external_code.ExternalCode[source]

Bases: openmdao.core.component.Component

Run an external code as a component

Default stdin is the ‘null’ device, default stdout is the console, and default stderr is error.out.

Options:

deriv_options[‘type’] : str(‘user’)

Derivative calculation type (‘user’, ‘fd’, ‘cs’) Default is ‘user’, where derivative is calculated from user-supplied derivatives. Set to ‘fd’ to finite difference this system. Set to ‘cs’ to perform the complex step if your components support it.

deriv_options[‘form’] : str(‘forward’)

Finite difference mode. (forward, backward, central)

deriv_options[‘step_size’] : float(1e-06)

Default finite difference stepsize

deriv_options[‘step_calc’] : str(‘absolute’)

Set to absolute, relative

deriv_options[‘check_type’] : str(‘fd’)

Type of derivative check for check_partial_derivatives. Set to ‘fd’ to finite difference this system. Set to ‘cs’ to perform the complex step method if your components support it.

deriv_options[‘check_form’] : str(‘forward’)

Finite difference mode: (“forward”, “backward”, “central”) During check_partial_derivatives, the difference form that is used for the check.

deriv_options[‘check_step_calc’] : str(‘absolute’,)

Set to ‘absolute’ or ‘relative’. Default finite difference step calculation for the finite difference check in check_partial_derivatives.

deriv_options[‘check_step_size’] : float(1e-06)

Default finite difference stepsize for the finite difference check in check_partial_derivatives”

deriv_options[‘linearize’] : bool(False)

Set to True if you want linearize to be called even though you are using FD.

options[‘command’] : list([])

Command to be executed. Command must be a list of command line args.

options[‘env_vars’] : dict({})

Environment variables required by the command

options[‘external_input_files’] : list([])

(optional) list of input file names to check the existence of before solve_nonlinear

options[‘external_output_files’] : list([])

(optional) list of input file names to check the existence of after solve_nonlinear

options[‘poll_delay’] : float(0.0)

Delay between polling for command completion. A value of zero will use an internally computed default.

options[‘timeout’] : float(0.0)

Maximum time in seconds to wait for command completion. A value of zero implies an infinite wait. If the timeout interval is exceeded, an AnalysisError will be raised.

options[‘fail_hard’] : bool(True)

Behavior on error returned from code, either raise a ‘hard’ error (RuntimeError) if True or a ‘soft’ error (AnalysisError) if False.

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

Args:out_stream : a file-like object, optional
solve_nonlinear(params, unknowns, resids)[source]

Runs the component