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.

size

(int) Total length of the states being solved.

xm

(ndarray) Most recent state.

SOLVER = 'BROYDEN'
__init__(**kwargs)[source]

Initialize all attributes.

Parameters
**kwargsdict

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.

compute_norm(vec)[source]

Compute norm of the vector.

Under MPI, compute the norm on rank 0, and broadcast it to all other ranks.

Parameters
vecndarray

Array of real or complex values. For MPI on rank 0, should be full dimension of the openmdao vector with duplicate indices removed.

Returns
float

Norm of vec, computed on rank 0 and broadcast to all other ranks.

get_vector(vec)[source]

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

This is the full incoming vec when no states are defined. When under MPI, the values are appopriately gathered without duplicates to rank 0.

Parameters
vec<Vector>

Vector from which to extract state values.

Returns
ndarray

Array containing values of vector at desired states.

property msginfo

Return info to prepend to messages.

Returns
str

Info to prepend to messages.

record_iteration(**kwargs)

Record an iteration of the current Solver.

Parameters
**kwargsdict

Keyword arguments (used for abs and rel error).

set_linear_vector(dx)[source]

Copy values from step into the linear vector for backtracking.

Parameters
dxndarray

Full step in the states for this iteration.

set_states(new_val)[source]

Set new values for states specified in options.

Parameters
new_valndarray

New values for states.

solve()

Run the solver.