converged Function

private function converged(me, a, b)

Determines convergence in x based on if the reltol or abstol is satisfied.

Type Bound

root_solver

Arguments

Type IntentOptional Attributes Name
class(root_solver), intent(inout) :: me
real(kind=wp), intent(in) :: a

old value

real(kind=wp), intent(in) :: b

new value

Return Value logical


Called by

proc~~converged~~CalledByGraph proc~converged root_module::root_solver%converged proc~anderson_bjorck root_module::anderson_bjorck_solver%anderson_bjorck proc~anderson_bjorck->proc~converged proc~anderson_bjorck_king root_module::anderson_bjorck_king_solver%anderson_bjorck_king proc~anderson_bjorck_king->proc~converged proc~barycentric root_module::barycentric_solver%barycentric proc~barycentric->proc~converged proc~bdqrf root_module::bdqrf_solver%bdqrf proc~bdqrf->proc~converged proc~bisection root_module::bisection_solver%bisection proc~bisection->proc~converged proc~blendtf root_module::blendtf_solver%blendtf proc~blendtf->proc~converged proc~illinois root_module::illinois_solver%illinois proc~illinois->proc~converged proc~itp root_module::itp_solver%itp proc~itp->proc~converged proc~muller root_module::muller_solver%muller proc~muller->proc~converged proc~pegasus root_module::pegasus_solver%pegasus proc~pegasus->proc~converged proc~regula_falsi root_module::regula_falsi_solver%regula_falsi proc~regula_falsi->proc~converged proc~ridders root_module::ridders_solver%ridders proc~ridders->proc~converged proc~zhang root_module::zhang_solver%zhang proc~zhang->proc~converged

Source Code

    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