The study of dynamical systems is facilitated by a coordinate framework with coordinate surfaces that coincide with invariant structures of the dynamical flow. For integrable (e.g. axisymmetric) systems\, a continuous family of invariant surfaces is guaranteed and action-angle (straight-fieldline) coordinates may be constructed. For non-integrable systems\, e.g. stellarators and perturbed tokamaks\, this continuous family is broken. Nevertheless\,action-angle-like coordinates can still be constructed that simplify the description of the dynamics\, where

possible. The Poincare-Birkhoff theorem\, the Aubry-Mather theorem\, and the KAM theorem show that there are important structures that are invariant under the perturbed dynamics; namely the periodic orbits\, the cantori\,and the irrational flux surfaces. Coordinates adapted to these invariant sets\, which we call chaotic coordinates\,provide substantial advantages. The regular motion becomes straight\, and the irregular motion is bounded by\, and dissected by\, coordinate surfaces that coincide with surfaces of locally-minimal magnetic-fieldline flux. Chaotic coordinates are based on almost-invariant surfaces. The theory of quadratic-flux-minimizing (QFM)surfaces is reviewed\, and the numerical techniques that allow high-order QFM surfaces to be

constructed for chaotic magnetic fields of experimental relevance are described. As a practical example\, the chaotic edge of the

magnetic field as calculated by HINT2 code in the Large Helical Device (LHD) is examined. The theoretical and numerical techniques for finding the boundary surface are implemented\, and a coordinate system based on a selection of QFM surfaces is constructed that simplifies the description of the magnetic field; so that\, to a good approximation\, the flux surfaces (including the last closed flux surface) become straight and the islands become ‘square’. URL:https://wp.physics.wisc.edu/twap/?id=3477 END:VEVENT END:VCALENDAR