solve_gke Subroutine

private subroutine solve_gke(pdf, rhs_ky, restart_time_step, istep)

solve_gke accepts as argument pdf, the guiding centre distribution function in k-space, and returns rhs_ky, the right-hand side of the gyrokinetic equation in k-space; i.e., if dg/dt = r, then rhs_ky = rdt; note that if include_apar = T, then the input pdf is actually gbar = g + (Ze/T)(vpa/c)F0

if full_flux_surface = .true., then initially obtain the RHS of the GKE in alpha-space; will later inverse Fourier transform to get RHS in k_alpha-space rhs_ky will always be needed as the array returned by the subroutine, but intermediate array rhs_y (RHS of gke in alpha-space) only needed for full_flux_surface = .true. rhs is array referred to for both flux tube and full-flux-surface simulations; for full-flux-surface it should point to rhs_y rhs is array referred to for both flux tube and full-flux-surface simulations; for flux tube it should point to rhs_ky start with g in k-space and (ky,kx,z) local obtain fields corresponding to g

obtain the gyro-average of the electrostatic potential phi and store in g_scratch; this can be a particularly costly operation when simulating a full flux surface due to the coupling of different k-alphas inherent in the gyro-average; calculate once here to avoid repeated calculation later TODO-GA : can this be spec up??

default is to continue with same time step size. if estimated CFL condition for nonlinear terms is violated then restart_time_step will be set to .true. calculate and add ExB nonlinearity to RHS of GK eqn do this first, as the CFL condition may require a change in time step and thus recomputation of mirror, wdrift, wstar, and parstream include contribution from the parallel nonlinearity (aka turbulent acceleration)

include contribution from perp flow shear in the parallel component of the toroidal flow

calculate and add mirror term to RHS of GK eqn calculate and add alpha-component of magnetic drift term to RHS of GK eqn calculate and add psi-component of magnetic drift term to RHS of GK eqn calculate and add omega_* term to RHS of GK eqn calculate and add contribution from collisions to RHS of GK eqn

calculate and add parallel streaming term to RHS of GK eqn if simulating a full flux surface (flux annulus), all terms to this point have been calculated in real-space in alpha (y); transform to kalpha (ky) space before adding to RHS of GKE. NB: it may be that for fully explicit calculation, this transform can be eliminated with additional code changes

Arguments

Type IntentOptional Attributes Name
complex, intent(inout), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: pdf
complex, intent(out), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:), target :: rhs_ky
logical, intent(out) :: restart_time_step
integer, intent(in) :: istep