Skip to content

plasma_plots.theory.parameters

Plasma parameters in SI units: frequencies, lengths, speeds and Struphy’s units.

Densities are in m⁻³, magnetic fields in T, temperatures in eV (k_B T / e, so 1 eV is 11604.5 K) unless a function says otherwise, and the results are in SI units: angular frequencies in rad/s, lengths in m, speeds in m/s. Ions have the mass mass_number × m_p (proton masses, as in Struphy and the NRL Plasma Formulary) and the charge charge_number × e.

Examples

The electron plasma frequency and Debye length of a 1e19 m⁻³, 100 eV plasma:

>>> print(
... f"{plasma_frequency(1e19):.3e} rad/s, {debye_length(1e19, 100.0):.3e} m"
... )
1.784e+11 rad/s, 2.351e-05 m

Attributes

NameDescription
STRUPHY_UNIT_SYMBOLSNo description.
boltzmann_constantNo description.
electron_massNo description.
elementary_chargeNo description.
ev_to_jouleNo description.
ev_to_kelvinNo description.
proton_massNo description.
speed_of_lightNo description.
vacuum_permeabilityNo description.
vacuum_permittivityNo description.

Functions

NameDescription
alfven_speedCompute the Alfvén speed v_A = B / √(μ₀ n m_i), with m_i = mass_number × m_p.
cyclotron_frequencyCompute the cyclotron (gyro-) frequency Ω = q|B|/m.
debye_lengthCompute the electron Debye length λ_D = √(ε₀ T / (n e²)).
inertial_lengthCompute the inertial length (skin depth) d = c / ω_p.
larmor_radiusCompute the Larmor (gyro-) radius ρ = m v⊥ / (|q| B).
lower_hybrid_frequencyCompute the lower hybrid frequency, 1/ω_LH² = 1/(Ω_i² + ω_pi²) + 1/(|Ω_e| Ω_i).
plasma_betaCompute the plasma beta β = n T / (B²/(2μ₀)), the ratio of thermal to magnetic pressure.
plasma_frequencyCompute the plasma frequency ω_p = √(n q² / (ε₀ m)).
plasma_parameterCompute the plasma parameter N_D = (4π/3) n λ_D³, the number of electrons in a Debye sphere.
sound_speedCompute the ion sound speed c_s = √((γ_e Z T_e + γ_i T_i) / m_i).
struphy_equation_parametersCompute the equation parameters α, ε and κ of one Struphy species.
struphy_unitsCompute the units of Struphy's normalization from its base units.
thermal_speedCompute the thermal speed of a Maxwellian of temperature T.
upper_hybrid_frequencyCompute the upper hybrid frequency ω_UH = √(ω_pe² + Ω_e²).

STRUPHY_UNIT_SYMBOLSattributemodule attribute#

STRUPHY_UNIT_SYMBOLS = {
  'x': 'm',
  'B': 'T',
  'n': 'm⁻³',
  'kBT': 'keV',
  'v': 'm/s',
  't': 's',
  'frequency': '1/s',
  'p': 'Pa',
  'rho': 'kg/m³',
  'j': 'A/m²'
}

boltzmann_constantattributemodule attribute#

boltzmann_constant = 1.380649e-23

electron_massattributemodule attribute#

electron_mass = 9.1093837015e-31

elementary_chargeattributemodule attribute#

elementary_charge = 1.602176634e-19

ev_to_jouleattributemodule attribute#

ev_to_joule = elementary_charge

ev_to_kelvinattributemodule attribute#

ev_to_kelvin = elementary_charge / boltzmann_constant

proton_massattributemodule attribute#

proton_mass = 1.67262192369e-27

speed_of_lightattributemodule attribute#

speed_of_light = 299792458.0

vacuum_permeabilityattributemodule attribute#

vacuum_permeability = 1.25663706212e-06

vacuum_permittivityattributemodule attribute#

vacuum_permittivity = 8.8541878128e-12

alfven_speedfunction#

def alfven_speed(field, density, mass_number=1, relativistic=False)

Compute the Alfvén speed v_A = B / √(μ₀ n m_i), with m_i = mass_number × m_p.

Parameters

NameTypeDefaultDescription
fieldfloat or array_likerequiredMagnetic field B, in T.
densityfloat or array_likerequiredIon density n, in m⁻³ (the mass density is n m_i; electrons are neglected).
mass_numberfloat or array_like1Ion mass in proton masses, as in Struphy. Default: 1.
relativisticboolFalseIf true, return the relativistic v_A / √(1 + v_A²/c²). Default: False.

