calculate_bounce_points Subroutine

private subroutine calculate_bounce_points(bounce_points)

Uses

Determine which theta grid points correspond to bounce points for each pitch angle.

For regular trapped particles we could determine this from forbid, as we do in other parts of the code, however we prefer a forbid independent method to allow for generalisation to wfb and wfb-like particles.

Arguments

Type IntentOptional Attributes Name
logical, intent(out), dimension(-ntgrid:, :) :: bounce_points

Contents


Source Code

  subroutine calculate_bounce_points(bounce_points)
    use theta_grid, only: ntgrid, bmag
    use mp, only: mp_abort
    implicit none
    logical, dimension(-ntgrid:, :), intent(out) :: bounce_points
    integer :: ig, il
    integer :: il_llim

    bounce_points = .false.

    ! We could set the lower lambda grid index which we consider here
    ! in order to either include or exclude the wfb if we allow it to
    ! bounce. For now we will not allow for wfb bounce points, leaving these
    ! to be handled by special code elsewhere.
    il_llim = ng2 + 2

    do il = il_llim, nlambda
       do ig = -ntgrid, ntgrid
          ! Note, this imposes a requirement that our pitch angle and
          ! magnetic field grids are calculated consisently to within bouncefuzz.
          ! In other words we require lambda*bmag = 1 to within bouncefuzz.
          bounce_points(ig,il) = abs(1.0 - al(il)*bmag(ig)) <= bouncefuzz
       end do
    end do

  end subroutine calculate_bounce_points