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 = ( μ + A z ) x 1 − ω x 2 x ˙ 2 = ω x 1 + ( μ + A z ) x 2 + u z ˙ = − λ ( z − x 1 2 − x 2 2 ) \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} x ˙ 1 x ˙ 2 z ˙ = ( μ + A z ) x 1 − ω x 2 = ω x 1 + ( μ + A z ) x 2 + u = − λ ( z − x 1 2 − x 2 2 )
with parameters μ = 0.1 \mu = 0.1 μ = 0.1 , ω = 1.0 \omega = 1.0 ω = 1.0 , A = − 0.1 A = -0.1 A = − 0.1 , λ = 1.0 \lambda = 1.0 λ = 1.0 .
The action u u u enters through the x ˙ 2 \dot{x}_2 x ˙ 2 equation. Integration uses RK45 with Δ t = 0.01 s \Delta t = 0.01\,\text{s} Δ t = 0.01 s .
Spaces and limits
Property Value State dimension 3 Action dimension 1 x 1 , x 2 x_1, x_2 x 1 , x 2 range[ − 1 , 1 ] [-1, 1] [ − 1 , 1 ] z z z range[ 0 , 1 ] [0, 1] [ 0 , 1 ] Action range [ − 10 , 10 ] [-10, 10] [ − 10 , 10 ] Δ t \Delta t Δ t 0.01 s Max episode steps 2000 (20 s)
Cost function
c ( x , u ) = x ⊤ Q x + u ⊤ R u , Q = I 3 , R = I 1 c(x, u) = x^\top Q x + u^\top R u, \qquad Q = I_3, \quad R = I_1 c ( x , u ) = x ⊤ Q x + u ⊤ R u , Q = I 3 , R = I 1
Reference point: x ∗ = 0 x^* = \mathbf{0} x ∗ = 0 .
LQR linearisation
The LQR baseline uses the Jacobian linearised at the origin ( x 1 , x 2 , z ) = ( 0 , 0 , 0 ) (x_1, x_2, z) = (0, 0, 0) ( x 1 , x 2 , z ) = ( 0 , 0 , 0 ) :
A lin = ( μ − ω 0 ω μ 0 0 0 − λ ) , B lin = ( 0 1 0 ) 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} A lin = μ ω 0 − ω μ 0 0 0 − λ , B lin = 0 1 0
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 = x 1 2 + x 2 2 z = x_1^2 + x_2^2 z = 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 − μ / A = 1 .
Source: koopmanrl/environments/fluid_flow.py