user_defined.py#

Define the LinearUserDefined class.

class openmdao.solvers.linear.user_defined.LinearUserDefined(solve_function=None, **kwargs)[source]

Bases: LinearSolver

LinearUserDefined solver.

This is a solver that wraps a user-written linear solve function.

Parameters:
solve_functionfunction

Custom function containing the solve_linear function. The default is None, which means the name defaults to “solve_linear”.

**kwargsdict

Options dictionary.

Attributes:
solve_functionfunction

Custom function containing the solve_linear function. The default is None, which means the name defaults to “solve_linear”.

SOLVER = 'LN: USER'
__init__(solve_function=None, **kwargs)[source]

Initialize all attributes.

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.

does_recursive_applies()

Return False.

By default, assume linear solvers don’t do recursive apply_linear calls.

Returns:
bool

True if solver makes recursive apply_linear calls on its subsystems.

get_reports_dir()

Get the path to the directory where the report files should go.

If it doesn’t exist, it will be created.

Returns:
str

The path to the directory where reports should be written.

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

report_failure(msg)

Report a failure that has occurred.

The msg may be printed or ignored depending on the iprint option, and may raise an AnalysisError depending on the err_on_non_converge option.

Parameters:
msgstr

Message indicating the failure.

solve(mode, rel_systems=None)[source]

Solve the linear system for the problem in self._system().

The full solution vector is returned.

Parameters:
modestr

Derivative mode, can be ‘fwd’ or ‘rev’.

rel_systemsset of str

Set of names of relevant systems based on the current linear solve. Deprecated.

use_relevance()

Return True if relevance should be active.

Returns:
bool

True if relevance should be active.