PlasmaBO

DOI version

Installation

using Pkg
Pkg.add("PlasmaBO")

Features

  • Hermite-Hermite (BO-HH) expansion solver for arbitrary/analytic distributions
    • Maxwellian / BiMaxwellian
  • Analytic Product-Bi-Kappa (BO-PBK) solver
  • Multi-fluid solver
  • Integration with ChargedParticles.jl

Usage Examples

The matrix eigenvalue method (Xie [1], Xie and Xiao [2]) finds all wave modes simultaneously by transforming the dispersion relation into a matrix eigenvalue problem using J-pole approximation for the plasma dispersion function.

This approach is more efficient to find multiple modes at once, and doesn't require initial guesses for the root finder.

Check out the ring beam instability example for detailed usage instructions, also see firehose instability example for using with arbitrary velocity distributions, BO-PBK example for using with kappa distributions (BO-PBK), cold plasma example for comparing kinetic and fluid solvers, and dispersion surface tracking example for 2D scanning and mode tracking.

Solvers

BO-PBK (BOPBK) is an analytic, distribution-aware eigen-solver optimized for kappa plasmas, whereas BO-Arbitrary (BOHH) is a universal but numerically heavier framework that approximates any distribution at the cost of efficiency and low-κ accuracy.

PlasmaBO.BOPBKType
BOPBK(; N = 2)

Dispersion solver using the PBK matrix formulation.

N controls the truncation order of the cyclotron harmonic index used to build the dispersion matrix.

source
PlasmaBO.BOHHType
BOHH(; N = 2, J = 8)

Dispersion solver using the Hermite-Hankel (HH) matrix formulation.

N controls the truncation order of the cyclotron harmonic index. J controls the truncation order of the Hermite expansion used in the solver.

source
PlasmaBO.BOFluidType
BOFluid()

Dispersion solver using the multi-fluid electromagnetic matrix formulation.

source

Notation & Assumptions

The formulation (code) is valid for non-relativistic, arbitrary gyrotropic distributions.

  • Coordinates
    • z: direction parallel to the background magnetic field (B0).
    • x: one perpendicular direction (any perpendicular direction is equivalent).
  • Velocities
    • vz, vx: particle velocity components along z and x.
    • vdz, vdx: drift/bulk velocity components along z and x (when present in a distribution parameterization).
    • vtz, vtx: thermal speeds along z and x.
  • Wave vector
    • θ: propagation angle between k and B0.
    • k∥ = k cos(θ), k⊥ = k sin(θ).

References

Xie et al. [3], Xie [4], Xie [5],