Returns

float or numpy.ndarray
v_A, in m/s.

Examples

>>> # deuterium, 1 T
>>> print(f"{alfven_speed(1.0, 1e20, mass_number=2):.4g} m/s")
1.542e+06 m/s

cyclotron_frequencyfunction#

def cyclotron_frequency(field, mass=electron_mass, charge=elementary_charge)

Compute the cyclotron (gyro-) frequency Ω = q|B|/m.

Parameters

NameTypeDefaultDescription
fieldfloat or array_likerequiredMagnetic field B, in T (its sign doesn’t matter).
massfloat or array_likeelectron_massParticle mass m, in kg. Default: the electron mass.
chargefloat or array_likeelementary_chargeParticle charge q, in C. Ω has its sign: the default +e gives the magnitude, −e the signed electron frequency (negative, for the left-handed electron gyration).

Returns

float or numpy.ndarray
Ω in rad/s.

Examples

>>> print(f"{cyclotron_frequency(1.0) / (2 * np.pi):.4g} Hz")
2.799e+10 Hz
>>> print(f"{cyclotron_frequency(1.0, charge=-elementary_charge):.4g} rad/s")
-1.759e+11 rad/s

debye_lengthfunction#

def debye_length(density, temperature)

Compute the electron Debye length λ_D = √(ε₀ T / (n e²)).

Parameters

NameTypeDescription
densityfloat or array_likeElectron density n, in m⁻³.
temperaturefloat or array_likeElectron temperature T, in eV.

Returns

float or numpy.ndarray
λ_D, in m. With the default thermal_speed(), λ_D = v_th / ω_pe.

Examples

>>> print(f"{debye_length(1e6, 1.0):.4g} m") # 1 cm⁻³, 1 eV
7.434 m

inertial_lengthfunction#

def inertial_length(density, mass=electron_mass, charge=elementary_charge)

Compute the inertial length (skin depth) d = c / ω_p.

Parameters

NameTypeDefaultDescription
densityfloat or array_likerequiredNumber density n of the species, in m⁻³.
massfloat or array_likeelectron_massParticle mass m, in kg. Default: the electron mass.
chargefloat or array_likeelementary_chargeParticle charge q, in C. Default: e.

Returns

float or numpy.ndarray
d, in m. For ions, d_i = v_A / Ω_i.

Examples

>>> print(f"{inertial_length(1e20):.4g} m") # electrons
0.0005314 m
>>> print(f"{inertial_length(1e20, mass=proton_mass):.4g} m") # protons
0.02277 m

larmor_radiusfunction#

def larmor_radius(field, temperature=None, perpendicular_speed=None, mass=electron_mass, charge=elementary_charge)

Compute the Larmor (gyro-) radius ρ = m v⊥ / (|q| B).

Give either the temperature, for the thermal Larmor radius with v⊥ = √(T/m), or the perpendicular speed.

Parameters

NameTypeDefaultDescription
fieldfloat or array_likerequiredMagnetic field B, in T.
temperaturefloat or array_likeNoneTemperature T, in eV; then v⊥ = √(T/m) (the NRL convention).
perpendicular_speedfloat or array_likeNoneThe perpendicular speed v⊥, in m/s.
massfloat or array_likeelectron_massParticle mass m, in kg. Default: the electron mass.
chargefloat or array_likeelementary_chargeParticle charge q, in C (its sign doesn’t matter). Default: e.

Returns

float or numpy.ndarray
ρ, in m.

Raises

ValueError
If not exactly one of temperature and perpendicular_speed is given.

Examples

>>> # 1 keV electron, 1 T
>>> print(f"{larmor_radius(1.0, temperature=1e3):.4g} m")
7.54e-05 m
>>> radius = larmor_radius(2.0, perpendicular_speed=1e6, mass=proton_mass)
>>> print(f"{radius:.4g} m")
0.00522 m

lower_hybrid_frequencyfunction#

def lower_hybrid_frequency(density, field, mass_number=1, charge_number=1)

Compute the lower hybrid frequency, 1/ω_LH² = 1/(Ω_i² + ω_pi²) + 1/(|Ω_e| Ω_i).

Parameters

NameTypeDefaultDescription
densityfloat or array_likerequiredElectron density n_e, in m⁻³ (the ion density is n_e / Z).
fieldfloat or array_likerequiredMagnetic field B, in T.
mass_numberfloat or array_like1Ion mass in proton masses. Default: 1.
charge_numberfloat or array_like1Ion charge number Z. Default: 1.

