desc.particles.CurveParticleInitializer

class desc.particles.CurveParticleInitializer(curve, N, E=3500000.0, m=4, q=2, xi_min=-1, xi_max=1, grid=None, seed=0, is_curve_magnetic_axis=False)Source

Randomly sample particles starting on a curve.

Sampling will done on the nodes of the grid based on the curve length represented by |x_s|*ds at each node. Higher the length, more likely a node will be chosen to spawn a particle. Multiple particles can be initialized at the same node.

Parameters:
  • curve (desc.geometry.Curve) – Curve object to initialize samples on.

  • N (int) – Number of particles to generate.

  • E (array-like) – Initial particle kinetic energy, in eV

  • m (array-like) – Mass of particles, in proton masses.

  • q (array-like) – charge of particles, in units of elementary charge.

  • xi_min (float) – Minimum and maximum values for randomly sampled normalized parallel velocity. xi = vpar/v.

  • xi_max (float) – Minimum and maximum values for randomly sampled normalized parallel velocity. xi = vpar/v.

  • grid (Grid) – Grid used to discretize curve. Default is LinearGrid(N=curve.N)

  • seed (int) – Seed for rng.

  • is_curve_magnetic_axis (bool) – Whether user ensures the given curve is the magnetic axis of the equilibrium. If True, additional coordinate mapping is not performed, and particles are initialized directly on the magnetic axis. Defaults to False. Before setting this to True, please make sure the curve is indeed the magnetic axis of the equilibrium, and obtained through an equivalent function such as eq.get_axis().

Methods

copy([deepcopy])

Return a (deep)copy of this object.

equiv(other)

Compare equivalence between DESC objects.

init_particles(model, field, **kwargs)

Initialize particles for a given trajectory model.

load(load_from[, file_format])

Initialize from file.

save(file_name[, file_format, file_mode])

Save the object.