nhdspy

nhdspy is a Python wrapper for NHDS, a numerical plasma dispersion relation solver written in Fortran.

Installing

To install nhdspy, download the code from https://github.com/dstansby/nhdspy Then change into the source directory and run:

pip install nhdspy

To run nhdspy you will need the following requirements:

  • gfortran
  • hdf5
  • libz
  • szip

Running nhdspy will automatically try to compile the bundled FORTRAN code. The following environment variables must point to their respective libaries:

  • HDF5
  • LIBZ
  • LIBSZ

Examples

import nhdspy
import matplotlib.pyplot as plt

electrons = nhdspy.Species(-1, 1 / 1836, 1, 0, 1, 1)
protons = nhdspy.Species(1, 1, 1, 0, 1, 1)
propagation_angle = 0.001
input = nhdspy.InputParams([protons, electrons], propagation_angle, 1e-4)
print(nhdspy.format_input_file(input))
output = nhdspy.run(input)

fig, ax = plt.subplots()
ax.plot(output.kz, output.omega_real)
ax.plot(output.kz, output.omega_imag)
plt.show()

nhdspy Package

Functions

format_input_file(input) Function to create input file.
run(input) Run the dispersion solver for a given input.

Classes

InputParams(species, omega_guess, …[, …]) Input parameters for calculating a dispersion relation.
Result(input, run_output) Result of running the dispersion solver.
Species(q, m, n, v_d, t_ani, beta_par) A single bi-Maxwellian species.

Indices and tables