Skip to content

Add periodic GEM Fourier reconnection example - #37

Closed
rogeriojorge wants to merge 2 commits into
mainfrom
agent/gem-fourier-reconnection
Closed

rogeriojorge wants to merge 2 commits into
mainfrom
agent/gem-fourier-reconnection

Conversation

@rogeriojorge

Copy link
Copy Markdown
Member

Summary

  • add one self-contained Fourier--Hermite example for a GEM-normalized Harris-sheet reconnection problem
  • double the transverse GEM domain and use two well-separated sheets so both spatial directions remain periodic
  • retain the GEM mass/temperature ratios, sheet width, background density, Alfvén speed, perturbation amplitude, and original 0.2 d_i spatial spacing
  • save reconnected flux and a |B| movie with magnetic-flux contours
  • evolve in short chunks so long runs retain only requested movie frames

This PR changes no solver source, test, or configuration file. Its complete scope is one 171-line example and the two media files shown below.

Scope of the benchmark

The original GEM challenge uses a single Harris sheet, periodic x, and conducting walls in y. SPECTRAX's Fourier solver is periodic, so this is explicitly a doubly periodic GEM analogue, not an exact reproduction of the wall-bounded benchmark. The transverse domain is doubled from 12.8 d_i to 25.6 d_i, placing sheets at one and three quarters of the domain. This preserves the original distance from each sheet to its image and preserves the transverse wavelength of the GEM seed.

The equilibrium uses six kinetic populations: drifting electron/ion populations for each sheet plus stationary background electron/ion populations. Splitting the distribution this way represents the Harris drifts and stationary 0.2 n_0 background exactly in their matched finite Hermite bases.

Parameters follow GEM: m_i/m_e=25, T_i/T_e=5, lambda=0.5 d_i, n_b=0.2 n_0, v_A/c=0.1, and psi_0=0.1 B_0 d_i.

References:

Result

Reconnected magnetic flux

Magnetic reconnection movie

The black curves are A_z contours (in-plane magnetic field lines); the color is |B|/B_0. The island O-point forms near the domain center and the periodic X-points lie at the left/right boundary.

Validation

  • pytest -q: 3 passed
  • ruff check Examples/2D_GEM_reconnection.py: passed
  • local CPU default smoke run: finite, 2.6 s at 33^2, H=4, t=10 omega_pe^-1
  • RTX A4000 production run: 129^2, H=6, t=625 omega_pe^-1 or Omega_ci t=12.5, 724.8 s end-to-end, about 12.2 GB device memory
  • maximum reconnected flux: 0.2938 B_0 d_i
  • terminal outer-mode coefficient fractions: 3.77e-5, 1.41e-4, and 6.53e-8 in the three Hermite directions

A 129^2, H=4, nu=1 run suffered adaptive-step collapse near Omega_ci t=7.3; increasing velocity resolution to H=6 completed with small terminal tails. This draft therefore demonstrates topology and a stable resolved trajectory, but does not claim Fourier/Hermite convergence or reproduce GEM's conducting-wall flux curve.

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rogeriojorge

Copy link
Copy Markdown
Member Author

Validation update (2026-07-16): do not review this draft yet. The committed movie ends at Omega_ci t=12.5, before the nonlinear GEM rise, and is not a saturation result.

Longer single-A4000 tests exposed an explicit timestep barrier as Hermite structure reaches the terminal modes. Tested configurations included 129^2/H6 with nu=0.3,0.5,1,3, 93^2/H8 with nu=0,1, and 65^2/H10 with nu=0.3; none reached the required Omega_ci t=40. The best 129^2/H6, nu=0.3 trajectory reached about Omega_ci t=23.8 before geometric adaptive-step collapse. Loosening the ODE tolerance did not remove the barrier.

The validation target is the digitized Schmitz--Grauer kinetic GEM curve: peak nonlinear rate about 0.279, and mean reconnected flux about 3.162 B0 di over 30 <= Omega_ci t <= 40, plus the published Bz quadrupole at Omega_ci t=17.7. No replacement media will be pushed until a trajectory reaches and holds that interval. The likely prerequisite is an IMEX/integrating-factor or real-split implicit treatment, together with sharding for higher Hermite resolution. The PR remains draft and no merge is requested.

The example writes the flux plot and animation to its output directory.
@rogeriojorge

Copy link
Copy Markdown
Member Author

Closing as redundant with #34, which adds the mainline periodic double-Harris reconnection example. This GEM analogue needs H>=6 at 129² (about 12 GB on a GPU) to avoid adaptive-step collapse; at 65², H=4 it slowed to about 2 h per 25 omega_pe^-1 chunk near Omega_ci t=4. Being doubly periodic, it also cannot be compared with the wall-bounded GEM flux curve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant