direct.py

LinearSolver that uses linalg.solve or LU factor/solve.

class openmdao.solvers.linear.direct.DirectSolver(**kwargs)[source]

Bases: openmdao.solvers.solver.LinearSolver

LinearSolver that uses linalg.solve or LU factor/solve.

SOLVER = 'LN: Direct'
__init__(**kwargs)

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()

Clean up resources prior to exit.

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).

solve(vec_names, mode, rel_systems=None)[source]

Run the solver.

Parameters
vec_names[str, …]

list of names of the right-hand-side vectors.

modestr

‘fwd’ or ‘rev’.

rel_systemsset of str

Names of systems relevant to the current solve.

openmdao.solvers.linear.direct.format_nan_error(system, matrix)[source]

Format a coherent error message when the matrix contains NaN.

Parameters
system<System>

System containing the Directsolver.

matrixndarray

Matrix of interest.

Returns
str

New error string.

openmdao.solvers.linear.direct.format_singular_error(system, matrix)[source]

Format a coherent error message for any ill-conditioned mmatrix.

Parameters
system<System>

System containing the Directsolver.

matrixndarray

Matrix of interest.

Returns
str

New error string.

openmdao.solvers.linear.direct.index_to_varname(system, loc)[source]

Given a matrix location, return the name of the variable associated with that index.

Parameters
system<System>

System containing the Directsolver.

locint

Index of row or column.

Returns
str

String containing variable absolute name (and promoted name if there is one) and index.

openmdao.solvers.linear.direct.loc_to_error_msg(system, loc_txt, loc)[source]

Given a matrix location, format a coherent error message when matrix is singular.

Parameters
system<System>

System containing the Directsolver.

loc_txtstr

Either ‘row’ or ‘col’.

locint

Index of row or column.

Returns
str

New error string.