Skip to content

Commit

Permalink
Merge 7c2082a into c85ac17
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth-T-Moore committed Sep 6, 2017
2 parents c85ac17 + 7c2082a commit f2e6574
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,30 @@ This is a solver that let's you define custom method for performing a linear sol
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.

The function needs to have the following signature:

.. code-block:: python
def my_solve_function(d_outputs, d_residuals, mode):
r"""
Apply inverse jac product. The model is assumed to be in an unscaled state.
Parameters
----------
d_outputs : Vector
unscaled, dimensional quantities read via d_outputs[key]
d_residuals : Vector
unscaled, dimensional quantities read via d_residuals[key]
mode : str
either 'fwd' or 'rev'
Returns
-------
None or bool or (bool, float, float)
The bool is the failure flag; and the two floats are absolute and relative error.
"""
Here is a rather contrived example where an identity preconditioner is used by giving the component's "mysolve"
method to a LinearUserDefined solver.

Expand Down
3 changes: 2 additions & 1 deletion openmdao/solvers/linear/user_defined.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def __init__(self, solve_function=None, **kwargs):
Parameters
----------
solve_function : function
Custom function containing the solve_linear function.
Custom function containing the solve_linear function. The default is None, which means
the name defaults to "solve_linear".
**kwargs : dict
Options dictionary.
"""
Expand Down

0 comments on commit f2e6574

Please sign in to comment.