gyro_averages Module

inverse fourier transform coefs%fourier for several phase space points and compare with unfiltered version in alpha-space



Variables

Type Visibility Attributes Name Initial
real, public, dimension(:, :, :, :), allocatable :: aj0x
real, public, dimension(:, :, :, :), allocatable :: aj1x
real, public, dimension(:, :), allocatable :: aj0v
real, public, dimension(:, :), allocatable :: aj1v
type(coupled_alpha_type), public, dimension(:, :, :, :), allocatable :: j0_ffs
type(coupled_alpha_type), public, dimension(:, :, :, :), allocatable :: j0_B_ffs
logical, private :: bessinit = .false.
type(coupled_alpha_type), public, dimension(:, :, :, :), allocatable :: j1_ffs
real, public, dimension(:, :, :, :), allocatable :: j0_const
real, public, dimension(:, :, :, :), allocatable :: j0_B_const
real, public, dimension(:, :, :, :), allocatable :: j0max_const

Interfaces

public interface gyro_average

  • private subroutine gyro_average_local(field, iky, ikx, iz, ivmu, gyro_field)

    gyro_average_local takes a field at a given ky, kx, z and (vpa, mu, s) value and returns the gyro-average of that field;

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in) :: field
    integer, intent(in) :: iky
    integer, intent(in) :: ikx
    integer, intent(in) :: iz
    integer, intent(in) :: ivmu
    complex, intent(out) :: gyro_field
  • private subroutine gyro_average_kxky_local(field, iz, ivmu, gyro_field)

    if simulating a full flux surface, the alpha dependence present in kperp makes gyro-averaging non-local in k-space if simulating a flux tube, a gyro-average is local in k-space

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:, :) :: field
    integer, intent(in) :: iz
    integer, intent(in) :: ivmu
    complex, intent(out), dimension(:, :) :: gyro_field
  • private subroutine gyro_average_kxkyz_local(field, ivmu, gyro_field)

    if simulating a full flux surface, the alpha dependence present in kperp makes gyro-averaging non-local in k-space if simulating a flux tube, a gyro-average is local in k-space

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:, :, -nzgrid:, :) :: field
    integer, intent(in) :: ivmu
    complex, intent(out), dimension(:, :, -nzgrid:, :) :: gyro_field
  • private subroutine gyro_average_kxkyzv_local(field, gyro_field)

    if simulating a full flux surface, the alpha dependence present in kperp makes gyro-averaging non-local in k-space if simulating a flux tube, a gyro-average is local in k-space

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: field
    complex, intent(out), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: gyro_field
  • private subroutine gyro_average_v_local(distfn, imu, ikxkyz, gyro_distfn)

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:) :: distfn
    integer, intent(in) :: imu
    integer, intent(in) :: ikxkyz
    complex, intent(out), dimension(:) :: gyro_distfn
  • private subroutine gyro_average_vmu_local(distfn, ikxkyz, gyro_distfn)

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:, :) :: distfn
    integer, intent(in) :: ikxkyz
    complex, intent(out), dimension(:, :) :: gyro_distfn
  • private subroutine gyro_average_vmus_nonlocal(field, iky, ikx, iz, gyro_field)

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(vmu_lo%llim_proc:) :: field
    integer, intent(in) :: iky
    integer, intent(in) :: ikx
    integer, intent(in) :: iz
    complex, intent(out), dimension(vmu_lo%llim_proc:) :: gyro_field
  • private subroutine gyro_average_ffs_kxky_local(field, gyro_field, coefs)

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:, :) :: field
    complex, intent(out), dimension(:, :) :: gyro_field
    type(coupled_alpha_type), intent(in), dimension(:, :) :: coefs
  • private subroutine gyro_average_ffs_kxkyz_local(field, gyro_field, coefs)

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:, :, -nzgrid:, :) :: field
    complex, intent(out), dimension(:, :, -nzgrid:, :) :: gyro_field
    type(coupled_alpha_type), intent(in), dimension(:, :, -nzgrid:) :: coefs
  • private subroutine gyro_average_ffs_field(field, gyro_field, coefs)

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:, :, -nzgrid:, :) :: field
    complex, intent(out), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: gyro_field
    type(coupled_alpha_type), intent(in), dimension(:, :, -nzgrid:, vmu_lo%llim_proc:) :: coefs
  • private subroutine gyro_average_ffs(dist, gyro_dist, coefs)

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: dist
    complex, intent(out), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: gyro_dist
    type(coupled_alpha_type), intent(in), dimension(:, :, -nzgrid:, vmu_lo%llim_proc:) :: coefs

