The Newton solver and the related parameters. This describes the reference implementation Dumux::NewtonSolver. More...
The Newton solver and the related parameters. This describes the reference implementation Dumux::NewtonSolver.
The following describes Newton's method and the reference implementation Dumux::NewtonSolver of a multi-dimensional Newton solver to solve a non-linear system of equations in DuMux. For solving nonlinear equations with only one unknown, DuMux also provides Dumux::findScalarRootNewton and Dumux::findScalarRootBrent.
We assume that the equations (in DuMux usually the discretized partial differential equations) are formulated as a residual equation:
with the residual operator
The goal of Newton's method is to find a vector
Newton's method is an iterative algorithm: it generates a sequence of approximations,
This allows to compute a tangent direction of residual surface in n-dimensional space as
With the tangent direction
This is one Newton step (or iteration). We repeat the steps of calculating the residual and the Jacobian matrix, solve the linear system, and update the approximation until we reach a good enough solution (see below for the available termination criteria).
Assembly.NumericDifference.PriVarMagnitude
and Assembly.NumericDifference.BaseEpsilon
.The Dumux::NewtonSolver reference implementation of Newton's method has several features discussed below that can be controlled by user-set parameters (e.g. via a parameter input file or the command line, see Runtime Parameters).
Here we describe strategies that differ from the default update strategy, that is:
The different strategies can be enabled via runtime parameters as described below.
The idea of line search is to find an optimal scaling factor
such that the residual norm evaluated with the new iterate
The default implementation of Dumux::NewtonSolver uses a simple backtracking line search algorithm to approximately solve the above optimization problem. The algorithm is based on the following steps:
Newton.LineSearchReductionFactor
(default value Newton.LineSearchMinRelaxationFactor
(default value Newton.UseLineSearch = true
.For instance in problems where the residual has multiple roots, it can be beneficial to restrict the search space to a certain region in the parameter space. This can be achieved by a chopped update strategy, where the solution vector is projected back to a feasible region after each Newton step. A chopped update strategy can be enabled by setting Newton.EnableChop = true
. As such strategies are usually problem-dependent, there is no default implementation. The parameter will merely active the hook Dumux::NewtonSolver::choppedUpdate_ which can be overridden in a derived class, see Dumux::RichardsNewtonSolver for an example implementation using this strategy.
Newton.EnableChop = true
. The line search and chopped update are mutually exclusive, i.e. if Newton.UseLineSearch
is set to true, the Newton.EnableChop
parameter will be ignored.Newton's method finds an approximate solution to the residual equation
The default is the relative shift criterion in addition to bounds on the minimum and maximum number of iterations. The solver never terminates if Newton.MinSteps
(default value Newton.MaxSteps
(default value
This criterion is enabled per default. The idea is to terminate the algorithm when the solution vector does not change significantly between iterations. This criterion does not check the actual residual but is useful in practice and fast to compute. We compute the maximum difference of any degree of freedom (entry of the vector
where Newton.MaxRelativeShift
(default value Newton.EnableShiftCriterion = false
. The relative shift criterion can be combined with a residual criterion (see below) by enabling a residual criterion without disabling the shift criterion. By default the Newton solver terminates when either of the criteria are fulfilled. If you want to require both criteria to be fulfilled, you can do so by setting Newton.SatisfyResidualAndShiftCriterion = true
.
This criterion is disabled by default. It can be enabled by setting Newton.EnableResidualCriterion = true
. The idea is to terminate the algorithm when the norm of the residual vector is small in comparison to the initial residual norm. The relative residual norm criterion checks if
where Newton.ResidualReduction
(default value
This criterion is disabled by default. The idea is to terminate the algorithm when norm of the residual vector is small enough in comparison with a given absolute threshold. This requires knowledge about the problem because the magnitude of the residual vector has to be estimated. The criterion is enabled by setting Newton.EnableAbsoluteResidualCriterion = true
and Newton.EnableResidualCriterion = true
. It checks if
where Newton.MaxAbsoluteResidual
(default value
The extended interface Dumux::NewtonSolver::solve with time loop in the signature provides an automated adaptive time stepping strategy. The idea is retry the entire algorithm with a lower the time step size if the Newton solver fails to converge. This is repeated until the Newton solver either converges or the maximum number of allowed retry steps is reached.
The factor by which the time step size is reduced after each non-converged try is set by the parameter Newton.RetryTimeStepReductionFactor
(default value Newton.MaxTimeStepDivisions
(default value
Finally, Dumux::NewtonSolver::suggestTimeStepSize suggest a new time-step size based on the current time-step size and the convergence history of the Newton solver. In particular, the implemented heuristic determines how much the time step size is adjusted depends on how far away the Newton is from converging within Newton.TargetSteps
(default value
Technically, when using a finite difference approximation of the Jacobian, we use a so-called quasi-Newton method for which the Jacobian matrix is replaced by an approximation. Another strategy is useful for simulations where the Jacobian matrix is expensive to compute but not all degrees of freedom are expected to change significantly between iterations (for example if changes only happen in parts of the simulation domain).
If supported by the assembler (e.g. Dumux::FVAssembler), the Newton solver can tell the assembler to only recompute those entries of the Jacobian matrix that are associated with primary variables that have changed significantly. This strategy is enabled via the parameter Newton.EnablePartialReassembly
(default value is false
).
The threshold for the partial reassembly is computed can also be controlled via parameters. The threshold
where Newton.ReassemblyMinThreshold
(default value Newton.ReassemblyMaxThreshold
(default value Newton.MaxRelativeShift
) described above.
Switching primary variables during Newton's method is a form of nonlinear preconditioning. We solve an alternative problem with different primary variables where the hope that the root is easier to find. This can be, for instance, because the finite difference approximation of the Jacobian is numerically better conditioned in the new variables. The strategy depends on the problem at hand. For an example, see for instance 2pnc for a model with activated primary variable switch.
Files | |
file | multidomain/newtonconvergencewriter.hh |
This class provides the infrastructure to write the convergence behaviour of the Newton method for multidomain simulations into a VTK file. | |
file | multidomain/newtonsolver.hh |
file | nonlinear/newtonconvergencewriter.hh |
This class provides the infrastructure to write the convergence behaviour of the newton method into a VTK file. | |
file | nonlinear/newtonsolver.hh |
Reference implementation of a Newton solver. | |
file | staggerednewtonconvergencewriter.hh |
This class provides the infrastructure to write the convergence behaviour of the newton method for the staggered discretization scheme into a VTK file. | |
Classes | |
class | Dumux::MultiDomainNewtonConvergenceWriter< MDTraits > |
Writes the intermediate solutions for every Newton iteration. More... | |
class | Dumux::MultiDomainNewtonSolver< Assembler, LinearSolver, CouplingManager, Reassembler, Comm > |
Newton solver for coupled problems. More... | |
struct | Dumux::ConvergenceWriterInterface< SolutionVector, ResidualVector > |
A convergence writer interface Provide an interface that show the minimal requirements a convergence write passed to a newton method has to fulfill. More... | |
class | Dumux::NewtonConvergenceWriter< GridGeometry, SolutionVector, ResidualVector > |
Writes the intermediate solutions for every Newton iteration. More... | |
class | Dumux::NewtonSolver< Assembler, LinearSolver, Reassembler, Comm > |
An implementation of a Newton solver. The comprehensive documentation is in Newton solver, providing more details about the algorithm and the related parameters. More... | |
class | Dumux::StaggeredNewtonConvergenceWriter< GridGeometry, SolutionVector, ResidualVector > |
Writes the intermediate solutions for every Newton iteration (for staggered grid scheme) More... | |