Class RootFinder
Defined in File RootFinder.H
Inheritance Relationships
Base Type
public refCount
Derived Types
public BisectionRootFinder(Class BisectionRootFinder)public NewtonRootFinder(Class NewtonRootFinder)public TOMS748RootFinder(Class TOMS748RootFinder)
Class Documentation
-
class RootFinder : public refCount
Base abstract class for finding roots of non-linear algebraic equations.
In the context of wall modelling the latter are provided by laws of the wall. The root finders are therefore used in conjunction with the LOTW wall model.
User dictionaries select the algorithm and can set
maxIter. The convergence tolerance is not user configurable. The current Newton, TOMS748 and Bisection implementations use the same internal binary digit target, corresponding to approximately single-precision relative accuracy in the root estimate.Contributors/Copyright: 2016-2026 Timofey Mukha 2017 Saleh Rezaeiravesh
Subclassed by BisectionRootFinder, NewtonRootFinder, TOMS748RootFinder
Public Functions
-
inline RootFinder(const word &rootFinderName, std::function<scalar(scalar)> f, std::function<scalar(scalar)> d, const label maxIter)
-
inline RootFinder(std::function<scalar(scalar)> f, std::function<scalar(scalar)> d, const dictionary &dict)
-
inline RootFinder(const dictionary &dict)
-
inline RootFinder(const RootFinder &orig)
-
virtual autoPtr<RootFinder> clone() const = 0
Clone the object.
-
inline virtual ~RootFinder()
Destructor.
-
virtual std::pair<scalar, label> root(scalar, scalar, scalar) const = 0
Return root and iteration count.
-
inline void setFunction(std::function<scalar(scalar)> f)
Set the implicit function defining the equation.
-
inline virtual void setDerivative(std::function<scalar(scalar)> d)
Set the implicit function defining the derivative.
-
inline label maxIter() const
Return maxIter_.
-
inline std::function<scalar(scalar)> f() const
Return the function f_.
-
inline std::function<scalar(scalar)> d() const
Return the function d_.
-
inline scalar f(scalar v) const
Compute the value of f.
-
inline scalar d(scalar v) const
Compute the value of d.
-
virtual void write(Foam::Ostream &os) const
Public Static Functions
-
static autoPtr<RootFinder> New(const word &rootFinderName, std::function<scalar(scalar)> f, std::function<scalar(scalar)> d, const label maxIter)
-
static autoPtr<RootFinder> New(std::function<scalar(scalar)> f, std::function<scalar(scalar)> d, const dictionary &dict)
-
static autoPtr<RootFinder> New(const dictionary &dict)
Protected Attributes
-
std::function<scalar(scalar)> f_ =
[](scalar i) { return 0; } Function defining the equation to be solved.
-
std::function<scalar(scalar)> d_ =
[](scalar i) { return 0; } Function defining the derivative of the equation to be solved.
-
const label maxIter_
Maximum number of iterations.
-
inline RootFinder(const word &rootFinderName, std::function<scalar(scalar)> f, std::function<scalar(scalar)> d, const label maxIter)