Returns

float or numpy.ndarray
ω_LH, in rad/s. For ω_pi ≫ Ω_i it tends to √(|Ω_e| Ω_i).

Examples

>>> print(f"{lower_hybrid_frequency(1e20, 1.0) / (2 * np.pi):.4g} Hz")
6.237e+08 Hz

plasma_betafunction#

def plasma_beta(density, temperature, field)

Compute the plasma beta β = n T / (B²/(2μ₀)), the ratio of thermal to magnetic pressure.

For several species, add their β (or pass the summed pressure n T of all species).

Parameters

NameTypeDescription
densityfloat or array_likeNumber density n, in m⁻³.
temperaturefloat or array_likeTemperature T, in eV.
fieldfloat or array_likeMagnetic field B, in T.

Returns

float or numpy.ndarray
β (dimensionless).

Examples

>>> print(f"{plasma_beta(1e20, 1e4, 5.0):.4f}") # 10 keV, 5 T
0.0161

plasma_frequencyfunction#

def plasma_frequency(density, mass=electron_mass, charge=elementary_charge)

Compute the plasma frequency ω_p = √(n q² / (ε₀ m)).

Parameters

NameTypeDefaultDescription
densityfloat or array_likerequiredNumber density n of the species, in m⁻³.
massfloat or array_likeelectron_massParticle mass m, in kg. Default: the electron mass.
chargefloat or array_likeelementary_chargeParticle charge q, in C (its sign doesn’t matter). Default: e.

Returns

float or numpy.ndarray
ω_p in rad/s (divide by 2π for Hz).

Examples

>>> print(f"{plasma_frequency(1e18) / (2 * np.pi):.4g} Hz")
8.979e+09 Hz
>>> # deuterons
>>> print(f"{plasma_frequency(1e20, mass=2 * proton_mass):.4g} rad/s")
9.309e+09 rad/s

plasma_parameterfunction#

def plasma_parameter(density, temperature)

Compute the plasma parameter N_D = (4π/3) n λ_D³, the number of electrons in a Debye sphere.

Parameters

NameTypeDescription
densityfloat or array_likeElectron density n, in m⁻³.
temperaturefloat or array_likeElectron temperature T, in eV.

Returns

float or numpy.ndarray
N_D (dimensionless). A plasma is weakly coupled for N_D ≫ 1.

Examples

>>> print(f"{plasma_parameter(1e6, 1.0):.3g}") # 1 cm⁻³, 1 eV
1.72e+09

sound_speedfunction#

def sound_speed(electron_temperature, ion_temperature=0.0, mass_number=1, charge_number=1, electron_gamma=1.0, ion_gamma=3.0)

Compute the ion sound speed c_s = √((γ_e Z T_e + γ_i T_i) / m_i).

Parameters

NameTypeDefaultDescription
electron_temperaturefloat or array_likerequiredElectron temperature T_e, in eV.
ion_temperaturefloat or array_like0.0Ion temperature T_i, in eV. Default: 0 (cold ions).
mass_numberfloat or array_like1Ion mass in proton masses. Default: 1.
charge_numberfloat or array_like1Ion charge number Z. Default: 1.
electron_gammafloat1.0Adiabatic index γ_e of the electrons. Default: 1 (isothermal electrons).
ion_gammafloat3.0Adiabatic index γ_i of the ions. Default: 3 (1-D adiabatic ions).

Returns

float or numpy.ndarray
c_s, in m/s.

Examples

>>> print(f"{sound_speed(1.0):.4g} m/s")
9787 m/s

struphy_equation_parametersfunction#

def struphy_equation_parameters(units, charge_number=1, mass_number=1)

Compute the equation parameters α, ε and κ of one Struphy species.

Mirrors struphy.models.species.Species.EquationParameters, with ω_p and Ω_c of the species at the unit density and unit field: α = ω_p/Ω_c, ε = 1/(Ω_c t) and κ = ω_p t.

Parameters

NameTypeDefaultDescription
unitsdictrequiredThe units from struphy_units().
charge_numberfloat1Charge number Z of the species. Default: 1.
mass_numberfloat1Mass number A of the species, in proton masses. Default: 1.

Returns

dict
alpha, epsilon and kappa.

Examples

