Skip to content
Projects

Helix

Download notebookView on GitHubRun when the site was built.

A helical wire of round cross-section: an RF coil, a spring or a helical electrode.

Helix(start, radius, pitch, turns, wire_radius) winds turns times around axis at radius, advancing pitch per turn, right-handed unless left_handed=True. Its ends are hemispherical caps. The level set is the exact signed distance within a wire radius of the wire and a lower bound farther away (level_set_exact is false), so signed_distance measures the distance to a sampled surface mesh instead.

import numpy as np
from simgeometry import Helix
coil = Helix(start=(0.0, 0.0, 0.0), radius=0.5, pitch=0.25, turns=4, wire_radius=0.05)
print("axial length:", coil.length, " wire length:", round(coil.wire_length, 4))
print("start of the wire inside:", coil.contains((0.5, 0.0, 0.0)))
print("axis inside:", coil.contains((0.0, 0.0, 0.5)))
assert np.isclose(coil.wire_length, 4 * np.hypot(2 * np.pi * 0.5, 0.25))
# half a turn in, the centreline is at (-0.5, 0, 0.125); 0.02 outward from it:
level = coil.level_set(np.array([[-0.52], [0.0], [0.125]]))
print(f"level set 0.02 from the centreline: {float(level[0]):.4f}")
assert np.isclose(float(level[0]), 0.02 - 0.05)
axial length: 1.0 wire length: 12.6061
start of the wire inside: True
axis inside: False
level set 0.02 from the centreline: -0.0300
import plasma_plots
import pyvista as pv
pv.OFF_SCREEN = True # render without a window, e.g. on a docs server
plotter = coil.show_3d(
backend="pyvista", display=False, resolution=96, show_bounds=False
)
plasma_plots.scene(plotter, alt="A helical wire of four turns")
A helical wire of four turns
Open in a new tab