tree_d_3d.bodies
Charged particles, alone or adopted by a simulation.
Classes
| Name | Description |
|---|---|
ChargedBody | A physical particle or weighted macroparticle in consistent units. |
ChargedBodyclass#
class ChargedBody(x: float, y: float, vx: float = 0.0, vy: float = 0.0, mass: float = 1.0, charge: float = 1.0, *, weight: float = 1.0, fixed: bool = False)A physical particle or weighted macroparticle in consistent units.
Input mass and charge are per physical particle. Weight multiplies both, preserving q/m; stored mass and charge are the totals. A fixed source stays immobile. SI inputs give SI outputs.
State lives in arrays. A simulation adopts its bodies, after which
pos, vel and force are views of columns of the simulation’s
(2, N) arrays, and reading or assigning any attribute reads or writes
them.
chargeattributeclass attributeinstance attribute#
charge = property(
lambda self: float(self._charge[self._index]),
lambda self,
value: self._charge.__setitem__(self._index, value)
)fixedattributeclass attributeinstance attribute#
fixed = property(
lambda self: bool(self._fixed[self._index]),
lambda self,
value: self._fixed.__setitem__(self._index, value)
)forceattributeclass attributeinstance attribute#
force = property(
lambda self: self._force[:, self._index],
lambda self,
value: self._force.__setitem__((slice(None), self._index), value)
)massattributeclass attributeinstance attribute#
mass = property(
lambda self: float(self._mass[self._index]),
lambda self,
value: self._mass.__setitem__(self._index, value)
)posattributeclass attributeinstance attribute#
pos = property(
lambda self: self._pos[:, self._index],
lambda self,
value: self._pos.__setitem__((slice(None), self._index), value)
)velattributeclass attributeinstance attribute#
vel = property(
lambda self: self._vel[:, self._index],
lambda self,
value: self._vel.__setitem__((slice(None), self._index), value)
)weightattributeinstance attribute#
weight = _finite('weight', weight, positive=True)