Live demo: charts and modes on a chaotic attractor
A quantized-local reduced-order model is fixed by two numbers: the number of charts, \(K\), into which the attractor is quantized, and the number of modes per chart, \(r\), which is the dimension of each local basis. This page lets you move both with a slider and shows what each choice changes: which part of the attractor every chart owns, how much of a test window the charts represent at all, and how long a closed-loop forecast of the reduced model stays on top of the reference solution. Every panel also draws the single-chart model at the same number of modes, because quantization is worth something only against that baseline.
The test case is the 1-D Kuramoto–Sivashinsky equation in its chaotic regime, which is
the case qlroms.intrusive_qlroms.ks1d registers as "chaotic". The
models are intrusive: every chart carries the Kuramoto–Sivashinsky equation projected
onto its own basis, and the reduced coordinates are handed from chart to chart by the
transition maps.
How to read the panels
Attractor and charts. Every dot is one training snapshot, drawn in the plane of the two leading global proper orthogonal decomposition (POD) coefficients and coloured by the chart that owns it. The numbered discs are the chart centroids, the black line is the closed-loop forecast of the reduced model in the same plane, and the dashed line is the forecast of the single-chart model at the same number of modes. Each line stops, with a cross, at the instant that forecast leaves the range of the attractor. Moving \(K\) repartitions the same cloud: the charts of the chaotic case cut one connected cloud rather than separate lobes, because this attractor does not split into disjoint regimes.
Space-time forecast. The field \(u(x, t)\) of the full-order model, of the selected reduced model and of the single-chart model at the same number of modes, all started from the same initial condition and drawn on the same colour scale. The two fields separate where the forecast loses the phase of the travelling structures, which happens the earlier the smaller \(r\) is.
Error history. The forecast error is the relative error of the closed-loop forecast against the reference solution. The representation error is what remains when the true snapshots are projected onto the charts and lifted back, so it is the floor that no forecast on that geometry improves upon. The dashed line is the forecast error of the single-chart model, and the fourth tile above reads the difference between the two predictability times.
Predictability over the sweep. The predictability time of every model of the sweep, one cell per pair \((K, r)\). Clicking a cell loads that model into the other panels.
Representation error against one chart. The same grid, carrying the representation error of \(K\) charts divided by that of a single global basis of the same size, \(r\). Below 1 the charts represent the unseen window better than one global basis at equal cost; above 1 they represent it worse. The row \(K = 1\) is 1 by construction.
Chart occupancy. The fraction of the training attractor each chart owns, next to the fraction of the forecast spent in it. A forecast that visits only some of the charts, or that parks in one of them, has left the attractor.
Chart sequence. The same occupancy resolved in time: the chart index against time, for the forecast and for the true state over the same window. The two agree while the forecast is still a forecast, and part at the predictability time, which the dashed line marks. The sequence therefore separates the two ways a quantized-local model fails: the state may be carried to the wrong chart, and the dynamics within the right chart may still be wrong.
The model behind the sliders
The full-order model is the 1-D Kuramoto–Sivashinsky equation
where \(u(x, t)\) is the scalar field; \(\nu\) is the viscosity; and the domain is periodic, \(x \in [0, L)\). The demo runs the chaotic regime \(\nu = 1\) and \(L = 20\pi\), for which the leading Lyapunov exponent is \(\lambda_1 = 0.062\), so the Lyapunov time is \(t_\lambda = 1/\lambda_1 = 16.1\). Equation (1) is discretized on \(N = 128\) equispaced grid points and advanced with a fourth-order exponential time-differencing Runge–Kutta scheme with a time step \(\Delta t = 0.05\), as proposed by Kassam and Trefethen (2005). The state is the vector of grid values, \(\bm{u} \in \mathbb{R}^{N}\), and one snapshot is one state.
The charts quantize the attractor. K-means on the training snapshots returns \(K\) centroids \(\bm{c}_k\), and chart \(k\) owns the snapshots whose nearest centroid is \(\bm{c}_k\). Each chart carries the POD basis \(\bm{\Phi}_k \in \mathbb{R}^{N \times r}\) of its own snapshots, centred on its own centroid, so a state that the chart owns is represented as
where \(\bm{a} \in \mathbb{R}^{r}\) are the reduced coordinates. The two sliders move exactly the two numbers of equation (2): \(K\) sets how many bases there are, and \(r\) sets how many columns each of them has.
Substituting the representation in equation (2) into equation (1) and projecting onto \(\bm{\Phi}_k\) gives one quadratic system per chart
where \(\bm{b}_k = \bm{\Phi}_k^\top\mathbf{L}\bm{c}_k\) is the constant forcing of the centroid; \(\mathbf{A}_k = \bm{\Phi}_k^\top\mathbf{L}\bm{\Phi}_k\) is the projected linear operator, with \(\mathbf{L}\) the discretization of the second and fourth derivatives of equation (1); and \(\mathsf{B}_k\) is the projected convective term. The quadratic term is evaluated by lifting the reduced coordinates to the grid, squaring the field there, and projecting the result back, which is exact for a quadratic nonlinearity and costs one matrix-vector product per grid point. Equation (3) is advanced with the same time-stepping scheme as equation (1), applied to the projected linear operator \(\mathbf{A}_k\).
A forecast crosses chart boundaries. At every step the model measures the distance of the current reduced state to each centroid, and when the nearest chart changes from \(j\) to \(k\), the coordinates are carried over by the transition map
The map in equation (4) is exact only in the atlas, the shared global coordinate system
of qlroms.atlas, because two local bases of \(r < N\) columns do
not span the same subspace; the part of the state that chart \(k\) cannot represent is lost
at the switch. This is one of the two error sources the demo separates, the other being
the truncation of equation (2) itself.
The panels report two errors and one time. The representation error
in which \(k\) is the chart nearest to the true state \(\bm{u}(t)\), measures the geometry alone, with no time stepping. The forecast error \(e(t)\) replaces the bracket of equation (5) with the closed-loop forecast, which is started from the first test snapshot and advanced without ever seeing the reference solution again. The predictability time, \(T_\mathrm{ph}\), is the first time at which \(e(t)\) exceeds 0.5, and is reported in Lyapunov times, as in Colanera and Magri (2025).
What the sweep shows
The dimension of the reduced state sets the predictability time. At \(r = 20\) modes, the lower end of the sweep, the representation error is 0.30 with one chart and 0.24 with ten, and no model survives a fifth of a Lyapunov time. At \(r = 48\) the representation error drops to 0.007 with one chart and 0.005 with ten, and the forecasts hold for between 1.2 and 2.3 Lyapunov times; at \(r = 64\), half of the 128 grid points, the single-chart model reaches 3.6 Lyapunov times.
Quantization lowers the representation error in every cell of the sweep, provided that each chart owns enough snapshots. The ratio map states the trade-off: every model with more than one chart is below 1, the ratio falls as charts are added up to eight and is then flat, and from six charts on it lies between 0.72 and 0.86 at every basis size, with the lowest value, 0.72, at eight charts of 64 modes. The gain depends on the amount of data each basis is fitted on: a chart owns about \(N_\mathrm{train}/K\) snapshots, so at twelve charts each local basis is built from some 16 700 of the 200 000 training snapshots. With a training window of 40 000 snapshots each of the twelve local bases is built from some 3 300 snapshots, and a 64-mode basis fitted on that much data does not carry to the unseen window: on the same test window, the ratio at twelve charts of 64 modes is 1.30 instead of 0.78, and every model of eight charts or more is above 1 from \(r = 28\).
Predictability follows the modes up to 40 modes, and the charts from 48 modes on. Below 40 modes every model of the sweep leaves the attractor within half a Lyapunov time, and the differences between the cells of a column are the scatter of single forecasts rather than an ordering. At \(r = 48\) every model with more than one chart outlasts the single-chart model, between 1.7 and 2.3 Lyapunov times against 1.2; at \(r = 64\) the quantized models span 3.6 to 6.7 Lyapunov times against 3.6, with twelve charts reaching 6.7. The exception is \(r = 56\), where they straddle the single-chart value, between 2.7 and 4.4 against 3.5. Because each cell is one forecast from one initial condition, the ordering within a column carries that spread, and what the map supports is the trend across columns: with enough data per chart, quantization buys length of forecast as well as accuracy of representation. Either way, a fair comparison between \(K = 1\) and \(K > 1\) is one at equal \(r\), which is what the two sliders hold fixed.
The clustering itself is a choice, and not a given: k-means here runs on the physical
snapshots, with one snapshot assigned to one chart, and the space it clusters in, the
tolerance for overlapping assignment and the transition rule are all arguments of
fit_clusters. Tutorial
3 runs the same \((K, r)\) sweep with the
diagnosis stack, and tutorial 1 varies those
clustering arguments.
How the data are produced
The page is static: every number it shows is precomputed by one script, and the browser only selects between stored states. To regenerate the sweep, or to run it on another case or another grid, run
python scripts/ks/build_web_demo_data.py --Ntrain 200000 --Ntest 4000 --out docs/demo/data
The script generates the trajectory of the full-order model, splits it into a training
window of 200 000 snapshots and a test window of 4 000 snapshots (\(12.4\,t_\lambda\)), fits
the charts once per \(K\) with build_local_model, truncates that model to each \(r\), and
forecasts in closed loop from the first test snapshot. It writes one JSON file per
\((K, r)\) pair, plus an index, which is what the page fetches when a slider moves.
The length of the training window is set by the local bases, and not by the global basis. With 40 000 snapshots instead of 200 000, the representation error of the single-chart model changes by 0.003 at \(r = 32\), which is 5% of its value, whereas the representation error of twelve charts of 64 modes increases by a factor of 1.8, which moves its ratio to the single-chart model from 0.77 to 1.30; at 100 000 snapshots that ratio is 0.87. The sweep covers \(K = 1\) to 12 charts and \(r = 20\) to 64 modes. The upper bound is half of the 128 grid points, beyond which a reduced-order model of this case is no longer a reduction worth making. The lower bound is the point below which the comparison stops carrying information: at \(r = 16\) or fewer modes the representation error exceeds 0.31, every model of the sweep leaves the attractor in about a tenth of a Lyapunov time, and one dead forecast cannot be told from another.
Two caveats follow from the design. Each cell of the sweep is a single forecast from a
single initial condition, so its predictability time carries the spread of chaotic
trajectories and is not an average over the attractor; the diagnosis stack in
qlroms.utils.diagnosis is the tool for averaged statistics.
The space-time fields are stored as 8-bit images of 200 columns, which is enough to see
the structures move, but not to measure them.
References
- Kassam, A.-K., & Trefethen, L. N. (2005). Fourth-order time-stepping for stiff PDEs. SIAM Journal on Scientific Computing, 26(4), 1214–1233.
- Colanera, A., & Magri, L. (2025). Quantized local reduced-order modeling in time (ql-ROM). Computer Methods in Applied Mechanics and Engineering, 447, 118393.