Skip to content

Commit

Permalink
Merge 717e458 into 568ecc8
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth-T-Moore committed Aug 24, 2017
2 parents 568ecc8 + 717e458 commit b3a99d7
Show file tree
Hide file tree
Showing 7 changed files with 423 additions and 22 deletions.
1 change: 1 addition & 0 deletions openmdao/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from openmdao.solvers.linear.petsc_ksp import PetscKSP
from openmdao.solvers.linear.linear_runonce import LinearRunOnce
from openmdao.solvers.linear.scipy_iter_solver import ScipyIterativeSolver
from openmdao.solvers.linear.user_defined import LinearUserDefined
from openmdao.solvers.linesearch.backtracking import ArmijoGoldsteinLS
from openmdao.solvers.linesearch.backtracking import BoundsEnforceLS
from openmdao.solvers.nonlinear.nonlinear_block_gs import NonlinearBlockGS
Expand Down
18 changes: 18 additions & 0 deletions openmdao/docs/features/solvers/linear_user_defined.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
:orphan:

.. _lnuserdefined:

Linear Solver: LinearUserDefined
================================

This is a solver that let's you define custom method for performing a linear solve on a component. The default
method is named "solve_linear", but you can give it any name by passing in the function or method handle to
the "solve_function" attribute.

Here is a rather contrived example where an identity preconditioner is used by giving the compoennt's "mysolve"
method to a LinearUserDefined solver.

.. embed-test::
openmdao.solvers.linear.tests.test_user_defined.TestUserDefinedSolver.test_feature

.. tags:: Solver, LinearSolver
1 change: 1 addition & 0 deletions openmdao/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Solvers (nonlinear and linear)
features/solvers/scipy_iter_solver
features/solvers/petsc_ksp
features/solvers/linear_block_jac
features/solvers/linear_user_defined
features/solvers/linesearch_backtracking

Drivers
Expand Down
18 changes: 0 additions & 18 deletions openmdao/solvers/linear/direct.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,10 @@
class DirectSolver(LinearSolver):
"""
LinearSolver that uses linalg.solve or LU factor/solve.
Attributes
----------
_print_name : str ('Direct')
print name.
"""

SOLVER = 'LN: Direct'

def __init__(self, **kwargs):
"""
Declare the solver option.
Parameters
----------
**kwargs : {}
dictionary of options set by the instantiating class/script.
"""
super(DirectSolver, self).__init__(**kwargs)

self._print_name = 'Direct'

def _linearize(self):
"""
Perform factorization.
Expand Down
4 changes: 0 additions & 4 deletions openmdao/solvers/linear/petsc_ksp.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ class PetscKSP(LinearSolver):
----------
precon : Solver
Preconditioner for linear solve. Default is None for no preconditioner.
_print_name : str ('KSP')
print name.
_ksp : dist
dictionary of KSP instances (keyed on vector name).
"""
Expand All @@ -196,8 +194,6 @@ def __init__(self, **kwargs):

super(PetscKSP, self).__init__(**kwargs)

self._print_name = 'KSP'

# initialize dictionary of KSP instances (keyed on vector name)
self._ksp = {}

Expand Down

0 comments on commit b3a99d7

Please sign in to comment.