ln_direct.py

OpenMDAO LinearSolver that explicitly solves the linear system using linalg.solve or scipy LU factor/solve. Inherits from MultLinearSolver just for the mult function.

class openmdao.solvers.ln_direct.DirectSolver[source]

Bases: openmdao.solvers.solver_base.MultLinearSolver

OpenMDAO LinearSolver that explicitly solves the linear system using linalg.solve. The user can choose to have the jacobian assembled directly or through matrix-vector product.

Options:

options[‘iprint’] : int(0)

Set to 0 to print only failures, set to 1 to print iteration totals to stdout, set to 2 to print the residual each iteration to stdout, or -1 to suppress all printing.

options[‘mode’] : str(‘auto’)

Derivative calculation mode, set to ‘fwd’ for forward mode, ‘rev’ for reverse mode, or ‘auto’ to let OpenMDAO determine the best mode.

options[‘jacobian_method’] : str(‘MVP’)

Method to assemble the jacobian to solve. Select ‘MVP’ to build the Jacobian by calling apply_linear with columns of identity. Select ‘assemble’ to build the Jacobian by taking the calculated Jacobians in each component and placing them directly into a clean identity matrix.

options[‘solve_method’] : str(‘LU’)

Solution method, either ‘solve’ for linalg.solve, or ‘LU’ for linalg.lu_factor and linalg.lu_solve.

setup(system)[source]

Initialization. Allocate Jacobian and set up some helpers.

Args:

system: `System`

System that owns this solver.

solve(rhs_mat, system, mode)[source]

Solves the linear system for the problem in self.system. The full solution vector is returned.

Args:

rhs_mat : dict of ndarray

Dictionary containing one ndarry per top level quantity of interest. Each array contains the right-hand side for the linear solve.

system : System

Parent System object.

mode : string

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

Returns:

dict of ndarray : Solution vectors