Skip to main content

Fluid Flow (FluidFlow-v0)

The Fluid Flow environment models a two-dimensional oscillatory shear flow. It is a canonical example of a system with nonlinear amplitude-frequency coupling that still admits a low-dimensional Koopman representation.

Dynamics​

The continuous-time dynamics are

x˙1=(μ+Az) x1−ω x2x˙2=ω x1+(μ+Az) x2+uz˙=−λ(z−x12−x22)\begin{aligned} \dot{x}_1 &= (\mu + A z)\, x_1 - \omega\, x_2 \\ \dot{x}_2 &= \omega\, x_1 + (\mu + A z)\, x_2 + u \\ \dot{z} &= -\lambda\bigl(z - x_1^2 - x_2^2\bigr) \end{aligned}

with parameters μ=0.1\mu = 0.1, ω=1.0\omega = 1.0, A=−0.1A = -0.1, λ=1.0\lambda = 1.0.

The action uu enters through the x˙2\dot{x}_2 equation. Integration uses RK45 with Δt=0.01 s\Delta t = 0.01\,\text{s}.

Spaces and limits​

PropertyValue
State dimension3
Action dimension1
x1,x2x_1, x_2 range[−1,1][-1, 1]
zz range[0,1][0, 1]
Action range[−10,10][-10, 10]
Δt\Delta t0.01 s
Max episode steps2000 (20 s)

Cost function​

c(x,u)=x⊤Qx+u⊤Ru,Q=I3,R=I1c(x, u) = x^\top Q x + u^\top R u, \qquad Q = I_3, \quad R = I_1

Reference point: x∗=0x^* = \mathbf{0}.

LQR linearisation​

The LQR baseline uses the Jacobian linearised at the origin (x1,x2,z)=(0,0,0)(x_1, x_2, z) = (0, 0, 0):

Alin=(μ−ω0ωμ000−λ),Blin=(010)A_{\text{lin}} = \begin{pmatrix} \mu & -\omega & 0 \\ \omega & \mu & 0 \\ 0 & 0 & -\lambda \end{pmatrix}, \qquad B_{\text{lin}} = \begin{pmatrix} 0 \\ 1 \\ 0 \end{pmatrix}

Usage​

uv run -m koopmanrl.soft_koopman_value_iteration --env_id FluidFlow-v0
uv run -m koopmanrl.soft_actor_koopman_critic \
--config_file configurations/sakc_fluid_flow_hparams.json

Notes​

  • The third state z=x12+x22z = x_1^2 + x_2^2 is the amplitude squared; the system has a natural limit cycle at radius −μ/A=1\sqrt{-\mu / A} = 1.
  • Source: koopmanrl/environments/fluid_flow.py