public interface gyro_average_j1

  • private subroutine gyro_average_j1_vmus_nonlocal(field, iky, ikx, iz, gyro_field)

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(vmu_lo%llim_proc:) :: field
    integer, intent(in) :: iky
    integer, intent(in) :: ikx
    integer, intent(in) :: iz
    complex, intent(out), dimension(vmu_lo%llim_proc:) :: gyro_field
  • private subroutine gyro_average_j1_local(field, iky, ikx, iz, ivmu, gyro_field)

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in) :: field
    integer, intent(in) :: iky
    integer, intent(in) :: ikx
    integer, intent(in) :: iz
    integer, intent(in) :: ivmu
    complex, intent(out) :: gyro_field
  • private subroutine gyro_average_j1_kxky_local(field, iz, ivmu, gyro_field)

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:, :) :: field
    integer, intent(in) :: iz
    integer, intent(in) :: ivmu
    complex, intent(out), dimension(:, :) :: gyro_field
  • private subroutine gyro_average_j1_kxkyz_local(field, ivmu, gyro_field)

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:, :, -nzgrid:, :) :: field
    integer, intent(in) :: ivmu
    complex, intent(out), dimension(:, :, -nzgrid:, :) :: gyro_field
  • private subroutine gyro_average_j1_v_local(distfn, imu, ikxkyz, gyro_distfn)

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:) :: distfn
    integer, intent(in) :: imu
    integer, intent(in) :: ikxkyz
    complex, intent(out), dimension(:) :: gyro_distfn
  • private subroutine gyro_average_j1_vmu_local(distfn, ikxkyz, gyro_distfn)

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:, :) :: distfn
    integer, intent(in) :: ikxkyz
    complex, intent(out), dimension(:, :) :: gyro_distfn
  • private subroutine gyro_average_j1_kxkyzv_local(field, gyro_field)

    if simulating a full flux surface, the alpha dependence present in kperp makes gyro-averaging non-local in k-space if simulating a flux tube, a gyro-average is local in k-space

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: field
    complex, intent(out), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: gyro_field

Subroutines

public subroutine init_bessel()

Arguments

None

private subroutine init_bessel_ffs()

aj0_alpha will contain J_0 as a function of k_alpha and alpha j0_B will contain J_0Bexp(-v^2) as a function of k_alpha and alpha for each value of alpha, take kperp^2 calculated on domain kx = [-kx_max, kx_max] and ky = [0, ky_max] and use symmetry to obtain kperp^2 on domain kx = [0, kx_max] and ky = [-ky_max, ky_max] this makes later convolutions involving sums over all ky more straightforward calculate the argument of the Bessel function, which depends on both alpha and k_alpha

Read more…

Arguments

None

public subroutine find_max_required_kalpha_index(ft, idx, imu, iz, is, tol_in)

subroutine takes a set of Fourier coefficients (ft) and returns the minimum number of coeffients that must be retained (idx) to ensure that the relative error in the total spectral energy is below a specified tolerance (tol_floor)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:) :: ft
integer, intent(out) :: idx
integer, intent(in), optional :: imu
integer, intent(in), optional :: iz
integer, intent(in), optional :: is
real, intent(in), optional :: tol_in

public subroutine finish_bessel()

Arguments

None

private subroutine gyro_average_local(field, iky, ikx, iz, ivmu, gyro_field)

gyro_average_local takes a field at a given ky, kx, z and (vpa, mu, s) value and returns the gyro-average of that field;

Arguments

Type IntentOptional Attributes Name
complex, intent(in) :: field
integer, intent(in) :: iky
integer, intent(in) :: ikx
integer, intent(in) :: iz
integer, intent(in) :: ivmu
complex, intent(out) :: gyro_field

private subroutine gyro_average_kxky_local(field, iz, ivmu, gyro_field)

if simulating a full flux surface, the alpha dependence present in kperp makes gyro-averaging non-local in k-space if simulating a flux tube, a gyro-average is local in k-space

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :) :: field
integer, intent(in) :: iz
integer, intent(in) :: ivmu
complex, intent(out), dimension(:, :) :: gyro_field

private subroutine gyro_average_kxkyz_local(field, ivmu, gyro_field)

if simulating a full flux surface, the alpha dependence present in kperp makes gyro-averaging non-local in k-space if simulating a flux tube, a gyro-average is local in k-space

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :, -nzgrid:, :) :: field
integer, intent(in) :: ivmu
complex, intent(out), dimension(:, :, -nzgrid:, :) :: gyro_field

private subroutine gyro_average_kxkyzv_local(field, gyro_field)

if simulating a full flux surface, the alpha dependence present in kperp makes gyro-averaging non-local in k-space if simulating a flux tube, a gyro-average is local in k-space

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: field
complex, intent(out), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: gyro_field

private subroutine gyro_average_ffs_kxky_local(field, gyro_field, coefs)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :) :: field
complex, intent(out), dimension(:, :) :: gyro_field
type(coupled_alpha_type), intent(in), dimension(:, :) :: coefs

