Sets up the pitch angle grid and associated data. Does so by calling other routines. A summary of the actions is below.
Determines the location of lambda (al) grid points in the passing domain and associated integrations weights. Also determines the integration weights for the trapped pitch angle grid (the location of trapped al is already determined through the values of bset).
Alongside determining the passing locations and the lambda integration weights we also set forbid, jend and call xigridset to setup the grid and associated quantities.
subroutine lgridset
use theta_grid, only: eps_trapped
implicit none
logical :: has_trapped_points
! Decide if we need to calculate the trapped lambda integration weights
has_trapped_points = trapped_particles .and. eps_trapped > epsilon(0.0)
! Intialise the weights to zero
wl = 0.0
! Calculate the passing lambda grid location and integration weights
call setup_passing_lambda_grids(al, wl)
! Calculate the trapped lambda grid integration weights
if (has_trapped_points) call setup_trapped_lambda_grids(al, wl)
! Calculate the forbid flag indicating which pitch angles are allowed at
! various points.
call calculate_forbidden_region(forbid)
! Calculate the is_bounce_point flag indicating which pitch angles are allowed at
! various points.
call calculate_bounce_points(is_bounce_point)
! Calculate the jend values indicating the pitch angle which bounces at
! each theta point.
call calculate_jend(jend)
! Calculate the ittp values indicating which pitch angles are
! considered totally trapped.
call calculate_ittp(can_be_ttp, is_ttp)
! Setup the xi (v||/v) grid used in collisions
call xigridset
end subroutine lgridset