rschw Function

public function rschw(z, mass)

Function to invert the tortoise radius as a function of Schwarzschild radius.

Simple Newton root finding algorithm. Have problems converging for negative rstar as it overshoots and rschw-2M can become negative.

Arguments

Type IntentOptional AttributesName
real(kind=wp), intent(in) :: z

The tortoise radius to invert, .

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

The mass of the black hole, .

Return Value real(kind=wp)

The return value is .


Calls

proc~~rschw~~CallsGraph proc~rschw rschw interface~eps eps proc~rschw->interface~eps proc~eps_prec_s eps_prec_s interface~eps->proc~eps_prec_s proc~eps_prec_q eps_prec_q interface~eps->proc~eps_prec_q proc~eps_prec_d eps_prec_d interface~eps->proc~eps_prec_d

Called by

proc~~rschw~~CalledByGraph proc~rschw rschw proc~invert_tortoise invert_tortoise proc~invert_tortoise->proc~rschw proc~tdc_set_coefficients tdc_set_coefficients proc~tdc_set_coefficients->proc~invert_tortoise proc~scal_schw_init scal_schw_init proc~scal_schw_init->proc~invert_tortoise proc~output_coords output_coords proc~output_coords->proc~invert_tortoise interface~output_coords output_coords interface~output_coords->proc~output_coords interface~scal_schw_init scal_schw_init interface~scal_schw_init->proc~scal_schw_init interface~tdc_set_coefficients tdc_set_coefficients interface~tdc_set_coefficients->proc~tdc_set_coefficients

Contents

Source Code


Source Code

  function rschw( z, mass )
  !! Function to invert the tortoise radius as a function of Schwarzschild
  !! radius.
  !!
  !! Simple Newton root finding algorithm. Have problems converging for
  !! negative rstar as it overshoots and rschw-2M can become negative.

    implicit none

    real(wp), intent(in) :: z
    !! The tortoise radius to invert, \(z\).
    real(wp), intent(in) :: mass
    !! The mass of the black hole, \(M\).
    real(wp) :: rschw
    !! The return value is \(r_{\mathrm{schw}}(z)-2M\).
    real(wp) :: xcurrent, xnew
    integer(ip) :: iter
!   real(wp), parameter :: eps = 1.0e-12_wp

    iter = 0
    xcurrent = 1.0_wp

    loop: do
      iter = iter+1
      xnew = (z - 2.0_wp*mass*log(0.5_wp*xcurrent/mass)) &
             /(1+2.0_wp*mass/xcurrent)
      if ( abs ( xnew - xcurrent) < eps(1.0_wp) ) exit loop
      if (iter>maxiter) stop 'Function rschw failed to converge. Aborting'
      xcurrent = xnew
    end do loop
    rschw = xnew
  end function rschw