private subroutine gyro_average_ffs_kxkyz_local(field, gyro_field, coefs)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :, -nzgrid:, :) :: field
complex, intent(out), dimension(:, :, -nzgrid:, :) :: gyro_field
type(coupled_alpha_type), intent(in), dimension(:, :, -nzgrid:) :: coefs

private subroutine gyro_average_ffs_field(field, gyro_field, coefs)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :, -nzgrid:, :) :: field
complex, intent(out), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: gyro_field
type(coupled_alpha_type), intent(in), dimension(:, :, -nzgrid:, vmu_lo%llim_proc:) :: coefs

private subroutine gyro_average_ffs(dist, gyro_dist, coefs)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: dist
complex, intent(out), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: gyro_dist
type(coupled_alpha_type), intent(in), dimension(:, :, -nzgrid:, vmu_lo%llim_proc:) :: coefs

private subroutine gyro_average_v_local(distfn, imu, ikxkyz, gyro_distfn)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:) :: distfn
integer, intent(in) :: imu
integer, intent(in) :: ikxkyz
complex, intent(out), dimension(:) :: gyro_distfn

private subroutine gyro_average_vmu_local(distfn, ikxkyz, gyro_distfn)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :) :: distfn
integer, intent(in) :: ikxkyz
complex, intent(out), dimension(:, :) :: gyro_distfn

private subroutine gyro_average_vmus_nonlocal(field, iky, ikx, iz, gyro_field)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(vmu_lo%llim_proc:) :: field
integer, intent(in) :: iky
integer, intent(in) :: ikx
integer, intent(in) :: iz
complex, intent(out), dimension(vmu_lo%llim_proc:) :: gyro_field

private subroutine gyro_average_j1_vmus_nonlocal(field, iky, ikx, iz, gyro_field)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(vmu_lo%llim_proc:) :: field
integer, intent(in) :: iky
integer, intent(in) :: ikx
integer, intent(in) :: iz
complex, intent(out), dimension(vmu_lo%llim_proc:) :: gyro_field

private subroutine gyro_average_j1_local(field, iky, ikx, iz, ivmu, gyro_field)

Arguments

Type IntentOptional Attributes Name
complex, intent(in) :: field
integer, intent(in) :: iky
integer, intent(in) :: ikx
integer, intent(in) :: iz
integer, intent(in) :: ivmu
complex, intent(out) :: gyro_field

private subroutine gyro_average_j1_kxky_local(field, iz, ivmu, gyro_field)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :) :: field
integer, intent(in) :: iz
integer, intent(in) :: ivmu
complex, intent(out), dimension(:, :) :: gyro_field

private subroutine gyro_average_j1_kxkyz_local(field, ivmu, gyro_field)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :, -nzgrid:, :) :: field
integer, intent(in) :: ivmu
complex, intent(out), dimension(:, :, -nzgrid:, :) :: gyro_field

private subroutine gyro_average_j1_vmu_local(distfn, ikxkyz, gyro_distfn)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :) :: distfn
integer, intent(in) :: ikxkyz
complex, intent(out), dimension(:, :) :: gyro_distfn

private subroutine gyro_average_j1_v_local(distfn, imu, ikxkyz, gyro_distfn)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:) :: distfn
integer, intent(in) :: imu
integer, intent(in) :: ikxkyz
complex, intent(out), dimension(:) :: gyro_distfn

private subroutine gyro_average_j1_kxkyzv_local(field, gyro_field)

if simulating a full flux surface, the alpha dependence present in kperp makes gyro-averaging non-local in k-space if simulating a flux tube, a gyro-average is local in k-space

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: field
complex, intent(out), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: gyro_field

public subroutine band_lu_solve_ffs(lu, solvec)

Arguments

Type IntentOptional Attributes Name
type(gam0_ffs_type), intent(in), dimension(:, -nzgrid:) :: lu
complex, intent(inout), dimension(:, :, -nzgrid:) :: solvec

private subroutine band_lu_solve_ffs_single(lu, solvec)

Arguments

Type IntentOptional Attributes Name
type(gam0_ffs_type), intent(in) :: lu
complex, intent(inout), dimension(:) :: solvec

public subroutine band_lu_factorisation_ffs(gam0, lu_gam0)

Arguments

Type IntentOptional Attributes Name
type(coupled_alpha_type), intent(in), dimension(:, :, -nzgrid:) :: gam0
type(gam0_ffs_type), intent(out), dimension(:, -nzgrid:) :: lu_gam0

private subroutine band_lu_factorisation_single(gam0, lu_gam0)

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :) :: gam0
type(gam0_ffs_type), intent(out) :: lu_gam0