Skip to main content

Crate use_plasma

Crate use_plasma 

Source
Expand description

§use-plasma

Small scalar plasma physics helpers for RustUse.

§Install

[dependencies]
use-plasma = "0.0.1"

§Foundation

use-plasma provides small scalar plasma physics helpers for plasma frequency, Debye length, Debye number, thermal speed, gyrofrequency, gyroradius, plasma pressure, magnetic pressure, plasma beta, Alfven speed, charge density, and quasi-neutrality checks.

Inputs are expected to be SI-style numeric values:

  • particles per cubic meter for number density
  • kelvin for temperature
  • teslas for magnetic flux density
  • kilograms for mass
  • kilograms per cubic meter for mass density
  • meters for Debye length and gyroradius
  • radians per second for angular frequency
  • hertz for frequency
  • pascals for pressure
  • coulombs per cubic meter for charge density

The crate keeps only a few local convenience constants. Broader physical constants belong in the top-level use-constants set. Unit abstractions belong in the top-level use-units set. Electromagnetic field helpers belong in use-electromagnetism, and particle metadata belongs in use-particle.

§Example

use use_plasma::{ElectronPlasma, alfven_speed};

let plasma = ElectronPlasma::new(1.0e18, 10_000.0).ok_or("expected valid plasma")?;

assert!(plasma.debye_length().is_some_and(|value| value > 0.0));
assert!(plasma.plasma_frequency().is_some_and(|value| value > 0.0));
assert!(alfven_speed(0.01, 1.0e-10).is_some_and(|value| value >= 0.0));

§When to use directly

Choose use-plasma when you need reusable scalar plasma formulas without bringing in a larger simulation stack or a broader plasma modeling framework.

§Scope

  • APIs stay dependency-free, f64-first, and intentionally small.
  • This crate is not a plasma simulation engine, particle-in-cell framework, magnetohydrodynamics solver, radiation transport tool, or materials database.
  • Detailed collisional transport models, plasma chemistry, and reaction networks are out of scope.

§Status

use-plasma is a pre-1.0 crate with a deliberately small scalar API. Small scalar plasma physics helpers.

Modules§

prelude

Structs§

ElectronPlasma
A simple electron-plasma state.
PlasmaSpecies
A simple scalar plasma species description.

Constants§

BOLTZMANN_CONSTANT
Boltzmann constant in joules per kelvin.
ELECTRON_MASS
Electron mass in kilograms.
ELEMENTARY_CHARGE
Elementary charge in coulombs.
PROTON_MASS
Proton mass in kilograms.
VACUUM_PERMEABILITY
Vacuum permeability in henries per meter.
VACUUM_PERMITTIVITY
Vacuum permittivity in farads per meter.

Functions§

alfven_speed
Computes the Alfven speed.
charge_density
Computes charge density.
debye_length
Computes the Debye length.
debye_number
Computes the Debye number.
debye_sphere_volume
Computes the Debye sphere volume.
electron_gyrofrequency
Computes the electron gyrofrequency using electron mass and charge magnitude.
electron_gyroradius
Computes the electron gyroradius using electron mass and charge magnitude.
electron_plasma_angular_frequency
Computes the electron plasma angular frequency.
electron_plasma_frequency
Computes the electron plasma frequency in hertz.
electron_thermal_speed
Computes the electron thermal speed.
gyro_angular_frequency
Computes the gyro angular frequency.
gyrofrequency
Computes the gyrofrequency in hertz.
gyroradius
Computes the gyroradius.
ion_plasma_angular_frequency
Computes the ion plasma angular frequency.
is_quasi_neutral
Checks whether a plasma is quasi-neutral within a relative tolerance.
is_valid_coulomb_logarithm
Returns whether a Coulomb logarithm value is finite and positive.
magnetic_pressure
Computes magnetic pressure.
particle_thermal_speed
Computes a particle thermal speed.
plasma_beta
Computes plasma beta.
plasma_pressure
Computes scalar plasma pressure.
total_plasma_pressure
Computes total scalar plasma pressure.