plasmacoll.markers
Marker storage that :meth:~plasmacoll.mcc.MonteCarloCollisions.collide_species works on.
Any object with positions, velocities and weights arrays and
remove/add methods (the :class:MarkerSet protocol) can be collided,
so a particle-in-cell code can pass its own particle containers through a thin
adapter. :class:ParticleArrays is a simple implementation that keeps the
markers in three arrays and compacts them on removal.
Classes
| Name | Description |
|---|---|
MarkerSet | The markers of one species, as the collision operator needs them. |
ParticleArrays | Markers of one species held in three arrays. |
MarkerSetclass#
class MarkerSet(Protocol)Bases: Protocol
The markers of one species, as the collision operator needs them.
positions has shape (N, ndim) (any ndim, read only by density
profiles and copied to products), velocities shape (N, 3) in m/s,
weights shape (N,): the number of physical particles per marker.
Collisions update rows of velocities in place.
positionsproperty#
positions: ArrayReturn the marker positions, shape (N, ndim).
velocitiesproperty#
velocities: ArrayReturn the marker velocities, shape (N, 3), updated in place.
weightsproperty#
weights: ArrayReturn the marker weights, shape (N,).
ParticleArraysclassdataclass#
class ParticleArrays(positions: Array, velocities: Array, weights: Array)Markers of one species held in three arrays.
Attributes
| Name | Type | Description |
|---|---|---|
positions | Array | Positions, shape (N, ndim). |
velocities | Array | Velocities in m/s, shape (N, 3). |
weights | Array | Physical particles per marker, shape (N,). |
positionsattributeinstance attribute#
positions: Arrayvelocitiesattributeinstance attribute#
velocities: Arrayweightsattributeinstance attribute#
weights: Arraytotal_weightproperty#
total_weight: floatReturn the number of physical particles the markers represent.
addmethod#
def add(positions: Array, velocities: Array, weights: Array) -> NoneAppend new markers.
emptymethodclassmethod#
def empty(ndim: int = 1) -> ParticleArraysReturn a set without markers, with ndim position components.
maxwellianmethodclassmethod#
def maxwellian(num: int, mass: float, temperature: float, weight: float = 1.0, drift: tuple[float, float, float] = (0.0, 0.0, 0.0), ndim: int = 1, rng: Any = None, seed: int | None = None) -> ParticleArraysSample num markers from a drifting Maxwellian, all at the origin.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
num | int | required | The number of markers. |
mass | float | required | Particle mass in kg. |
temperature | float | required | Temperature in K; see :func:plasmacoll.constants.ev_to_kelvin. |
weight | float | 1.0 | Physical particles per marker. |
drift | tuple[float, float, float] | (0.0, 0.0, 0.0) | Mean velocity in m/s. |
ndim | int | 1 | Number of position components. |
rng | Any | None | A NumPy or CuPy Generator; one seeded with seed if None. |
seed | int | None | None | Seed of the generator made when rng is None. |
mean_energy_evmethod#
def mean_energy_ev(mass: float) -> floatReturn the weighted mean kinetic energy in eV (0 without markers).
removemethod#
def remove(mask: Array) -> NoneRemove the markers flagged in the boolean mask.
temperaturemethod#
def temperature(mass: float) -> floatReturn the kinetic temperature in K about the mean velocity (0 if empty).