dcbsol Function

private pure function dcbsol(a, b, c) result(x)

Solution to a*x**3 + 3*b*x - 2c = 0, where a and b**3 + a*c**2 are both non-negative (zero generated, in lieu of infinity, if a = b = 0)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: a
real(kind=wp), intent(in) :: b
real(kind=wp), intent(in) :: c

Return Value real(kind=wp)


Calls

proc~~dcbsol~~CallsGraph proc~dcbsol gooding_module::dcbsol proc~dcubrt gooding_module::dcubrt proc~dcbsol->proc~dcubrt

Called by

proc~~dcbsol~~CalledByGraph proc~dcbsol gooding_module::dcbsol proc~ekepl gooding_module::ekepl proc~ekepl->proc~dcbsol proc~els2pv gooding_module::els2pv proc~els2pv->proc~dcbsol proc~els2pv->proc~ekepl proc~els3pv gooding_module::els3pv proc~els3pv->proc~els2pv proc~propagate gooding_module::propagate proc~propagate->proc~els3pv

Source Code

    pure function dcbsol (a, b, c) result(x)

    implicit none

    real(wp)               :: x
    real(wp),intent(in)    :: a
    real(wp),intent(in)    :: b
    real(wp),intent(in)    :: c

    real(wp) :: bsq,d

    if (a==zero .and. b==zero .or. c==zero) then
        x = zero
    else
        bsq = b*b
        d = sqrt(a) * abs(c)
        d = dcubrt(d + sqrt(b*bsq + d*d))**2
        x = two * c / (d + b + bsq / d)
    end if

    end function dcbsol