finite_difference.py¶
Finite difference derivative approximations.

class
openmdao.approximation_schemes.finite_difference.
FDForm
(deltas, coeffs, current_coeff)¶ Bases:
tuple

__contains__
(self, key, /)¶ Return key in self.

__getitem__
(self, key, /)¶ Return self[key].

__init__
(self, /, *args, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.

__iter__
(self, /)¶ Implement iter(self).

coeffs
¶ Alias for field number 1

count
()¶

current_coeff
¶ Alias for field number 2

deltas
¶ Alias for field number 0

index
()¶ Raises ValueError if the value is not present.


class
openmdao.approximation_schemes.finite_difference.
FiniteDifference
[source]¶ Bases:
openmdao.approximation_schemes.approximation_scheme.ApproximationScheme
Approximation scheme using finite differences to estimate derivatives.
For example, using the ‘forward’ form with a step size of ‘h’ will approximate the derivative in the following way:
\[f'(x) = \frac{f(x+h)  f(x)}{h} + O(h).\]
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 subclasses.

compute_approximations
(self, system, jac=None, total=False)[source]¶ Execute the system to compute the approximate subJacobians.
 Parameters
 systemSystem
System on which the execution is run.
 jacNone or dictlike
If None, update system with the approximated subJacobians. Otherwise, store the approximations in the given dictlike object.
 totalbool
If True total derivatives are being approximated, else partials.