[1]
H. Xie. Efficient Framework for Solving Plasma Waves with Arbitrary Distributions. Physics of Plasmas 32, 60702 (2025).
[2]
H. Xie and Y. Xiao. PDRK: A General Kinetic Dispersion Relation Solver for Magnetized Plasma*. Plasma Science and Technology 18, 97 (2016).
[3]
[4]
H.-s. Xie. PDRF: A General Dispersion Relation Solver for Magnetized Multi-Fluid Plasma. Computer Physics Communications 185, 670–675 (2014).
[5]
H.-S. (. Xie. Generalized Plasma Dispersion Function: One-Solve-All Treatment, Visualizations, and Application to Landau Damping. Physics of Plasmas 20, 92125 (2013).
[6]
T. Umeda, S. Matsukiyo, T. Amano and Y. Miyoshi. A Numerical Electromagnetic Linear Dispersion Relation for Maxwellian Ring-Beam Velocity Distributions. Physics of Plasmas 19, 72107 (2012).
[7]
T. Cattaert, M. A. Hellberg and R. L. Mace. Oblique Propagation of Electromagnetic Waves in a Kappa-Maxwellian Plasma. Physics of Plasmas 14, 82111 (2007).
[8]

API Reference

PlasmaBO.BOFluidType
BOFluid()

Dispersion solver using the multi-fluid electromagnetic matrix formulation.

source
PlasmaBO.BOHHType
BOHH(; N = 2, J = 8)

Dispersion solver using the Hermite-Hankel (HH) matrix formulation.

N controls the truncation order of the cyclotron harmonic index. J controls the truncation order of the Hermite expansion used in the solver.

source
PlasmaBO.BOPBKType
BOPBK(; N = 2)

Dispersion solver using the PBK matrix formulation.

N controls the truncation order of the cyclotron harmonic index used to build the dispersion matrix.

source
PlasmaBO.BranchPointType
BranchPoint{T}
BranchPoint(k, ω)

Initial point specification for dispersion branch tracking.

Fields

  • k: Wave vector at initial point
  • ω: Frequency at initial point
  • locator: Callable used to locate the seed eigenvalue at the initial point

Example

# Track unstable branch starting at k=0.03 with γ=0.1721
point1 = BranchPoint(0.03, 0.1721im)     # Auto: track by Im

# Track real frequency mode at k=0.5 with ωᵣ=2.5
point2 = BranchPoint(0.5, 2.5)  # Auto: track by Re
source
PlasmaBO.FluidSpeciesType
FluidSpecies{T}

Fluid species parameters for the multi-fluid dispersion relation solver.

Fields

  • q: Charge
  • m: Mass
  • n: Number density (m⁻³)
  • Tz: Parallel temperature (eV)
  • Tp: Perpendicular temperature (eV)
  • vdz: Parallel drift velocity (in units of c)
  • gamma_z: Parallel polytrope exponent (default: 1.0 for isothermal)
  • gamma_p: Perpendicular polytrope exponent (default: 1.0 for isothermal)
source
PlasmaBO.JPoleCoefficientsType
JPoleCoefficients{T}

J-pole approximation coefficients for the plasma dispersion function. Z(ζ) ≈ Σⱼ bⱼ/(ζ - cⱼ)

source
PlasmaBO.funAnMethod
funAn(n, a, d, m, p)

Perpendicular integral for Jn²: ∫ Jn²(ay) exp(-(y-d)²) (y-d)^m y^p dy.

source
PlasmaBO.funBnMethod
funBn(n, a, d, m, p)

Perpendicular integral for Jn·Jn': ∫ Jn(ay) Jn'(ay) exp(-(y-d)²) (y-d)^m y^p dy.

source
PlasmaBO.funCnMethod
funCn(n, a, d, m, p)

Perpendicular integral for (Jn')²: ∫ [Jn'(ay)]² exp(-(y-d)²) (y-d)^m y^p dy.

source
PlasmaBO.funInMethod
funIn(n)

Normalization integral I_n = ∫ v^n exp(-v²) dv / √π.

Returns Γ((n+1)/2)/√π for even n, 0 for odd n.

source
PlasmaBO.get_jpole_coefficientsFunction
get_jpole_coefficients(J=8)

Get J-pole approximation coefficients for the plasma dispersion function.

Supported values: J ∈ {4, 6, 8, 10, 12, 16, 20, 24, 28, 32}

source
PlasmaBO.hermite_HMethod
hermite_H(n::Int, x)

Compute physicists' Hermite polynomial H_n(x) using recurrence relation.

Recurrence Relations

  • H_0(x) = 1
  • H_1(x) = 2x
  • H{n+1}(x) = 2x*Hn(x) - 2n*H_{n-1}(x)

Examples

hermite_H(0, 1.5)  # Returns 1.0
hermite_H(1, 1.5)  # Returns 3.0 (= 2*1.5)
hermite_H(2, 1.5)  # Returns 7.0 (= 2*1.5*3.0 - 2*1*1.0)
source
PlasmaBO.hermite_a0_to_aMethod
hermite_a0_to_a(a0lm)

Convert normalized Hermite basis coefficients: a0lm -> alm

Transforms expansion:

f(z,x) = Σ_{l,m} a0_{l,m} * ρ_l(z) * u_m(x)

to:

f(z,x) = Σ_{l,m} a_{l,m} * g_l(z) * h_m(x)

where:

  • ρl, um are normalized Hermite functions
  • g_l(z) ∝ z^l * exp(-z²/2)
  • h_m(x) ∝ x^m * exp(-x²/2)
source
PlasmaBO.hermite_coefficients_matrixMethod
hermite_coefficients_matrix(nmax)

Compute coefficient matrix for expanding Hermite polynomials in power basis given the maximum order nmax.

Returns matrix cHn[n+1, k+1] such that:

H_n(x) / √(2^n n! √π) = Σ_k cHn[n+1, k+1] * x^k / √(2^{n-k} n! √π)

This is used to convert between normalized Hermite basis and power-law basis.

Returns

  • cHn: (nmax+1) × (nmax+1) coefficient matrix
source
PlasmaBO.hermite_expansionMethod
hermite_expansion(
    fv::AbstractMatrix{T},
    vz, vx, vtz, vtp;
    Nz = 16, Nx = 16,
    dz = zero(T), dx = zero(T)
) where {T}

Compute Hermite expansion coefficients from gridded distribution function.

Expands arbitrary 2D distribution f(vparallel, vperp) as:

f(vz, vx) = Σ_{l=0}^{Nz} Σ_{m=0}^{Nx} a_{l,m} * ρ_l(vz) * u_m(vx)

where ρl and um are normalized Hermite basis functions. Nz, Nx are the maximum parallel and perpendicular Hermite indices, respectively.

Arguments

  • fv: Distribution function values on (vz, vx) grid
  • vz: Parallel velocity grid (1D or matches fv size)
  • vx: Perpendicular velocity grid (1D or matches fv size)
  • vtz: Parallel thermal velocity (default: 1.0)
  • vtp: Perpendicular thermal velocity (default: 1.0)
  • dz: Parallel drift velocity (default: 0.0)
  • dx: Perpendicular drift velocity (default: 0.0)

Returns

Named tuple with:

  • alm: (Nz+1) × (Nx+1) coefficient matrix in power-law basis
  • a0lm: (Nz+1) × (Nx+1) coefficient matrix in Hermite basis

Algorithm

  1. Compute a0_{l,m} via numerical integration:

    a0_{l,m} = ∫∫ f(z,x) ρ_l(z) u_m(x) dz dx * (2/(Lz*Lx))
  2. Normalize by distribution integral

  3. Convert to power-law basis: a{l,m} = hermitea0toa(a0_{l,m})

source
PlasmaBO.solve_dispersion_matrixFunction
solve_dispersion_matrix(params, kx, kz; N=2, J=8)

Solve the kinetic dispersion relation using the matrix eigenvalue method.

Returns all eigenfrequencies ω(k) for the given wave vector (kx, kz).

This method transforms the dispersion relation into a matrix eigenvalue problem using J-pole approximation for the plasma dispersion function, allowing simultaneous computation of all wave modes.

  • kx: Perpendicular wave vector component (m⁻¹)
  • kz: Parallel wave vector component (m⁻¹)
  • J: Number of poles for Z-function approximation (default: 8)

See also: get_jpole_coefficients

source
PlasmaBO.trackMethod
track(solution, point)

Track a single dispersion branch across parameter space from initial point.

The algorithm:

  1. Start at the k-point nearest to the initial point
  2. Track bidirectionally using interpolation to predict ω at each k
  3. Select nearest eigenvalue to prediction

Example

initial = BranchPoint(0.03, 0.1721im)
k_branch, ω_branch = track(solution, initial)

See also: BranchPoint

source