approximation_scheme.py

Base class used to define the interface for derivative approximation schemes.

class openmdao.approximation_schemes.approximation_scheme.ApproximationScheme[source]

Bases: object

Base class used to define the interface for derivative approximation schemes.

Attributes
_approx_groupslist

A list of approximation tuples ordered into groups of ‘of’s matching the same ‘wrt’.

_colored_approx_groups: list

A list containing info for all colored approximation groups.

_approx_groups_cached_under_csbool

Flag indicates whether approx_groups was generated under complex step from higher in the model hieararchy.

_wrt_metadict

A dict that maps wrt name to its fd/cs metadata.

_progress_outNone or file-like object

Attribute to output the progress of check_totals

_during_sparsity_compbool

If True, we’re doing a sparsity computation and uncolored approxs need to be restricted to only colored columns.

_jac_scattertuple

Data needed to scatter values from results array to a total jacobian column.

__init__()[source]

Initialize the ApproximationScheme.

add_approximation(abs_key, system, 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.

systemSystem

Containing System.

kwargsdict

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

compute_approximations(system, jac=None)[source]

Execute the system to compute the approximate sub-Jacobians.

Parameters
systemSystem

System on which the execution is run.

jacNone or dict-like

If None, update system with the approximated sub-Jacobians. Otherwise, store the approximations in the given dict-like object.