Skip to content

Precondition midpoint collision and diffusion#28

Open
rogeriojorge wants to merge 1 commit into
agent/solvax-newton-midpointfrom
agent/midpoint-collision-diffusion-preconditioner
Open

Precondition midpoint collision and diffusion#28
rogeriojorge wants to merge 1 commit into
agent/solvax-newton-midpointfrom
agent/midpoint-collision-diffusion-preconditioner

Conversation

@rogeriojorge

@rogeriojorge rogeriojorge commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

  • add an optional collision/diffusion diagonal preconditioner factory for implicit midpoint
  • pass optional preconditioner factories through to SOLVAX Newton–Krylov
  • test the exact midpoint diagonal and the preconditioned Diffrax integration path

The inverse action is local and matrix-free:

(I + dt / 2 * (nu C + D k²))⁻¹

The electromagnetic residual is left unchanged. Users opt in with
ImplicitMidpoint(preconditioner=collision_diffusion_preconditioner).

Depends on #27.

Why

Collisions are diagonal in Hermite space and diffusion is diagonal in Fourier
space, so their exact midpoint contribution is the cheapest physics-based
approximation to the full kinetic Jacobian. It requires no assembled matrix,
factorization, or communication and is compatible with local Hermite shards.

Validation

  • pytest -q: 7 passed
  • repository fatal flake8 checks and Ruff lint pass
  • 65² / (28,4,4), dt=1e-3, 20 midpoint steps, D=1:
    • no preconditioner: 92.61 s
    • collision/diffusion preconditioner: 15.97 s (5.8x faster)
    • relative endpoint difference: 1.96e-11 in Ck, 1.55e-13 in Fk
    • energy drift improves from 4.85e-16 to 1.21e-16
  • nonstiff D=0 control:
    • 10.88 s without versus 11.03 s with preconditioning (+1.4%)
    • relative Ck difference 2.48e-15; energy agrees to roundoff

Distributed nonlinear/Krylov inner products are intentionally left to a
separate PR after the midpoint and parallel stacks share a common base.

@rogeriojorge rogeriojorge marked this pull request as ready for review July 13, 2026 14:58
@rogeriojorge rogeriojorge force-pushed the agent/solvax-newton-midpoint branch from 5c23eb9 to db8a2fe Compare July 16, 2026 14:13
@rogeriojorge rogeriojorge force-pushed the agent/midpoint-collision-diffusion-preconditioner branch from 5b5bce8 to 934dc4e Compare July 16, 2026 14:13
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