Architecture#
pyna is organised around two ideas:
dynamical systems define evolution rules on finite-dimensional phase spaces;
topology modules describe geometric objects living in those phase spaces.
This separation lets the same object hierarchy represent toroidal magnetic field-line structures, Hamiltonian resonance zones, classical maps, N-body orbits and stochastic sample paths.
Layer 0: Dynamics#
pyna.topo.dynamics provides the abstract mathematical layer:
PhaseSpaceContinuousFlowHamiltonianFlowDiscreteMapPoincareMapandGeneralPoincareMap
pyna.dynamics adds ready-to-use finite-dimensional systems:
CallableFlowandCallableMapHamiltonianSystemandSeparableHamiltonianSystemNBodySystemItoSDE,BrownianMotionandGeometricBrownianMotion
These classes use the topology core for sampled outputs. A deterministic flow
trajectory is a pyna.topo.core.Trajectory; a discrete iterate cloud is a
pyna.topo.core.Orbit.
Layer 1: Geometry#
pyna.topo.core is the domain-agnostic geometry hierarchy:
Class |
Meaning |
Time type |
|---|---|---|
|
finite sampled curve in phase space |
continuous |
|
periodic orbit of a continuous flow |
continuous |
|
resonance zone around an elliptic cycle |
continuous |
|
family of tubes sharing one resonance |
continuous |
|
finite sampled iterates of a map |
discrete |
|
finite periodic orbit of a map |
discrete |
|
one resonance island on a section |
discrete |
|
periodic chain of islands on a section |
discrete |
The key bridge is section_cut:
Cycle --section_cut--> PeriodicOrbit
Tube --section_cut--> IslandChain
TubeChain --section_cut--> IslandChain
This mirrors the toroidal workflow where continuous magnetic island tubes are observed as discrete island chains on a Poincare section.
Layer 2: Toroidal Specialization#
pyna.topo.toroidal subclasses the generic core:
core.SectionPoint -> toroidal.FixedPoint
core.PeriodicOrbit -> toroidal.PeriodicOrbit
core.Cycle -> toroidal.Cycle
core.Island -> toroidal.Island
core.IslandChain -> toroidal.IslandChain
core.Tube -> toroidal.Tube
core.TubeChain -> toroidal.TubeChain
The toroidal layer adds:
R,Zandphicoordinateswinding numbers
(m, n)DPmand monodromy classificationcyna-accelerated section cuts and tracing
section-view correspondence and reconstruction helpers
Layer 3: Workflow and Extension Helpers#
pyna.topo.protocols, adapters, builders, bridges and
factories provide the software-engineering extension layer. The main
notebook-facing entry point is TopologyWorkflow. These helpers keep
construction policy and backend selection outside the mathematical dataclasses:
external systems can conform by protocol, normalize data with adapters, promote
objects through builders, cut continuous geometry through bridges, and select
runtime implementations through factories.
Layer 4: Acceleration#
cyna implements the bottlenecks behind high-level pyna APIs. It should not
own high-level scientific object semantics; it supplies fast kernels for
tracing, interpolation, fixed-point scans, wall hits and perturbation response.
Design Rules#
Prefer generic
pyna.topo.coreclasses for new finite-dimensional geometry.Add toroidal-specific fields only in
pyna.topo.toroidalsubclasses.A sampled finite trajectory is geometry, not automatically an invariant set.
Promote objects to
Cycle/PeriodicOrbitonly when a periodic structure is part of the model or has been validated numerically.Keep cyna at bridge boundaries; application-level APIs should return pyna objects, not raw C++ arrays.