direct.py#
LinearSolver that uses linalg.solve or LU factor/solve.
- class openmdao.solvers.linear.direct.DirectSolver(**kwargs)[source]
Bases:
LinearSolverLinearSolver that uses linalg.solve or LU factor/solve.
- Parameters:
- **kwargsdict
Options dictionary.
- Attributes:
- _lin_rhs_checkerLinearRHSChecker or None
Object for checking the right-hand side of the linear solve.
Methods
add_recorder(recorder)Add a recorder to the solver's RecordingManager.
can_solve_cycle()Return True if this solver can solve groups with cycles.
check_config(logger)Perform optional error checks.
cleanup()Clean up resources prior to exit.
does_recursive_applies()Return False.
get_outputs_dir(*subdirs[, mkdir])Get the path under which all output files of this solver are to be placed.
get_reports_dir()Get the path to the directory where the report files should go.
preferred_sparse_format()Return the preferred sparse format for the dr/do matrix of a split jacobian.
record_iteration(**kwargs)Record an iteration of the current Solver.
report_failure(msg)Report a failure that has occurred.
solve(mode[, rel_systems])Run the solver.
use_relevance()Return True if relevance should be active.
- SOLVER = 'LN: Direct'
- __init__(**kwargs)[source]
Declare the solver options.
- can_solve_cycle()[source]
Return True if this solver can solve groups with cycles.
- Returns:
- bool
True if this solver can solve groups with cycles.
- check_config(logger)[source]
Perform optional error checks.
- Parameters:
- loggerobject
The object that manages logging output.
- preferred_sparse_format()[source]
Return the preferred sparse format for the dr/do matrix of a split jacobian.
- Returns:
- str
The preferred sparse format for the dr/do matrix of a split jacobian.
- solve(mode, rel_systems=None)[source]
Run the solver.
- Parameters:
- modestr
‘fwd’ or ‘rev’.
- rel_systemsset of str
Names of systems relevant to the current solve. Deprecated.
- use_relevance()[source]
Return True if relevance should be active.
- Returns:
- bool
True if relevance should be active.
- 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.