Lorenz 96 model
The Lorenz 96 model is a dynamical system formulated by Edward Lorenz in 1996. It is defined as follows. For :
where it is assumed that and and. Here is the state of the system and is a forcing constant. is a common value known to cause chaotic behavior.
It is commonly used as a model problem in data assimilation.
Python simulation
from scipy.integrate import odeint
import matplotlib.pyplot as plt
import numpy as np
- These are our constants
F = 8 # Forcing
def L96:
"""Lorenz 96 model with constant forcing"""
return - np.roll) * np.roll - x + F
x0 = F * np.ones # Initial state
x0 += 0.01 # Add small perturbation to the first variable
t = np.arange
x = odeint
- Plot the first three variables
ax = fig.add_subplot
ax.plot
ax.set_xlabel
ax.set_ylabel
ax.set_zlabel
plt.show
Julia simulation
using DynamicalSystems, PyPlot
PyPlot.using3D
N = 5
F = 8.0
u₀ = F * ones
u₀ += 0.01 # small perturbation
- The Lorenz-96 model is predefined in DynamicalSystems.jl:
- Equivalently, to define a fast version explicitly, do:
function where
F = p
# 3 edge cases explicitly
@inbounds dx = * x - x + F
@inbounds dx = * x - x + F
@inbounds dx = * x - x + F
# then the general case
for n in 3:
@inbounds dx = * x - x + F
end
return nothing
end
lor96 = Lorenz96 # create struct
ds = ContinuousDynamicalSystem
- And now evolve a trajectory
Tf = 30.0 # final time
tr = trajectory
- And plot in 3D:
plot3D