← f_ notebook · ideas/f_swift.md

f_swift — Swift-Hohenberg generator (working name) ​

Status: ⚪ concept only. Captured 2026-11-28 (Claude offline, docs only) from ideas/visualpde_survey.md. Equation forms are observed in VisualPDE's presets.js; the reuse of the f_ks and f_cgl machinery is inferred. Nothing tried, specced or benched. Priority 2 in the survey, the cheapest to build.

Why this one ​

Swift-Hohenberg is the standard model of stripe and hexagon pattern onset: a stationary instability with a preferred wavelength, capped by a nonlinearity. It is the real-valued sibling of the amplitude equations behind f_cgl (the Ginzburg-Landau envelope of an SH pattern, pattern_formation_orientation.md, from the Wikipedia page per its own tag). It is also fourth-order and stiff, which is why f_ks is solved spectrally; SH is the same kind of problem.

du/dt = r u - (1 + lap)^2 u + N(u)         (N a quadratic-cubic or cubic-quintic nonlinearity)

(That form is the textbook equation, from memory, not read in the clone.) VisualPDE writes it as a second-order system to keep the stencil small: an auxiliary field v with cross-diffusion terms diffusionStr_1_2: -D, diffusionStr_2_1: D, reaction (r - 1) u - 2 v + a u^2 + b u^3 (+ c u^5), dt = 0.0005 (observed in swiftHohenberg and swiftHohenbergLocalised). A spectral solver does not need that rewrite.

Regimes VisualPDE already carries (observed names) ​

swiftHohenberg (the default), swiftHohenbergLocalised (isolated patches that neither spread nor shrink), swiftHohenbergRight, swiftHohenbergLocalisedDirectedAdvection, swiftHohenbergLocalisedRotationalAdvection (the pattern advected by a drift), Heterogeneous-Swift-Hohenberg (a spatially varying r), SuperlatticeDynamic and Superlattice* (two-wavelength lattices; the _nonlinear-physics/superlattice-patterns.md page). The parameter values of these were not tabulated here.

What f_ would offer ​

  • Stripes, hexagons (with a quadratic term) and squares or quasi-patterns; localized "snaking" patches.
  • r map by texture (the Heterogeneous preset): an image sets where the pattern exists, so a mask or image carves the stripe field. A cheap, striking input mode.
  • Drift (the advected presets): a vecfield inlet that moves the pattern. That would couple to the f_ vecfield family, which no spectral generator here does today.
  • Outlets: look, exact gradient vecfield (stripe direction) and a tensor of the local orientation are the natural faces, since the pattern has a clear local axis. A tensor from the state is f_nematic territory (ideas/f_nematic.md); only mention it, do not scope it here.

Overlap ​

  • f_ks: a different instability (KS has a band of growing modes with chaos; SH has a sharp preferred wavelength and, near onset, ordered stripes). The two feel different but share a solver.
  • f_quasi: also makes stripes and quasi-patterns, but it is a stateless generator; SH is dynamical and can show defects and grain boundaries.
  • Maybe a mode of f_ks rather than a module: P-quasi-nwaves records Matt calling a related idea "maybe a mode of f_quasi". That is Matt's call.

Solver and cost [inferred, unchecked] ​

Spectral split-step, like f_ks (2.39 ms per frame) and f_cgl (about 3.47 ms, an upper bound, per docs/f-reference/f_cgl.md). The linear operator r - (1 - k^2)^2 is exact per Fourier bin; the nonlinearity is pointwise. If f_ks and f_cgl share a stepper, SH is a new kernel and a new dial set, not a new solver class. This was not checked against src/f_ks/ or src/f_cgl/.

Open questions ​

  1. Module or f_ks mode.
  2. Which nonlinearity: quadratic-cubic (hexagons), cubic-quintic (localized states), or a menu.
  3. Whether a vecfield drift inlet is worth the panel space (G-ui-density).
  4. Edge behavior is periodic by construction in a spectral solver; clamped edges would need a different method.

Gate ​

P-pattern-gen. Menu home: PDE (G-menu).