# Ballooning Stability (s-α diagram)

The **Ballooning** tab computes the infinite-n local ballooning eigenvalue across the (s, α) plane — the standard publication figure for tokamak ideal-MHD stability.

## The physics in one paragraph

Pressure-driven instabilities balloon outward at the outboard midplane where the bad curvature lives. The reduced ballooning equation (Connor, Hastie, Taylor 1979):

```
d/dθ {[1 + (s·θ - α·sin θ)²] dF/dθ}
  + α·[cos θ + sin θ·(s·θ - α·sin θ)] F = λ F
```

with F(±∞) = 0. λ tracks instability: more negative λ means stronger growth.

- `s = (r/q) dq/dr` — magnetic shear (stabilizing).
- `α = -(2μ₀ q² R / B²) dp/dr` — pressure gradient (destabilizing).

## What you get

- Heatmap of eigenvalue across (s, α) — red = unstable, blue = stable.
- Yellow curve traces the marginal-stability boundary.
- Status line reports the maximum stable α along the first-stability boundary.

## Reading the diagram

The textbook tokamak operates in the **first stability region** (low α, low-to-moderate s). The boundary curves to the right; high-shear / high-α plasmas can also be stable in the **second stability region** (Greene-Chance 1981).

Reverse-shear and strongly-shaped scenarios access second stability — that's why advanced tokamaks (DIII-D AT, NSTX) report β_N well above the conventional Troyon limit.

## Numerics

- Grid: configurable n_s × n_α. Default 17×17; max 51×51 (validated under 3s budget).
- Theta grid: 401 points on θ ∈ [-6π, +6π]. Bump to 801 if your boundary trace is jagged.
- Solver: tridiagonal inverse iteration with Rayleigh-quotient refinement (60 max iterations).

## References

- Connor, Hastie, Taylor 1979, [Proc. R. Soc. A 365, 1](https://doi.org/10.1098/rspa.1979.0010)
- Greene & Chance 1981, Nucl. Fusion 21, 453
- Wesson 2004, "Tokamaks" §6.6.5
