Determine which lambda grid points are forbidden at each theta/bmag value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(out), | dimension(-ntgrid:, :) | :: | forbid |
subroutine calculate_forbidden_region(forbid)
use theta_grid, only: ntgrid, bmag
use mp, only: mp_abort
implicit none
logical, dimension(-ntgrid:, :), intent(out) :: forbid
integer :: ig, il
forbid = .false.
! Set the forbid flag
do il = 1, nlambda
do ig = -ntgrid, ntgrid
forbid(ig,il) = 1.0 - al(il)*bmag(ig) < -bouncefuzz
end do
end do
! Check that none of our supposedly passing particles are forbidden
! at any point in our domain
do il = 1, ng2
if ( any(forbid(:,il)) ) then
call mp_abort("Fatal error: supposedly passing particle was trapped, in calculate_forbidden_region, in le_grids.f90", .true.)
end if
end do
end subroutine calculate_forbidden_region