microfield

starkzee.microfield.calculate_normal_field(Ne_m3)[source]

Return the Holtsmark normal electric field F₀ [V m⁻¹] and mean inter-particle distance r_e [m].

F₀ is the characteristic field strength that scales the Holtsmark distribution. It is defined as the Coulomb field of one electron at the mean inter-particle spacing r_e:

r_e = (3 / 4π N_e)^(1/3) F₀ = e / (4π ε₀ r_e²)

Parameters:

Ne_m3 (float) – Electron number density [m⁻³].

Returns:

  • F0 (float) – Normal (Holtsmark) electric field [V m⁻¹].

  • re (float) – Mean inter-electron distance [m].

starkzee.microfield.calculate_debye_length(Te_ev, Ne_m3)[source]

Return the electron Debye screening length λ_D [m].

The Debye length characterizes the spatial scale over which the plasma screens individual Coulomb fields:

λ_D = √(ε₀ T_e / (N_e e)) [T_e in eV, so e T_e gives k_B T_e in J]

Parameters:
  • Te_ev (float) – Electron temperature [eV].

  • Ne_m3 (float) – Electron number density [m⁻³].

Returns:

Debye length [m].

Return type:

float

starkzee.microfield.calculate_multispecies_debye_length(Te_ev, Ne_m3, species_charges=None, species_concentrations=None)[source]

Return the multi-species Debye length λ_D [m].

Extends the single-species Debye length to a plasma containing multiple ion species by summing their charge-weighted contributions to the screening:

λ_D = √(ε₀ T_e / (N_e e × (1 + Σ_i X_i Z_i²)))

where X_i = N_i / N_e is the fractional concentration and Z_i the charge of species i. The 1 in the denominator accounts for the electron contribution. If no species information is given the function falls back to the single-species result calculate_debye_length().

Parameters:
  • Te_ev (float) – Electron (and ion) temperature [eV]. The formula assumes T_e = T_i.

  • Ne_m3 (float) – Electron number density [m⁻³].

  • species_charges (list of float, optional) – Charge numbers Z_i for each ion species.

  • species_concentrations (list of float, optional) – Relative concentrations X_i = N_i / N_e for each species. Must have the same length as species_charges.

Returns:

Multi-species Debye length [m].

Return type:

float

starkzee.microfield.holtsmark_distribution(beta)[source]

Return the Holtsmark microfield probability density W(β) at reduced field β.

The Holtsmark distribution describes the statistical distribution of electric microfields in an ideal, unscreened, spatially uncorrelated plasma of point charges. It is computed via the Fourier transform:

W(β) = (2β/π) ∫₀^∞ y sin(βy) exp(−y^{3/2}) dy

where β = F / F₀ is the field normalized to the Holtsmark normal field F₀. W(β) is normalized so that ∫₀^∞ W(β) dβ = 1.

Parameters:

beta (float) – Reduced electric field β = F / F₀ ≥ 0.

Returns:

Holtsmark probability density W(β) ≥ 0.

Return type:

float

Notes

Returns 0 for β ≤ 1e-5 (the distribution vanishes at zero field). The upper integration limit is truncated to 15 rather than ∞ because exp(−y^{3/2}) decays faster than any exponential for large y.

References

Holtsmark, J., Ann. Phys. 58, 577 (1919).

starkzee.microfield.hooper_distribution(beta, a)[source]

Return the Hooper screened microfield probability density W(β, a).

The Hooper distribution extends the Holtsmark distribution to screened plasmas by multiplying the characteristic function integrand by a screening factor that depends on the screening parameter a = r_e / λ_D:

T(y, a) = exp(−y^{3/2} × S(y, a))

where the screening function is the analytical approximation

S(y, a) = (1 + 1.5 a² / y²)^{−3/4}

which transitions smoothly from S → 1 (Holtsmark) for y ≫ a to S → 0 (fully screened) for y ≪ a. The distribution is computed via

W(β, a) = (2β/π) ∫₀^∞ y sin(βy) T(y, a) dy

Parameters:
  • beta (float) – Reduced electric field β = F / F₀ ≥ 0.

  • a (float) – Screening parameter a = r_e / λ_D. a = 0 recovers Holtsmark. Typical tokamak edge values: a ≈ 0.3–1.0.

Returns:

Screened microfield probability density W(β, a) ≥ 0.

Return type:

float

Notes

Returns 0 for β ≤ 1e-5. A small regularisation (1e-8) in the screening denominator prevents division by zero at y → 0.

References

Hooper, C.F., Phys. Rev. 149, 77 (1966).

starkzee.microfield.microfield_quadrature(Ne_m3, Te_ev, num_points=50, max_beta=10.0, use_screening=True, species_charges=None, species_concentrations=None, custom_table_path=None)[source]

Build a quadrature grid of plasma electric microfield magnitudes and weights.

Discretises the microfield integral ∫ W(F) dF over a uniform grid of num_points values of the reduced field β = F / F₀ in [0, max_beta]. The returned arrays satisfy:

Σ_i weight_i ≈ 1

so that integrals of the form ∫ f(F) W(F) dF can be approximated by a simple weighted sum Σ_i weight_i × f(fields_i).

The distribution W(β) is one of:

  • Holtsmark (use_screening=False): unscreened, valid when r_e ≪ λ_D.

  • Hooper (use_screening=True, default): screened by the Debye length, appropriate for most laboratory plasmas.

  • Custom table (custom_table_path provided): loads a user-supplied two-column file [β, W(β)] (e.g. from APEX or MD simulations) and interpolates it onto the β grid.

Parameters:
  • Ne_m3 (float) – Electron number density [m⁻³].

  • Te_ev (float) – Electron temperature [eV]. Used to compute the Debye length when use_screening=True.

  • num_points (int, optional) – Number of quadrature points in β (default 50). 20 points is usually sufficient; 50 gives better accuracy in the far wings.

  • max_beta (float, optional) – Upper limit of the β grid (default 10). W(β) is negligible beyond β ≈ 5–8 for typical screening parameters.

  • use_screening (bool, optional) – If True (default) use the Hooper screened distribution; if False use the unscreened Holtsmark distribution.

  • species_charges (list of float, optional) – Ion charge numbers for multi-species Debye screening.

  • species_concentrations (list of float, optional) – Relative ion concentrations N_i / N_e for each species.

  • custom_table_path (str or None, optional) – Path to a plain-text file with columns [β, W(β)]. If loading fails the function falls back to the analytical Hooper distribution with a warning.

Returns:

  • fields (ndarray, shape (num_points,)) – Electric field magnitudes F = β × F₀ [V m⁻¹].

  • weights (ndarray, shape (num_points,)) – Quadrature weights W(β) dβ (dimensionless, sum ≈ 1).

Notes

The grid starts at β = 0 (F = 0) where W(0) = 0. Points with weight ≤ 1e-15 are skipped by the profile integrator for efficiency.

Results are cached internally; repeated calls with identical arguments return the pre-computed arrays without re-evaluating the distribution integrals.