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.

options[‘iprint’] : int(0)

Set to 0 to disable printing, set to 1 to print the residual to stdout each iteration, set to 2 to print subiteration residuals as well.

options[‘maxiter’] : int(20)

Maximum number of iterations.

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

Relative convergence tolerance.

options[‘solve_subsystems’] : bool(True)

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

print_all_convergence()[source]

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

setup(sub)[source]

Initialize sub solvers.

Args:

sub: `System`

System that owns this solver.

solve(params, unknowns, resids, system, metadata=None)[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).