---
name: "newton"
section: "3rheolef"
platform: "linux"
package: "librheolef-dev"
version: "7.2-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/newton"
---

# newton(3rheolef)

nonlinear solver (rheolef-7.2)

## NAME

newton - nonlinear solver (rheolef-7.2)

## SYNOPSIS

```
template <class Problem, class Field>
int newton (const Problem& P, Field& uh, Float& tol, size_t& max_iter, odiststream *p_derr = 0)
```

## DESCRIPTION

This function implements a generic Newton method for the resolution of the following problem:

```
    F(u) = 0
```

 A simple call to the algorithm writes:

```
    my_problem P;
    field uh (Xh);
    newton (P, uh, tol, max_iter);
```

 The `my_problem` class should contain some methods for the evaluation of F, i.e. the `residue` of the problem, and its derivative. The minimal requirements are:

```
    class my_problem {
    public:
      typedef value_type;
      value_type residue           (const value_type& uh)  const;
      void update_derivative       (const value_type& uh)  const;
      value_type  derivative_solve (const value_type& mrh) const;
      Float dual_space_norm        (const value_type& mrh) const;
    };
```

 The `value_type` could be a **field(2)**. The Newton method could also be applied when `value_type` is a simple `Float` scalar. Conversely, it supports multi-field extensions.

The `update_derivative` and `derivative_solver` members are called at each step of the Newton algorithm.

The `dual_space_norm` member function returns a scalar from the weighted residual field term `mrh` returned by the `residue` function: this scalar is used as the stopping criterion of the algorithm.

## EXAMPLE

See the **p\_laplacian\_newton.cc** example and the **usersguide** for more.

## IMPLEMENTATION

This documentation has been generated from file main/lib/newton.h

## AUTHOR

Pierre  Saramito  \<Pierre.Saramito@imag.fr\>

## COPYRIGHT

Copyright   (C)  2000-2018  Pierre  Saramito  \<Pierre.Saramito@imag.fr\> GPLv3+: GNU GPL version 3 or later  \<http://gnu.org/licenses/gpl.html\>. This  is  free  software:  you  are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
