torus_solver.vmec

class torus_solver.vmec.VMECBoundary(nfp, m, n, rbc, rbs, zbc, zbs)[source]

Bases: object

Fourier representation of a VMEC boundary surface.

VMEC convention (stellarator-symmetric case):

R(θ,φ) = Σ [RBC(n,m) cos(mθ - n*nfp*φ) + RBS(n,m) sin(mθ - n*nfp*φ)] Z(θ,φ) = Σ [ZBC(n,m) cos(mθ - n*nfp*φ) + ZBS(n,m) sin(mθ - n*nfp*φ)]

Here we use φ on [0,2π) for the full torus, so the nfp factor is included.

Parameters:
  • nfp (int)

  • m (ndarray)

  • n (ndarray)

  • rbc (ndarray)

  • rbs (ndarray)

  • zbc (ndarray)

  • zbs (ndarray)

m: ndarray
n: ndarray
nfp: int
rbc: ndarray
rbs: ndarray
zbc: ndarray
zbs: ndarray
torus_solver.vmec.read_vmec_boundary(path)[source]

Parse a VMEC input file and return the boundary Fourier coefficients.

Return type:

VMECBoundary

Parameters:

path (str | Path)

torus_solver.vmec.vmec_boundary_RZ_and_derivatives(boundary, *, theta, phi)[source]

Evaluate (R,Z) and first derivatives on a (theta,phi) grid.

theta: (Nθ,), phi: (Nφ,) with phi spanning [0,2π) for the full torus. Returns arrays of shape (Nθ,Nφ): (R,Z,R_theta,R_phi,Z_theta,Z_phi).

Return type:

tuple[Array, Array, Array, Array, Array, Array]

Parameters:
torus_solver.vmec.vmec_boundary_xyz_and_normals(boundary, *, theta, phi)[source]

Return xyz and outward unit normal on the VMEC boundary.

Return type:

tuple[Array, Array]

Parameters: