broyden.py

Define the BroydenSolver class.

Based on implementation in Scipy via OpenMDAO 0.8x with improvements based on NPSS solver.

class openmdao.solvers.nonlinear.broyden.BroydenSolver(**kwargs)[source]

Bases: openmdao.solvers.solver.NonlinearSolver

Broyden solver.

Attributes

delta_fxm (ndarray) Most recent change in residual vector.
delta_xm (ndarray) Most recent change in state vector.
fxm (ndarray) Most recent residual.
Gm (ndarray) Most recent Jacobian matrix.
linear_solver (LinearSolver) Linear solver to use for calculating inverse Jacobian.
linesearch (NonlinearSolver) Line search algorithm. Default is None for no line search.
n (int) Total length of the states being solved.
xm (ndarray) Most recent state.
SOLVER = 'BROYDEN'
__init__(**kwargs)[source]

Initialize all attributes.

Parameters:
**kwargs : dict

options dictionary.

add_recorder(recorder)

Add a recorder to the solver’s RecordingManager.

Parameters:
recorder : <CaseRecorder>

A recorder instance to be added to RecManager.

cleanup()[source]

Clean up resources prior to exit.

get_residuals()[source]

Return a vector containing the values of the residuals specified in options.

Returns:
ndarray

Array containing values of residuals.

get_states()[source]

Return a vector containing the values of the states specified in options.

This is used to get the initial state guesses.

Returns:
ndarray

Array containing values of states.

record_iteration(**kwargs)

Record an iteration of the current Solver.

Parameters:
**kwargs : dict

Keyword arguments (used for abs and rel error).

set_linear_vector(dx)[source]

Copy values from step into the linear vector for backtracking.

Parameters:
dx : ndarray

Full step in the states for this iteration.

set_states(new_val)[source]

Set new values for states specified in options.

Parameters:
new_val : ndarray

New values for states.

solve()

Run the solver.

Returns:
boolean

Failure flag; True if failed to converge, False is successful.

float

absolute error.

float

relative error.