Determines the lambda grid point integration weights in the trapped domain using either new or old (default) methods, determined by [[le_grids_knobs::new_trap_int]] with new=high-order interp, old=finite difference).
Here we overwrite/replace any previously calculated weights
for points considered trapped. This is usually ok as we have a clear
separation between passing and trapped so the trapped weights are
zero on entry to this routine. In some situations, however, we
may consider some points as both passing and trapped and run the
risk of discarding any existing passing weights for such points.
This could potentially be the case with Radau-like grids, for example
(although likely isn't an issue currently as the routine here does not
calculate a weight for the wfb when bmag = bmax). A simple fix is to
replace weights =
with effectively weights +=
in this routine and
those it calls.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in), | dimension(:) | :: | lambda_grid |
The lambda grid points. |
|
real, | intent(inout), | dimension(-ntgrid:, :) | :: | weights |
The integration weights for the lambda grid. Note this is
intent |
subroutine setup_trapped_lambda_grids(lambda_grid, weights)
use theta_grid, only: ntgrid
implicit none
!> The lambda grid points.
real, dimension(:), intent(in) :: lambda_grid
!> The integration weights for the lambda grid. Note this is
!> intent `in out` as we only set a portion of the grid so may
!> want to keep the rest of the input values.
real, dimension(-ntgrid:, :), intent(in out) :: weights
if (new_trap_int) then
call setup_trapped_lambda_grids_new_trap_int(lambda_grid, weights)
else
call setup_trapped_lambda_grids_old_finite_difference(lambda_grid, weights)
end if
end subroutine setup_trapped_lambda_grids