user_defined.py

Define the LinearUserDefined class.

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

Bases: openmdao.solvers.solver.LinearSolver

LinearUserDefined solver.

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

Attributes

solve_function

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

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

Initialize all attributes.

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.

add_recorder(self, recorder)

Add a recorder to the solver’s RecordingManager.

Parameters
recorder<CaseRecorder>

A recorder instance to be added to RecManager.

cleanup(self)

Clean up resources prior to exit.

record_iteration(self, **kwargs)

Record an iteration of the current Solver.

Parameters
**kwargsdict

Keyword arguments (used for abs and rel error).

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

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

The full solution vector is returned.

Parameters
vec_nameslist

list of vector names.

modestring

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

rel_systemsset of str

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