version 3.10.0
Loading...
Searching...
No Matches

Nonlinear solvers and helpers. More...

Description

Topics

 Newton solver
 The Newton solver and the related parameters. This describes the reference implementation Dumux::NewtonSolver.
 

Files

file  findscalarroot.hh
 Root finding algorithms for scalar functions.
 
file  leastsquares.hh
 Levenberg-Marquardt algorithm for solving nonlinear least squares problems.
 
file  primaryvariableswitchadapter.hh
 An adapter for the Newton to manage models with primary variable switch.
 

Classes

class  Dumux::Optimization::Detail::LevenbergMarquardt< Assembler, LinearSolver >
 A nonlinear least squares solver with \(n\) model parameters and \(m\) observations. More...
 
class  Dumux::PrimaryVariableSwitchAdapter< Variables, isValid >
 An adapter for the Newton to manage models with primary variable switch. More...
 
class  Dumux::PrimaryVariableSwitchAdapter< Variables, false >
 An empty adapter for the Newton for models without primary variable switch. More...
 

Functions

template<class Scalar, class ResFunc, class DerivFunc, typename std::enable_if_t< std::is_invocable_r_v< Scalar, ResFunc, Scalar > &&std::is_invocable_r_v< Scalar, DerivFunc, Scalar > > ...>
Scalar Dumux::findScalarRootNewton (Scalar xOld, const ResFunc &residual, const DerivFunc &derivative, const Scalar tol=1e-13, const int maxIter=200)
 Newton's root finding algorithm for scalar functions (secant method)
 
template<class Scalar, class ResFunc, typename std::enable_if_t< std::is_invocable_r_v< Scalar, ResFunc, Scalar > > ...>
Scalar Dumux::findScalarRootNewton (Scalar xOld, const ResFunc &residual, const Scalar tol=1e-13, const int maxIter=200)
 Newton's root finding algorithm for scalar functions (secant method)
 
template<class Scalar, class ResFunc, typename std::enable_if_t< std::is_invocable_r_v< Scalar, ResFunc, Scalar > > ...>
Scalar Dumux::findScalarRootBrent (Scalar a, Scalar b, const ResFunc &residual, const Scalar tol=1e-13, const int maxIter=200)
 Brent's root finding algorithm for scalar functions.
 

Variables

template<class Variables>
constexpr bool Dumux::hasPriVarsSwitch = Dune::Std::is_detected<Detail::DetectPVSwitch, Variables>()
 Helper boolean to check if the given variables involve primary variable switching.
 

Function Documentation

◆ findScalarRootBrent()

template<class Scalar, class ResFunc, typename std::enable_if_t< std::is_invocable_r_v< Scalar, ResFunc, Scalar > > ...>
Scalar Dumux::findScalarRootBrent ( Scalar a,
Scalar b,
const ResFunc & residual,
const Scalar tol = 1e-13,
const int maxIter = 200 )
Note
Modified from pseudo-code on wikipedia: https://en.wikipedia.org/wiki/Brent%27s_method
See also R.P. Brent "An algorithm with guaranteed convergence for finding a zero of a function", The Computer Journal (1971).
This is usually more robust than Newton's method
Parameters
aLower bound
bUpper bound
residualResidual function
tolRelative shift tolerance
maxIterMaximum number of iterations

◆ findScalarRootNewton() [1/2]

template<class Scalar, class ResFunc, class DerivFunc, typename std::enable_if_t< std::is_invocable_r_v< Scalar, ResFunc, Scalar > &&std::is_invocable_r_v< Scalar, DerivFunc, Scalar > > ...>
Scalar Dumux::findScalarRootNewton ( Scalar xOld,
const ResFunc & residual,
const DerivFunc & derivative,
const Scalar tol = 1e-13,
const int maxIter = 200 )
Parameters
xOldinitial guess
residualResidual function
derivativeDerivative of the residual
tolRelative shift tolerance
maxIterMaximum number of iterations

◆ findScalarRootNewton() [2/2]

template<class Scalar, class ResFunc, typename std::enable_if_t< std::is_invocable_r_v< Scalar, ResFunc, Scalar > > ...>
Scalar Dumux::findScalarRootNewton ( Scalar xOld,
const ResFunc & residual,
const Scalar tol = 1e-13,
const int maxIter = 200 )
Note
The derivative is numerically computed. If the derivative is know use signature with derivative function.
Parameters
xOldinitial guess
residualResidual function
tolRelative shift tolerance
maxIterMaximum number of iterations

Variable Documentation

◆ hasPriVarsSwitch

template<class Variables>
bool Dumux::hasPriVarsSwitch = Dune::Std::is_detected<Detail::DetectPVSwitch, Variables>()
inlineconstexpr