Lorenz 96 modelThe Lorenz 96 model is a dynamical system formulated by Edward Lorenz in 1996.[1] 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.[2] Python simulation![]() from scipy.integrate import odeint
import matplotlib.pyplot as plt
import numpy as np
# These are our constants
N = 5 # Number of variables
F = 8 # Forcing
def L96(x, t):
"""Lorenz 96 model with constant forcing"""
return (np.roll(x, -1) - np.roll(x, 2)) * np.roll(x, 1) - x + F
x0 = F * np.ones(N) # Initial state (equilibrium)
x0[0] += 0.01 # Add small perturbation to the first variable
t = np.arange(0.0, 30.0, 0.01)
x = odeint(L96, x0, t)
# Plot the first three variables
fig = plt.figure()
ax = fig.add_subplot(projection="3d")
ax.plot(x[:, 0], x[:, 1], x[:, 2])
ax.set_xlabel("$x_1$")
ax.set_ylabel("$x_2$")
ax.set_zlabel("$x_3$")
plt.show()
Julia simulationusing DynamicalSystems, PyPlot
PyPlot.using3D()
# parameters and initial conditions
N = 5
F = 8.0
u₀ = F * ones(N)
u₀[1] += 0.01 # small perturbation
# The Lorenz-96 model is predefined in DynamicalSystems.jl:
ds = Systems.lorenz96(N; F = F)
# Equivalently, to define a fast version explicitly, do:
struct Lorenz96{N} end # Structure for size type
function (obj::Lorenz96{N})(dx, x, p, t) where {N}
F = p[1]
# 3 edge cases explicitly (performance)
@inbounds dx[1] = (x[2] - x[N - 1]) * x[N] - x[1] + F
@inbounds dx[2] = (x[3] - x[N]) * x[1] - x[2] + F
@inbounds dx[N] = (x[1] - x[N - 2]) * x[N - 1] - x[N] + F
# then the general case
for n in 3:(N - 1)
@inbounds dx[n] = (x[n + 1] - x[n - 2]) * x[n - 1] - x[n] + F
end
return nothing
end
lor96 = Lorenz96{N}() # create struct
ds = ContinuousDynamicalSystem(lor96, u₀, [F])
# And now evolve a trajectory
dt = 0.01 # sampling time
Tf = 30.0 # final time
tr = trajectory(ds, Tf; dt = dt)
# And plot in 3D:
x, y, z = columns(tr)
plot3D(x, y, z)
References
|
Index:
pl ar de en es fr it arz nl ja pt ceb sv uk vi war zh ru af ast az bg zh-min-nan bn be ca cs cy da et el eo eu fa gl ko hi hr id he ka la lv lt hu mk ms min no nn ce uz kk ro simple sk sl sr sh fi ta tt th tg azb tr ur zh-yue hy my ace als am an hyw ban bjn map-bms ba be-tarask bcl bpy bar bs br cv nv eml hif fo fy ga gd gu hak ha hsb io ig ilo ia ie os is jv kn ht ku ckb ky mrj lb lij li lmo mai mg ml zh-classical mr xmf mzn cdo mn nap new ne frr oc mhr or as pa pnb ps pms nds crh qu sa sah sco sq scn si sd szl su sw tl shn te bug vec vo wa wuu yi yo diq bat-smg zu lad kbd ang smn ab roa-rup frp arc gn av ay bh bi bo bxr cbk-zam co za dag ary se pdc dv dsb myv ext fur gv gag inh ki glk gan guw xal haw rw kbp pam csb kw km kv koi kg gom ks gcr lo lbe ltg lez nia ln jbo lg mt mi tw mwl mdf mnw nqo fj nah na nds-nl nrm nov om pi pag pap pfl pcd krc kaa ksh rm rue sm sat sc trv stq nso sn cu so srn kab roa-tara tet tpi to chr tum tk tyv udm ug vep fiu-vro vls wo xh zea ty ak bm ch ny ee ff got iu ik kl mad cr pih ami pwn pnt dz rmy rn sg st tn ss ti din chy ts kcg ve
Portal di Ensiklopedia Dunia