Lorenz-84
Lorenz-84, the general circulation as a westerly jet and a travelling wave.
- Class:
Lorenz84System - Import:
from skcomplex.systems.physics.climate import Lorenz84System - Field:
physics/climate - Topics:
chaos,ode,atmosphere,general circulation - References:
- Lorenz 1984
- 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 Lorenz84System
trajectory = Lorenz84System().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
x |
1.0 |
y |
1.0 |
z |
1.0 |
a |
0.25 |
b |
4.0 |
F |
8.0 |
G |
1.0 |
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 | none |
| Laws | rate |
| Randomness | deterministic |
| Domains | real |
| Structure | fixed |
Class
The source of the class shows how it builds its components from its model parameters.
class Lorenz84System(BaseSystem):
"""Lorenz-84, the general circulation as a westerly jet and a travelling wave.
The system is chaotic for `F = 8`.
The jet `x` and the cosine and sine phases `y` and `z` of the eddies follow `dx/dt = -y^2 - z^2 - a x + a F`, `dy/dt
= x y - b x z - y + G`, and `dz/dt = b x y + x z - z`. The system has the states `atmosphere.x`, `atmosphere.y`, and
`atmosphere.z`.
Args:
x:
The initial strength of the westerly jet.
y:
The initial cosine phase of the eddies.
z:
The initial sine phase of the eddies.
a:
The damping of the jet relative to the eddies.
b:
The displacement of the eddies by the jet.
F:
The forcing of the jet by the equator-to-pole temperature contrast.
G:
The forcing of the eddies by the land-sea contrast.
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 Lorenz84System
>>> Lorenz84System(G=1.25).prepare().system_.interactions[0].G
1.25
"""
field = 'physics/climate'
topics = ('chaos', 'ode', 'atmosphere', 'general circulation')
references = ('Lorenz 1984', 'Datseris and Parlitz 2022')
until = 100.0
dt = 0.05
def __init__(
self,
x: float = 1.0,
y: float = 1.0,
z: float = 1.0,
*,
a: float = 0.25,
b: float = 4.0,
F: float = 8.0,
G: float = 1.0,
label: str = 'system',
solver: BaseSolver | str = 'auto',
backend: BaseBackend | str = 'auto',
) -> None:
super().__init__(label, solver=solver, backend=backend)
self.x = x
self.y = y
self.z = z
self.a = a
self.b = b
self.F = F
self.G = G
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of the jet and the eddies of the atmosphere.
Args:
context:
The observables to compile with the problem, or `None` for none.
"""
super()._prepare(context)
self.system_ = System(
self.label,
elements=[Lorenz84Element('atmosphere', x=self.x, y=self.y, z=self.z)],
interactions=[
Lorenz84Interaction('circulation', target='atmosphere', a=self.a, b=self.b, F=self.F, G=self.G),
],
)
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
Lorenz84Element, fromElement
Interactions:
Lorenz84Interaction, fromInteraction
class Lorenz84Element(Element):
"""Atmosphere of Lorenz-84.
The general circulation is reduced to a westerly jet `x` and a travelling wave of eddies, whose cosine and sine
phases are `y` and `z`. `Lorenz84Interaction` gives their laws.
Args:
label:
The label of the atmosphere.
x:
The initial strength of the westerly jet.
y:
The initial cosine phase of the eddies.
z:
The initial sine phase of the eddies.
Examples:
>>> from skcomplex.systems.physics.climate import Lorenz84Element
>>> Lorenz84Element('atmosphere', x=2.0).x
2.0
"""
def __init__(self, label: str, *, x: float = 1.0, y: float = 1.0, z: float = 1.0) -> None:
super().__init__(label)
self.x = x
self.y = y
self.z = z
class Lorenz84Interaction(Interaction):
"""Forcing and damping of the jet of Lorenz-84 and its exchange with the eddies.
The jet `x` and the phases `y` and `z` of the eddies of the target follow `x' = -y^2 - z^2 - a x + a F`,
`y' = x y - b x z - y + G`, and `z' = b x y + x z - z`.
Args:
label:
The label of the interaction.
target:
The path of the atmosphere.
a:
The damping of the jet relative to the eddies.
b:
The displacement of the eddies by the jet.
F:
The forcing of the jet by the equator-to-pole temperature contrast.
G:
The forcing of the eddies by the land-sea contrast.
Examples:
>>> from skcomplex.systems.physics.climate import Lorenz84Interaction
>>> Lorenz84Interaction('circulation', target='atmosphere').F
8.0
"""
law_classes = (RateLaw,)
def __init__(
self,
label: str,
*,
target: Role,
a: float = 0.25,
b: float = 4.0,
F: float = 8.0,
G: float = 1.0,
) -> None:
super().__init__(label)
self.target = target
self.a = a
self.b = b
self.F = F
self.G = G
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the rates of the jet and of both phases of the eddies.
Args:
context:
The namespace of the atmosphere, the time `t`, and the parameters.
"""
super()._prepare(context)
x, y, z, t = context.target.x, context.target.y, context.target.z, context.t
a, b = context.a, context.b
self.laws_ = [
RateLaw(x.diff(t), -(y**2) - z**2 - a * x + a * context.F),
RateLaw(y.diff(t), x * y - b * x * z - y + context.G),
RateLaw(z.diff(t), b * x * y + x * z - z),
]
Equations
The equations are those that symbolic returns for the system with its default parameters.
atmosphere.x: diff(x_atmosphere(t), t) == F_circulation*a_circulation - a_circulation*x_atmosphere(t) - y_atmosphere(t)^2 - z_atmosphere(t)^2
atmosphere.y: diff(y_atmosphere(t), t) == -b_circulation*x_atmosphere(t)*z_atmosphere(t) + x_atmosphere(t)*y_atmosphere(t) + G_circulation - y_atmosphere(t)
atmosphere.z: diff(z_atmosphere(t), t) == b_circulation*x_atmosphere(t)*y_atmosphere(t) + x_atmosphere(t)*z_atmosphere(t) - z_atmosphere(t)