RasmahRasmah

Operator Inference (OpInf)

Overview

Operator inference (Peherstorfer & Willcox 2016) learns a reduced-order model directly from snapshot data — no access to the governing equations is needed. Given state snapshots X and their time derivatives dX/dt on a basis V, it fits the reduced dynamics

\[\dot{\tilde x} = A \tilde x + B u + H\,(\tilde x \otimes \tilde x) + c\]

by least squares. The learned A, B, H, c then evolve the reduced model at a fraction of the cost of the full simulation.

using Rasmah
using LinearAlgebra

Learn a linear system from data

Generate snapshots of a known linear system dx/dt = A_full x, reduce them with a POD basis, and infer the reduced operator. The inferred operator should reproduce the true reduced dynamics.

A_full = [-0.1 2.0; -2.0 -0.1]          # stable oscillatory system
m = 200
X = zeros(2, m); X[:, 1] = [1.0, 0.0]
dt = 0.05
for k in 1:(m - 1)
    X[:, k + 1] = X[:, k] + dt * (A_full * X[:, k])
end
dXdt = A_full * X                        # exact derivatives

V = svd(X).U[:, 1:2]                     # POD basis (full rank here)
op = opinf(X, dXdt, V; quadratic = false, dt = dt)

println("inferred A ≈ A_full: ", maximum(abs, op.A - (V' * A_full * V)) < 1e-8)
inferred A ≈ A_full: true

Verify the inferred model predicts

March the inferred reduced model and compare it to the true trajectory:

x0 = [1.0, 0.0]
pred = opinf_predict(op, V' * x0, m; u = nothing)
err = maximum(norm(pred[:, k] - V' * X[:, k]) for k in 1:m)
println("reduced prediction error = ", round(err; digits = 10))
reduced prediction error = 0.0

Next steps