>>> units = struphy_units(velocity_scale="alfvén", mass_number=1)
>>> params = struphy_equation_parameters(units)
>>> print({key: f"{value:.4g}" for key, value in params.items()})
{'alpha': '137.4', 'epsilon': '0.02277', 'kappa': '6036'}

struphy_unitsfunction#

def struphy_units(x=1.0, B=1.0, n=1.0, kBT=None, velocity_scale='light', mass_number=None, charge_number=None)

Compute the units of Struphy’s normalization from its base units.

Mirrors struphy.physics.physics.Units.derive_units (the base units are those of struphy.io.options.BaseUnits in a parameter file, the velocity scale is the model’s velocity_scale and the mass and charge numbers are those of the model’s bulk species):

  • velocity v: c for "light"; B / √(A m_p n μ₀) for "alfvén"; (Z e B / (A m_p)) x for "cyclotron"; √(kBT / (A m_p)) for "thermal"; 1 m/s for None,
  • time t = x / v, and the frequency 1/t (normalized angular frequencies ω t are in rad/t),
  • with a bulk species (mass_number given): pressure p = A m_p n v² (= B²/μ₀ for "alfvén"), mass density ρ = A m_p n, current density j = e n v.

Parameters

NameTypeDefaultDescription
xfloat1.0Unit of length, in m (BaseUnits.x). Default: 1.
Bfloat1.0Unit of magnetic field, in T (BaseUnits.B). Default: 1.
nfloat1.0Unit of number density, in 1e20 m⁻³ as in BaseUnits.n (not in m⁻³). Default: 1.
kBTfloatNoneUnit of thermal energy, in keV as in BaseUnits.kBT; needed for "thermal".
velocity_scale('light', 'alfvén', 'cyclotron', 'thermal', None)"light"The model’s velocity scale ("alfven" is accepted too). Default: "light".
mass_numberfloatNoneMass number A of the bulk species, in proton masses; needed except for "light" and None.
charge_numberfloatNoneCharge number Z of the bulk species; needed for "cyclotron".

Returns

dict
Floats, in SI units except kBT: x (m), B (T), n (m⁻³), kBT (keV or None), v (m/s), t (s), frequency (1/s), p (Pa), rho (kg/m³) and j (A/m²); the last three are None without a bulk species. STRUPHY_UNIT_SYMBOLS holds these unit names.

Raises

ValueError
If velocity_scale is unknown or a quantity it needs is missing.

Examples

>>> units = struphy_units(
... x=1.0, B=1.0, n=1.0, velocity_scale="alfvén", mass_number=2
... )
>>> print(f"v = {units['v']:.4g} m/s, t = {units['t']:.4g} s")
v = 1.542e+06 m/s, t = 6.484e-07 s
>>> print(f"p = {units['p']:.4g} Pa") # B²/μ₀
p = 7.958e+05 Pa

thermal_speedfunction#

def thermal_speed(temperature, mass=electron_mass, convention='sqrt(T/m)')

Compute the thermal speed of a Maxwellian of temperature T.

Parameters

NameTypeDefaultDescription
temperaturefloat or array_likerequiredTemperature T, in eV.
massfloat or array_likeelectron_massParticle mass m, in kg. Default: the electron mass.
convention('sqrt(T/m)', 'sqrt(2T/m)', 'mean')"sqrt(T/m)""sqrt(T/m)": the standard deviation of each velocity component, as in the NRL formulary and in Struphy’s Maxwellians and velocity_scale="thermal"; "sqrt(2T/m)": the most probable speed, common in kinetic theory; "mean": the mean speed √(8T/(πm)). Default: "sqrt(T/m)".

Returns

float or numpy.ndarray
The thermal speed, in m/s.

Raises

ValueError
If convention is unknown.

Examples

>>> print(f"{thermal_speed(1.0):.4g} m/s")
4.194e+05 m/s
>>> print(f"{thermal_speed(1.0, convention='sqrt(2T/m)'):.4g} m/s")
5.931e+05 m/s

upper_hybrid_frequencyfunction#

def upper_hybrid_frequency(density, field)

Compute the upper hybrid frequency ω_UH = √(ω_pe² + Ω_e²).

Parameters

NameTypeDescription
densityfloat or array_likeElectron density n_e, in m⁻³.
fieldfloat or array_likeMagnetic field B, in T.

Returns

float or numpy.ndarray
ω_UH, in rad/s.

Examples

>>> print(f"{upper_hybrid_frequency(1e19, 1.0):.4g} rad/s")
2.505e+11 rad/s