This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

vp.plasma.landau

Landau damping of a Langmuir wave, computed from the Vlasov-Poisson equations and checked against the exact root of the dispersion relation.

Part of the distribution vipyr-plasma; it runs from a checkout of the repository. Planned on PyPI as pip install "vipyr[plasma]".

Signature

vp.plasma.landau(setup="k05", *, nx=None, nv=None, vmax=None, vt=None, k=None, alpha=None, dt=None, t_end=None, t_fit0=None, t_fit1=None)

setup picks a deck, a named set of every parameter's value; a keyword left as None keeps the deck's value. The program's checks are written for each deck's settings.

Parameters

setup : str, default k05
The deck: a named set of every parameter's value, with the checks that hold at it. Range: one of k05, k04.
nx : int, default k05 16, k04 16
Grid points in x over one wavelength. Range: >= 4, <= 4096.
nv : int, default k05 256, k04 256
Grid points in v on [-VMAX, VMAX), periodic. Range: >= 16, <= 16384.
vmax : float, default k05 6.0, k04 6.0
The velocity grid's edge; 6 VT or more, so the Maxwellian's tail does not wrap around (must be positive). Range: >= 0.
vt : float, default k05 1.0, k04 1.0
The electrons' thermal speed, which is also the Debye length in these units (must be positive). Range: >= 0.
k : float, default k05 0.5, k04 0.4
The perturbation's wavenumber; the box is 2 pi / K0 (must be positive). Range: >= 0. The program's K0.
alpha : float, default k05 1.0e-4, k04 1.0e-4
The relative amplitude of the density perturbation, 1 + ALPHA cos(K0 x); small, so the wave stays linear. Range: >= 0, <= 0.01.
dt : float, default k05 0.05, k04 0.05
The time step, in units of the inverse plasma frequency (must be positive). Range: >= 0.
t_end : float, default k05 40.0, k04 60.0
The run's length, in units of the inverse plasma frequency. Units: units of the inverse plasma frequency. Range: >= 0.
t_fit0 : float, default k05 10.0, k04 12.0
The fit window's start: late enough that the faster-damped roots of the dispersion relation have died away (each deck says why its value). Range: >= 0.
t_fit1 : float, default k05 40.0, k04 60.0
The fit window's end. Range: >= 0.

Returns

A frozen LandauResult. Iterating it gives the fields below in order; it also has params, tests, log and check().

gamma : float, units of the plasma frequency
The damping rate fitted to the field energy's peaks (negative: damped), in units of the plasma frequency.
omega : float, units of the plasma frequency
The frequency from the peaks' spacing, in units of the plasma frequency.
gamma_exact : float
The imaginary part of the exact Landau root at k lambda_D = K0 VT.
omega_exact : float
The real part of the exact Landau root.
gamma_err : float
|GAMMA - GAMMA_EXACT| / |GAMMA_EXACT|.
omega_err : float
|OMEGA - OMEGA_EXACT| / OMEGA_EXACT.
npeaks : int
How many field-energy peaks the fit used.
fit_rms : float
Rms distance of the peaks of log W from the fitted line.
time : ndarray[float64]
The time of each field-energy sample, (n + 1/2) DT.
wfield : ndarray[float64]
The field energy, integral of E^2 / 2 dx, at each TIME.
mass_drift : float
The largest relative change of the particle count over the run.
l2_drift : float
The relative change of the integral of f^2 over the run.
energy_drift : float
The change of kinetic plus field energy over the run, in units of the initial field energy.

Raises

vipyr.ParameterError
A ValueError: an argument outside its range, choices, rank or shape, or one of a group given without the rest; its .param names the argument.
TypeError
An argument of the wrong type, or an unknown keyword.
vipyr.VivBuildError
An ImportError: no C compiler, or the program's C does not build.
RuntimeError
The program stops with its own message (a combination it rejects, or no convergence where the program treats that as an error).

Examples

import vipyr as vp
r = vp.plasma.landau(setup="k05")      # k lambda_D = 0.5
print(r.gamma, r.gamma_exact, r.omega)
assert r.check()
-0.15332316227395903 -0.1533594669096037 1.4157402830257086

Each example ran as written when these pages were generated, and the output shown is what it printed.

Checked against

Reference
the exact root of the Langmuir dispersion relation for a Maxwellian, from the plasma dispersion function (plasma/landau_check.viv)
Cases
the decks k05 (k lambda_D = 0.5) and k04 (0.4)
Gamma tolerance
8 × 10−4 relative, the damping rate
Omega tolerance
2 × 10−4 relative, the frequency

Source