Examples - cchandre/HamLorenz GitHub Wiki
The file example1.py computes the solution of a cubic Hamiltonian Lorenz model with N=100 nodes and plots the time series.
The file example2.py computes and plots the Poincaré section of a cubic Hamiltonian Lorenz model with N=6 nodes.
The file example3.py computes the Lyapunov exponents of a cubic Hamiltonian Lorenz model with N=100 nodes.
The file example4.py computes the solution of a custom Hamiltonian Lorenz model with N=100 nodes, defined by $\phi(x)=\sinh(x)$.
The file example5.py simulates and analyzes a Hamiltonian Lorenz model with Casimir $\phi(x) = x + a x^2 + b x^3$. It computes statistical and topological properties such as PDFs, kurtosis, and Euler characteristics of excursion sets to compare the system's behavior with Gaussian reference fields.
The file example6.py simulates and compares the dynamics of two Hamiltonian Lorenz models—one based on a cubic Casimir and the other on a regularized hyperbolic sine Casimir—by integrating their equations, analyzing time series, PDFs, and optionally computing Lyapunov exponents.
from hamlorenz import HamLorenz
import numpy as np
N = 100
tf = 1e4
hl = HamLorenz(N)
x0 = hl.generate_initial_conditions(energy=25, casimirs=[24.8, 22.7])
sol = hl.integrate(tf, x0, t_eval=np.arange(tf), method='BM4', step=1e-1)
hl.plot_timeseries(sol)