newton.py

Non-linear solver that implements a Newton’s method.

class openmdao.solvers.newton.Newton[source]

Bases: openmdao.solvers.solver_base.NonLinearSolver

A python Newton solver that solves a linear system to determine the next direction to step. Also uses Backtracking as the default line search algorithm, but you can choose a different one by specifying self.line_search. A linear solver can also be specified by assigning it to self.ln_solver to use a different solver than the one in the parent system.

Options:

options[‘alpha’] : float(1.0)

Initial over-relaxation factor.

options[‘atol’] : float(1e-12)

Absolute convergence tolerance on the residual.

options[‘err_on_maxiter’] : bool(False)

If True, raise an AnalysisError if not converged at maxiter.

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[‘maxiter’] : int(20)

Maximum number of iterations.

options[‘rtol’] : float(1e-10)

Relative convergence tolerance on the residual.

options[‘solve_subsystems’] : bool(True)

Set to True to solve subsystems. You may need this for solvers nested under Newton.

options[‘utol’] : float(1e-12)

Convergence tolerance on the change in the unknowns.

print_all_convergence(level=2)[source]

Turns on iprint for this solver and all subsolvers. Override if your solver has subsolvers.

Args:

level : int(2)

iprint level. Set to 2 to print residuals each iteration; set to 1 to print just the iteration totals.

setup(sub)[source]

Initialize sub solvers.

Args:

sub: `System`

System that owns this solver.

solve(driver, params, unknowns, resids, system, metadata)[source]

Solves the system using a Netwon’s Method.

Args:

params : VecWrapper

VecWrapper containing parameters. (p)

unknowns : VecWrapper

VecWrapper containing outputs and states. (u)

resids : VecWrapper

VecWrapper containing residuals. (r)

system : System

Parent System object.

metadata : dict, optional

Dictionary containing execution metadata (e.g. iteration coordinate).