---
title: "Follow energy through a reconnection calculation"
description: "Derive the coupled MHD energy transfer and reproduce a conservative calculation that still changes ideal null flux incorrectly."
canonical_url: "https://sandboxphysics.com/stories/solar-magnetic-reconnection/follow-the-converted-energy/"
language: "en"
page_type: "story"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/stories/solar-magnetic-reconnection/follow-the-converted-energy/"
last_modified: "2026-11-03"
---

[From magnetic stress to reconnection](https://sandboxphysics.com/stories/solar-magnetic-reconnection/)

L3 · Magnetic reconnection and solar-flare signals

# Follow energy through a reconnection calculation

Sandbox Physics · 2026-11-03

A reconnection calculation needs two kinds of evidence: energy must move through the stated physical channels, and the local field must obey induction accurately. A conservative Fourier calculation can pass the first test while failing the second. We can reproduce that failure with a small ideal problem.

## Before you begin

Use the flux function and diffusivity from L1 and the current-sheet scales from L2. Partial derivatives describe change along one coordinate; the Laplacian adds the second spatial derivatives. Periodic integrals below have no boundary flux.

## Evolve the field and fluid together

Take a periodic square with each side $2\pi L_0$, uniform density and no external driver after the initial state. The invariant direction is $z$. Normalize field by $B_0$, velocity by $v_A$ and time by $t_A=L_0/v_A$. All following equations use these dimensionless coordinates.

The magnetic potential $\psi$ gives the field; a streamfunction $\phi$ gives the incompressible velocity. Current and vorticity use negative Laplacians under this convention. Taking the curl of the momentum equation removes pressure, while solving the streamfunction Poisson relation enforces incompressibility.

The Lorentz-force curl drives vorticity. Fluid advection and magnetic diffusion evolve the potential. Thus the outflow is part of the solution. No independent velocity drawing is added to make a reconnection picture.

$$
\mathbf B=(\psi_y,-\psi_x),\quad j=-\nabla^2\psi,\qquad\mathbf v=(\phi_y,-\phi_x),\quad\omega=-\nabla^2\phi
$$

The current and vorticity point along the invariant direction.

$$
\partial_t\psi+\mathbf v\cdot\nabla\psi=\eta\nabla^2\psi,\qquad\partial_t\omega+\mathbf v\cdot\nabla\omega=\mathbf B\cdot\nabla j+\nu\nabla^2\omega
$$

Eta is magnetic diffusivity and nu is kinematic viscosity, each divided by length scale times Alfvén speed. There is no density or temperature evolution.

Sources: [Zhou et al. (2019), Magnetic island merger as a mechanism for inverse magnetic energy transfer, Physical Review Research 1, 012004(R)](https://doi.org/10.1103/PhysRevResearch.1.012004) · [Sandbox Physics AC28, independent MHD energy, local-induction and grid/time-reference programs, fixed scientific archive](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/solar-reconnection-science.zip)

## Derive the energy transfer and its heat terms

Use a domain average to define magnetic and kinetic energy densities. Multiply the potential equation by current and integrate by parts. The magnetic-energy change contains work on the fluid and Ohmic loss. The momentum equation receives the same work with the opposite sign.

Viscosity removes kinetic energy. The symmetric part of the velocity gradient is the strain tensor. In a periodic incompressible plane, its domain-integrated heating equals viscosity times mean vorticity squared. The local maps are different: vorticity squared is not generally the pointwise physical viscous-heating density. The model records only their common domain integral.

Integrating both loss rates with the same Runge–Kutta stages as the fields creates the two dissipative reservoirs. Their sum with field and fluid energy is the unforced model’s check. No conversion from that sum to a solar joule total is possible until a physical volume, including invariant depth, has been specified.

$$
S_{ij}=\tfrac12(\partial_i v_j+\partial_j v_i)
$$

The strain-rate tensor uses spatial derivatives of velocity; repeated indices below are summed.

$$
E_B=\tfrac12\langle B^2\rangle,\quad E_K=\tfrac12\langle v^2\rangle,\quad\mathcal W=\langle j\,\mathbf v\cdot\nabla\psi\rangle
$$

Angle brackets denote domain means; energy-density scale is magnetic field squared divided by vacuum permeability.

$$
\frac{dE_B}{dt}=\langle\nabla\psi\cdot\nabla\partial_t\psi\rangle=\langle j\,\partial_t\psi\rangle
$$

Periodic boundary terms cancel in the integration by parts. Substituting induction gives the magnetic work and Ohmic terms below.

$$
\dot E_B=-\mathcal W-\eta\langle j^2\rangle,\quad\dot E_K=\mathcal W-\nu\langle\omega^2\rangle
$$

The same signed work transfers energy between the resolved reservoirs.

$$
\dot Q_\Omega=\eta\langle j^2\rangle,\quad\dot Q_\nu=\nu\langle\omega^2\rangle=\langle2\nu S_{ij}S_{ij}\rangle
$$

The last equality holds after spatial averaging under the periodic incompressible assumptions. Local heating is evaluated from the strain tensor.

Sources: [Zhou et al. (2019), Magnetic island merger as a mechanism for inverse magnetic energy transfer, Physical Review Research 1, 012004(R)](https://doi.org/10.1103/PhysRevResearch.1.012004) · [Sandbox Physics AC28, independent MHD energy, local-induction and grid/time-reference programs, fixed scientific archive](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/solar-reconnection-science.zip)

## Calculate a mode with an answer known in advance

Start with zero fluid motion and a single potential mode $A\cos(k_xx+k_yy)$. Its current is proportional to its potential, so the magnetic force has zero vorticity source. Only resistive diffusion acts. Solving its scalar time equation gives an exact exponential.

The reference tests amplitude, phase when a uniform mean flow is added, magnetic energy and integrated heat against that answer. It halves the step to measure the fourth-order field error. A separate viscous shear has its own analytic decay. Signed errors are retained; a small negative equivalent numerical diffusivity in this benchmark is a truncation error, not a physical solar transport coefficient.

The nonlinear default supplies an additional sign check. Its initial vorticity acceleration has a known spatial sign and amplitude. Squaring fields to make an energy test would hide a reversal of that force.

$$
\psi(t)=A e^{-\eta(k_x^2+k_y^2)t}\cos(k_xx+k_yy)
$$

Without mean advection, the mode keeps its phase and decays at the stated rate.

$$
\psi_0=\tfrac12\cos2x+\tfrac12\cos y,\quad\phi_0=0\quad\Longrightarrow\quad(\partial_t\omega)_0=\tfrac32\sin2x\sin y
$$

This independent Lorentz-curl result fixes the startup direction of the actual default problem.

Sources: [Zhou et al. (2019), Magnetic island merger as a mechanism for inverse magnetic energy transfer, Physical Review Research 1, 012004(R)](https://doi.org/10.1103/PhysRevResearch.1.012004) · [Sandbox Physics AC28, independent MHD energy, local-induction and grid/time-reference programs, fixed scientific archive](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/solar-reconnection-science.zip)

## Compare the actual nonlinear state with a finer grid

The periodic default starts with unequal spatial scales, which leave a nonzero force that the pressure cannot remove completely. At normalized time one, the independent 128-grid solution has the values below. They are rounded for reading; the full-precision JSON is needed to reproduce a tiny energy residual.

At time two, the 128-to 256 current-field relative norm difference is about 0.00436%. The peak-current discrepancy is about 0.00455%. A 64-grid calculation is off by about 2.1% in peak current and a 32-grid calculation by about 20%, even though their global energy sums look excellent.

The four interactive cases also check every saved physical time against the finer grid. Local induction, null identity, field differences and time-step convergence are separate quantities. The fixed parameter cases and endpoints define the tested region.

| At normalized time one | Mean normalized density |
| --- | --- |
| Magnetic energy | $0.23843546$ |
| Fluid kinetic energy | $0.03383606$ |
| Ohmic heat | $0.03746352$ |
| Viscous heat | $0.00276497$ |

![Numerical current and magnetic contours at three times, with the energy conversion and retained coarse-grid errors.](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/mhd-fields-energy-convergence.png)

Own periodic stressed-field calculation. The scene, flow and energy share the same numerical state; the lower-resolution discrepancies remain visible.

Sources: [Zhou et al. (2019), Magnetic island merger as a mechanism for inverse magnetic energy transfer, Physical Review Research 1, 012004(R)](https://doi.org/10.1103/PhysRevResearch.1.012004) · [Sandbox Physics AC28, independent MHD energy, local-induction and grid/time-reference programs, fixed scientific archive](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/solar-reconnection-science.zip)

## A conservative ideal calculation can still change null flux incorrectly

Set both transport coefficients to zero and choose the potentials below. The points $O=(0,0)$ and $X=(0,\pi/2)$ are genuine magnetic nulls. The ideal continuum equation gives zero potential rate at both because its advective term vanishes there.

A Fourier representation adds periodic sine and cosine waves; Galerkin projection returns nonlinear products to the retained wave numbers. Expanding the nonlinear product generates a Fourier harmonic with horizontal wave number sixteen. The 32-grid two-thirds truncation discards it. This removes a cancellation at the nulls, leaving projected rates $+0.0008$ and $-0.0008$. Even an almost empty initial edge-energy spectrum misses the problem.

By time $0.05$, the coarse O–X contrast has changed about $8.11\times10^{-5}$. Energy, mean potential-square and cross-helicity (the mean velocity dotted into magnetic field) still remain at machine-level conservation, and irreversible heat is zero. The same physical initial condition on 64 cells changes the contrast only about $2.09\times10^{-11}$.

The failure is a spatial projection error. It must not be relabelled as an extra physical resistivity. This is why the display admits only its tested cases and checks local induction in addition to global invariants.

$$
\psi_0=0.01\cos8x+0.04\cos2y,\qquad\phi_0=0.01\sin8x\sin2y
$$

This is an explicit failure experiment, not an additional interactive preset.

$$
-\mathbf v\cdot\nabla\psi=0.0008(1-\cos16x)\cos2y-0.0032\cos8x(1-\cos4y)
$$

At each null the complete expression cancels to zero. Removing the wave-number-sixteen term destroys that local cancellation.

Sources: [Zhou et al. (2019), Magnetic island merger as a mechanism for inverse magnetic energy transfer, Physical Review Research 1, 012004(R)](https://doi.org/10.1103/PhysRevResearch.1.012004) · [Sandbox Physics AC28, independent MHD energy, local-induction and grid/time-reference programs, fixed scientific archive](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/solar-reconnection-science.zip)

## Reproduce the failure and keep both ends of the flux contrast

Unpack the scientific archive and run these commands from its root with the pinned numerical dependencies. The first script regenerates the nonlinear grid/time and analytic checks; the second reruns the retained ideal failure and signed startup. The per-time comparison script compares every saved case/time with the finer solution.

For the closed periodic island, the O point also diffuses. The time derivative of the signed O-minus-X potential therefore uses both electric fields. At the late default state, the finite-grid local induction residual is about seven millionths. The report retains it as a numerical diagnostic, with physical diffusivity fixed at its input value.

$$
E_z(\text{null})=\eta j,\qquad\frac{d}{dt}[\psi(O)-\psi(X)]=E_z(X)-E_z(O)
$$

This continuum relation uses the declared sign convention; the numerical projection residual is recorded alongside it.

```
python -W error scripts/astronomy/ac28/run_reference.py
python -W error scripts/astronomy/ac28/run_counterexamples.py
python -W error scripts/astronomy/ac28/verify_runtime_domain.py
python -W error scripts/astronomy/ac28/test_reference.py
```

Sources: [Zhou et al. (2019), Magnetic island merger as a mechanism for inverse magnetic energy transfer, Physical Review Research 1, 012004(R)](https://doi.org/10.1103/PhysRevResearch.1.012004) · [Sandbox Physics AC28, independent MHD energy, local-induction and grid/time-reference programs, fixed scientific archive](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/solar-reconnection-science.zip)

## Run the independent science

The small package contains independent Python, the exact NOAA input, our synthetic MHD states and source/units/failure notes. The pinned dependencies are listed before the offline commands.

- [solar-reconnection-science.zip](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/solar-reconnection-science.zip) 6.33 MB
- [include-manifest.json](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/include-manifest.json) 0.01 MB
- [README-science.md](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/README-science.md) 0.01 MB
- [runtime-domain-reference.json](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/runtime-domain-reference.json) 0.21 MB
- [goes-reference-results.json](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/goes-reference-results.json) 0.01 MB
- [retained-counterexamples.json](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/retained-counterexamples.json) 0.00 MB

Exact files and reuse terms

solar-reconnection-science.zip
6325678 bytes
SHA-256: 4f680fc833816eb4ae27fd1bce178ee61af985c0f800097e86e11cd489710f07

include-manifest.json
10996 bytes
SHA-256: 363ff93f8e96ae524583d067b560f865ff526021cb45bc725a21efd41161e405

README-science.md
9685 bytes
SHA-256: f0aee6da22e4e5ff73aa326ee9b8b3028601bed9b1e2a9974056588db417d32a

runtime-domain-reference.json
208128 bytes
SHA-256: 33cdb0c1deec2889759846f572b8d32ce1da3c2de9278e549a068bece7391f5d

goes-reference-results.json
5924 bytes
SHA-256: cc4e4785d66571658b1824d9c4aa5fdacfdba5f0643c2f126245836771a5c197

retained-counterexamples.json
1826 bytes
SHA-256: 1e89efaf39a01b431ea1aeb75c8b9a108f508a4ab1972351e47df68266db561e

NOAA permits unrestricted use and redistribution of the selected original input. New standalone Python is MIT; our data, plots and documents are CC BY4.0 with source attribution. Original publication PDFs and website Engine code are excluded.

## Work through the question

Why can an energy-conserving numerical solution fail flux freezing at a null?

The Galerkin projection can preserve global quadratic identities while removing a nonlinear harmonic needed for a local cancellation. The explicit 32-grid example demonstrates both outcomes in the same run.

May $\nu\omega^2$ be used as the local viscous-heating colour?

The domain integral agrees with strain heating for this periodic incompressible model, but pointwise it generally differs from $2\nu S_{ij}S_{ij}$. Local Ohmic heating can instead be shown directly as magnetic diffusivity times current squared.

The 128-grid default has a small energy residual. What additional evidence is needed before using its current?

Compare the full current field and peak with the 256-grid result at the same physical times; test time-step refinement, local induction and the selected null identities. The retained32/64 failures show why energy alone is insufficient.

### [Export one numerical state and its history](https://sandboxphysics.com/labs/magnetic-reconnection/)

1. Pause the default evolution and save the state JSON plus history CSV.
2. Match case, physical time, probe and four energy densities. Use full precision for the energy residual.
3. Compare the null-flux change with both local electric fields, keeping the local induction residual visible.

## Primary sources

1. [Sandbox Physics AC28, independent MHD energy, local-induction and grid/time-reference programs, fixed scientific archive](https://sandboxphysics.com/stories/solar-magnetic-reconnection/materials/solar-reconnection-science.zip)
2. [Zhou et al. (2019), Magnetic island merger as a mechanism for inverse magnetic energy transfer, Physical Review Research 1, 012004(R)](https://doi.org/10.1103/PhysRevResearch.1.012004)

[Previous: How a thin current sheet sets the pace](https://sandboxphysics.com/stories/solar-magnetic-reconnection/how-a-sheet-sets-the-pace/) [Next: Recompute a flare from one GOES file](https://sandboxphysics.com/stories/solar-magnetic-reconnection/one-goes-file-one-flare/)
