spectrax._simulation

Time integration driver for the spectral Vlasov–Maxwell system.

Functions

cross_product(k_vec, F_vec)

Compute the cross product k × F for length-3 vectors or broadcastable arrays.

ode_system(Nx, Ny, Nz, Nn, Nm, Np, Ns, t, Ck_Fk, args)

Right-hand side for the coupled Vlasov-Maxwell system expressed in spectral form.

simulation([input_parameters, Nx, Ny, Nz, Nn, Nm, Np, ...])

Run a spectral Vlasov-Maxwell simulation and return the solution together with

Module Contents

spectrax._simulation.cross_product(k_vec, F_vec)

Compute the cross product k × F for length-3 vectors or broadcastable arrays.

Parameters:
  • k_vec (array-like) – First vector with leading dimension 3.

  • F_vec (array-like) – Second vector with leading dimension 3.

Returns:

Array representing the cross product with the same trailing shape as the inputs.

Return type:

jnp.ndarray

spectrax._simulation.ode_system(Nx, Ny, Nz, Nn, Nm, Np, Ns, t, Ck_Fk, args)

Right-hand side for the coupled Vlasov-Maxwell system expressed in spectral form.

Parameters:
  • Nx (int) – Number of Fourier modes per spatial dimension.

  • Ny (int) – Number of Fourier modes per spatial dimension.

  • Nz (int) – Number of Fourier modes per spatial dimension.

  • Nn (int) – Number of Hermite modes per velocity-space dimension.

  • Nm (int) – Number of Hermite modes per velocity-space dimension.

  • Np (int) – Number of Hermite modes per velocity-space dimension.

  • Ns (int) – Number of species.

  • t (float) – Integration time (unused but required by Diffrax interface).

  • Ck_Fk (jnp.ndarray) – Flattened state vector containing concatenated Hermite coefficients followed by electromagnetic field coefficients.

  • args (tuple) – Cached parameter tuple produced in simulation providing physical constants, grids, and helper arrays.

Returns:

Flattened derivative vector matching the shape of Ck_Fk.

Return type:

jnp.ndarray

spectrax._simulation.simulation(input_parameters={}, Nx=33, Ny=1, Nz=1, Nn=20, Nm=1, Np=1, Ns=2, timesteps=200, dt=0.01, solver=Dopri8(), adaptive_time_step=True)

Run a spectral Vlasov-Maxwell simulation and return the solution together with the parameter dictionary used to produce it.

Parameters:
  • input_parameters (dict, optional) – User-specified overrides passed to initialize_simulation_parameters.

  • Nx (int, optional) – Number of retained Fourier modes per spatial direction.

  • Ny (int, optional) – Number of retained Fourier modes per spatial direction.

  • Nz (int, optional) – Number of retained Fourier modes per spatial direction.

  • Nn (int, optional) – Number of Hermite modes per velocity-space axis.

  • Nm (int, optional) – Number of Hermite modes per velocity-space axis.

  • Np (int, optional) – Number of Hermite modes per velocity-space axis.

  • Ns (int, optional) – Number of species.

  • timesteps (int, optional) – Number of solution snapshots to save between t=0 and t_max.

  • dt (float, optional) – Initial integration step size.

  • solver (diffrax.AbstractSolver, optional) – Diffrax solver instance controlling the time integration.

Returns:

Dictionary containing the evolved coefficients (Ck, Fk), time samples, perturbation diagnostics, and all simulation parameters.

Return type:

dict