changed rootfinders to return also when absolute tolerance is less than prescribed, not only when function value is less than tolerance.

This commit is contained in:
hnil 2020-05-10 22:32:01 +02:00
parent 55620ac254
commit ded8ef1a66

View File

@ -124,7 +124,7 @@ namespace Opm
iterations_used = 0;
// In every iteraton, x1 is the last point computed,
// and x0 is the last point computed that makes it a bracket.
while (fabs(x1 - x0) >= 1e-9*eps) {
while (fabs(x1 - x0) >= eps) {
double xnew = regulaFalsiStep(x0, x1, f0, f1);
double fnew = f(xnew);
// cout << "xnew = " << xnew << " fnew = " << fnew << endl;
@ -221,7 +221,7 @@ namespace Opm
iterations_used = 0;
// In every iteraton, x1 is the last point computed,
// and x0 is the last point computed that makes it a bracket.
while (fabs(x1 - x0) >= 1e-9*eps) {
while (fabs(x1 - x0) >= eps) {
double xnew = regulaFalsiStep(x0, x1, f0, f1);
double fnew = f(xnew);
// cout << "xnew = " << xnew << " fnew = " << fnew << endl;