Determines convergence in x based on if the reltol or abstol is satisfied.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(root_solver), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in) | :: | a |
old value |
||
real(kind=wp), | intent(in) | :: | b |
new value |
function converged(me,a,b) implicit none class(root_solver),intent(inout) :: me real(wp),intent(in) :: a !! old value real(wp),intent(in) :: b !! new value logical :: converged real(wp) :: d ! original way: ! converged = (abs(b-a) <= abs(b)*me%rtol + me%atol) exit d = abs(b-a) if (d <= me%atol) then ! absolute converged = .true. else ! relative if (a /= 0.0_wp) then converged = d / abs(a) <= me%rtol else converged = .false. end if end if end function converged