-
gc2ds_classes.py: contains the GC classes and main functions defining the GC dynamics -
run_gc2ds.py: example of a run file to reproduce the computations done in [Mauger, Chandre (2025)]
Once run_gc2ds.py has been edited with the relevant parameters, run the file as
python3 run_gc2ds.pyor in batch mode
nohup python3 -u run_gc2ds.py &>gc2d.out < /dev/null &The list of Python packages and their version are specified in requirements.txt
- A: Amplitude of the electrostatic potential
- M: Number of modes in the electrostatic potential
-
seed: Seed for the random phases
$\phi_{nm}$ of the electrostatic potential (optional; default=27)
params = {"A": 1.0, "M": 16, "seed": 42}
gc = GC2Ds(params)Since GC2Ds is s subclass of HamSys (from the python package pyhamsys), it inherits all its methods, including:
-
integrate: Integrate numerically the trajectories of the system defined by the element of the class GC2Ds from the initial conditions defined by the functioninitial_conditions. -
compute_lyapunov: Compute the Lyapunov spectrum. -
save_data: Save simulation results to a.matfile with metadata.
In addition, GC2Ds has the following key methods:
-
initial_conditions: Generate starting (x, y) positions—random or on a regular grid. -
y_dot: Time derivative of positions for integration. -
k_dot: Scalar diagnostic of the potential field. -
potential: Potential value at time t and position z=(x, y), and its first and second derivatives, obtained by specifying (dx, dy). -
hamiltonian: Total Hamiltonian (sum of the potentials for each trajectory). -
y_dot_lyap: Extended system (equations of motion and tangent flow) for Lyapunov-exponent calculations. -
plot_sol: 2-D plot of a solution obtained by the functionintegrate(for Poincaré sections).
Generate initial 2-D coordinates for trajectories on a periodic domain.
- n_traj: Number of points. For
"fixed", rounded to a perfect square for a square grid. - x, y: (min, max) ranges; default
(0, 2π). - kind:
"random"for uniform random samples,"fixed"for a regular grid. - seed: Random seed when
type="random".
1-D xp.ndarray of length 2*n_traj: all x's followed by all y's.
z0 = gc.initial_conditions(50, type="random", seed=123)
z0 = gc.initial_conditions(100, x=(0, np.pi), y=(0, np.pi), type="fixed")F. Mauger, C. Chandre, Extended phase-space symplectic integration for electron dynamics (2025)
@article{GC2Ds,
title = {Extended phase-space symplectic integration for electron dynamics},
author = {François Mauger and Cristel Chandre},
journal = {},
volume = {},
pages = {},
year = {2025},
doi = {},
}For more information: cristel.chandre@cnrs.fr