Lorenz-96
Lorenz-96 on a ring of sites around a latitude circle.
- Class:
Lorenz96System - Import:
from skcomplex.systems.physics.climate import Lorenz96System - Field:
physics/climate - Topics:
chaos,ode,atmosphere,spatiotemporal chaos,data assimilation - References:
- Lorenz 1996
- Datseris and Parlitz 2022
Use this system
The block imports the class and simulates the system with its default parameters and its tuned run settings.
from skcomplex.systems.physics.climate import Lorenz96System
trajectory = Lorenz96System().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
n_sites |
20 |
F |
8.0 |
perturbation |
0.01 |
solver |
'auto' |
backend |
'auto' |
Tags
The system with its default parameters has these capability tags, which solvers and analyses check.
| Tag | Values |
|---|---|
| Time | continuous |
| Space | continuous |
| Laws | rate |
| Randomness | deterministic |
| Domains | vector |
| Structure | fixed |
Class
The source of the class shows how it builds its components from its model parameters.
class Lorenz96System(BaseSystem):
"""Lorenz-96 on a ring of sites around a latitude circle.
Every site follows `dx_i/dt = (x_{i+1} - x_{i-2}) x_{i-1} - x_i + F`.
The sites start at the steady state `F`, and the first one is displaced by `perturbation`. For `F = 8` the steady
state is unstable and the ring is chaotic. The system has the values `ring.x` of all sites.
Args:
n_sites:
The number of sites, at least 4, the dimension of the state `x`.
F:
The constant forcing.
perturbation:
The displacement of the first site from the steady state.
label:
The label of the system, which names it when it is nested in another one.
solver:
The solver of the problem, or `'auto'` for the one the system chooses.
backend:
The backend that evaluates the compiled functions, or `'auto'` for the one the system chooses.
Examples:
>>> from skcomplex.systems.physics.climate import Lorenz96System
>>> Lorenz96System(6).prepare().system_.space.n_dim
6
"""
field = 'physics/climate'
topics = ('chaos', 'ode', 'atmosphere', 'spatiotemporal chaos', 'data assimilation')
references = ('Lorenz 1996', 'Datseris and Parlitz 2022')
until = 20.0
dt = 0.05
def __init__(
self,
n_sites: int = 20,
*,
F: float = 8.0,
perturbation: float = 0.01,
label: str = 'system',
solver: BaseSolver | str = 'auto',
backend: BaseBackend | str = 'auto',
) -> None:
super().__init__(label, solver=solver, backend=backend)
self.n_sites = n_sites
self.F = F
self.perturbation = perturbation
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of a ring of sites, at the steady state but for the first one.
Args:
context:
The observables to compile with the problem, or `None` for none.
"""
super()._prepare(context)
values = np.full(self.n_sites, float(self.F))
values[0] += self.perturbation
self.system_ = System(
self.label,
elements=[Lorenz96Element('ring', x=values)],
interactions=[Lorenz96Interaction('advection', target='ring', F=self.F)],
space=ContinuousSpace(n_dim=self.n_sites),
)
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
Lorenz96Element, fromElement
Interactions:
Lorenz96Interaction, fromInteraction
class Lorenz96Element(Element):
"""Ring of Lorenz-96 sites around a latitude circle, with the values `x` of all sites.
Args:
label:
The label of the ring.
x:
The initial values of all sites.
Examples:
>>> from skcomplex.systems.physics.climate import Lorenz96Element
>>> Lorenz96Element('ring', x=[8.0, 8.0, 8.0, 8.0]).x
[8.0, 8.0, 8.0, 8.0]
"""
def __init__(self, label: str, *, x: npt.ArrayLike = 8.0) -> None:
super().__init__(label)
self.x = x
class Lorenz96Interaction(Interaction):
"""Advection, damping, and forcing of the sites of a Lorenz-96 ring.
Every site follows `dx_i/dt = (x_{i+1} - x_{i-2}) x_{i-1} - x_i + F`, with the indices taken around the ring.
Args:
label:
The label of the interaction.
target:
The path of the ring, whose value `x` holds every site.
F:
The constant forcing.
Examples:
>>> from skcomplex.systems.physics.climate import Lorenz96Interaction
>>> Lorenz96Interaction('advection', target='ring').F
8.0
"""
law_classes = (RateLaw,)
def __init__(self, label: str, *, target: Role, F: float = 8.0) -> None:
super().__init__(label)
self.target = target
self.F = F
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the rate of the values of all sites.
Args:
context:
The namespace of the ring, the time `t`, and the forcing.
"""
super()._prepare(context)
x = context.target.x
n_sites = len(x)
rates = [(x[(i + 1) % n_sites] - x[i - 2]) * x[i - 1] - x[i] + context.F for i in range(n_sites)]
self.laws_ = [RateLaw(x, vector(SR, rates))]