spectrax._diagnostics

Post-processing diagnostics for SPECTRAX simulation outputs.

The main entry point is diagnostics(), which takes the dictionary returned by spectrax.simulation.simulation() and adds commonly used derived quantities (energy diagnostics and normalization constants).

This implementation is multi-species: it computes kinetic energy per species from low-order Hermite moments and stores the result in a single array kinetic_energy_species with shape (Nt, Ns).

For backwards compatibility with older plotting scripts, it also writes kinetic_energy_species1, kinetic_energy_species2, … as separate keys when possible.

Functions

diagnostics(→ None)

Compute and attach common diagnostics to output (mutates in-place).

Module Contents

spectrax._diagnostics.diagnostics(output: dict) None

Compute and attach common diagnostics to output (mutates in-place).

Parameters:
  • output (The following keys are added to) –

    Dictionary holding simulation results and parameters. This function expects at least the following keys:

    • alpha_s: array of shape (3*Ns,) (thermal scales per species)

    • u_s: array of shape (3*Ns,) (drift velocities per species)

    • Ck: Hermite-Fourier coefficients of shape (Nt, Ns*Hs, Ny, Nx, Nz)

    • Fk: field Fourier coefficients of shape (Nt, 6, Ny, Nx, Nz)

    • Omega_cs: array of shape (Ns,) (cyclotron frequencies)

    • Lx: domain length in x (used for k_norm)

    Optionally, it may use: - Nn, Nm, Np to decode flattened Hermite indices - mi_me for legacy 2-species Debye length and mass scaling - ms or masses for general per-species mass scaling

  • keys (Added)

  • ----------

  • output

  • Ns (-)

  • lambda_D (-)

  • k_norm (-)

  • kinetic_energy_species (-)

  • kinetic_energy (-)

  • EM_energy (-)

  • total_energy (-)

  • keys) (- kinetic_energy_species{j} for j=1..Ns (back-compat convenience)

Returns:

output is mutated in-place.

Return type:

None