allocate arrays and initialize to zero dvpe * vpe = d(2muB0) * B/2B0 first get equally spaced grid in mu with max value mu_max = vperp_max2/(2max(bmag)) want first grid point at dmu/2 to avoid mu=0 special point dmu/2 + (nmu-1)dmu = mu_max so dmu = mu_max/(nmu-1/2) do simplest thing to start leave dmu(nmu) uninitialized. should never be used, so want valgrind or similar to return error if it is
maxwell_mu is the mu part of the v-space Maxwellian
factor of 2. necessary to account for 2pi from integration over gyro-angle and 1/pi^(3/2) normalization of velocity space Jacobian
if maxwellian_normalization, the evolved pdf is normalized by a Maxwwellian; in this case, the velocity integration must account for the Maxwellian.
add ghost cell at mu=0 and beyond mu_max for purposes of differentiation note assuming here that grid spacing for ghost cell is equal to grid spacing for last non-ghost cell this is mu at cell centres (including to left and right of mu grid boundary points) this is mu_{j+1/2} - mu_{j-1/2}