regcoil.Regcoil

class regcoil.Regcoil(plasma, coil, mpol_potential, ntor_potential, net_poloidal_current=None, net_toroidal_current=0.0, stellarator_symmetric=True)

Assembles matrix_B, matrix_K, and the RHS vectors from a plasma and coil surface, then caches one generalized eigendecomposition so every subsequent lambda is O(nbf**2). Immutable after construction – mutating coil/plasma afterwards does not update a live Regcoil.

__init__ is split into a cheap assembly (surfaces, potential modes, basis_functions, f_all, d_xyz – no Fortran, no big BLAS) and an expensive one (_build_operators: build_g_and_h, matrix_B/K, eigh), so that regcoil.load() can reconstruct a Regcoil from disk running only the cheap part – its stored Solutions then plot with no kernel call. The operators are rebuilt lazily, via _ensure_operators, only if a new lambda is solved on such an object.

__init__(plasma, coil, mpol_potential, ntor_potential, net_poloidal_current=None, net_toroidal_current=0.0, stellarator_symmetric=True)

Methods

__init__(plasma, coil, mpol_potential, ...)

load(path)

Load a Regcoil (plus its plasma and coil) from path.

save(path)

Save this problem (plus its plasma and coil) to path.

scan(lambdas)

Vectorized over an array of lambdas -- free after the eigendecomposition cached in __init__.

solve(lam)

One regularized solve at a single lambda (lam=np.inf is the well-defined heavily-regularized limit) -> Solution.

solve_for_target(metric, value[, xtol, ...])

Bisect (in log(lambda)) for the lambda whose Solution.<metric> (e.g. 'max_K', 'f_B') equals value.