complex_step.py

Complex Step derivative approximations.

class openmdao.approximation_schemes.complex_step.ComplexStep[source]

Bases: openmdao.approximation_schemes.approximation_scheme.ApproximationScheme

Approximation scheme using complex step to calculate derivatives.

For example, using a step size of ‘h’ will approximate the derivative in the following way:

\[f'(x) = \Im{\frac{f(x+ih)}{h}}.\]
__init__(self)[source]

Initialize the ApproximationScheme.

add_approximation(self, abs_key, kwargs)[source]

Use this approximation scheme to approximate the derivative d(of)/d(wrt).

Parameters
abs_keytuple(str,str)

Absolute name pairing of (of, wrt) for the derivative.

kwargsdict

Additional keyword arguments, to be interpreted by sub-classes.

compute_approximations(self, system, jac, total=False)[source]

Execute the system to compute the approximate sub-Jacobians.

Parameters
systemSystem

System on which the execution is run.

jacdict-like

Approximations are stored in the given dict-like object.

totalbool

If True total derivatives are being approximated, else partials.